Statically import commonly used TldState enum values

Takes advantage of the fact that the default state of a TLD created in tests is GENERAL_AVAILABILITY.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=228916164
This commit is contained in:
mcilwain 2019-01-11 11:34:08 -08:00 committed by Ben McIlwain
parent eeb65b4610
commit 170980db2f
14 changed files with 62 additions and 63 deletions

View file

@ -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();
}
}

View file

@ -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)

View file

@ -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);

View file

@ -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",

View file

@ -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");

View file

@ -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();

View file

@ -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<DomainCreateFlow,
persistActiveContact("jd1234");
persistActiveContact("sh8013");
persistResource(
newHostResource("ns2.example.net")
.asBuilder()
.addStatusValue(StatusValue.PENDING_DELETE)
.build());
newHostResource("ns2.example.net").asBuilder().addStatusValue(PENDING_DELETE).build());
clock.advanceOneMilli();
LinkedResourceInPendingDeleteProhibitsOperationException thrown =
assertThrows(LinkedResourceInPendingDeleteProhibitsOperationException.class, this::runFlow);
@ -1191,10 +1189,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
persistActiveHost("ns2.example.net");
persistActiveContact("sh8013");
persistResource(
newContactResource("jd1234")
.asBuilder()
.addStatusValue(StatusValue.PENDING_DELETE)
.build());
newContactResource("jd1234").asBuilder().addStatusValue(PENDING_DELETE).build());
clock.advanceOneMilli();
LinkedResourceInPendingDeleteProhibitsOperationException thrown =
assertThrows(LinkedResourceInPendingDeleteProhibitsOperationException.class, this::runFlow);
@ -1211,7 +1206,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
@Test
public void testFailure_predelegation() {
createTld("tld", TldState.PREDELEGATION);
createTld("tld", PREDELEGATION);
persistContactsAndHosts();
EppException thrown =
assertThrows(NoGeneralRegistrationsInCurrentPhaseException.class, this::runFlow);
@ -1229,7 +1224,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
@Test
public void testFailure_quietPeriod() {
createTld("tld", TldState.QUIET_PERIOD);
createTld("tld", QUIET_PERIOD);
persistContactsAndHosts();
EppException thrown =
assertThrows(NoGeneralRegistrationsInCurrentPhaseException.class, this::runFlow);
@ -1238,7 +1233,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
@Test
public void testSuccess_superuserPredelegation() throws Exception {
createTld("tld", TldState.PREDELEGATION);
createTld("tld", PREDELEGATION);
persistContactsAndHosts();
doSuccessfulTest(
"tld", "domain_create_response.xml", SUPERUSER, ImmutableMap.of("DOMAIN", "example.tld"));
@ -1254,7 +1249,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
@Test
public void testSuccess_superuserQuietPeriod() throws Exception {
createTld("tld", TldState.QUIET_PERIOD);
createTld("tld", QUIET_PERIOD);
persistContactsAndHosts();
doSuccessfulTest(
"tld", "domain_create_response.xml", SUPERUSER, ImmutableMap.of("DOMAIN", "example.tld"));

View file

@ -24,6 +24,7 @@ import static google.registry.batch.AsyncTaskEnqueuer.QUEUE_ASYNC_ACTIONS;
import static google.registry.flows.domain.DomainTransferFlowTestCase.persistWithPendingTransfer;
import static google.registry.model.EppResourceUtils.loadByForeignKey;
import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.model.registry.Registry.TldState.PREDELEGATION;
import static google.registry.model.reporting.DomainTransactionRecord.TransactionReportField.DELETED_DOMAINS_GRACE;
import static google.registry.model.reporting.DomainTransactionRecord.TransactionReportField.DELETED_DOMAINS_NOGRACE;
import static google.registry.model.reporting.DomainTransactionRecord.TransactionReportField.NET_ADDS_10_YR;
@ -86,7 +87,6 @@ import google.registry.model.host.HostResource;
import google.registry.model.poll.PendingActionNotificationResponse;
import google.registry.model.poll.PollMessage;
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.HistoryEntry;
@ -723,7 +723,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
@Test
public void testFailure_predelegation() throws Exception {
createTld("tld", TldState.PREDELEGATION);
createTld("tld", PREDELEGATION);
setUpSuccessfulTest();
EppException thrown = assertThrows(BadCommandForRegistryPhaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -731,7 +731,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
@Test
public void testSuccess_superuserPredelegation() throws Exception {
createTld("tld", TldState.PREDELEGATION);
createTld("tld", PREDELEGATION);
setUpSuccessfulTest();
clock.advanceOneMilli();
runFlowAssertResponse(

View file

@ -40,7 +40,6 @@ import google.registry.model.host.HostResource;
import google.registry.model.ofy.Ofy;
import google.registry.model.registrar.Registrar;
import google.registry.model.registrar.RegistrarContact;
import google.registry.model.registry.Registry.TldState;
import google.registry.model.reporting.HistoryEntry;
import google.registry.model.transfer.TransferData;
import google.registry.model.transfer.TransferStatus;
@ -98,7 +97,7 @@ public class RdapJsonFormatterTest {
// Create the registrar in 1999, then update it in 2000.
clock.setTo(DateTime.parse("1999-01-01T00:00:00Z"));
createTld("xn--q9jyb4c", TldState.GENERAL_AVAILABILITY);
createTld("xn--q9jyb4c");
registrar = persistResource(makeRegistrar("unicoderegistrar", "みんな", Registrar.State.ACTIVE));
clock.setTo(DateTime.parse("2000-01-01T00:00:00Z"));
registrar = persistResource(registrar);

View file

@ -17,6 +17,7 @@ package google.registry.rde.imports;
import static com.google.common.collect.ImmutableList.toImmutableList;
import static com.google.common.truth.Truth.assertThat;
import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.model.registry.Registry.TldState.PREDELEGATION;
import static google.registry.testing.DatastoreHelper.createTld;
import static google.registry.testing.DatastoreHelper.persistActiveContact;
import static google.registry.testing.DatastoreHelper.persistNewRegistrar;
@ -47,7 +48,6 @@ import google.registry.model.index.EppResourceIndex;
import google.registry.model.index.EppResourceIndexBucket;
import google.registry.model.index.ForeignKeyIndex;
import google.registry.model.registrar.Registrar;
import google.registry.model.registry.Registry.TldState;
import google.registry.testing.AppEngineRule;
import google.registry.testing.FakeClock;
import google.registry.testing.ShardableTestCase;
@ -89,8 +89,8 @@ public class RdeImportUtilsTest extends ShardableTestCase {
clock = new FakeClock();
clock.setTo(DateTime.now(UTC));
rdeImportUtils = new RdeImportUtils(ofy(), clock, "import-bucket", gcsUtils);
createTld("test", TldState.PREDELEGATION);
createTld("getld", TldState.GENERAL_AVAILABILITY);
createTld("test", PREDELEGATION);
createTld("getld");
persistNewRegistrar("RegistrarX", "RegistrarX", Registrar.Type.REAL, 1L);
}

View file

@ -28,6 +28,7 @@ import static google.registry.model.EppResourceUtils.createDomainRepoId;
import static google.registry.model.EppResourceUtils.createRepoId;
import static google.registry.model.ResourceTransferUtils.createTransferResponse;
import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.model.registry.Registry.TldState.GENERAL_AVAILABILITY;
import static google.registry.model.registry.label.PremiumListUtils.parentPremiumListEntriesOnRevision;
import static google.registry.pricing.PricingEngineProxy.getDomainRenewCost;
import static google.registry.util.CollectionUtils.difference;
@ -179,8 +180,7 @@ public class DatastoreHelper {
}
public static Registry newRegistry(String tld, String roidSuffix) {
return newRegistry(
tld, roidSuffix, ImmutableSortedMap.of(START_OF_TIME, TldState.GENERAL_AVAILABILITY));
return newRegistry(tld, roidSuffix, ImmutableSortedMap.of(START_OF_TIME, GENERAL_AVAILABILITY));
}
public static Registry newRegistry(
@ -332,17 +332,17 @@ public class DatastoreHelper {
/** Creates and persists a tld. */
public static void createTld(String tld) {
createTld(tld, TldState.GENERAL_AVAILABILITY);
createTld(tld, GENERAL_AVAILABILITY);
}
public static void createTld(String tld, String roidSuffix) {
createTld(tld, roidSuffix, ImmutableSortedMap.of(START_OF_TIME, TldState.GENERAL_AVAILABILITY));
createTld(tld, roidSuffix, ImmutableSortedMap.of(START_OF_TIME, GENERAL_AVAILABILITY));
}
/** Creates and persists the given TLDs. */
public static void createTlds(String... tlds) {
for (String tld : tlds) {
createTld(tld, TldState.GENERAL_AVAILABILITY);
createTld(tld, GENERAL_AVAILABILITY);
}
}

View file

@ -16,6 +16,8 @@ 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.testing.DatastoreHelper.createTld;
import static google.registry.testing.DatastoreHelper.persistPremiumList;
import static google.registry.testing.DatastoreHelper.persistReservedList;
@ -31,7 +33,6 @@ import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Range;
import com.googlecode.objectify.Key;
import google.registry.model.registry.Registry;
import google.registry.model.registry.Registry.TldState;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.math.BigDecimal;
@ -68,7 +69,7 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
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<CreateTldCommand> {
"--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<CreateTldCommand> {
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);

View file

@ -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<DeleteTldCommand> {
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));
}

View file

@ -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<UpdateTldCommand> {
"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<UpdateTldCommand> {
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<UpdateTldCommand> {
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<UpdateTldCommand> {
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<UpdateTldCommand> {
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(