mirror of
https://github.com/google/nomulus.git
synced 2025-07-09 12:43:24 +02:00
Allow claims keys on domain creates during quiet periods (#453)
* Allow claims keys on domain creates during quiet periods Since we're using TldState.QUIET_PERIOD for the .new LRP (in which only reserved domains with allocation tokens may be registered), we also need to support claims keys during this phase. Otherwise, domains that appear in MarksDB will not be registrable during LRP, even if the correct claims key is provided. This is based on an error report from a registrar, in which a correct-looking domain create was failing with the error message "Declared launch extension phase does not match the current registry phase".
This commit is contained in:
parent
16b4d15292
commit
2a29ecc2a2
3 changed files with 38 additions and 6 deletions
|
@ -30,6 +30,7 @@ import static google.registry.model.registry.Registries.findTldForName;
|
||||||
import static google.registry.model.registry.Registries.getTlds;
|
import static google.registry.model.registry.Registries.getTlds;
|
||||||
import static google.registry.model.registry.Registry.TldState.GENERAL_AVAILABILITY;
|
import static google.registry.model.registry.Registry.TldState.GENERAL_AVAILABILITY;
|
||||||
import static google.registry.model.registry.Registry.TldState.PREDELEGATION;
|
import static google.registry.model.registry.Registry.TldState.PREDELEGATION;
|
||||||
|
import static google.registry.model.registry.Registry.TldState.QUIET_PERIOD;
|
||||||
import static google.registry.model.registry.Registry.TldState.START_DATE_SUNRISE;
|
import static google.registry.model.registry.Registry.TldState.START_DATE_SUNRISE;
|
||||||
import static google.registry.model.registry.label.ReservationType.FULLY_BLOCKED;
|
import static google.registry.model.registry.label.ReservationType.FULLY_BLOCKED;
|
||||||
import static google.registry.model.registry.label.ReservationType.RESERVED_FOR_ANCHOR_TENANT;
|
import static google.registry.model.registry.label.ReservationType.RESERVED_FOR_ANCHOR_TENANT;
|
||||||
|
@ -140,9 +141,9 @@ import org.joda.time.Duration;
|
||||||
public class DomainFlowUtils {
|
public class DomainFlowUtils {
|
||||||
|
|
||||||
/** Map from launch phases to the allowed tld states. */
|
/** Map from launch phases to the allowed tld states. */
|
||||||
private static final ImmutableMap<LaunchPhase, TldState> LAUNCH_PHASE_TO_TLD_STATES =
|
private static final ImmutableMultimap<LaunchPhase, TldState> LAUNCH_PHASE_TO_TLD_STATES =
|
||||||
new ImmutableMap.Builder<LaunchPhase, TldState>()
|
new ImmutableMultimap.Builder<LaunchPhase, TldState>()
|
||||||
.put(LaunchPhase.CLAIMS, GENERAL_AVAILABILITY)
|
.putAll(LaunchPhase.CLAIMS, GENERAL_AVAILABILITY, QUIET_PERIOD)
|
||||||
.put(LaunchPhase.SUNRISE, START_DATE_SUNRISE)
|
.put(LaunchPhase.SUNRISE, START_DATE_SUNRISE)
|
||||||
.put(LaunchPhase.OPEN, GENERAL_AVAILABILITY)
|
.put(LaunchPhase.OPEN, GENERAL_AVAILABILITY)
|
||||||
.build();
|
.build();
|
||||||
|
@ -443,8 +444,9 @@ public class DomainFlowUtils {
|
||||||
static void verifyLaunchPhaseMatchesRegistryPhase(
|
static void verifyLaunchPhaseMatchesRegistryPhase(
|
||||||
Registry registry, LaunchExtension launchExtension, DateTime now) throws EppException {
|
Registry registry, LaunchExtension launchExtension, DateTime now) throws EppException {
|
||||||
if (!LAUNCH_PHASE_TO_TLD_STATES.containsKey(launchExtension.getPhase())
|
if (!LAUNCH_PHASE_TO_TLD_STATES.containsKey(launchExtension.getPhase())
|
||||||
|| LAUNCH_PHASE_TO_TLD_STATES.get(launchExtension.getPhase())
|
|| !LAUNCH_PHASE_TO_TLD_STATES
|
||||||
!= registry.getTldState(now)) {
|
.get(launchExtension.getPhase())
|
||||||
|
.contains(registry.getTldState(now))) {
|
||||||
// No launch operations are allowed during the quiet period or predelegation.
|
// No launch operations are allowed during the quiet period or predelegation.
|
||||||
throw new LaunchPhaseMismatchException();
|
throw new LaunchPhaseMismatchException();
|
||||||
}
|
}
|
||||||
|
|
|
@ -831,6 +831,36 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
|
||||||
assertClaimsLordn();
|
assertClaimsLordn();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSuccess_claimsNoticeInQuietPeriod() throws Exception {
|
||||||
|
allocationToken =
|
||||||
|
persistResource(
|
||||||
|
new AllocationToken.Builder()
|
||||||
|
.setDomainName("example-one.tld")
|
||||||
|
.setToken("abcDEF23456")
|
||||||
|
.setTokenType(SINGLE_USE)
|
||||||
|
.build());
|
||||||
|
persistResource(
|
||||||
|
Registry.get("tld")
|
||||||
|
.asBuilder()
|
||||||
|
.setTldStateTransitions(
|
||||||
|
ImmutableSortedMap.of(
|
||||||
|
START_OF_TIME,
|
||||||
|
PREDELEGATION,
|
||||||
|
DateTime.parse("1999-01-01T00:00:00Z"),
|
||||||
|
QUIET_PERIOD))
|
||||||
|
.setReservedLists(persistReservedList("res1", "example-one,RESERVED_FOR_SPECIFIC_USE"))
|
||||||
|
.build());
|
||||||
|
clock.setTo(DateTime.parse("2009-08-16T09:00:00.0Z"));
|
||||||
|
setEppInput("domain_create_allocationtoken_claims.xml");
|
||||||
|
persistContactsAndHosts();
|
||||||
|
runFlowAssertResponse(loadFile("domain_create_response_claims.xml"));
|
||||||
|
assertSuccessfulCreate("tld", ImmutableSet.of(RESERVED), allocationToken);
|
||||||
|
assertDnsTasksEnqueued("example-one.tld");
|
||||||
|
assertClaimsLordn();
|
||||||
|
assertAllocationTokenWasRedeemed("abcDEF23456");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_noClaimsNotice_forClaimsListName_afterClaimsPeriodEnd() throws Exception {
|
public void testSuccess_noClaimsNotice_forClaimsListName_afterClaimsPeriodEnd() throws Exception {
|
||||||
persistClaimsList(ImmutableMap.of("example", CLAIMS_KEY));
|
persistClaimsList(ImmutableMap.of("example", CLAIMS_KEY));
|
||||||
|
@ -1047,7 +1077,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
|
||||||
.setReservedLists(
|
.setReservedLists(
|
||||||
persistReservedList("anchor-with-claims", "example-one,RESERVED_FOR_ANCHOR_TENANT"))
|
persistReservedList("anchor-with-claims", "example-one,RESERVED_FOR_ANCHOR_TENANT"))
|
||||||
.build());
|
.build());
|
||||||
setEppInput("domain_create_anchor_tenant_claims.xml");
|
setEppInput("domain_create_allocationtoken_claims.xml");
|
||||||
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"));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue