mirror of
https://github.com/google/nomulus.git
synced 2025-05-15 00:47:11 +02:00
Default missing type= argument to "registration" in launch:create EPP extension
<launch:create> has an optional type argument, that can take either "application" or "registration": https://tools.ietf.org/html/rfc8334#section-3.3.1 We get that type via createExtension.get().getCreateType(), where if the type= argument isn't given, the function returns null. In that case, we need to decide based on the TLD - application for end-date sunrise, and registration for start-date sunrise. For now we can't do that, because FlowPicker doesn't have access to the TLD information. Until that is fixed we decide as follows: - landrush and sunrush phases will default to APPLICATION, because there's no possible registration for it. - sunrise defaults to REGISTRATION because we're currenly launching start-date sunrise that uses registration. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=189942568
This commit is contained in:
parent
e525df791f
commit
edcb725a18
9 changed files with 211 additions and 9 deletions
|
@ -86,7 +86,6 @@ import google.registry.model.eppinput.ResourceCommand;
|
|||
import google.registry.model.host.HostCommand;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
/** Class that picks a flow to handle a given EPP command. */
|
||||
public class FlowPicker {
|
||||
|
@ -243,6 +242,9 @@ public class FlowPicker {
|
|||
}
|
||||
};
|
||||
|
||||
private static final ImmutableSet<LaunchPhase> LAUNCH_PHASES_DEFAULTING_TO_APPLICATION =
|
||||
ImmutableSet.of(LaunchPhase.SUNRUSH, LaunchPhase.LANDRUSH);
|
||||
|
||||
/**
|
||||
* Application CRUD flows have an extension and are keyed on the type of their {@link
|
||||
* ResourceCommand}.
|
||||
|
@ -258,9 +260,6 @@ public class FlowPicker {
|
|||
DomainCommand.Info.class, DomainApplicationInfoFlow.class,
|
||||
DomainCommand.Update.class, DomainApplicationUpdateFlow.class);
|
||||
|
||||
private final Set<LaunchPhase> launchPhases =
|
||||
ImmutableSet.of(LaunchPhase.SUNRISE, LaunchPhase.SUNRUSH, LaunchPhase.LANDRUSH);
|
||||
|
||||
@Override
|
||||
Class<? extends Flow> get(
|
||||
EppInput eppInput, InnerCommand innerCommand, ResourceCommand resourceCommand) {
|
||||
|
@ -269,13 +268,28 @@ public class FlowPicker {
|
|||
}
|
||||
Optional<LaunchCreateExtension> createExtension =
|
||||
eppInput.getSingleExtension(LaunchCreateExtension.class);
|
||||
// Return a flow if the type is APPLICATION, or if it's null and we are in a launch phase.
|
||||
// If the type is specified as REGISTRATION, return null.
|
||||
// Return a flow if the type is APPLICATION. If the type is REGISTRATION, return null.
|
||||
if (createExtension.isPresent()) {
|
||||
LaunchPhase launchPhase = createExtension.get().getPhase();
|
||||
// <launch:create> has an optional type argument, that can take either "application" or
|
||||
// "registration".
|
||||
// https://tools.ietf.org/html/rfc8334#section-3.3.1
|
||||
// We get that type via createExtension.get().getCreateType()
|
||||
// If it isn't given, the function returns null.
|
||||
// In that case, we need to decide based on the TLD. For now we can't do that - so we
|
||||
// TEMPORARILY decide as follows:
|
||||
// landrush and sunrush phases will default to APPLICATION, because there's no possible
|
||||
// registration for it.
|
||||
// sunrise defaults to REGISTRATION because we're currenly launching start-date sunrise
|
||||
// that uses direct registration.
|
||||
//
|
||||
// TODO(b/76095570): if createExtension.get().getCreateType() isn't explicitly given,
|
||||
// we need to set it according to the TldState (which means we need to know the TLD and
|
||||
// load the Registry - which will probably result in a big refactoring since we can use
|
||||
// TldState information to pick the flow)
|
||||
if (APPLICATION.equals(createExtension.get().getCreateType())
|
||||
|| (createExtension.get().getCreateType() == null
|
||||
&& launchPhases.contains(launchPhase))) {
|
||||
&& LAUNCH_PHASES_DEFAULTING_TO_APPLICATION.contains(launchPhase))) {
|
||||
return applicationFlows.get(resourceCommand.getClass());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1189,4 +1189,59 @@ public class EppLifecycleDomainTest extends EppTestCase {
|
|||
|
||||
assertCommandAndResponse("logout.xml", "logout_response.xml");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that missing type= argument on launch create works in start-date sunrise.
|
||||
*
|
||||
* <p>TODO(b/76095570):have the same exact test on end-date sunrise - using the same .xml file -
|
||||
* that checks that an application was created.
|
||||
*/
|
||||
@Test
|
||||
public void testDomainCreation_startDateSunrise_noType() 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 start-date sunrise, create with mark will succeed but without will fail.
|
||||
// We also test we can delete without a mark.
|
||||
assertCommandAndResponse(
|
||||
"domain_info.xml",
|
||||
ImmutableMap.of("NAME", "test-validate.example"),
|
||||
"response_error.xml",
|
||||
ImmutableMap.of(
|
||||
"MSG", "The domain with given ID (example.tld) doesn't exist.", "CODE", "2303"),
|
||||
sunriseDate.plusDays(1));
|
||||
|
||||
assertCommandAndResponse(
|
||||
"domain_create_start_date_sunrise_encoded_mark_no_type.xml",
|
||||
ImmutableMap.of(),
|
||||
"domain_create_response.xml",
|
||||
ImmutableMap.of(
|
||||
"NAME", "test-validate.example",
|
||||
"CRDATE", "2014-09-09T09:10:09Z",
|
||||
"EXDATE", "2015-09-09T09:10:09Z"),
|
||||
sunriseDate.plusDays(1).plusMinutes(1));
|
||||
|
||||
assertCommandAndResponse(
|
||||
"domain_info_wildcard.xml",
|
||||
ImmutableMap.of("NAME", "test-validate.example"),
|
||||
"domain_info_response_ok_wildcard.xml",
|
||||
ImmutableMap.of(
|
||||
"NAME", "test-validate.example",
|
||||
"CRDATE", "2014-09-09T09:10:09Z",
|
||||
"EXDATE", "2015-09-09T09:10:09Z"),
|
||||
sunriseDate.plusDays(1).plusMinutes(2));
|
||||
|
||||
assertCommandAndResponse("logout.xml", "logout_response.xml");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1779,6 +1779,24 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
|
|||
assertNoLordn("0000001761376042759136-65535", null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that missing type= argument on launch create works in start-date sunrise.
|
||||
*
|
||||
* <p>TODO(b/76095570):have the same exact test on end-date sunrise - using the same .xml file -
|
||||
* that checks that an application was created.
|
||||
*/
|
||||
@Test
|
||||
public void testSuccess_startDateSunriseRegistration_withEncodedSignedMark_noType()
|
||||
throws Exception {
|
||||
createTld("tld", TldState.START_DATE_SUNRISE);
|
||||
clock.setTo(DateTime.parse("2014-09-09T09:09:09Z"));
|
||||
setEppInput("domain_create_sunrise_encoded_signed_mark_no_type.xml");
|
||||
persistContactsAndHosts();
|
||||
runFlowAssertResponse(loadFile("domain_create_response_encoded_signed_mark_name.xml"));
|
||||
assertSuccessfulCreate("tld", false);
|
||||
assertNoLordn("0000001761376042759136-65535", null);
|
||||
}
|
||||
|
||||
|
||||
/** Tests possible confusion caused by the common start-date and end-date sunrise LaunchPhase. */
|
||||
@Test
|
||||
|
|
|
@ -15,7 +15,8 @@
|
|||
</create>
|
||||
<extension>
|
||||
<launch:create
|
||||
xmlns:launch="urn:ietf:params:xml:ns:launch-1.0">
|
||||
xmlns:launch="urn:ietf:params:xml:ns:launch-1.0"
|
||||
type="application">
|
||||
<launch:phase>sunrise</launch:phase>
|
||||
<launch:codeMark>
|
||||
<launch:code>49FD46E6C4B45C55D4AC</launch:code>
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -19,7 +19,8 @@
|
|||
</create>
|
||||
<extension>
|
||||
<launch:create
|
||||
xmlns:launch="urn:ietf:params:xml:ns:launch-1.0">
|
||||
xmlns:launch="urn:ietf:params:xml:ns:launch-1.0"
|
||||
type="application">
|
||||
<launch:phase>sunrise</launch:phase>
|
||||
</launch:create>
|
||||
</extension>
|
||||
|
|
File diff suppressed because one or more lines are too long
38
javatests/google/registry/flows/testdata/domain_info_response_ok_wildcard.xml
vendored
Normal file
38
javatests/google/registry/flows/testdata/domain_info_response_ok_wildcard.xml
vendored
Normal file
|
@ -0,0 +1,38 @@
|
|||
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
||||
<response>
|
||||
<result code="1000">
|
||||
<msg>Command completed successfully</msg>
|
||||
</result>
|
||||
<resData>
|
||||
<domain:infData
|
||||
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
|
||||
<domain:name>%NAME%</domain:name>
|
||||
<domain:roid>%ROID%</domain:roid>
|
||||
<domain:status s="ok"/>
|
||||
<domain:registrant>jd1234</domain:registrant>
|
||||
<domain:contact type="admin">sh8013</domain:contact>
|
||||
<domain:contact type="tech">sh8013</domain:contact>
|
||||
<domain:ns>
|
||||
<domain:hostObj>ns1.example.external</domain:hostObj>
|
||||
<domain:hostObj>ns2.example.external</domain:hostObj>
|
||||
</domain:ns>
|
||||
<domain:clID>NewRegistrar</domain:clID>
|
||||
<domain:crID>NewRegistrar</domain:crID>
|
||||
<domain:crDate>%CRDATE%</domain:crDate>
|
||||
<domain:exDate>%EXDATE%</domain:exDate>
|
||||
<domain:authInfo>
|
||||
<domain:pw>2fooBAR</domain:pw>
|
||||
</domain:authInfo>
|
||||
</domain:infData>
|
||||
</resData>
|
||||
<extension>
|
||||
<rgp:infData xmlns:rgp="urn:ietf:params:xml:ns:rgp-1.0">
|
||||
<rgp:rgpStatus s="addPeriod"/>
|
||||
</rgp:infData>
|
||||
</extension>
|
||||
<trID>
|
||||
<clTRID>ABC-12345</clTRID>
|
||||
<svTRID>server-trid</svTRID>
|
||||
</trID>
|
||||
</response>
|
||||
</epp>
|
11
javatests/google/registry/flows/testdata/domain_info_wildcard.xml
vendored
Normal file
11
javatests/google/registry/flows/testdata/domain_info_wildcard.xml
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
||||
<command>
|
||||
<info>
|
||||
<domain:info
|
||||
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
|
||||
<domain:name hosts="all">%NAME%</domain:name>
|
||||
</domain:info>
|
||||
</info>
|
||||
<clTRID>ABC-12345</clTRID>
|
||||
</command>
|
||||
</epp>
|
Loading…
Add table
Add a link
Reference in a new issue