diff --git a/java/google/registry/flows/domain/DomainFlowUtils.java b/java/google/registry/flows/domain/DomainFlowUtils.java index ed9e16f6e..13140df86 100644 --- a/java/google/registry/flows/domain/DomainFlowUtils.java +++ b/java/google/registry/flows/domain/DomainFlowUtils.java @@ -27,6 +27,7 @@ import static google.registry.model.ofy.ObjectifyService.ofy; 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.START_DATE_SUNRISE; import static google.registry.model.registry.label.ReservationType.FULLY_BLOCKED; import static google.registry.model.registry.label.ReservationType.NAMESERVER_RESTRICTED; @@ -890,7 +891,7 @@ public class DomainFlowUtils { /** Check that the registry phase is not predelegation, during which some flows are forbidden. */ public static void verifyNotInPredelegation(Registry registry, DateTime now) throws BadCommandForRegistryPhaseException { - if (registry.getTldState(now) == TldState.PREDELEGATION) { + if (registry.getTldState(now) == PREDELEGATION) { throw new BadCommandForRegistryPhaseException(); } } diff --git a/java/google/registry/model/OteAccountBuilder.java b/java/google/registry/model/OteAccountBuilder.java index 0370e6097..8ce511a87 100644 --- a/java/google/registry/model/OteAccountBuilder.java +++ b/java/google/registry/model/OteAccountBuilder.java @@ -19,6 +19,8 @@ import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkState; import static com.google.common.collect.ImmutableList.toImmutableList; import static google.registry.model.ofy.ObjectifyService.ofy; +import static google.registry.model.registry.Registry.TldState.GENERAL_AVAILABILITY; +import static google.registry.model.registry.Registry.TldState.START_DATE_SUNRISE; import static google.registry.util.DateTimeUtils.START_OF_TIME; import com.google.common.collect.ImmutableList; @@ -113,9 +115,9 @@ public final class OteAccountBuilder { RegistryEnvironment.get() != RegistryEnvironment.PRODUCTION, "Can't setup OT&E in production"); clientIdToTld = createClientIdToTldMap(baseClientId); - sunriseTld = createTld(baseClientId + "-sunrise", TldState.START_DATE_SUNRISE, false, 0); - gaTld = createTld(baseClientId + "-ga", TldState.GENERAL_AVAILABILITY, false, 2); - eapTld = createTld(baseClientId + "-eap", TldState.GENERAL_AVAILABILITY, true, 3); + sunriseTld = createTld(baseClientId + "-sunrise", START_DATE_SUNRISE, false, 0); + gaTld = createTld(baseClientId + "-ga", GENERAL_AVAILABILITY, false, 2); + eapTld = createTld(baseClientId + "-eap", GENERAL_AVAILABILITY, true, 3); registrars = clientIdToTld.keySet().stream() .map(OteAccountBuilder::createRegistrar) diff --git a/java/google/registry/rde/imports/RdeImportUtils.java b/java/google/registry/rde/imports/RdeImportUtils.java index fc5c597b6..f34815ed0 100644 --- a/java/google/registry/rde/imports/RdeImportUtils.java +++ b/java/google/registry/rde/imports/RdeImportUtils.java @@ -17,6 +17,7 @@ package google.registry.rde.imports; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkState; import static google.registry.model.ofy.ObjectifyService.ofy; +import static google.registry.model.registry.Registry.TldState.PREDELEGATION; import static google.registry.util.DateTimeUtils.END_OF_TIME; import static google.registry.util.DateTimeUtils.START_OF_TIME; import static google.registry.util.PreconditionsUtils.checkArgumentPresent; @@ -155,7 +156,7 @@ public class RdeImportUtils { Registry registry = Registry.get(tld); TldState currentState = registry.getTldState(clock.nowUtc()); checkArgument( - currentState == TldState.PREDELEGATION, + currentState == PREDELEGATION, "TLD '%s' is in state %s and cannot be imported", tld, currentState); diff --git a/javatests/google/registry/flows/CheckApiActionTest.java b/javatests/google/registry/flows/CheckApiActionTest.java index f30e99c86..9226c4b19 100644 --- a/javatests/google/registry/flows/CheckApiActionTest.java +++ b/javatests/google/registry/flows/CheckApiActionTest.java @@ -16,6 +16,7 @@ package google.registry.flows; import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth8.assertThat; +import static google.registry.model.registry.Registry.TldState.PREDELEGATION; import static google.registry.monitoring.whitebox.CheckApiMetric.Availability.AVAILABLE; import static google.registry.monitoring.whitebox.CheckApiMetric.Availability.REGISTERED; import static google.registry.monitoring.whitebox.CheckApiMetric.Availability.RESERVED; @@ -28,7 +29,6 @@ import static google.registry.testing.DatastoreHelper.persistResource; import static org.mockito.Mockito.verify; import google.registry.model.registry.Registry; -import google.registry.model.registry.Registry.TldState; import google.registry.monitoring.whitebox.CheckApiMetric; import google.registry.monitoring.whitebox.CheckApiMetric.Availability; import google.registry.monitoring.whitebox.CheckApiMetric.Status; @@ -151,7 +151,7 @@ public class CheckApiActionTest { @Test public void testFailure_tldInPredelegation() { - createTld("predelegated", TldState.PREDELEGATION); + createTld("predelegated", PREDELEGATION); assertThat(getCheckResponse("foo.predelegated")) .containsExactly( "status", "error", diff --git a/javatests/google/registry/flows/domain/DomainCheckFlowTest.java b/javatests/google/registry/flows/domain/DomainCheckFlowTest.java index 5248a5a23..132660c5a 100644 --- a/javatests/google/registry/flows/domain/DomainCheckFlowTest.java +++ b/javatests/google/registry/flows/domain/DomainCheckFlowTest.java @@ -15,6 +15,7 @@ package google.registry.flows.domain; import static google.registry.model.eppoutput.CheckData.DomainCheck.create; +import static google.registry.model.registry.Registry.TldState.PREDELEGATION; import static google.registry.model.registry.Registry.TldState.START_DATE_SUNRISE; import static google.registry.testing.DatastoreHelper.createTld; import static google.registry.testing.DatastoreHelper.createTlds; @@ -377,7 +378,7 @@ public class DomainCheckFlowTest @Test public void testFailure_predelegation() { - createTld("tld", TldState.PREDELEGATION); + createTld("tld", PREDELEGATION); EppException thrown = assertThrows(BadCommandForRegistryPhaseException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -917,9 +918,7 @@ public class DomainCheckFlowTest @Test public void testIcannActivityReportField_getsLogged() throws Exception { - createTld("com", TldState.GENERAL_AVAILABILITY); - createTld("net", TldState.GENERAL_AVAILABILITY); - createTld("org", TldState.GENERAL_AVAILABILITY); + createTlds("com", "net", "org"); setEppInput("domain_check.xml"); runFlow(); assertIcannReportingActivityFieldLogged("srs-dom-check"); diff --git a/javatests/google/registry/flows/domain/DomainClaimsCheckFlowTest.java b/javatests/google/registry/flows/domain/DomainClaimsCheckFlowTest.java index 3650ebfa9..54b30fcb3 100644 --- a/javatests/google/registry/flows/domain/DomainClaimsCheckFlowTest.java +++ b/javatests/google/registry/flows/domain/DomainClaimsCheckFlowTest.java @@ -14,6 +14,7 @@ package google.registry.flows.domain; +import static google.registry.model.registry.Registry.TldState.PREDELEGATION; import static google.registry.testing.DatastoreHelper.assertNoBillingEvents; import static google.registry.testing.DatastoreHelper.createTld; import static google.registry.testing.DatastoreHelper.createTlds; @@ -130,7 +131,7 @@ public class DomainClaimsCheckFlowTest @Test public void testFailure_predelgation() { - createTld("tld", TldState.PREDELEGATION); + createTld("tld", PREDELEGATION); setEppInput("domain_check_claims.xml"); EppException thrown = assertThrows(BadCommandForRegistryPhaseException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); diff --git a/javatests/google/registry/flows/domain/DomainCreateFlowTest.java b/javatests/google/registry/flows/domain/DomainCreateFlowTest.java index 2d8cc97cf..0357ae9f3 100644 --- a/javatests/google/registry/flows/domain/DomainCreateFlowTest.java +++ b/javatests/google/registry/flows/domain/DomainCreateFlowTest.java @@ -21,11 +21,14 @@ import static google.registry.flows.FlowTestCase.UserPrivileges.SUPERUSER; import static google.registry.model.billing.BillingEvent.Flag.ANCHOR_TENANT; import static google.registry.model.domain.fee.Fee.FEE_EXTENSION_URIS; import static google.registry.model.eppcommon.StatusValue.OK; +import static google.registry.model.eppcommon.StatusValue.PENDING_DELETE; import static google.registry.model.eppcommon.StatusValue.SERVER_HOLD; import static google.registry.model.eppcommon.StatusValue.SERVER_TRANSFER_PROHIBITED; import static google.registry.model.eppcommon.StatusValue.SERVER_UPDATE_PROHIBITED; import static google.registry.model.ofy.ObjectifyService.ofy; 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.pricing.PricingEngineProxy.isDomainPremium; import static google.registry.testing.DatastoreHelper.assertBillingEvents; @@ -139,13 +142,11 @@ import google.registry.model.domain.launch.LaunchNotice; import google.registry.model.domain.rgp.GracePeriodStatus; import google.registry.model.domain.secdns.DelegationSignerData; import google.registry.model.domain.token.AllocationToken; -import google.registry.model.eppcommon.StatusValue; import google.registry.model.poll.PendingActionNotificationResponse.DomainPendingActionNotificationResponse; import google.registry.model.poll.PollMessage; import google.registry.model.registrar.Registrar; import google.registry.model.registrar.Registrar.State; import google.registry.model.registry.Registry; -import google.registry.model.registry.Registry.TldState; import google.registry.model.registry.Registry.TldType; import google.registry.model.reporting.DomainTransactionRecord; import google.registry.model.reporting.DomainTransactionRecord.TransactionReportField; @@ -1165,10 +1166,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase { assertThat(registry.getCreationTime()).isIn(Range.closed(before, after)); assertThat(registry.getDomainCreateRestricted()).isFalse(); assertThat(registry.getDnsWriters()).containsExactly("FooDnsWriter"); - assertThat(registry.getTldState(registry.getCreationTime())).isEqualTo(TldState.PREDELEGATION); + assertThat(registry.getTldState(registry.getCreationTime())).isEqualTo(PREDELEGATION); assertThat(registry.getRedemptionGracePeriodLength()) .isEqualTo(Registry.DEFAULT_REDEMPTION_GRACE_PERIOD); assertThat(registry.getPendingDeleteLength()).isEqualTo(Registry.DEFAULT_PENDING_DELETE_LENGTH); @@ -104,7 +105,7 @@ public class CreateTldCommandTest extends CommandTestCase { "--dns_writers=VoidDnsWriter", "xn--q9jyb4c"); assertThat(Registry.get("xn--q9jyb4c").getTldState(DateTime.now(UTC))) - .isEqualTo(TldState.GENERAL_AVAILABILITY); + .isEqualTo(GENERAL_AVAILABILITY); } @Test @@ -256,7 +257,7 @@ public class CreateTldCommandTest extends CommandTestCase { runCommandForced("co.uk", "--roid_suffix=COUK", "--dns_writers=VoidDnsWriter"); Registry registry = Registry.get("co.uk"); - assertThat(registry.getTldState(new DateTime())).isEqualTo(TldState.PREDELEGATION); + assertThat(registry.getTldState(new DateTime())).isEqualTo(PREDELEGATION); assertThat(registry.getAddGracePeriodLength()).isEqualTo(Registry.DEFAULT_ADD_GRACE_PERIOD); assertThat(registry.getRedemptionGracePeriodLength()) .isEqualTo(Registry.DEFAULT_REDEMPTION_GRACE_PERIOD); diff --git a/javatests/google/registry/tools/DeleteTldCommandTest.java b/javatests/google/registry/tools/DeleteTldCommandTest.java index 88148c820..969f7ca33 100644 --- a/javatests/google/registry/tools/DeleteTldCommandTest.java +++ b/javatests/google/registry/tools/DeleteTldCommandTest.java @@ -14,6 +14,7 @@ package google.registry.tools; +import static google.registry.model.registry.Registry.TldState.GENERAL_AVAILABILITY; import static google.registry.testing.DatastoreHelper.allowRegistrarAccess; import static google.registry.testing.DatastoreHelper.newRegistry; import static google.registry.testing.DatastoreHelper.persistDeletedDomain; @@ -25,7 +26,6 @@ import com.google.common.base.Ascii; import com.google.common.collect.ImmutableSortedMap; import google.registry.model.registry.Registry; import google.registry.model.registry.Registry.RegistryNotFoundException; -import google.registry.model.registry.Registry.TldState; import google.registry.model.registry.Registry.TldType; import org.joda.time.DateTime; import org.junit.Before; @@ -43,13 +43,13 @@ public class DeleteTldCommandTest extends CommandTestCase { newRegistry( TLD_REAL, Ascii.toUpperCase(TLD_REAL), - ImmutableSortedMap.of(START_OF_TIME, TldState.GENERAL_AVAILABILITY), + ImmutableSortedMap.of(START_OF_TIME, GENERAL_AVAILABILITY), TldType.REAL)); persistResource( newRegistry( TLD_TEST, Ascii.toUpperCase(TLD_TEST), - ImmutableSortedMap.of(START_OF_TIME, TldState.GENERAL_AVAILABILITY), + ImmutableSortedMap.of(START_OF_TIME, GENERAL_AVAILABILITY), TldType.TEST)); } diff --git a/javatests/google/registry/tools/UpdateTldCommandTest.java b/javatests/google/registry/tools/UpdateTldCommandTest.java index 19bb1de94..03cd3d689 100644 --- a/javatests/google/registry/tools/UpdateTldCommandTest.java +++ b/javatests/google/registry/tools/UpdateTldCommandTest.java @@ -16,6 +16,9 @@ package google.registry.tools; import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth8.assertThat; +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.testing.DatastoreHelper.createTld; import static google.registry.testing.DatastoreHelper.persistPremiumList; @@ -34,7 +37,6 @@ import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSortedMap; import com.googlecode.objectify.Key; import google.registry.model.registry.Registry; -import google.registry.model.registry.Registry.TldState; import google.registry.model.registry.label.PremiumList; import java.io.ByteArrayOutputStream; import java.io.PrintStream; @@ -75,18 +77,16 @@ public class UpdateTldCommandTest extends CommandTestCase { "xn--q9jyb4c"); Registry registry = Registry.get("xn--q9jyb4c"); - assertThat(registry.getTldState(sunriseStart.minusMillis(1))).isEqualTo(TldState.PREDELEGATION); + assertThat(registry.getTldState(sunriseStart.minusMillis(1))).isEqualTo(PREDELEGATION); assertThat(registry.getTldState(sunriseStart)).isEqualTo(START_DATE_SUNRISE); assertThat(registry.getTldState(sunriseStart.plusMillis(1))).isEqualTo(START_DATE_SUNRISE); assertThat(registry.getTldState(quietPeriodStart.minusMillis(1))).isEqualTo(START_DATE_SUNRISE); - assertThat(registry.getTldState(quietPeriodStart)).isEqualTo(TldState.QUIET_PERIOD); - assertThat(registry.getTldState(quietPeriodStart.plusMillis(1))) - .isEqualTo(TldState.QUIET_PERIOD); - assertThat(registry.getTldState(gaStart.minusMillis(1))).isEqualTo(TldState.QUIET_PERIOD); - assertThat(registry.getTldState(gaStart)).isEqualTo(TldState.GENERAL_AVAILABILITY); - assertThat(registry.getTldState(gaStart.plusMillis(1))) - .isEqualTo(TldState.GENERAL_AVAILABILITY); - assertThat(registry.getTldState(END_OF_TIME)).isEqualTo(TldState.GENERAL_AVAILABILITY); + assertThat(registry.getTldState(quietPeriodStart)).isEqualTo(QUIET_PERIOD); + assertThat(registry.getTldState(quietPeriodStart.plusMillis(1))).isEqualTo(QUIET_PERIOD); + assertThat(registry.getTldState(gaStart.minusMillis(1))).isEqualTo(QUIET_PERIOD); + assertThat(registry.getTldState(gaStart)).isEqualTo(GENERAL_AVAILABILITY); + assertThat(registry.getTldState(gaStart.plusMillis(1))).isEqualTo(GENERAL_AVAILABILITY); + assertThat(registry.getTldState(END_OF_TIME)).isEqualTo(GENERAL_AVAILABILITY); } @Test @@ -94,7 +94,7 @@ public class UpdateTldCommandTest extends CommandTestCase { persistResource( Registry.get("xn--q9jyb4c") .asBuilder() - .setTldStateTransitions(ImmutableSortedMap.of(START_OF_TIME, TldState.PREDELEGATION)) + .setTldStateTransitions(ImmutableSortedMap.of(START_OF_TIME, PREDELEGATION)) .build()); runCommandForced("--set_current_tld_state=START_DATE_SUNRISE", "xn--q9jyb4c"); assertThat(Registry.get("xn--q9jyb4c").getTldState(now.plusDays(1))) @@ -569,8 +569,8 @@ public class UpdateTldCommandTest extends CommandTestCase { Registry.get("xn--q9jyb4c").asBuilder() .setTldStateTransitions( ImmutableSortedMap.of( - START_OF_TIME, TldState.PREDELEGATION, - now.minusMonths(1), TldState.GENERAL_AVAILABILITY)) + START_OF_TIME, PREDELEGATION, + now.minusMonths(1), GENERAL_AVAILABILITY)) .build()); IllegalArgumentException thrown = assertThrows( @@ -585,8 +585,8 @@ public class UpdateTldCommandTest extends CommandTestCase { Registry.get("xn--q9jyb4c").asBuilder() .setTldStateTransitions( ImmutableSortedMap.of( - START_OF_TIME, TldState.PREDELEGATION, - now.plusMonths(1), TldState.GENERAL_AVAILABILITY)) + START_OF_TIME, PREDELEGATION, + now.plusMonths(1), GENERAL_AVAILABILITY)) .build()); IllegalArgumentException thrown = assertThrows( @@ -603,8 +603,8 @@ public class UpdateTldCommandTest extends CommandTestCase { Registry.get("xn--q9jyb4c").asBuilder() .setTldStateTransitions( ImmutableSortedMap.of( - START_OF_TIME, TldState.PREDELEGATION, - now.minusMonths(1), TldState.GENERAL_AVAILABILITY)) + START_OF_TIME, PREDELEGATION, + now.minusMonths(1), GENERAL_AVAILABILITY)) .build()); IllegalArgumentException thrown = assertThrows(