Consolidate wildcarded domain_create_response testdata XMLs

This is a follow-up to [] It also removes a couple of the
doSuccessfulTest() overloads (having that many was overkill), and statically
imports a few constants for line length reasons.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=204971899
This commit is contained in:
mcilwain 2018-07-17 14:10:21 -07:00 committed by jianglai
parent e32b1a571a
commit abfc60ab39
5 changed files with 94 additions and 92 deletions

View file

@ -17,11 +17,15 @@ package google.registry.flows.domain;
import static com.google.common.io.BaseEncoding.base16; import static com.google.common.io.BaseEncoding.base16;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth8.assertThat; import static com.google.common.truth.Truth8.assertThat;
import static google.registry.flows.FlowTestCase.UserPrivileges.SUPERUSER;
import static google.registry.model.billing.BillingEvent.Flag.ANCHOR_TENANT;
import static google.registry.model.domain.fee.Fee.FEE_EXTENSION_URIS; import static google.registry.model.domain.fee.Fee.FEE_EXTENSION_URIS;
import static google.registry.model.eppcommon.StatusValue.OK; import static google.registry.model.eppcommon.StatusValue.OK;
import static google.registry.model.eppcommon.StatusValue.SERVER_TRANSFER_PROHIBITED; import static google.registry.model.eppcommon.StatusValue.SERVER_TRANSFER_PROHIBITED;
import static google.registry.model.eppcommon.StatusValue.SERVER_UPDATE_PROHIBITED; import static google.registry.model.eppcommon.StatusValue.SERVER_UPDATE_PROHIBITED;
import static google.registry.model.ofy.ObjectifyService.ofy; import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.model.registry.Registry.TldState.GENERAL_AVAILABILITY;
import static google.registry.model.registry.Registry.TldState.START_DATE_SUNRISE;
import static google.registry.pricing.PricingEngineProxy.isDomainPremium; import static google.registry.pricing.PricingEngineProxy.isDomainPremium;
import static google.registry.testing.DatastoreHelper.assertBillingEvents; import static google.registry.testing.DatastoreHelper.assertBillingEvents;
import static google.registry.testing.DatastoreHelper.assertPollMessagesForResource; import static google.registry.testing.DatastoreHelper.assertPollMessagesForResource;
@ -216,7 +220,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
Money.of( Money.of(
Registry.get(domainTld).getCurrency(), Registry.get(domainTld).getCurrency(),
Registry.get(domainTld).getEapFeeFor(clock.nowUtc()).getCost()); Registry.get(domainTld).getEapFeeFor(clock.nowUtc()).getCost());
boolean isAnchorTenant = expectedBillingFlags.contains(Flag.ANCHOR_TENANT); boolean isAnchorTenant = expectedBillingFlags.contains(ANCHOR_TENANT);
DateTime billingTime = DateTime billingTime =
isAnchorTenant isAnchorTenant
? clock.nowUtc().plus(Registry.get(domainTld).getAnchorTenantAddGracePeriodLength()) ? clock.nowUtc().plus(Registry.get(domainTld).getAnchorTenantAddGracePeriodLength())
@ -338,11 +342,6 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
assertTasksEnqueued(QUEUE_CLAIMS, task); assertTasksEnqueued(QUEUE_CLAIMS, task);
} }
private void doSuccessfulTest(
String domainTld, String responseXmlFile, UserPrivileges userPrivileges) throws Exception {
doSuccessfulTest(domainTld, responseXmlFile, userPrivileges, ImmutableMap.of());
}
private void doSuccessfulTest( private void doSuccessfulTest(
String domainTld, String domainTld,
String responseXmlFile, String responseXmlFile,
@ -362,12 +361,9 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
doSuccessfulTest(domainTld, responseXmlFile, UserPrivileges.NORMAL, substitutions); doSuccessfulTest(domainTld, responseXmlFile, UserPrivileges.NORMAL, substitutions);
} }
private void doSuccessfulTest(String domainTld, String responseXmlFile) throws Exception {
doSuccessfulTest(domainTld, responseXmlFile, UserPrivileges.NORMAL);
}
private void doSuccessfulTest(String domainTld) throws Exception { private void doSuccessfulTest(String domainTld) throws Exception {
doSuccessfulTest(domainTld, "domain_create_response.xml"); doSuccessfulTest(
domainTld, "domain_create_response.xml", ImmutableMap.of("DOMAIN", "example.tld"));
} }
private void doSuccessfulTest() throws Exception { private void doSuccessfulTest() throws Exception {
@ -377,7 +373,8 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
@Test @Test
public void testDryRun() throws Exception { public void testDryRun() throws Exception {
persistContactsAndHosts(); persistContactsAndHosts();
dryRunFlowAssertResponse(loadFile("domain_create_response.xml")); dryRunFlowAssertResponse(
loadFile("domain_create_response.xml", ImmutableMap.of("DOMAIN", "example.tld")));
} }
@Test @Test
@ -397,7 +394,8 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
public void testSuccess_clTridNotSpecified() throws Exception { public void testSuccess_clTridNotSpecified() throws Exception {
setEppInput("domain_create_no_cltrid.xml"); setEppInput("domain_create_no_cltrid.xml");
persistContactsAndHosts(); persistContactsAndHosts();
doSuccessfulTest("tld", "domain_create_response_no_cltrid.xml"); doSuccessfulTest(
"tld", "domain_create_response_no_cltrid.xml", ImmutableMap.of("DOMAIN", "example.tld"));
} }
@Test @Test
@ -445,7 +443,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
assertTransactionalFlow(true); assertTransactionalFlow(true);
String expectedResponseXml = String expectedResponseXml =
loadFile( loadFile(
"domain_create_response_wildcard.xml", ImmutableMap.of("DOMAIN", "example.foo.tld")); "domain_create_response.xml", ImmutableMap.of("DOMAIN", "example.foo.tld"));
runFlowAssertResponse(CommitMode.LIVE, UserPrivileges.NORMAL, expectedResponseXml); runFlowAssertResponse(CommitMode.LIVE, UserPrivileges.NORMAL, expectedResponseXml);
assertSuccessfulCreate("foo.tld", ImmutableSet.of()); assertSuccessfulCreate("foo.tld", ImmutableSet.of());
assertNoLordn(); assertNoLordn();
@ -474,8 +472,9 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
eppRequestSource = EppRequestSource.TOOL; eppRequestSource = EppRequestSource.TOOL;
setEppInput("domain_create_anchor_tenant.xml"); setEppInput("domain_create_anchor_tenant.xml");
persistContactsAndHosts(); persistContactsAndHosts();
runFlowAssertResponse(loadFile("domain_create_response.xml")); runFlowAssertResponse(
assertSuccessfulCreate("tld", ImmutableSet.of(Flag.ANCHOR_TENANT)); loadFile("domain_create_response.xml", ImmutableMap.of("DOMAIN", "example.tld")));
assertSuccessfulCreate("tld", ImmutableSet.of(ANCHOR_TENANT));
assertNoLordn(); assertNoLordn();
} }
@ -495,7 +494,8 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
.build()); .build());
setEppInput("domain_create_lrp.xml"); setEppInput("domain_create_lrp.xml");
persistContactsAndHosts(); persistContactsAndHosts();
runFlowAssertResponse(loadFile("domain_create_response.xml")); runFlowAssertResponse(
loadFile("domain_create_response.xml", ImmutableMap.of("DOMAIN", "example.tld")));
assertSuccessfulCreate("tld", ImmutableSet.of()); assertSuccessfulCreate("tld", ImmutableSet.of());
assertNoLordn(); assertNoLordn();
assertThat(ofy().load().entity(token).now().getRedemptionHistoryEntry()).isNotNull(); assertThat(ofy().load().entity(token).now().getRedemptionHistoryEntry()).isNotNull();
@ -520,7 +520,8 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
.build()); .build());
setEppInput("domain_create_lrp.xml"); setEppInput("domain_create_lrp.xml");
persistContactsAndHosts(); persistContactsAndHosts();
runFlowAssertResponse(loadFile("domain_create_response.xml")); runFlowAssertResponse(
loadFile("domain_create_response.xml", ImmutableMap.of("DOMAIN", "example.tld")));
assertSuccessfulCreate("tld", ImmutableSet.of()); assertSuccessfulCreate("tld", ImmutableSet.of());
assertNoLordn(); assertNoLordn();
assertThat(ofy().load().entity(token).now().getRedemptionHistoryEntry()).isNull(); assertThat(ofy().load().entity(token).now().getRedemptionHistoryEntry()).isNull();
@ -539,7 +540,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
@Test @Test
public void testFailure_generalAvailability_withEncodedSignedMark() { public void testFailure_generalAvailability_withEncodedSignedMark() {
createTld("tld", TldState.GENERAL_AVAILABILITY); createTld("tld", GENERAL_AVAILABILITY);
clock.setTo(DateTime.parse("2014-09-09T09:09:09Z")); clock.setTo(DateTime.parse("2014-09-09T09:09:09Z"));
setEppInput( setEppInput(
"domain_create_registration_encoded_signed_mark.xml", "domain_create_registration_encoded_signed_mark.xml",
@ -552,7 +553,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
@Test @Test
public void testFailure_generalAvailability_superuserMismatchedEncodedSignedMark() { public void testFailure_generalAvailability_superuserMismatchedEncodedSignedMark() {
createTld("tld", TldState.GENERAL_AVAILABILITY); createTld("tld", GENERAL_AVAILABILITY);
clock.setTo(DateTime.parse("2014-09-09T09:09:09Z")); clock.setTo(DateTime.parse("2014-09-09T09:09:09Z"));
setEppInput( setEppInput(
"domain_create_registration_encoded_signed_mark.xml", "domain_create_registration_encoded_signed_mark.xml",
@ -746,7 +747,8 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
persistResource(Registry.get("example").asBuilder().setPremiumPriceAckRequired(false).build()); persistResource(Registry.get("example").asBuilder().setPremiumPriceAckRequired(false).build());
setEppInput("domain_create_premium.xml"); setEppInput("domain_create_premium.xml");
persistContactsAndHosts("net"); persistContactsAndHosts("net");
doSuccessfulTest("example", "domain_create_response_premium.xml"); doSuccessfulTest(
"example", "domain_create_response_premium.xml", ImmutableMap.of("DOMAIN", "rich.example"));
} }
@Test @Test
@ -767,7 +769,10 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
clock.nowUtc().plusDays(1), clock.nowUtc().plusDays(1),
Money.of(USD, 0))) Money.of(USD, 0)))
.build()); .build());
doSuccessfulTest("example", "domain_create_response_premium_eap.xml"); doSuccessfulTest(
"example",
"domain_create_response_premium_eap.xml",
ImmutableMap.of("DOMAIN", "rich.example"));
} }
/** /**
@ -842,7 +847,8 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
public void testSuccess_noNameserversOrDsData() throws Exception { public void testSuccess_noNameserversOrDsData() throws Exception {
setEppInput("domain_create_no_hosts_or_dsdata.xml", ImmutableMap.of("DOMAIN", "example.tld")); setEppInput("domain_create_no_hosts_or_dsdata.xml", ImmutableMap.of("DOMAIN", "example.tld"));
persistContactsAndHosts(); persistContactsAndHosts();
runFlowAssertResponse(loadFile("domain_create_response.xml")); runFlowAssertResponse(
loadFile("domain_create_response.xml", ImmutableMap.of("DOMAIN", "example.tld")));
assertNoDnsTasksEnqueued(); assertNoDnsTasksEnqueued();
} }
@ -851,7 +857,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
setEppInput("domain_create_missing_period.xml"); setEppInput("domain_create_missing_period.xml");
persistContactsAndHosts(); persistContactsAndHosts();
runFlowAssertResponse( runFlowAssertResponse(
loadFile("domain_create_response.xml"), loadFile("domain_create_response.xml", ImmutableMap.of("DOMAIN", "example.tld")),
"epp.response.resData.creData.exDate"); // Ignore expiration date; we verify it below "epp.response.resData.creData.exDate"); // Ignore expiration date; we verify it below
assertAboutDomains() assertAboutDomains()
.that(reloadResourceByForeignKey()) .that(reloadResourceByForeignKey())
@ -883,7 +889,8 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
persistClaimsList(ImmutableMap.of("example", CLAIMS_KEY)); persistClaimsList(ImmutableMap.of("example", CLAIMS_KEY));
persistContactsAndHosts(); persistContactsAndHosts();
persistResource(Registry.get("tld").asBuilder().setClaimsPeriodEnd(clock.nowUtc()).build()); persistResource(Registry.get("tld").asBuilder().setClaimsPeriodEnd(clock.nowUtc()).build());
runFlowAssertResponse(loadFile("domain_create_response.xml")); runFlowAssertResponse(
loadFile("domain_create_response.xml", ImmutableMap.of("DOMAIN", "example.tld")));
assertSuccessfulCreate("tld", ImmutableSet.of()); assertSuccessfulCreate("tld", ImmutableSet.of());
assertDnsTasksEnqueued("example.tld"); assertDnsTasksEnqueued("example.tld");
} }
@ -1088,8 +1095,8 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
setEppInput("domain_create_anchor_authcode.xml"); setEppInput("domain_create_anchor_authcode.xml");
persistContactsAndHosts(); persistContactsAndHosts();
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, UserPrivileges.SUPERUSER, loadFile("domain_create_anchor_response.xml")); CommitMode.LIVE, SUPERUSER, loadFile("domain_create_anchor_response.xml"));
assertSuccessfulCreate("tld", ImmutableSet.of(Flag.ANCHOR_TENANT)); assertSuccessfulCreate("tld", ImmutableSet.of(ANCHOR_TENANT));
// Token should not be marked as used, since interpreting the authcode as anchor tenant should // Token should not be marked as used, since interpreting the authcode as anchor tenant should
// take precedence. // take precedence.
assertThat(ofy().load().entity(token).now().getRedemptionHistoryEntry()).isNull(); assertThat(ofy().load().entity(token).now().getRedemptionHistoryEntry()).isNull();
@ -1100,7 +1107,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
setEppInput("domain_create_anchor_authcode.xml"); setEppInput("domain_create_anchor_authcode.xml");
persistContactsAndHosts(); persistContactsAndHosts();
runFlowAssertResponse(loadFile("domain_create_anchor_response.xml")); runFlowAssertResponse(loadFile("domain_create_anchor_response.xml"));
assertSuccessfulCreate("tld", ImmutableSet.of(Flag.ANCHOR_TENANT)); assertSuccessfulCreate("tld", ImmutableSet.of(ANCHOR_TENANT));
assertNoLordn(); assertNoLordn();
} }
@ -1114,7 +1121,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
setEppInput("domain_create_anchor_authcode.xml"); setEppInput("domain_create_anchor_authcode.xml");
persistContactsAndHosts(); persistContactsAndHosts();
runFlowAssertResponse(loadFile("domain_create_anchor_response.xml")); runFlowAssertResponse(loadFile("domain_create_anchor_response.xml"));
assertSuccessfulCreate("tld", ImmutableSet.of(Flag.ANCHOR_TENANT)); assertSuccessfulCreate("tld", ImmutableSet.of(ANCHOR_TENANT));
assertNoLordn(); assertNoLordn();
} }
@ -1128,8 +1135,9 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
eppRequestSource = EppRequestSource.TOOL; eppRequestSource = EppRequestSource.TOOL;
setEppInput("domain_create_anchor_tenant.xml"); setEppInput("domain_create_anchor_tenant.xml");
persistContactsAndHosts(); persistContactsAndHosts();
runFlowAssertResponse(loadFile("domain_create_response.xml")); runFlowAssertResponse(
assertSuccessfulCreate("tld", ImmutableSet.of(Flag.ANCHOR_TENANT)); loadFile("domain_create_response.xml", ImmutableMap.of("DOMAIN", "example.tld")));
assertSuccessfulCreate("tld", ImmutableSet.of(ANCHOR_TENANT));
assertNoLordn(); assertNoLordn();
} }
@ -1146,7 +1154,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
clock.setTo(DateTime.parse("2009-08-16T09:00:00.0Z")); clock.setTo(DateTime.parse("2009-08-16T09:00:00.0Z"));
persistContactsAndHosts(); persistContactsAndHosts();
runFlowAssertResponse(loadFile("domain_create_response_claims.xml")); runFlowAssertResponse(loadFile("domain_create_response_claims.xml"));
assertSuccessfulCreate("tld", ImmutableSet.of(Flag.ANCHOR_TENANT)); assertSuccessfulCreate("tld", ImmutableSet.of(ANCHOR_TENANT));
assertDnsTasksEnqueued("example-one.tld"); assertDnsTasksEnqueued("example-one.tld");
assertClaimsLordn(); assertClaimsLordn();
} }
@ -1156,7 +1164,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
setEppInput("domain_create_reserved.xml"); setEppInput("domain_create_reserved.xml");
persistContactsAndHosts(); persistContactsAndHosts();
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, UserPrivileges.SUPERUSER, loadFile("domain_create_reserved_response.xml")); CommitMode.LIVE, SUPERUSER, loadFile("domain_create_reserved_response.xml"));
assertSuccessfulCreate("tld", ImmutableSet.of()); assertSuccessfulCreate("tld", ImmutableSet.of());
} }
@ -1199,7 +1207,8 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
public void testSuccess_superuserOpenApplication() throws Exception { public void testSuccess_superuserOpenApplication() throws Exception {
persistContactsAndHosts(); persistContactsAndHosts();
persistActiveDomainApplication(getUniqueIdFromCommand()); persistActiveDomainApplication(getUniqueIdFromCommand());
doSuccessfulTest("tld", "domain_create_response.xml", UserPrivileges.SUPERUSER); doSuccessfulTest(
"tld", "domain_create_response.xml", SUPERUSER, ImmutableMap.of("DOMAIN", "example.tld"));
} }
@Test @Test
@ -1286,7 +1295,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
@Test @Test
public void testFailure_startDateSunrise_missingLaunchExtension() { public void testFailure_startDateSunrise_missingLaunchExtension() {
createTld("tld", TldState.START_DATE_SUNRISE); createTld("tld", START_DATE_SUNRISE);
persistContactsAndHosts(); persistContactsAndHosts();
EppException thrown = EppException thrown =
assertThrows(MustHaveSignedMarksInCurrentPhaseException.class, this::runFlow); assertThrows(MustHaveSignedMarksInCurrentPhaseException.class, this::runFlow);
@ -1306,28 +1315,32 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
public void testSuccess_superuserPredelegation() throws Exception { public void testSuccess_superuserPredelegation() throws Exception {
createTld("tld", TldState.PREDELEGATION); createTld("tld", TldState.PREDELEGATION);
persistContactsAndHosts(); persistContactsAndHosts();
doSuccessfulTest("tld", "domain_create_response.xml", UserPrivileges.SUPERUSER); doSuccessfulTest(
"tld", "domain_create_response.xml", SUPERUSER, ImmutableMap.of("DOMAIN", "example.tld"));
} }
@Test @Test
public void testSuccess_superuserSunrush() throws Exception { public void testSuccess_superuserSunrush() throws Exception {
createTld("tld", TldState.SUNRUSH); createTld("tld", TldState.SUNRUSH);
persistContactsAndHosts(); persistContactsAndHosts();
doSuccessfulTest("tld", "domain_create_response.xml", UserPrivileges.SUPERUSER); doSuccessfulTest(
"tld", "domain_create_response.xml", SUPERUSER, ImmutableMap.of("DOMAIN", "example.tld"));
} }
@Test @Test
public void testSuccess_superuserStartDateSunrise_isSuperuser() throws Exception { public void testSuccess_superuserStartDateSunrise_isSuperuser() throws Exception {
createTld("tld", TldState.START_DATE_SUNRISE); createTld("tld", START_DATE_SUNRISE);
persistContactsAndHosts(); persistContactsAndHosts();
doSuccessfulTest("tld", "domain_create_response.xml", UserPrivileges.SUPERUSER); doSuccessfulTest(
"tld", "domain_create_response.xml", SUPERUSER, ImmutableMap.of("DOMAIN", "example.tld"));
} }
@Test @Test
public void testSuccess_superuserQuietPeriod() throws Exception { public void testSuccess_superuserQuietPeriod() throws Exception {
createTld("tld", TldState.QUIET_PERIOD); createTld("tld", TldState.QUIET_PERIOD);
persistContactsAndHosts(); persistContactsAndHosts();
doSuccessfulTest("tld", "domain_create_response.xml", UserPrivileges.SUPERUSER); doSuccessfulTest(
"tld", "domain_create_response.xml", SUPERUSER, ImmutableMap.of("DOMAIN", "example.tld"));
} }
@Test @Test
@ -1339,7 +1352,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
// Modify the Registrar to block premium names. // Modify the Registrar to block premium names.
persistResource(loadRegistrar("TheRegistrar").asBuilder().setBlockPremiumNames(true).build()); persistResource(loadRegistrar("TheRegistrar").asBuilder().setBlockPremiumNames(true).build());
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, UserPrivileges.SUPERUSER, loadFile("domain_create_response_premium.xml")); CommitMode.LIVE, SUPERUSER, loadFile("domain_create_response_premium.xml"));
assertSuccessfulCreate("example", ImmutableSet.of()); assertSuccessfulCreate("example", ImmutableSet.of());
} }
@ -1352,7 +1365,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, CommitMode.LIVE,
UserPrivileges.NORMAL, UserPrivileges.NORMAL,
loadFile("domain_create_response_wildcard.xml", substitutions)); loadFile("domain_create_response.xml", substitutions));
DomainResource domain = reloadResourceByForeignKey(); DomainResource domain = reloadResourceByForeignKey();
HistoryEntry historyEntry = getHistoryEntries(domain).get(0); HistoryEntry historyEntry = getHistoryEntries(domain).get(0);
assertPollMessagesForResource( assertPollMessagesForResource(
@ -1719,7 +1732,8 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
createTld("tld", TldState.SUNRISE); createTld("tld", TldState.SUNRISE);
setEppInput("domain_create_registration_sunrise.xml"); setEppInput("domain_create_registration_sunrise.xml");
persistContactsAndHosts(); persistContactsAndHosts();
doSuccessfulTest("tld", "domain_create_response.xml", UserPrivileges.SUPERUSER); doSuccessfulTest(
"tld", "domain_create_response.xml", SUPERUSER, ImmutableMap.of("DOMAIN", "example.tld"));
} }
@Test @Test
@ -1728,8 +1742,9 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
setEppInput("domain_create_registration_qlp_sunrise.xml"); setEppInput("domain_create_registration_qlp_sunrise.xml");
eppRequestSource = EppRequestSource.TOOL; // Only tools can pass in metadata. eppRequestSource = EppRequestSource.TOOL; // Only tools can pass in metadata.
persistContactsAndHosts(); persistContactsAndHosts();
runFlowAssertResponse(loadFile("domain_create_response.xml")); runFlowAssertResponse(
assertSuccessfulCreate("tld", ImmutableSet.of(Flag.ANCHOR_TENANT)); loadFile("domain_create_response.xml", ImmutableMap.of("DOMAIN", "example.tld")));
assertSuccessfulCreate("tld", ImmutableSet.of(ANCHOR_TENANT));
assertNoLordn(); assertNoLordn();
} }
@ -1741,7 +1756,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
eppRequestSource = EppRequestSource.TOOL; // Only tools can pass in metadata. eppRequestSource = EppRequestSource.TOOL; // Only tools can pass in metadata.
persistContactsAndHosts(); persistContactsAndHosts();
runFlowAssertResponse(loadFile("domain_create_response_encoded_signed_mark_name.xml")); runFlowAssertResponse(loadFile("domain_create_response_encoded_signed_mark_name.xml"));
assertSuccessfulCreate("tld", ImmutableSet.of(Flag.ANCHOR_TENANT, Flag.SUNRISE)); assertSuccessfulCreate("tld", ImmutableSet.of(ANCHOR_TENANT, Flag.SUNRISE));
assertSunriseLordn(); assertSunriseLordn();
} }
@ -1753,13 +1768,13 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
eppRequestSource = EppRequestSource.TOOL; // Only tools can pass in metadata. eppRequestSource = EppRequestSource.TOOL; // Only tools can pass in metadata.
persistContactsAndHosts(); persistContactsAndHosts();
runFlowAssertResponse(loadFile("domain_create_response_claims.xml")); runFlowAssertResponse(loadFile("domain_create_response_claims.xml"));
assertSuccessfulCreate("tld", ImmutableSet.of(Flag.ANCHOR_TENANT)); assertSuccessfulCreate("tld", ImmutableSet.of(ANCHOR_TENANT));
assertClaimsLordn(); assertClaimsLordn();
} }
@Test @Test
public void testFailure_startDateSunriseRegistration_missingSignedMark() { public void testFailure_startDateSunriseRegistration_missingSignedMark() {
createTld("tld", TldState.START_DATE_SUNRISE); createTld("tld", START_DATE_SUNRISE);
setEppInput("domain_create_registration_sunrise.xml"); setEppInput("domain_create_registration_sunrise.xml");
persistContactsAndHosts(); persistContactsAndHosts();
EppException thrown = EppException thrown =
@ -1769,26 +1784,28 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
@Test @Test
public void testSuccess_superuserStartDateSunriseRegistration_isSuperuser() throws Exception { public void testSuccess_superuserStartDateSunriseRegistration_isSuperuser() throws Exception {
createTld("tld", TldState.START_DATE_SUNRISE); createTld("tld", START_DATE_SUNRISE);
setEppInput("domain_create_registration_sunrise.xml"); setEppInput("domain_create_registration_sunrise.xml");
persistContactsAndHosts(); persistContactsAndHosts();
doSuccessfulTest("tld", "domain_create_response.xml", UserPrivileges.SUPERUSER); doSuccessfulTest(
"tld", "domain_create_response.xml", SUPERUSER, ImmutableMap.of("DOMAIN", "example.tld"));
} }
@Test @Test
public void testSuccess_qlpRegistrationSunriseRegistration() throws Exception { public void testSuccess_qlpRegistrationSunriseRegistration() throws Exception {
createTld("tld", TldState.START_DATE_SUNRISE); createTld("tld", START_DATE_SUNRISE);
setEppInput("domain_create_registration_qlp_start_date_sunrise.xml"); setEppInput("domain_create_registration_qlp_start_date_sunrise.xml");
eppRequestSource = EppRequestSource.TOOL; // Only tools can pass in metadata. eppRequestSource = EppRequestSource.TOOL; // Only tools can pass in metadata.
persistContactsAndHosts(); persistContactsAndHosts();
runFlowAssertResponse(loadFile("domain_create_response.xml")); runFlowAssertResponse(
assertSuccessfulCreate("tld", ImmutableSet.of(Flag.ANCHOR_TENANT)); loadFile("domain_create_response.xml", ImmutableMap.of("DOMAIN", "example.tld")));
assertSuccessfulCreate("tld", ImmutableSet.of(ANCHOR_TENANT));
assertNoLordn(); assertNoLordn();
} }
@Test @Test
public void testSuccess_startDateSunriseRegistration_withEncodedSignedMark() throws Exception { public void testSuccess_startDateSunriseRegistration_withEncodedSignedMark() throws Exception {
createTld("tld", TldState.START_DATE_SUNRISE); createTld("tld", START_DATE_SUNRISE);
clock.setTo(DateTime.parse("2014-09-09T09:09:09Z")); clock.setTo(DateTime.parse("2014-09-09T09:09:09Z"));
setEppInput( setEppInput(
"domain_create_registration_encoded_signed_mark.xml", "domain_create_registration_encoded_signed_mark.xml",
@ -1808,7 +1825,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
@Test @Test
public void testSuccess_startDateSunriseRegistration_withEncodedSignedMark_noType() public void testSuccess_startDateSunriseRegistration_withEncodedSignedMark_noType()
throws Exception { throws Exception {
createTld("tld", TldState.START_DATE_SUNRISE); createTld("tld", START_DATE_SUNRISE);
clock.setTo(DateTime.parse("2014-09-09T09:09:09Z")); clock.setTo(DateTime.parse("2014-09-09T09:09:09Z"));
setEppInput("domain_create_sunrise_encoded_signed_mark_no_type.xml"); setEppInput("domain_create_sunrise_encoded_signed_mark_no_type.xml");
persistContactsAndHosts(); persistContactsAndHosts();
@ -1834,7 +1851,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
@Test @Test
public void testFail_startDateSunriseRegistration_wrongEncodedSignedMark() { public void testFail_startDateSunriseRegistration_wrongEncodedSignedMark() {
createTld("tld", TldState.START_DATE_SUNRISE); createTld("tld", START_DATE_SUNRISE);
clock.setTo(DateTime.parse("2014-09-09T09:09:09Z")); clock.setTo(DateTime.parse("2014-09-09T09:09:09Z"));
setEppInput( setEppInput(
"domain_create_registration_encoded_signed_mark.xml", "domain_create_registration_encoded_signed_mark.xml",
@ -1846,7 +1863,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
@Test @Test
public void testFail_startDateSunriseRegistration_markNotYetValid() { public void testFail_startDateSunriseRegistration_markNotYetValid() {
createTld("tld", TldState.START_DATE_SUNRISE); createTld("tld", START_DATE_SUNRISE);
// If we move now back in time a bit, the mark will not have gone into effect yet. // If we move now back in time a bit, the mark will not have gone into effect yet.
clock.setTo(DateTime.parse("2013-08-09T10:05:59Z").minusSeconds(1)); clock.setTo(DateTime.parse("2013-08-09T10:05:59Z").minusSeconds(1));
setEppInput( setEppInput(
@ -1859,7 +1876,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
@Test @Test
public void testFail_startDateSunriseRegistration_markExpired() { public void testFail_startDateSunriseRegistration_markExpired() {
createTld("tld", TldState.START_DATE_SUNRISE); createTld("tld", START_DATE_SUNRISE);
// Move time forward to the mark expiration time. // Move time forward to the mark expiration time.
clock.setTo(DateTime.parse("2017-07-23T22:00:00.000Z")); clock.setTo(DateTime.parse("2017-07-23T22:00:00.000Z"));
setEppInput( setEppInput(
@ -1872,7 +1889,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
@Test @Test
public void testFailure_startDateSunriseRegistration_withClaimsNotice() { public void testFailure_startDateSunriseRegistration_withClaimsNotice() {
createTld("tld", TldState.START_DATE_SUNRISE); createTld("tld", START_DATE_SUNRISE);
clock.setTo(DateTime.parse("2009-08-16T09:00:00.0Z")); clock.setTo(DateTime.parse("2009-08-16T09:00:00.0Z"));
setEppInput("domain_create_registration_start_date_sunrise_claims_notice.xml"); setEppInput("domain_create_registration_start_date_sunrise_claims_notice.xml");
persistContactsAndHosts(); persistContactsAndHosts();
@ -1909,7 +1926,8 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
createTld("tld", TldState.SUNRUSH); createTld("tld", TldState.SUNRUSH);
setEppInput("domain_create_registration_sunrush.xml"); setEppInput("domain_create_registration_sunrush.xml");
persistContactsAndHosts(); persistContactsAndHosts();
doSuccessfulTest("tld", "domain_create_response.xml", UserPrivileges.SUPERUSER); doSuccessfulTest(
"tld", "domain_create_response.xml", SUPERUSER, ImmutableMap.of("DOMAIN", "example.tld"));
} }
@Test @Test
@ -1918,8 +1936,9 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
setEppInput("domain_create_registration_qlp_sunrush.xml"); setEppInput("domain_create_registration_qlp_sunrush.xml");
eppRequestSource = EppRequestSource.TOOL; // Only tools can pass in metadata. eppRequestSource = EppRequestSource.TOOL; // Only tools can pass in metadata.
persistContactsAndHosts(); persistContactsAndHosts();
runFlowAssertResponse(loadFile("domain_create_response.xml")); runFlowAssertResponse(
assertSuccessfulCreate("tld", ImmutableSet.of(Flag.ANCHOR_TENANT)); loadFile("domain_create_response.xml", ImmutableMap.of("DOMAIN", "example.tld")));
assertSuccessfulCreate("tld", ImmutableSet.of(ANCHOR_TENANT));
assertNoLordn(); assertNoLordn();
} }
@ -1931,7 +1950,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
eppRequestSource = EppRequestSource.TOOL; // Only tools can pass in metadata. eppRequestSource = EppRequestSource.TOOL; // Only tools can pass in metadata.
persistContactsAndHosts(); persistContactsAndHosts();
runFlowAssertResponse(loadFile("domain_create_response_encoded_signed_mark_name.xml")); runFlowAssertResponse(loadFile("domain_create_response_encoded_signed_mark_name.xml"));
assertSuccessfulCreate("tld", ImmutableSet.of(Flag.ANCHOR_TENANT, Flag.SUNRISE)); assertSuccessfulCreate("tld", ImmutableSet.of(ANCHOR_TENANT, Flag.SUNRISE));
assertSunriseLordn(); assertSunriseLordn();
} }
@ -1943,7 +1962,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
eppRequestSource = EppRequestSource.TOOL; // Only tools can pass in metadata. eppRequestSource = EppRequestSource.TOOL; // Only tools can pass in metadata.
persistContactsAndHosts(); persistContactsAndHosts();
runFlowAssertResponse(loadFile("domain_create_response_claims.xml")); runFlowAssertResponse(loadFile("domain_create_response_claims.xml"));
assertSuccessfulCreate("tld", ImmutableSet.of(Flag.ANCHOR_TENANT)); assertSuccessfulCreate("tld", ImmutableSet.of(ANCHOR_TENANT));
assertClaimsLordn(); assertClaimsLordn();
} }
@ -1962,7 +1981,8 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
createTld("tld", TldState.LANDRUSH); createTld("tld", TldState.LANDRUSH);
setEppInput("domain_create_registration_landrush.xml"); setEppInput("domain_create_registration_landrush.xml");
persistContactsAndHosts(); persistContactsAndHosts();
doSuccessfulTest("tld", "domain_create_response.xml", UserPrivileges.SUPERUSER); doSuccessfulTest(
"tld", "domain_create_response.xml", SUPERUSER, ImmutableMap.of("DOMAIN", "example.tld"));
} }
@Test @Test
@ -1971,8 +1991,9 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
setEppInput("domain_create_registration_qlp_landrush.xml"); setEppInput("domain_create_registration_qlp_landrush.xml");
eppRequestSource = EppRequestSource.TOOL; // Only tools can pass in metadata. eppRequestSource = EppRequestSource.TOOL; // Only tools can pass in metadata.
persistContactsAndHosts(); persistContactsAndHosts();
runFlowAssertResponse(loadFile("domain_create_response.xml")); runFlowAssertResponse(
assertSuccessfulCreate("tld", ImmutableSet.of(Flag.ANCHOR_TENANT)); loadFile("domain_create_response.xml", ImmutableMap.of("DOMAIN", "example.tld")));
assertSuccessfulCreate("tld", ImmutableSet.of(ANCHOR_TENANT));
assertNoLordn(); assertNoLordn();
} }
@ -1996,7 +2017,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
eppRequestSource = EppRequestSource.TOOL; // Only tools can pass in metadata. eppRequestSource = EppRequestSource.TOOL; // Only tools can pass in metadata.
persistContactsAndHosts(); persistContactsAndHosts();
runFlowAssertResponse(loadFile("domain_create_response_claims.xml")); runFlowAssertResponse(loadFile("domain_create_response_claims.xml"));
assertSuccessfulCreate("tld", ImmutableSet.of(Flag.ANCHOR_TENANT)); assertSuccessfulCreate("tld", ImmutableSet.of(ANCHOR_TENANT));
assertClaimsLordn(); assertClaimsLordn();
} }
@ -2559,7 +2580,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
clock.nowUtc().plusDays(2), clock.nowUtc().plusDays(2),
Money.of(USD, 0))) Money.of(USD, 0)))
.build()); .build());
doSuccessfulTest("tld", "domain_create_response.xml"); doSuccessfulTest("tld", "domain_create_response.xml", ImmutableMap.of("DOMAIN", "example.tld"));
} }
@Test @Test
@ -2577,7 +2598,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
clock.nowUtc().minusDays(1), clock.nowUtc().minusDays(1),
Money.of(USD, 0))) Money.of(USD, 0)))
.build()); .build());
doSuccessfulTest("tld", "domain_create_response.xml"); doSuccessfulTest("tld", "domain_create_response.xml", ImmutableMap.of("DOMAIN", "example.tld"));
} }
@Test @Test

View file

@ -6,7 +6,7 @@
<resData> <resData>
<domain:creData <domain:creData
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0"> xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name>example.tld</domain:name> <domain:name>%DOMAIN%</domain:name>
<domain:crDate>1999-04-03T22:00:00.0Z</domain:crDate> <domain:crDate>1999-04-03T22:00:00.0Z</domain:crDate>
<domain:exDate>2001-04-03T22:00:00.0Z</domain:exDate> <domain:exDate>2001-04-03T22:00:00.0Z</domain:exDate>
</domain:creData> </domain:creData>

View file

@ -6,7 +6,7 @@
<resData> <resData>
<domain:creData <domain:creData
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0"> xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name>example.tld</domain:name> <domain:name>%DOMAIN%</domain:name>
<domain:crDate>1999-04-03T22:00:00.0Z</domain:crDate> <domain:crDate>1999-04-03T22:00:00.0Z</domain:crDate>
<domain:exDate>2001-04-03T22:00:00.0Z</domain:exDate> <domain:exDate>2001-04-03T22:00:00.0Z</domain:exDate>
</domain:creData> </domain:creData>

View file

@ -6,7 +6,7 @@
<resData> <resData>
<domain:creData <domain:creData
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0"> xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name>rich.example</domain:name> <domain:name>%DOMAIN%</domain:name>
<domain:crDate>1999-04-03T22:00:00.0Z</domain:crDate> <domain:crDate>1999-04-03T22:00:00.0Z</domain:crDate>
<domain:exDate>2001-04-03T22:00:00.0Z</domain:exDate> <domain:exDate>2001-04-03T22:00:00.0Z</domain:exDate>
</domain:creData> </domain:creData>

View file

@ -1,19 +0,0 @@
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<response>
<result code="1000">
<msg>Command completed successfully</msg>
</result>
<resData>
<domain:creData
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name>%DOMAIN%</domain:name>
<domain:crDate>1999-04-03T22:00:00.0Z</domain:crDate>
<domain:exDate>2001-04-03T22:00:00.0Z</domain:exDate>
</domain:creData>
</resData>
<trID>
<clTRID>ABC-12345</clTRID>
<svTRID>server-trid</svTRID>
</trID>
</response>
</epp>