Append event year to poll message external IDs

This solves the problem of external poll message IDs not being globally
unique by simply appending the event year. This means that autorenew poll
messages will increment by one every year, so they will always be unique.
This also requires no data schema changes, and thus most importantly, no
data migration.

Incoming requests lacking this new year field will continue to work for
now for backwards compatibility reasons. This is possible because we don't
actually use the year for anything.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=178012685
This commit is contained in:
mcilwain 2017-12-05 14:35:37 -08:00 committed by jianglai
parent 8e33bc898f
commit 931156fdd7
26 changed files with 270 additions and 127 deletions

View file

@ -364,6 +364,61 @@ public class EppLifecycleDomainTest extends EppTestCase {
assertCommandAndResponse("logout.xml", "logout_response.xml");
}
@Test
public void testDomainCreate_annualAutoRenewPollMessages_haveUniqueIds() throws Exception {
assertCommandAndResponse("login_valid.xml", "login_response.xml");
// Create the domain.
createFakesite();
// The first autorenew poll message isn't seen until after the initial two years of registration
// are up.
assertCommandAndResponse(
"poll.xml", "poll_response_empty.xml", DateTime.parse("2001-01-01T00:01:00Z"));
assertCommandAndResponse(
"poll.xml",
ImmutableMap.of(),
"poll_response_autorenew.xml",
ImmutableMap.of(
"ID", "1-C-EXAMPLE-13-16-2002",
"QDATE", "2002-06-01T00:04:00Z",
"DOMAIN", "fakesite.example",
"EXDATE", "2003-06-01T00:04:00Z"),
DateTime.parse("2002-07-01T00:01:00Z"));
assertCommandAndResponse(
"poll_ack.xml",
ImmutableMap.of("ID", "1-C-EXAMPLE-13-16-2002"),
"poll_ack_response_empty.xml",
null,
DateTime.parse("2002-07-01T00:02:00Z"));
// The second autorenew poll message isn't seen until after another year, and it should have a
// different ID.
assertCommandAndResponse(
"poll.xml", "poll_response_empty.xml", DateTime.parse("2002-07-01T00:05:00Z"));
assertCommandAndResponse(
"poll.xml",
ImmutableMap.of(),
"poll_response_autorenew.xml",
ImmutableMap.of(
"ID", "1-C-EXAMPLE-13-16-2003", // Note -- Year is different from previous ID.
"QDATE", "2003-06-01T00:04:00Z",
"DOMAIN", "fakesite.example",
"EXDATE", "2004-06-01T00:04:00Z"),
DateTime.parse("2003-07-01T00:05:00Z"));
// Ack the second poll message and verify that none remain.
assertCommandAndResponse(
"poll_ack.xml",
ImmutableMap.of("ID", "1-C-EXAMPLE-13-16-2003"),
"poll_ack_response_empty.xml",
null,
DateTime.parse("2003-07-01T00:05:05Z"));
assertCommandAndResponse(
"poll.xml", "poll_response_empty.xml", DateTime.parse("2003-07-01T00:05:10Z"));
assertCommandAndResponse("logout.xml", "logout_response.xml");
}
@Test
public void testDomainTransferPollMessage_serverApproved() throws Exception {
// As the losing registrar, create the domain.
@ -391,7 +446,7 @@ public class EppLifecycleDomainTest extends EppTestCase {
DateTime.parse("2001-01-01T00:01:00Z"));
assertCommandAndResponse(
"poll_ack.xml",
ImmutableMap.of("ID", "1-C-EXAMPLE-17-23"),
ImmutableMap.of("ID", "1-C-EXAMPLE-17-23-2001"),
"poll_ack_response_empty.xml",
null,
DateTime.parse("2001-01-01T00:01:00Z"));
@ -403,7 +458,7 @@ public class EppLifecycleDomainTest extends EppTestCase {
DateTime.parse("2001-01-06T00:01:00Z"));
assertCommandAndResponse(
"poll_ack.xml",
ImmutableMap.of("ID", "1-C-EXAMPLE-17-22"),
ImmutableMap.of("ID", "1-C-EXAMPLE-17-22-2001"),
"poll_ack_response_empty.xml",
null,
DateTime.parse("2001-01-06T00:01:00Z"));
@ -419,7 +474,7 @@ public class EppLifecycleDomainTest extends EppTestCase {
DateTime.parse("2001-01-06T00:02:00Z"));
assertCommandAndResponse(
"poll_ack.xml",
ImmutableMap.of("ID", "1-C-EXAMPLE-17-21"),
ImmutableMap.of("ID", "1-C-EXAMPLE-17-21-2001"),
"poll_ack_response_empty.xml",
null,
DateTime.parse("2001-01-06T00:02:00Z"));