Remove leniency on poll message ID format without years in them

It's been long enough since the format change adding in years that all
registrars should no longer have any IDs in the old format lying around
that they're still attempting to ACK. All poll messages have already been
coming back to registrars with the new format for months now.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=184714735
This commit is contained in:
mcilwain 2018-02-06 11:44:50 -08:00 committed by jianglai
parent 6280d74f1c
commit 29c38f3622
5 changed files with 40 additions and 42 deletions

View file

@ -104,24 +104,8 @@ public class PollAckFlowTest extends FlowTestCase<PollAckFlow> {
runFlowAssertResponse(loadFile("poll_ack_response_empty.xml"));
}
// TODO(b/68953444): Remove test when missing year field backwards compatibility no longer needed.
@Test
public void testSuccess_contactPollMessage_withMissingYearField() throws Exception {
setEppInput("poll_ack.xml", ImmutableMap.of("MSGID", "2-2-ROID-4-3"));
persistResource(
new PollMessage.OneTime.Builder()
.setId(MESSAGE_ID)
.setClientId(getClientIdForFlow())
.setEventTime(clock.nowUtc().minusDays(1))
.setMsg("Some poll message.")
.setParent(createHistoryEntryForEppResource(contact))
.build());
assertTransactionalFlow(true);
runFlowAssertResponse(loadFile("poll_ack_response_empty.xml"));
}
@Test
public void testSuccess_contactPollMessage_withIncorrectYearField() throws Exception {
public void testFailure_contactPollMessage_withIncorrectYearField() throws Exception {
setEppInput("poll_ack.xml", ImmutableMap.of("MSGID", "2-2-ROID-4-3-1999"));
persistResource(
new PollMessage.OneTime.Builder()
@ -132,7 +116,7 @@ public class PollAckFlowTest extends FlowTestCase<PollAckFlow> {
.setParent(createHistoryEntryForEppResource(contact))
.build());
assertTransactionalFlow(true);
runFlowAssertResponse(loadFile("poll_ack_response_empty.xml"));
assertThrows(MessageDoesNotExistException.class, this::runFlow);
}
@Test
@ -144,6 +128,7 @@ public class PollAckFlowTest extends FlowTestCase<PollAckFlow> {
@Test
public void testSuccess_recentActiveAutorenew() throws Exception {
setEppInput("poll_ack.xml", ImmutableMap.of("MSGID", "1-3-EXAMPLE-4-3-2010"));
persistAutorenewPollMessage(clock.nowUtc().minusMonths(6), END_OF_TIME);
assertTransactionalFlow(true);
runFlowAssertResponse(loadFile("poll_ack_response_empty.xml"));
@ -151,6 +136,7 @@ public class PollAckFlowTest extends FlowTestCase<PollAckFlow> {
@Test
public void testSuccess_oldActiveAutorenew() throws Exception {
setEppInput("poll_ack.xml", ImmutableMap.of("MSGID", "1-3-EXAMPLE-4-3-2009"));
persistAutorenewPollMessage(clock.nowUtc().minusYears(2), END_OF_TIME);
// Create three other messages to be queued for retrieval to get our count right, since the poll
// ack response wants there to be 4 messages in the queue when the ack comes back.
@ -158,11 +144,15 @@ public class PollAckFlowTest extends FlowTestCase<PollAckFlow> {
persistOneTimePollMessage(MESSAGE_ID + i);
}
assertTransactionalFlow(true);
runFlowAssertResponse(loadFile("poll_ack_response.xml"));
runFlowAssertResponse(
loadFile(
"poll_ack_response.xml",
ImmutableMap.of("MSGID", "1-3-EXAMPLE-4-3-2009", "COUNT", "4")));
}
@Test
public void testSuccess_oldInactiveAutorenew() throws Exception {
setEppInput("poll_ack.xml", ImmutableMap.of("MSGID", "1-3-EXAMPLE-4-3-2010"));
persistAutorenewPollMessage(clock.nowUtc().minusMonths(6), clock.nowUtc());
assertTransactionalFlow(true);
runFlowAssertResponse(loadFile("poll_ack_response_empty.xml"));
@ -175,7 +165,10 @@ public class PollAckFlowTest extends FlowTestCase<PollAckFlow> {
persistOneTimePollMessage(MESSAGE_ID + i);
}
assertTransactionalFlow(true);
runFlowAssertResponse(loadFile("poll_ack_response.xml"));
runFlowAssertResponse(
loadFile(
"poll_ack_response.xml",
ImmutableMap.of("MSGID", "1-3-EXAMPLE-4-3-2011", "COUNT", "4")));
}
@Test
@ -201,6 +194,21 @@ public class PollAckFlowTest extends FlowTestCase<PollAckFlow> {
assertThrows(InvalidMessageIdException.class, this::runFlow);
}
@Test
public void testFailure_contactPollMessage_withMissingYearField() throws Exception {
setEppInput("poll_ack.xml", ImmutableMap.of("MSGID", "2-2-ROID-4-3"));
persistResource(
new PollMessage.OneTime.Builder()
.setId(MESSAGE_ID)
.setClientId(getClientIdForFlow())
.setEventTime(clock.nowUtc().minusDays(1))
.setMsg("Some poll message.")
.setParent(createHistoryEntryForEppResource(contact))
.build());
assertTransactionalFlow(true);
assertThrows(InvalidMessageIdException.class, this::runFlow);
}
@Test
public void testFailure_invalidId_stringInsteadOfNumeric() throws Exception {
setEppInput("poll_ack.xml", ImmutableMap.of("MSGID", "ABC-12345"));