Add the START_DATE_SUNRISE phase

The START_DATE_SUNRISE phase allows registration of domains only with a signed mark. In all other respects - it is identical to the GENERAL_AVAILABILITY phase.

Note that Anchor Tenants bypass all checks, and are hence able to register domains without a signed mark.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=185534793
This commit is contained in:
guyben 2018-02-13 08:38:54 -08:00 committed by jianglai
parent bba975a991
commit b0cbc0f60d
17 changed files with 484 additions and 13 deletions

View file

@ -1083,4 +1083,95 @@ public class EppLifecycleDomainTest extends EppTestCase {
assertCommandAndResponse("logout.xml", "logout_response.xml");
}
/**
* Test a full launch of start-date sunrise.
*
* We show that we can't create during pre-delegation, can only create with an encoded mark during
* start-date sunrise - which we can then delete "as normal" (no need for a signed mark or
* anything for delete), and then use "regular" create during general-availability.
*/
@Test
public void testDomainCreation_startDateSunriseFull() throws Exception {
// The signed mark is valid between 2013 and 2017
DateTime sunriseDate = DateTime.parse("2014-09-08T09:09:09Z");
DateTime gaDate = sunriseDate.plusDays(30);
createTld(
"example",
ImmutableSortedMap.of(
START_OF_TIME, TldState.PREDELEGATION,
sunriseDate, TldState.START_DATE_SUNRISE,
gaDate, TldState.GENERAL_AVAILABILITY));
assertCommandAndResponse("login_valid.xml", "login_response.xml", sunriseDate.minusDays(3));
createContactsAndHosts();
// During pre-delegation, any create should fail both with and without mark
assertCommandAndResponse(
"domain_create_start_date_sunrise_encoded_mark.xml",
ImmutableMap.of(),
"response_error.xml",
ImmutableMap.of(
"MSG", "Declared launch extension phase does not match the current registry phase",
"CODE", "2306"),
sunriseDate.minusDays(2));
assertCommandAndResponse(
"domain_create_wildcard.xml",
ImmutableMap.of("HOSTNAME", "general.example"),
"response_error.xml",
ImmutableMap.of(
"MSG", "The current registry phase does not allow for general registrations",
"CODE", "2002"),
sunriseDate.minusDays(1));
// During start-date sunrise, create with mark will succeed but without will fail.
// We also test we can delete without a mark.
assertCommandAndResponse(
"domain_create_start_date_sunrise_encoded_mark.xml",
ImmutableMap.of(),
"domain_create_response.xml",
ImmutableMap.of(
"NAME", "test-validate.example",
"CRDATE", "2014-09-09T09:09:09Z",
"EXDATE", "2015-09-09T09:09:09Z"),
sunriseDate.plusDays(1));
assertCommandAndResponse(
"domain_delete.xml", ImmutableMap.of("NAME", "test-validate.example"),
"generic_success_response.xml", ImmutableMap.of(),
sunriseDate.plusDays(1).plusMinutes(1));
assertCommandAndResponse(
"domain_create_wildcard.xml",
ImmutableMap.of("HOSTNAME", "general.example"),
"response_error.xml",
ImmutableMap.of(
"MSG", "The current registry phase requires a signed mark for registrations",
"CODE", "2002"),
sunriseDate.plusDays(2));
// During general availability, sunrise creates will fail but regular creates succeed
assertCommandAndResponse(
"domain_create_start_date_sunrise_encoded_mark.xml",
ImmutableMap.of(),
"response_error.xml",
ImmutableMap.of(
"MSG", "Declared launch extension phase does not match the current registry phase",
"CODE", "2306"),
gaDate.plusDays(1));
assertCommandAndResponse(
"domain_create_wildcard.xml",
ImmutableMap.of("HOSTNAME", "general.example"),
"domain_create_response.xml",
ImmutableMap.of(
"NAME", "general.example",
"CRDATE", "2014-10-10T09:09:09Z",
"EXDATE", "2016-10-10T09:09:09Z"),
gaDate.plusDays(2));
assertCommandAndResponse("logout.xml", "logout_response.xml");
}
}

View file

@ -1192,6 +1192,15 @@ public class DomainApplicationCreateFlowTest
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
public void testFailure_startDateSunrise() throws Exception {
createTld("tld", TldState.START_DATE_SUNRISE);
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown = expectThrows(BadCommandForRegistryPhaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
public void testFailure_wrongDeclaredPhase() throws Exception {
setEppInput("domain_create_landrush_signed_mark.xml");
@ -1242,6 +1251,14 @@ public class DomainApplicationCreateFlowTest
runSuperuserFlow("domain_create_sunrush_response.xml");
}
@Test
public void testSuccess_superuserStartDateSunrise() throws Exception {
createTld("tld", TldState.START_DATE_SUNRISE);
persistContactsAndHosts();
clock.advanceOneMilli();
runSuperuserFlow("domain_create_sunrush_response.xml");
}
@Test
public void testSuccess_superuserWrongDeclaredPhase() throws Exception {
setEppInput("domain_create_landrush_signed_mark.xml");

View file

@ -282,6 +282,14 @@ public class DomainApplicationDeleteFlowTest
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
public void testFailure_startDateSunrise() throws Exception {
createTld("tld", TldState.START_DATE_SUNRISE);
persistResource(newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD").build());
EppException thrown = expectThrows(BadCommandForRegistryPhaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
public void testSuccess_superuserQuietPeriod() throws Exception {
createTld("tld", TldState.QUIET_PERIOD);
@ -309,6 +317,15 @@ public class DomainApplicationDeleteFlowTest
CommitMode.LIVE, UserPrivileges.SUPERUSER, loadFile("domain_delete_response.xml"));
}
@Test
public void testSuccess_superuserStartDateSunrise() throws Exception {
createTld("tld", TldState.START_DATE_SUNRISE);
persistResource(newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD").build());
clock.advanceOneMilli();
runFlowAssertResponse(
CommitMode.LIVE, UserPrivileges.SUPERUSER, loadFile("domain_delete_response.xml"));
}
@Test
public void testFailure_applicationIdForDifferentDomain() throws Exception {
persistResource(newDomainApplication("invalid.tld").asBuilder().setRepoId("1-TLD").build());

View file

@ -65,7 +65,9 @@ import google.registry.flows.EppRequestSource;
import google.registry.flows.ExtensionManager.UndeclaredServiceExtensionException;
import google.registry.flows.ResourceFlowTestCase;
import google.registry.flows.domain.DomainCreateFlow.DomainHasOpenApplicationsException;
import google.registry.flows.domain.DomainCreateFlow.MustHaveSignedMarksInCurrentPhaseException;
import google.registry.flows.domain.DomainCreateFlow.NoGeneralRegistrationsInCurrentPhaseException;
import google.registry.flows.domain.DomainFlowTmchUtils.NoMarksFoundMatchingDomainException;
import google.registry.flows.domain.DomainFlowUtils.AcceptedTooLongAgoException;
import google.registry.flows.domain.DomainFlowUtils.BadDomainNameCharacterException;
import google.registry.flows.domain.DomainFlowUtils.BadDomainNamePartsCountException;
@ -1258,6 +1260,15 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
public void testFailure_startDateSunrise_missingLaunchExtension() throws Exception {
createTld("tld", TldState.START_DATE_SUNRISE);
persistContactsAndHosts();
EppException thrown =
expectThrows(MustHaveSignedMarksInCurrentPhaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
public void testFailure_quietPeriod() throws Exception {
createTld("tld", TldState.QUIET_PERIOD);
@ -1281,6 +1292,13 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
doSuccessfulTest("tld", "domain_create_response.xml", UserPrivileges.SUPERUSER);
}
@Test
public void testSuccess_superuserStartDateSunrise_isSuperuser() throws Exception {
createTld("tld", TldState.START_DATE_SUNRISE);
persistContactsAndHosts();
doSuccessfulTest("tld", "domain_create_response.xml", UserPrivileges.SUPERUSER);
}
@Test
public void testSuccess_superuserQuietPeriod() throws Exception {
createTld("tld", TldState.QUIET_PERIOD);
@ -1710,6 +1728,68 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
assertClaimsLordn();
}
@Test
public void testFailure_startDateSunriseRegistration_missingSignedMark() throws Exception {
createTld("tld", TldState.START_DATE_SUNRISE);
setEppInput("domain_create_registration_start_date_sunrise.xml");
persistContactsAndHosts();
EppException thrown =
expectThrows(MustHaveSignedMarksInCurrentPhaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
public void testSuccess_superuserStartDateSunriseRegistration_isSuperuser() throws Exception {
createTld("tld", TldState.START_DATE_SUNRISE);
setEppInput("domain_create_registration_start_date_sunrise.xml");
persistContactsAndHosts();
doSuccessfulTest("tld", "domain_create_response.xml", UserPrivileges.SUPERUSER);
}
@Test
public void testSuccess_qlpRegistrationSunriseRegistration() throws Exception {
createTld("tld", TldState.START_DATE_SUNRISE);
setEppInput("domain_create_registration_qlp_start_date_sunrise.xml");
eppRequestSource = EppRequestSource.TOOL; // Only tools can pass in metadata.
persistContactsAndHosts();
runFlowAssertResponse(loadFile("domain_create_response.xml"));
assertSuccessfulCreate("tld", true);
assertNoLordn();
}
@Test
public void testSuccess_startDateSunriseRegistration_withEncodedSignedMark() throws Exception {
createTld("tld", TldState.START_DATE_SUNRISE);
clock.setTo(DateTime.parse("2014-09-09T09:09:09Z"));
setEppInput("domain_create_registration_start_date_sunrise_encoded_signed_mark.xml");
persistContactsAndHosts();
runFlowAssertResponse(loadFile("domain_create_response_encoded_signed_mark_name.xml"));
assertSuccessfulCreate("tld", false);
assertNoLordn("0000001761376042759136-65535", null);
}
@Test
public void testFail_startDateSunriseRegistration_wrongEncodedSignedMark() throws Exception {
createTld("tld", TldState.START_DATE_SUNRISE);
clock.setTo(DateTime.parse("2014-09-09T09:09:09Z"));
setEppInput("domain_create_registration_start_date_sunrise_wrong_encoded_signed_mark.xml");
persistContactsAndHosts();
EppException thrown =
expectThrows(NoMarksFoundMatchingDomainException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
public void testFailure_startDateSunriseRegistration_withClaimsNotice() throws Exception {
createTld("tld", TldState.START_DATE_SUNRISE);
clock.setTo(DateTime.parse("2009-08-16T09:00:00.0Z"));
setEppInput("domain_create_registration_start_date_sunrise_claims_notice.xml");
persistContactsAndHosts();
EppException thrown =
expectThrows(MustHaveSignedMarksInCurrentPhaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
public void testFailure_sunrushRegistration() throws Exception {
createTld("tld", TldState.SUNRUSH);

View file

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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>example.tld</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>
<extension>
<launch:create xmlns:launch="urn:ietf:params:xml:ns:launch-1.0" type="registration">
<launch:phase name="start-date">sunrise</launch:phase>
</launch:create>
<metadata:metadata xmlns:metadata="urn:google:params:xml:ns:metadata-1.0">
<metadata:requestedByRegistrar>true</metadata:requestedByRegistrar>
<metadata:anchorTenant>true</metadata:anchorTenant>
</metadata:metadata>
</extension>
<clTRID>ABC-12345</clTRID>
</command>
</epp>

View file

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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>example.tld</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>
<extension>
<launch:create
xmlns:launch="urn:ietf:params:xml:ns:launch-1.0"
type="registration">
<launch:phase name="start-date">sunrise</launch:phase>
</launch:create>
</extension>
<clTRID>ABC-12345</clTRID>
</command>
</epp>

View file

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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>example-one.tld</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>
<extension>
<launch:create xmlns:launch="urn:ietf:params:xml:ns:launch-1.0" type="registration">
<launch:phase name="start-date">sunrise</launch:phase>
<launch:notice>
<launch:noticeID>370d0b7c9223372036854775807</launch:noticeID>
<launch:notAfter>2010-08-16T09:00:00.0Z</launch:notAfter>
<launch:acceptedDate>2009-08-16T09:00:00.0Z</launch:acceptedDate>
</launch:notice>
</launch:create>
</extension>
<clTRID>ABC-12345</clTRID>
</command>
</epp>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -718,6 +718,7 @@ enum google.registry.model.registry.Registry$TldState {
PDT;
PREDELEGATION;
QUIET_PERIOD;
START_DATE_SUNRISE;
SUNRISE;
SUNRUSH;
}