From 2a29ecc2a2db9c77b4844ce1e72f5dc3730a0ca7 Mon Sep 17 00:00:00 2001 From: Ben McIlwain Date: Thu, 23 Jan 2020 12:17:14 -0500 Subject: [PATCH] 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". --- .../flows/domain/DomainFlowUtils.java | 12 ++++--- .../flows/domain/DomainCreateFlowTest.java | 32 ++++++++++++++++++- ... domain_create_allocationtoken_claims.xml} | 0 3 files changed, 38 insertions(+), 6 deletions(-) rename core/src/test/resources/google/registry/flows/domain/{domain_create_anchor_tenant_claims.xml => domain_create_allocationtoken_claims.xml} (100%) diff --git a/core/src/main/java/google/registry/flows/domain/DomainFlowUtils.java b/core/src/main/java/google/registry/flows/domain/DomainFlowUtils.java index b6b85bced..a991f43fa 100644 --- a/core/src/main/java/google/registry/flows/domain/DomainFlowUtils.java +++ b/core/src/main/java/google/registry/flows/domain/DomainFlowUtils.java @@ -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.Registry.TldState.GENERAL_AVAILABILITY; 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.label.ReservationType.FULLY_BLOCKED; import static google.registry.model.registry.label.ReservationType.RESERVED_FOR_ANCHOR_TENANT; @@ -140,9 +141,9 @@ import org.joda.time.Duration; public class DomainFlowUtils { /** Map from launch phases to the allowed tld states. */ - private static final ImmutableMap LAUNCH_PHASE_TO_TLD_STATES = - new ImmutableMap.Builder() - .put(LaunchPhase.CLAIMS, GENERAL_AVAILABILITY) + private static final ImmutableMultimap LAUNCH_PHASE_TO_TLD_STATES = + new ImmutableMultimap.Builder() + .putAll(LaunchPhase.CLAIMS, GENERAL_AVAILABILITY, QUIET_PERIOD) .put(LaunchPhase.SUNRISE, START_DATE_SUNRISE) .put(LaunchPhase.OPEN, GENERAL_AVAILABILITY) .build(); @@ -443,8 +444,9 @@ public class DomainFlowUtils { static void verifyLaunchPhaseMatchesRegistryPhase( Registry registry, LaunchExtension launchExtension, DateTime now) throws EppException { if (!LAUNCH_PHASE_TO_TLD_STATES.containsKey(launchExtension.getPhase()) - || LAUNCH_PHASE_TO_TLD_STATES.get(launchExtension.getPhase()) - != registry.getTldState(now)) { + || !LAUNCH_PHASE_TO_TLD_STATES + .get(launchExtension.getPhase()) + .contains(registry.getTldState(now))) { // No launch operations are allowed during the quiet period or predelegation. throw new LaunchPhaseMismatchException(); } diff --git a/core/src/test/java/google/registry/flows/domain/DomainCreateFlowTest.java b/core/src/test/java/google/registry/flows/domain/DomainCreateFlowTest.java index 8ac8711a7..429ea8e29 100644 --- a/core/src/test/java/google/registry/flows/domain/DomainCreateFlowTest.java +++ b/core/src/test/java/google/registry/flows/domain/DomainCreateFlowTest.java @@ -831,6 +831,36 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase