Consolidate wildcarded domain_create testdata XMLs

It's simpler to have fewer of these, and it's clearer from callsites if it's
always explicit exactly which domain is being created.

I also removed two irregularities: domain_create.xml included hostnames but
domain_create_wildcard.xml did not, and the former called the domain name
%DOMAIN% whereas the latter called it %HOSTNAME%.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=204956433
This commit is contained in:
mcilwain 2018-07-17 12:35:27 -07:00 committed by jianglai
parent 8ec2eaf39c
commit e32b1a571a
10 changed files with 45 additions and 70 deletions

View file

@ -101,7 +101,7 @@ public class EppCommitLogsTest extends ShardableTestCase {
clock.advanceBy(standardDays(1));
DateTime timeAtCreate = clock.nowUtc();
clock.setTo(timeAtCreate);
eppLoader = new EppLoader(this, "domain_create.xml");
eppLoader = new EppLoader(this, "domain_create.xml", ImmutableMap.of("DOMAIN", "example.tld"));
runFlow();
ofy().clearSessionCache();
Key<DomainResource> key = Key.create(ofy().load().type(DomainResource.class).first().now());

View file

@ -142,7 +142,8 @@ public class EppLifecycleDomainTest extends EppTestCase {
createContacts(DateTime.parse("2000-06-01T00:00:00Z"));
// Create domain example.tld
assertThatCommand("domain_create_no_hosts_or_dsdata.xml")
assertThatCommand(
"domain_create_no_hosts_or_dsdata.xml", ImmutableMap.of("DOMAIN", "example.tld"))
.atTime("2000-06-01T00:02:00Z")
.hasResponse(
"domain_create_response.xml",
@ -171,7 +172,8 @@ public class EppLifecycleDomainTest extends EppTestCase {
// Create domain example.tld
DateTime createTime = DateTime.parse("2000-06-01T00:02:00Z");
assertThatCommand("domain_create_no_hosts_or_dsdata.xml")
assertThatCommand(
"domain_create_no_hosts_or_dsdata.xml", ImmutableMap.of("DOMAIN", "example.tld"))
.atTime(createTime)
.hasResponse(
"domain_create_response.xml",
@ -219,7 +221,8 @@ public class EppLifecycleDomainTest extends EppTestCase {
DateTime createTime = DateTime.parse("2000-06-01T00:02:00Z");
// Create domain example.tld
assertThatCommand("domain_create_no_hosts_or_dsdata.xml")
assertThatCommand(
"domain_create_no_hosts_or_dsdata.xml", ImmutableMap.of("DOMAIN", "example.tld"))
.atTime(createTime)
.hasResponse(
"domain_create_response.xml",
@ -481,7 +484,8 @@ public class EppLifecycleDomainTest extends EppTestCase {
createFakesite();
// Create domain example.tld
assertThatCommand("domain_create_no_hosts_or_dsdata.xml")
assertThatCommand(
"domain_create_no_hosts_or_dsdata.xml", ImmutableMap.of("DOMAIN", "example.tld"))
.atTime("2000-06-02T00:00:00Z")
.hasResponse(
"domain_create_response.xml",
@ -948,7 +952,8 @@ public class EppLifecycleDomainTest extends EppTestCase {
// Create domain example.bar.foo.tld
assertThatCommand(
"domain_create_wildcard.xml", ImmutableMap.of("HOSTNAME", "example.bar.foo.tld"))
"domain_create_no_hosts_or_dsdata.xml",
ImmutableMap.of("DOMAIN", "example.bar.foo.tld"))
.atTime("2000-06-01T00:02:00.001Z")
.hasResponse(
"domain_create_response.xml",
@ -958,7 +963,8 @@ public class EppLifecycleDomainTest extends EppTestCase {
"EXDATE", "2002-06-01T00:02:00Z"));
// Create domain example.foo.tld
assertThatCommand("domain_create_wildcard.xml", ImmutableMap.of("HOSTNAME", "example.foo.tld"))
assertThatCommand(
"domain_create_no_hosts_or_dsdata.xml", ImmutableMap.of("DOMAIN", "example.foo.tld"))
.atTime("2000-06-01T00:02:00.002Z")
.hasResponse(
"domain_create_response.xml",
@ -968,7 +974,8 @@ public class EppLifecycleDomainTest extends EppTestCase {
"EXDATE", "2002-06-01T00:02:00Z"));
// Create domain example.tld
assertThatCommand("domain_create_wildcard.xml", ImmutableMap.of("HOSTNAME", "example.tld"))
assertThatCommand(
"domain_create_no_hosts_or_dsdata.xml", ImmutableMap.of("DOMAIN", "example.tld"))
.atTime("2000-06-01T00:02:00.003Z")
.hasResponse(
"domain_create_response.xml",
@ -988,7 +995,8 @@ public class EppLifecycleDomainTest extends EppTestCase {
createContacts(DateTime.parse("2000-06-01T00:00:00.000Z"));
// Create domain example.tld.foo
assertThatCommand("domain_create_wildcard.xml", ImmutableMap.of("HOSTNAME", "example.tld.foo"))
assertThatCommand(
"domain_create_no_hosts_or_dsdata.xml", ImmutableMap.of("DOMAIN", "example.tld.foo"))
.atTime("2000-06-01T00:02:00.001Z")
.hasResponse(
"domain_create_response.xml",
@ -998,7 +1006,8 @@ public class EppLifecycleDomainTest extends EppTestCase {
"EXDATE", "2002-06-01T00:02:00Z"));
// Create domain example.tld
assertThatCommand("domain_create_wildcard.xml", ImmutableMap.of("HOSTNAME", "example.tld"))
assertThatCommand(
"domain_create_no_hosts_or_dsdata.xml", ImmutableMap.of("DOMAIN", "example.tld"))
.atTime("2000-06-01T00:02:00.002Z")
.hasResponse(
"domain_create_response.xml",
@ -1045,7 +1054,9 @@ public class EppLifecycleDomainTest extends EppTestCase {
"MSG",
"Declared launch extension phase does not match the current registry phase"));
assertThatCommand("domain_create_wildcard.xml", ImmutableMap.of("HOSTNAME", "general.example"))
assertThatCommand(
"domain_create_no_hosts_or_dsdata.xml",
ImmutableMap.of("DOMAIN", "general.example"))
.atTime(sunriseDate.minusDays(1))
.hasResponse(
"response_error.xml",
@ -1068,7 +1079,9 @@ public class EppLifecycleDomainTest extends EppTestCase {
.atTime(sunriseDate.plusDays(1).plusMinutes(1))
.hasResponse("generic_success_response.xml");
assertThatCommand("domain_create_wildcard.xml", ImmutableMap.of("HOSTNAME", "general.example"))
assertThatCommand(
"domain_create_no_hosts_or_dsdata.xml",
ImmutableMap.of("DOMAIN", "general.example"))
.atTime(sunriseDate.plusDays(2))
.hasResponse(
"response_error.xml",
@ -1086,7 +1099,9 @@ public class EppLifecycleDomainTest extends EppTestCase {
"MSG",
"Declared launch extension phase does not match the current registry phase"));
assertThatCommand("domain_create_wildcard.xml", ImmutableMap.of("HOSTNAME", "general.example"))
assertThatCommand(
"domain_create_no_hosts_or_dsdata.xml",
ImmutableMap.of("DOMAIN", "general.example"))
.atTime(gaDate.plusDays(2))
.hasResponse(
"domain_create_response.xml",

View file

@ -165,7 +165,8 @@ public class EppLifecycleHostTest extends EppTestCase {
// Create domain example.bar.foo.tld
assertThatCommand(
"domain_create_wildcard.xml", ImmutableMap.of("HOSTNAME", "example.bar.foo.tld"))
"domain_create_no_hosts_or_dsdata.xml",
ImmutableMap.of("DOMAIN", "example.bar.foo.tld"))
.atTime("2000-06-01T00:02:00.000Z")
.hasResponse(
"domain_create_response.xml",
@ -175,7 +176,8 @@ public class EppLifecycleHostTest extends EppTestCase {
"EXDATE", "2002-06-01T00:02:00Z"));
// Create domain example.foo.tld
assertThatCommand("domain_create_wildcard.xml", ImmutableMap.of("HOSTNAME", "example.foo.tld"))
assertThatCommand(
"domain_create_no_hosts_or_dsdata.xml", ImmutableMap.of("DOMAIN", "example.foo.tld"))
.atTime("2000-06-01T00:02:00.001Z")
.hasResponse(
"domain_create_response.xml",
@ -185,7 +187,8 @@ public class EppLifecycleHostTest extends EppTestCase {
"EXDATE", "2002-06-01T00:02:00Z"));
// Create domain example.tld
assertThatCommand("domain_create_wildcard.xml", ImmutableMap.of("HOSTNAME", "example.tld"))
assertThatCommand(
"domain_create_no_hosts_or_dsdata.xml", ImmutableMap.of("DOMAIN", "example.tld"))
.atTime("2000-06-01T00:02:00.002Z")
.hasResponse(
"domain_create_response.xml",

View file

@ -166,7 +166,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
private static final String CLAIMS_KEY = "2013041500/2/6/9/rJ1NrDO92vDsAzf7EQzgjX4R0000000001";
public DomainCreateFlowTest() {
setEppInput("domain_create.xml");
setEppInput("domain_create.xml", ImmutableMap.of("DOMAIN", "example.tld"));
clock.setTo(DateTime.parse("1999-04-03T22:00:00.0Z").minus(Duration.millis(1)));
}
@ -454,7 +454,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
@Test
public void testFailure_domainNameExistsAsTld_lowercase() {
createTlds("foo.tld", "tld");
setEppInput("domain_create_wildcard.xml", ImmutableMap.of("DOMAIN", "foo.tld"));
setEppInput("domain_create.xml", ImmutableMap.of("DOMAIN", "foo.tld"));
persistContactsAndHosts();
EppException thrown = assertThrows(DomainNameExistsAsTldException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -463,7 +463,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
@Test
public void testFailure_domainNameExistsAsTld_uppercase() {
createTlds("foo.tld", "tld");
setEppInput("domain_create_wildcard.xml", ImmutableMap.of("DOMAIN", "FOO.TLD"));
setEppInput("domain_create.xml", ImmutableMap.of("DOMAIN", "FOO.TLD"));
persistContactsAndHosts();
EppException thrown = assertThrows(BadDomainNameCharacterException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -840,7 +840,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
@Test
public void testSuccess_noNameserversOrDsData() throws Exception {
setEppInput("domain_create_no_hosts_or_dsdata.xml");
setEppInput("domain_create_no_hosts_or_dsdata.xml", ImmutableMap.of("DOMAIN", "example.tld"));
persistContactsAndHosts();
runFlowAssertResponse(loadFile("domain_create_response.xml"));
assertNoDnsTasksEnqueued();
@ -881,7 +881,6 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
@Test
public void testSuccess_noClaimsNotice_forClaimsListName_afterClaimsPeriodEnd() throws Exception {
persistClaimsList(ImmutableMap.of("example", CLAIMS_KEY));
setEppInput("domain_create.xml");
persistContactsAndHosts();
persistResource(Registry.get("tld").asBuilder().setClaimsPeriodEnd(clock.nowUtc()).build());
runFlowAssertResponse(loadFile("domain_create_response.xml"));
@ -892,7 +891,6 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
@Test
public void testFailure_missingClaimsNotice() {
persistClaimsList(ImmutableMap.of("example", CLAIMS_KEY));
setEppInput("domain_create.xml");
persistContactsAndHosts();
EppException thrown = assertThrows(MissingClaimsNoticeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -1349,7 +1347,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
public void testSuccess_customLogicIsCalled_andSavesExtraEntity() throws Exception {
// @see TestDomainCreateFlowCustomLogic for what the label "custom-logic-test" triggers.
ImmutableMap<String, String> substitutions = ImmutableMap.of("DOMAIN", "custom-logic-test.tld");
setEppInput("domain_create_wildcard.xml", substitutions);
setEppInput("domain_create.xml", substitutions);
persistContactsAndHosts();
runFlowAssertResponse(
CommitMode.LIVE,
@ -1619,7 +1617,6 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
@Test
public void testFailure_suspendedRegistrarCantCreateDomain() {
setEppInput("domain_create.xml");
persistContactsAndHosts();
persistResource(
Registrar.loadByClientId("TheRegistrar")
@ -2032,7 +2029,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
@Test
public void testFailure_emptyNameserverFailsWhitelist() {
setEppInput("domain_create_no_hosts_or_dsdata.xml");
setEppInput("domain_create_no_hosts_or_dsdata.xml", ImmutableMap.of("DOMAIN", "example.tld"));
persistResource(
Registry.get("tld")
.asBuilder()
@ -2075,7 +2072,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
@Test
public void testFailure_domainNameserverRestricted_noNameservers() {
setEppInput("domain_create_no_hosts_or_dsdata.xml");
setEppInput("domain_create_no_hosts_or_dsdata.xml", ImmutableMap.of("DOMAIN", "example.tld"));
persistContactsAndHosts();
persistResource(
Registry.get("tld")

View file

@ -3,7 +3,7 @@
<create>
<domain:create
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name>example.tld</domain:name>
<domain:name>%DOMAIN%</domain:name>
<domain:period unit="y">2</domain:period>
<domain:ns>
<domain:hostObj>ns1.example.net</domain:hostObj>

View file

@ -3,7 +3,7 @@
<create>
<domain:create
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name>example.tld</domain:name>
<domain:name>%DOMAIN%</domain:name>
<domain:period unit="y">2</domain:period>
<domain:registrant>jd1234</domain:registrant>
<domain:contact type="admin">sh8013</domain:contact>

View file

@ -1,22 +0,0 @@
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<command>
<create>
<domain:create
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name>%DOMAIN%</domain:name>
<domain:period unit="y">2</domain:period>
<domain:ns>
<domain:hostObj>ns1.example.net</domain:hostObj>
<domain:hostObj>ns2.example.net</domain:hostObj>
</domain:ns>
<domain:registrant>jd1234</domain:registrant>
<domain:contact type="admin">sh8013</domain:contact>
<domain:contact type="tech">sh8013</domain:contact>
<domain:authInfo>
<domain:pw>2fooBAR</domain:pw>
</domain:authInfo>
</domain:create>
</create>
<clTRID>ABC-12345</clTRID>
</command>
</epp>

View file

@ -3,7 +3,7 @@
<create>
<domain:create
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name>example.tld</domain:name>
<domain:name>%DOMAIN%</domain:name>
<domain:period unit="y">2</domain:period>
<domain:ns>
<domain:hostObj>ns1.example.net</domain:hostObj>

View file

@ -3,7 +3,7 @@
<create>
<domain:create
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name>example.tld</domain:name>
<domain:name>%DOMAIN%</domain:name>
<domain:period unit="y">2</domain:period>
<domain:registrant>jd1234</domain:registrant>
<domain:contact type="admin">sh8013</domain:contact>

View file

@ -1,18 +0,0 @@
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<command>
<create>
<domain:create
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name>%HOSTNAME%</domain:name>
<domain:period unit="y">2</domain:period>
<domain:registrant>jd1234</domain:registrant>
<domain:contact type="admin">sh8013</domain:contact>
<domain:contact type="tech">sh8013</domain:contact>
<domain:authInfo>
<domain:pw>2fooBAR</domain:pw>
</domain:authInfo>
</domain:create>
</create>
<clTRID>ABC-12345</clTRID>
</command>
</epp>