From 87a9d27299a845d3b1eec946ad14ce564eec8fbd Mon Sep 17 00:00:00 2001 From: jianglai Date: Wed, 5 Apr 2017 08:32:25 -0700 Subject: [PATCH] Remove domain create restriction check in non-create flows Since domain create restriction only applies to closed TLDs, flows like domain application create and domain application update does not apply, as the TLD never goes through sunrise period. Removing checks for domain create restrictions in these flows. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=152260673 --- docs/flows.md | 6 -- .../flows/domain/DomainAllocateFlow.java | 2 - .../domain/DomainApplicationCreateFlow.java | 2 - .../domain/DomainApplicationUpdateFlow.java | 5 -- .../flows/domain/DomainCreateFlow.java | 4 ++ .../flows/domain/DomainFlowUtils.java | 3 - .../flows/domain/DomainAllocateFlowTest.java | 49 ------------- .../DomainApplicationCreateFlowTest.java | 55 --------------- .../DomainApplicationUpdateFlowTest.java | 69 ------------------- 9 files changed, 4 insertions(+), 191 deletions(-) diff --git a/docs/flows.md b/docs/flows.md index ce34c767a..9039010bd 100644 --- a/docs/flows.md +++ b/docs/flows.md @@ -768,8 +768,6 @@ application. Updates cannot change the domain name that is being applied for. * Nameservers are not whitelisted for this domain. * Nameservers not specified for domain with nameserver-restricted reservation. - * Requested domain does not have nameserver-restricted reservation for a - TLD that requires such a reservation to create domains. * Registrant is not whitelisted for this TLD. * Application status prohibits this domain update. * 2306 @@ -880,8 +878,6 @@ An EPP flow that creates a new application for a domain resource. * Resource linked to this domain does not exist. * 2304 * The claims period for this TLD has ended. - * Requested domain does not have nameserver-restricted reservation for a - TLD that requires such a reservation to create domains. * Requested domain is reserved. * Requested domain requires a claims notice. * Nameservers are not whitelisted for this domain. @@ -942,8 +938,6 @@ An EPP flow that allocates a new domain resource from a domain application. * Domain application with specific ROID does not exist. * 2304 * Domain application already has a final status. - * Requested domain does not have nameserver-restricted reservation for a - TLD that requires such a reservation to create domains. * Registrant is not whitelisted for this TLD. * Nameservers are not whitelisted for this domain. * Nameservers are not whitelisted for this TLD. diff --git a/java/google/registry/flows/domain/DomainAllocateFlow.java b/java/google/registry/flows/domain/DomainAllocateFlow.java index 1929f231e..2c907d186 100644 --- a/java/google/registry/flows/domain/DomainAllocateFlow.java +++ b/java/google/registry/flows/domain/DomainAllocateFlow.java @@ -54,7 +54,6 @@ import google.registry.flows.FlowModule.Superuser; import google.registry.flows.FlowModule.TargetId; import google.registry.flows.TransactionalFlow; import google.registry.flows.annotations.ReportingSpec; -import google.registry.flows.domain.DomainFlowUtils.DomainNotAllowedForTldWithCreateRestrictionException; import google.registry.flows.domain.DomainFlowUtils.NameserversNotSpecifiedForNameserverRestrictedDomainException; import google.registry.flows.domain.DomainFlowUtils.NameserversNotSpecifiedForTldWithNameserverWhitelistException; import google.registry.model.ImmutableObject; @@ -102,7 +101,6 @@ import org.joda.time.DateTime; * @error {@link DomainAllocateFlow.MissingApplicationException} * @error {@link DomainAllocateFlow.OnlySuperuserCanAllocateException} * @error {@link DomainFlowUtils.ExceedsMaxRegistrationYearsException} - * @error {@link DomainNotAllowedForTldWithCreateRestrictionException} * @error {@link DomainFlowUtils.RegistrantNotAllowedException} * @error {@link DomainFlowUtils.NameserversNotAllowedForDomainException} * @error {@link DomainFlowUtils.NameserversNotAllowedForTldException} diff --git a/java/google/registry/flows/domain/DomainApplicationCreateFlow.java b/java/google/registry/flows/domain/DomainApplicationCreateFlow.java index db29303c6..b047c7590 100644 --- a/java/google/registry/flows/domain/DomainApplicationCreateFlow.java +++ b/java/google/registry/flows/domain/DomainApplicationCreateFlow.java @@ -64,7 +64,6 @@ import google.registry.flows.custom.DomainApplicationCreateFlowCustomLogic.After import google.registry.flows.custom.DomainApplicationCreateFlowCustomLogic.BeforeResponseParameters; import google.registry.flows.custom.DomainApplicationCreateFlowCustomLogic.BeforeResponseReturnData; import google.registry.flows.custom.EntityChanges; -import google.registry.flows.domain.DomainFlowUtils.DomainNotAllowedForTldWithCreateRestrictionException; import google.registry.flows.domain.DomainFlowUtils.NameserversNotSpecifiedForNameserverRestrictedDomainException; import google.registry.flows.domain.DomainFlowUtils.NameserversNotSpecifiedForTldWithNameserverWhitelistException; import google.registry.model.ImmutableObject; @@ -121,7 +120,6 @@ import org.joda.time.DateTime; * @error {@link DomainFlowUtils.CurrencyValueScaleException} * @error {@link DomainFlowUtils.DashesInThirdAndFourthException} * @error {@link DomainFlowUtils.DomainLabelTooLongException} - * @error {@link DomainNotAllowedForTldWithCreateRestrictionException} * @error {@link DomainFlowUtils.DomainReservedException} * @error {@link DomainFlowUtils.DuplicateContactForRoleException} * @error {@link DomainFlowUtils.EmptyDomainNamePartException} diff --git a/java/google/registry/flows/domain/DomainApplicationUpdateFlow.java b/java/google/registry/flows/domain/DomainApplicationUpdateFlow.java index 3662da025..b2c0e67f6 100644 --- a/java/google/registry/flows/domain/DomainApplicationUpdateFlow.java +++ b/java/google/registry/flows/domain/DomainApplicationUpdateFlow.java @@ -29,7 +29,6 @@ import static google.registry.flows.domain.DomainFlowUtils.checkAllowedAccessToT import static google.registry.flows.domain.DomainFlowUtils.cloneAndLinkReferences; import static google.registry.flows.domain.DomainFlowUtils.updateDsData; import static google.registry.flows.domain.DomainFlowUtils.validateContactsHaveTypes; -import static google.registry.flows.domain.DomainFlowUtils.validateDomainAllowedOnCreateRestrictedTld; import static google.registry.flows.domain.DomainFlowUtils.validateDsData; import static google.registry.flows.domain.DomainFlowUtils.validateFeeChallenge; import static google.registry.flows.domain.DomainFlowUtils.validateNameserversAllowedOnDomain; @@ -107,7 +106,6 @@ import org.joda.time.DateTime; * @error {@link DomainFlowUtils.NameserversNotSpecifiedForTldWithNameserverWhitelistException} * @error {@link DomainFlowUtils.NameserversNotAllowedForDomainException} * @error {@link DomainFlowUtils.NameserversNotSpecifiedForNameserverRestrictedDomainException} - * @error {@link DomainFlowUtils.DomainNotAllowedForTldWithCreateRestrictionException} * @error {@link DomainFlowUtils.NotAuthorizedForTldException} * @error {@link DomainFlowUtils.RegistrantNotAllowedException} * @error {@link DomainFlowUtils.SecDnsAllUsageException} @@ -213,9 +211,6 @@ public class DomainApplicationUpdateFlow implements TransactionalFlow { tld, add.getNameserverFullyQualifiedHostNames()); InternetDomainName domainName = InternetDomainName.from(existingApplication.getFullyQualifiedDomainName()); - if (registry.getDomainCreateRestricted()) { - validateDomainAllowedOnCreateRestrictedTld(domainName); - } validateNameserversAllowedOnDomain( domainName, nullToEmpty(add.getNameserverFullyQualifiedHostNames())); } diff --git a/java/google/registry/flows/domain/DomainCreateFlow.java b/java/google/registry/flows/domain/DomainCreateFlow.java index 8ea665ccc..96907b1fb 100644 --- a/java/google/registry/flows/domain/DomainCreateFlow.java +++ b/java/google/registry/flows/domain/DomainCreateFlow.java @@ -23,6 +23,7 @@ import static google.registry.flows.domain.DomainFlowUtils.createFeeCreateRespon import static google.registry.flows.domain.DomainFlowUtils.failfastForCreate; import static google.registry.flows.domain.DomainFlowUtils.prepareMarkedLrpTokenEntity; import static google.registry.flows.domain.DomainFlowUtils.validateCreateCommandContactsAndNameservers; +import static google.registry.flows.domain.DomainFlowUtils.validateDomainAllowedOnCreateRestrictedTld; import static google.registry.flows.domain.DomainFlowUtils.validateDomainName; import static google.registry.flows.domain.DomainFlowUtils.validateDomainNameWithIdnTables; import static google.registry.flows.domain.DomainFlowUtils.validateFeeChallenge; @@ -201,6 +202,9 @@ public class DomainCreateFlow implements TransactionalFlow { String domainLabel = domainName.parts().get(0); Registry registry = Registry.get(domainName.parent().toString()); validateCreateCommandContactsAndNameservers(command, registry, domainName); + if (registry.getDomainCreateRestricted()) { + validateDomainAllowedOnCreateRestrictedTld(domainName); + } TldState tldState = registry.getTldState(now); boolean isAnchorTenant = isAnchorTenant(domainName); LaunchCreateExtension launchCreate = eppInput.getSingleExtension(LaunchCreateExtension.class); diff --git a/java/google/registry/flows/domain/DomainFlowUtils.java b/java/google/registry/flows/domain/DomainFlowUtils.java index 228b6cee2..7aff94af9 100644 --- a/java/google/registry/flows/domain/DomainFlowUtils.java +++ b/java/google/registry/flows/domain/DomainFlowUtils.java @@ -780,9 +780,6 @@ public class DomainFlowUtils { nullToEmpty(command.getNameserverFullyQualifiedHostNames()); validateNameserversCountForTld(tld, domainName, fullyQualifiedHostNames.size()); validateNameserversAllowedOnTld(tld, fullyQualifiedHostNames); - if (registry.getDomainCreateRestricted()) { - validateDomainAllowedOnCreateRestrictedTld(domainName); - } validateNameserversAllowedOnDomain(domainName, fullyQualifiedHostNames); } diff --git a/javatests/google/registry/flows/domain/DomainAllocateFlowTest.java b/javatests/google/registry/flows/domain/DomainAllocateFlowTest.java index d613ebc38..b57c9bac3 100644 --- a/javatests/google/registry/flows/domain/DomainAllocateFlowTest.java +++ b/javatests/google/registry/flows/domain/DomainAllocateFlowTest.java @@ -45,7 +45,6 @@ import google.registry.flows.ResourceFlowTestCase; import google.registry.flows.domain.DomainAllocateFlow.HasFinalStatusException; import google.registry.flows.domain.DomainAllocateFlow.MissingApplicationException; import google.registry.flows.domain.DomainAllocateFlow.OnlySuperuserCanAllocateException; -import google.registry.flows.domain.DomainFlowUtils.DomainNotAllowedForTldWithCreateRestrictionException; import google.registry.flows.domain.DomainFlowUtils.ExceedsMaxRegistrationYearsException; import google.registry.flows.domain.DomainFlowUtils.NameserversNotAllowedForDomainException; import google.registry.flows.domain.DomainFlowUtils.NameserversNotAllowedForTldException; @@ -326,34 +325,6 @@ public class DomainAllocateFlowTest runFlowAsSuperuser(); } - @Test - public void testFailure_domainCreateRestricted_domainNotReserved() throws Exception { - setupDomainApplication("tld", TldState.QUIET_PERIOD); - persistResource( - Registry.get("tld") - .asBuilder() - .setDomainCreateRestricted(true) - .setReservedLists( - persistReservedList( - "reserved", "lol,NAMESERVER_RESTRICTED," + "ns2.example.net:ns3.example.net")) - .build()); - thrown.expect(DomainNotAllowedForTldWithCreateRestrictionException.class, "example-one.tld"); - runFlowAsSuperuser(); - } - - @Test - public void testSuccess_domainCreateNotRestricted_domainNotReserved() throws Exception { - setupDomainApplication("tld", TldState.QUIET_PERIOD); - persistResource( - Registry.get("tld") - .asBuilder() - .setReservedLists( - persistReservedList( - "reserved", "lol,NAMESERVER_RESTRICTED," + "ns2.example.net:ns3.example.net")) - .build()); - doSuccessfulTest(2); - } - @Test public void testSuccess_tldAndDomainNameserversWhitelistBothSatistfied() throws Exception { setupDomainApplication("tld", TldState.QUIET_PERIOD); @@ -408,26 +379,6 @@ public class DomainAllocateFlowTest runFlowAsSuperuser(); } - @Test - public void testFailure_tldNameserversAllowed_domainCreateRestricted_domainNotReserved() - throws Exception { - setupDomainApplication("tld", TldState.QUIET_PERIOD); - persistResource( - Registry.get("tld") - .asBuilder() - .setDomainCreateRestricted(true) - .setReservedLists( - persistReservedList( - "reserved", - "lol,NAMESERVER_RESTRICTED," - + "ns2.example.net:ns3.example.net:ns1.example.net")) - .setAllowedFullyQualifiedHostNames( - ImmutableSet.of("ns1.example.net", "ns2.example.net", "ns3.example.net")) - .build()); - thrown.expect(DomainNotAllowedForTldWithCreateRestrictionException.class, "example-one.tld"); - runFlowAsSuperuser(); - } - @Test public void testSuccess_sunrushAddGracePeriod() throws Exception { setupDomainApplication("tld", TldState.QUIET_PERIOD); diff --git a/javatests/google/registry/flows/domain/DomainApplicationCreateFlowTest.java b/javatests/google/registry/flows/domain/DomainApplicationCreateFlowTest.java index 499d711db..7455a575b 100644 --- a/javatests/google/registry/flows/domain/DomainApplicationCreateFlowTest.java +++ b/javatests/google/registry/flows/domain/DomainApplicationCreateFlowTest.java @@ -71,7 +71,6 @@ import google.registry.flows.domain.DomainFlowUtils.CurrencyUnitMismatchExceptio import google.registry.flows.domain.DomainFlowUtils.CurrencyValueScaleException; import google.registry.flows.domain.DomainFlowUtils.DashesInThirdAndFourthException; import google.registry.flows.domain.DomainFlowUtils.DomainLabelTooLongException; -import google.registry.flows.domain.DomainFlowUtils.DomainNotAllowedForTldWithCreateRestrictionException; import google.registry.flows.domain.DomainFlowUtils.DomainReservedException; import google.registry.flows.domain.DomainFlowUtils.DuplicateContactForRoleException; import google.registry.flows.domain.DomainFlowUtils.EmptyDomainNamePartException; @@ -1631,39 +1630,6 @@ public class DomainApplicationCreateFlowTest runFlow(); } - @Test - public void testFailure_domainCreateRestricted_domainNotReserved() throws Exception { - persistResource( - Registry.get("tld") - .asBuilder() - .setDomainCreateRestricted(true) - .setReservedLists( - persistReservedList( - "reserved", "test,NAMESERVER_RESTRICTED,ns2.example.net:ns3.example.net")) - .build()); - persistContactsAndHosts(); - clock.advanceOneMilli(); - thrown.expect(DomainNotAllowedForTldWithCreateRestrictionException.class, "test-validate.tld"); - runFlow(); - } - - @Test - public void testSuccess_domainCreateNotRestricted_domainNotReserved() throws Exception { - persistResource( - Registry.get("tld") - .asBuilder() - .setReservedLists( - persistReservedList( - "reserved", "test,NAMESERVER_RESTRICTED,ns2.example.net:ns3.example.net")) - .build()); - persistContactsAndHosts(); - clock.advanceOneMilli(); - doSuccessfulTest("domain_create_sunrise_encoded_signed_mark_response.xml", true); - assertAboutApplications() - .that(getOnlyGlobalResource(DomainApplication.class)) - .hasApplicationStatus(ApplicationStatus.VALIDATED); - } - @Test public void testSuccess_tldAndDomainNameserversWhitelistBothSatistfied() throws Exception { persistResource( @@ -1724,27 +1690,6 @@ public class DomainApplicationCreateFlowTest runFlow(); } - @Test - public void testFailure_tldNameserversAllowed_domainCreateRestricted_domainNotReserved() - throws Exception { - persistResource( - Registry.get("tld") - .asBuilder() - .setDomainCreateRestricted(true) - .setReservedLists( - persistReservedList( - "reserved", - "lol,NAMESERVER_RESTRICTED," - + "ns1.example.net:ns2.example.net:ns3.example.net")) - .setAllowedFullyQualifiedHostNames( - ImmutableSet.of("ns1.example.net", "ns2.example.net", "ns3.examplet.net")) - .build()); - persistContactsAndHosts(); - clock.advanceOneMilli(); - thrown.expect(DomainNotAllowedForTldWithCreateRestrictionException.class, "test-validate.tld"); - runFlow(); - } - @Test public void testFailure_max10Years() throws Exception { createTld("tld", TldState.LANDRUSH); diff --git a/javatests/google/registry/flows/domain/DomainApplicationUpdateFlowTest.java b/javatests/google/registry/flows/domain/DomainApplicationUpdateFlowTest.java index da5487e97..78548e16e 100644 --- a/javatests/google/registry/flows/domain/DomainApplicationUpdateFlowTest.java +++ b/javatests/google/registry/flows/domain/DomainApplicationUpdateFlowTest.java @@ -40,7 +40,6 @@ import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException; import google.registry.flows.ResourceFlowUtils.StatusNotClientSettableException; import google.registry.flows.domain.DomainApplicationUpdateFlow.ApplicationStatusProhibitsUpdateException; import google.registry.flows.domain.DomainFlowUtils.ApplicationDomainNameMismatchException; -import google.registry.flows.domain.DomainFlowUtils.DomainNotAllowedForTldWithCreateRestrictionException; import google.registry.flows.domain.DomainFlowUtils.DuplicateContactForRoleException; import google.registry.flows.domain.DomainFlowUtils.EmptySecDnsUpdateException; import google.registry.flows.domain.DomainFlowUtils.FeesMismatchException; @@ -787,22 +786,6 @@ public class DomainApplicationUpdateFlowTest doSuccessfulTest(); } - @Test - public void testSuccess_domainCreateRestricted_addedNameserverAllowed() throws Exception { - persistReferencedEntities(); - persistApplication(); - persistResource( - Registry.get("tld") - .asBuilder() - .setDomainCreateRestricted(true) - .setReservedLists( - persistReservedList( - "reserved", "example,NAMESERVER_RESTRICTED,ns1.example.tld:ns2.example.tld")) - .build()); - clock.advanceOneMilli(); - doSuccessfulTest(); - } - @Test public void testSuccess_addedNameserversAllowedInTldAndDomainNameserversWhitelists() throws Exception { @@ -859,58 +842,6 @@ public class DomainApplicationUpdateFlowTest runFlow(); } - @Test - public void testFailure_tldNameserversAllowed_domainCreateRestricted_domainNotReserved() - throws Exception { - persistReferencedEntities(); - persistApplication(); - persistResource( - Registry.get("tld") - .asBuilder() - .setDomainCreateRestricted(true) - .setAllowedFullyQualifiedHostNames( - ImmutableSet.of("ns1.example.tld", "ns2.example.tld")) - .setReservedLists( - persistReservedList( - "reserved", "lol,NAMESERVER_RESTRICTED,ns1.example.tld:ns2.example.tld")) - .build()); - clock.advanceOneMilli(); - thrown.expect(DomainNotAllowedForTldWithCreateRestrictionException.class); - runFlow(); - } - - @Test - public void testFailure_domainCreateRestricted_domainNotReserved() throws Exception { - persistReferencedEntities(); - persistApplication(); - persistResource( - Registry.get("tld") - .asBuilder() - .setDomainCreateRestricted(true) - .setReservedLists( - persistReservedList( - "reserved", "lol,NAMESERVER_RESTRICTED,ns1.example.tld:ns2.example.tld")) - .build()); - clock.advanceOneMilli(); - thrown.expect(DomainNotAllowedForTldWithCreateRestrictionException.class); - runFlow(); - } - - @Test - public void testSuccess_domainCreateNotRestricted_domainNotReserved() throws Exception { - persistReferencedEntities(); - persistApplication(); - persistResource( - Registry.get("tld") - .asBuilder() - .setReservedLists( - persistReservedList( - "reserved", "lol,NAMESERVER_RESTRICTED,ns1.example.tld:ns2.example.tld")) - .build()); - clock.advanceOneMilli(); - doSuccessfulTest(); - } - @Test public void testFailure_customPricingLogic_feeMismatch() throws Exception { persistReferencedEntities();