mirror of
https://github.com/google/nomulus
synced 2026-09-13 11:34:31 +00:00
Change Registry class name to Tld (#1991)
* Change Registry class name to Tld * Fix merge conflict * Some capitalization fixes
This commit is contained in:
@@ -42,8 +42,8 @@ import google.registry.model.domain.Domain;
|
||||
import google.registry.model.domain.DomainHistory;
|
||||
import google.registry.model.poll.PollMessage;
|
||||
import google.registry.model.reporting.HistoryEntry;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Registry.TldType;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.model.tld.Tld.TldType;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
||||
import google.registry.testing.DatabaseHelper;
|
||||
@@ -82,7 +82,7 @@ class DeleteProberDataActionTest {
|
||||
// Since "example" doesn't end with .test, its entities won't be deleted even though it is of
|
||||
// TEST type.
|
||||
createTld("example", "EXAMPLE");
|
||||
persistResource(Registry.get("example").asBuilder().setTldType(TldType.TEST).build());
|
||||
persistResource(Tld.get("example").asBuilder().setTldType(TldType.TEST).build());
|
||||
|
||||
// Since "not-test.test" isn't of TEST type, its entities won't be deleted even though it ends
|
||||
// with .test.
|
||||
@@ -90,9 +90,9 @@ class DeleteProberDataActionTest {
|
||||
|
||||
// Entities in these two should be deleted.
|
||||
createTld("ib-any.test", "IBANYT");
|
||||
persistResource(Registry.get("ib-any.test").asBuilder().setTldType(TldType.TEST).build());
|
||||
persistResource(Tld.get("ib-any.test").asBuilder().setTldType(TldType.TEST).build());
|
||||
createTld("oa-canary.test", "OACANT");
|
||||
persistResource(Registry.get("oa-canary.test").asBuilder().setTldType(TldType.TEST).build());
|
||||
persistResource(Tld.get("oa-canary.test").asBuilder().setTldType(TldType.TEST).build());
|
||||
|
||||
resetAction();
|
||||
}
|
||||
|
||||
+6
-12
@@ -48,7 +48,7 @@ import google.registry.model.domain.DomainHistory;
|
||||
import google.registry.model.domain.Period;
|
||||
import google.registry.model.reporting.DomainTransactionRecord;
|
||||
import google.registry.model.reporting.DomainTransactionRecord.TransactionReportField;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.persistence.PersistenceModule.TransactionIsolationLevel;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
||||
@@ -313,7 +313,7 @@ public class ExpandRecurringBillingEventsPipelineTest {
|
||||
void testSuccess_expandMultipleEvents_multipleDomains(int numOfThreads) {
|
||||
createTld("test");
|
||||
persistResource(
|
||||
Registry.get("test")
|
||||
Tld.get("test")
|
||||
.asBuilder()
|
||||
.setPremiumList(persistPremiumList("premium", USD, "other,USD 100"))
|
||||
.build());
|
||||
@@ -370,7 +370,7 @@ public class ExpandRecurringBillingEventsPipelineTest {
|
||||
domain
|
||||
.getCreationTime()
|
||||
.plusYears(2)
|
||||
.plus(Registry.DEFAULT_AUTO_RENEW_GRACE_PERIOD),
|
||||
.plus(Tld.DEFAULT_AUTO_RENEW_GRACE_PERIOD),
|
||||
TransactionReportField.netRenewsFieldFromYears(1),
|
||||
1)))
|
||||
.build());
|
||||
@@ -394,10 +394,7 @@ public class ExpandRecurringBillingEventsPipelineTest {
|
||||
.asBuilder()
|
||||
.setEventTime(domain.getCreationTime().plusYears(2))
|
||||
.setBillingTime(
|
||||
domain
|
||||
.getCreationTime()
|
||||
.plusYears(2)
|
||||
.plus(Registry.DEFAULT_AUTO_RENEW_GRACE_PERIOD))
|
||||
domain.getCreationTime().plusYears(2).plus(Tld.DEFAULT_AUTO_RENEW_GRACE_PERIOD))
|
||||
.build(),
|
||||
recurring
|
||||
.asBuilder()
|
||||
@@ -455,10 +452,7 @@ public class ExpandRecurringBillingEventsPipelineTest {
|
||||
DomainTransactionRecord.create(
|
||||
domain.getTld(),
|
||||
// We report this when the autorenew grace period ends.
|
||||
domain
|
||||
.getCreationTime()
|
||||
.plusYears(1)
|
||||
.plus(Registry.DEFAULT_AUTO_RENEW_GRACE_PERIOD),
|
||||
domain.getCreationTime().plusYears(1).plus(Tld.DEFAULT_AUTO_RENEW_GRACE_PERIOD),
|
||||
TransactionReportField.netRenewsFieldFromYears(1),
|
||||
1)))
|
||||
.build();
|
||||
@@ -472,7 +466,7 @@ public class ExpandRecurringBillingEventsPipelineTest {
|
||||
Domain domain, DomainHistory history, Recurring recurring, int cost) {
|
||||
return new BillingEvent.OneTime.Builder()
|
||||
.setBillingTime(
|
||||
domain.getCreationTime().plusYears(1).plus(Registry.DEFAULT_AUTO_RENEW_GRACE_PERIOD))
|
||||
domain.getCreationTime().plusYears(1).plus(Tld.DEFAULT_AUTO_RENEW_GRACE_PERIOD))
|
||||
.setRegistrarId("TheRegistrar")
|
||||
.setCost(Money.of(USD, cost))
|
||||
.setEventTime(domain.getCreationTime().plusYears(1))
|
||||
|
||||
@@ -16,9 +16,9 @@ package google.registry.beam.billing;
|
||||
|
||||
import static com.google.common.collect.ImmutableSet.toImmutableSet;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.model.tld.Registry.TldState.GENERAL_AVAILABILITY;
|
||||
import static google.registry.model.tld.Tld.TldState.GENERAL_AVAILABILITY;
|
||||
import static google.registry.testing.DatabaseHelper.createTld;
|
||||
import static google.registry.testing.DatabaseHelper.newRegistry;
|
||||
import static google.registry.testing.DatabaseHelper.newTld;
|
||||
import static google.registry.testing.DatabaseHelper.persistActiveDomain;
|
||||
import static google.registry.testing.DatabaseHelper.persistNewRegistrar;
|
||||
import static google.registry.testing.DatabaseHelper.persistResource;
|
||||
@@ -45,7 +45,7 @@ import google.registry.model.domain.Domain;
|
||||
import google.registry.model.domain.DomainHistory;
|
||||
import google.registry.model.registrar.Registrar;
|
||||
import google.registry.model.reporting.HistoryEntry;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
||||
import google.registry.testing.FakeClock;
|
||||
@@ -291,8 +291,8 @@ class InvoicingPipelineTest {
|
||||
.setPoNumber(Optional.of("22446688"))
|
||||
.build();
|
||||
persistResource(registrar);
|
||||
Registry test =
|
||||
newRegistry("test", "_TEST", ImmutableSortedMap.of(START_OF_TIME, GENERAL_AVAILABILITY))
|
||||
Tld test =
|
||||
newTld("test", "_TEST", ImmutableSortedMap.of(START_OF_TIME, GENERAL_AVAILABILITY))
|
||||
.asBuilder()
|
||||
.setInvoicingEnabled(true)
|
||||
.build();
|
||||
@@ -395,14 +395,14 @@ class InvoicingPipelineTest {
|
||||
registrar3 = registrar3.asBuilder().setBillingAccountMap(ImmutableMap.of(USD, "789")).build();
|
||||
persistResource(registrar3);
|
||||
|
||||
Registry test =
|
||||
newRegistry("test", "_TEST", ImmutableSortedMap.of(START_OF_TIME, GENERAL_AVAILABILITY))
|
||||
Tld test =
|
||||
newTld("test", "_TEST", ImmutableSortedMap.of(START_OF_TIME, GENERAL_AVAILABILITY))
|
||||
.asBuilder()
|
||||
.setInvoicingEnabled(true)
|
||||
.build();
|
||||
persistResource(test);
|
||||
Registry hello =
|
||||
newRegistry("hello", "_HELLO", ImmutableSortedMap.of(START_OF_TIME, GENERAL_AVAILABILITY))
|
||||
Tld hello =
|
||||
newTld("hello", "_HELLO", ImmutableSortedMap.of(START_OF_TIME, GENERAL_AVAILABILITY))
|
||||
.asBuilder()
|
||||
.setInvoicingEnabled(true)
|
||||
.build();
|
||||
|
||||
@@ -20,7 +20,7 @@ import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.truth.Truth;
|
||||
import google.registry.beam.TestPipelineExtension;
|
||||
import google.registry.beam.common.RegistryJpaIO.Read;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.persistence.NomulusPostgreSql;
|
||||
import google.registry.persistence.PersistenceModule;
|
||||
import google.registry.persistence.transaction.CriteriaQueryBuilder;
|
||||
@@ -67,7 +67,7 @@ public class DatabaseSnapshotTest {
|
||||
static JpaTransactionManager origJpa;
|
||||
static JpaTransactionManager jpa;
|
||||
|
||||
static Registry registry;
|
||||
static Tld registry;
|
||||
|
||||
@BeforeAll
|
||||
static void setup() {
|
||||
@@ -84,7 +84,7 @@ public class DatabaseSnapshotTest {
|
||||
origJpa = tm();
|
||||
TransactionManagerFactory.setJpaTm(() -> jpa);
|
||||
|
||||
Registry tld = DatabaseHelper.newRegistry("tld", "TLD");
|
||||
Tld tld = DatabaseHelper.newTld("tld", "TLD");
|
||||
tm().transact(() -> tm().put(tld));
|
||||
registry = tm().transact(() -> tm().loadByEntity(tld));
|
||||
}
|
||||
@@ -112,7 +112,7 @@ public class DatabaseSnapshotTest {
|
||||
@Test
|
||||
void readSnapshot() {
|
||||
try (DatabaseSnapshot databaseSnapshot = DatabaseSnapshot.createSnapshot()) {
|
||||
Registry snapshotRegistry =
|
||||
Tld snapshotRegistry =
|
||||
tm().transact(
|
||||
() ->
|
||||
tm().setDatabaseSnapshot(databaseSnapshot.getSnapshotId())
|
||||
@@ -124,17 +124,17 @@ public class DatabaseSnapshotTest {
|
||||
@Test
|
||||
void readSnapshot_withSubsequentChange() {
|
||||
try (DatabaseSnapshot databaseSnapshot = DatabaseSnapshot.createSnapshot()) {
|
||||
Registry updated =
|
||||
Tld updated =
|
||||
registry
|
||||
.asBuilder()
|
||||
.setCreateBillingCost(registry.getStandardCreateCost().plus(1))
|
||||
.build();
|
||||
tm().transact(() -> tm().put(updated));
|
||||
|
||||
Registry persistedUpdate = tm().transact(() -> tm().loadByEntity(registry));
|
||||
Tld persistedUpdate = tm().transact(() -> tm().loadByEntity(registry));
|
||||
Truth.assertThat(persistedUpdate).isNotEqualTo(registry);
|
||||
|
||||
Registry snapshotRegistry =
|
||||
Tld snapshotRegistry =
|
||||
tm().transact(
|
||||
() ->
|
||||
tm().setDatabaseSnapshot(databaseSnapshot.getSnapshotId())
|
||||
@@ -149,18 +149,18 @@ public class DatabaseSnapshotTest {
|
||||
@Test
|
||||
void readWithRegistryJpaIO() {
|
||||
try (DatabaseSnapshot databaseSnapshot = DatabaseSnapshot.createSnapshot()) {
|
||||
Registry updated =
|
||||
Tld updated =
|
||||
registry
|
||||
.asBuilder()
|
||||
.setCreateBillingCost(registry.getStandardCreateCost().plus(1))
|
||||
.build();
|
||||
tm().transact(() -> tm().put(updated));
|
||||
|
||||
Read<Registry, Registry> read =
|
||||
RegistryJpaIO.read(() -> CriteriaQueryBuilder.create(Registry.class).build(), x -> x)
|
||||
.withCoder(SerializableCoder.of(Registry.class))
|
||||
Read<Tld, Tld> read =
|
||||
RegistryJpaIO.read(() -> CriteriaQueryBuilder.create(Tld.class).build(), x -> x)
|
||||
.withCoder(SerializableCoder.of(Tld.class))
|
||||
.withSnapshot(databaseSnapshot.getSnapshotId());
|
||||
PCollection<Registry> registries = testPipeline.apply(read);
|
||||
PCollection<Tld> registries = testPipeline.apply(read);
|
||||
|
||||
// This assertion depends on Registry being Serializable, which may change if the
|
||||
// UnsafeSerializable interface is removed after migration.
|
||||
|
||||
@@ -17,7 +17,7 @@ package google.registry.beam.common;
|
||||
import static google.registry.persistence.transaction.JpaTransactionManagerExtension.makeRegistrar1;
|
||||
import static google.registry.testing.DatabaseHelper.insertInDb;
|
||||
import static google.registry.testing.DatabaseHelper.newContact;
|
||||
import static google.registry.testing.DatabaseHelper.newRegistry;
|
||||
import static google.registry.testing.DatabaseHelper.newTld;
|
||||
import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
||||
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||
|
||||
@@ -37,7 +37,7 @@ import google.registry.model.domain.secdns.DomainDsData;
|
||||
import google.registry.model.eppcommon.AuthInfo.PasswordAuth;
|
||||
import google.registry.model.eppcommon.StatusValue;
|
||||
import google.registry.model.registrar.Registrar;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.model.transfer.ContactTransferData;
|
||||
import google.registry.persistence.transaction.CriteriaQueryBuilder;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||
@@ -161,7 +161,7 @@ public class RegistryJpaReadTest {
|
||||
}
|
||||
|
||||
private void setupForJoinQuery() {
|
||||
Registry registry = newRegistry("com", "ABCD_APP");
|
||||
Tld registry = newTld("com", "ABCD_APP");
|
||||
Registrar registrar =
|
||||
makeRegistrar1()
|
||||
.asBuilder()
|
||||
|
||||
@@ -73,7 +73,7 @@ import google.registry.model.registrar.Registrar.State;
|
||||
import google.registry.model.reporting.DomainTransactionRecord;
|
||||
import google.registry.model.reporting.DomainTransactionRecord.TransactionReportField;
|
||||
import google.registry.model.reporting.HistoryEntry;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.persistence.VKey;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
||||
@@ -247,8 +247,8 @@ public class RdePipelineTest {
|
||||
|
||||
tm().transact(
|
||||
() -> {
|
||||
tm().put(Cursor.createScoped(CursorType.BRDA, now, Registry.get("soy")));
|
||||
tm().put(Cursor.createScoped(RDE_STAGING, now, Registry.get("soy")));
|
||||
tm().put(Cursor.createScoped(CursorType.BRDA, now, Tld.get("soy")));
|
||||
tm().put(Cursor.createScoped(RDE_STAGING, now, Tld.get("soy")));
|
||||
RdeRevision.saveRevision("soy", now, THIN, 0);
|
||||
RdeRevision.saveRevision("soy", now, FULL, 0);
|
||||
});
|
||||
@@ -562,8 +562,7 @@ public class RdePipelineTest {
|
||||
|
||||
private static DateTime loadCursorTime(CursorType type) {
|
||||
return tm().transact(
|
||||
() ->
|
||||
tm().loadByKey(Cursor.createScopedVKey(type, Registry.get("soy"))).getCursorTime());
|
||||
() -> tm().loadByKey(Cursor.createScopedVKey(type, Tld.get("soy"))).getCursorTime());
|
||||
}
|
||||
|
||||
private static Function<DepositFragment, String> getXmlElement(String pattern) {
|
||||
|
||||
@@ -25,8 +25,8 @@ import com.google.cloud.tasks.v2.Task;
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.common.collect.ImmutableListMultimap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Registry.TldType;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.model.tld.Tld.TldType;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
||||
import google.registry.testing.CloudTasksHelper;
|
||||
@@ -81,7 +81,7 @@ class TldFanoutActionTest {
|
||||
@BeforeEach
|
||||
void beforeEach() {
|
||||
createTlds("com", "net", "org", "example");
|
||||
persistResource(Registry.get("example").asBuilder().setTldType(TldType.TEST).build());
|
||||
persistResource(Tld.get("example").asBuilder().setTldType(TldType.TEST).build());
|
||||
}
|
||||
|
||||
private void assertTasks(String... tasks) {
|
||||
|
||||
@@ -47,7 +47,7 @@ import google.registry.dns.DnsMetrics.CommitStatus;
|
||||
import google.registry.dns.DnsMetrics.PublishStatus;
|
||||
import google.registry.dns.writer.DnsWriter;
|
||||
import google.registry.model.domain.Domain;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
||||
import google.registry.request.HttpException.ServiceUnavailableException;
|
||||
@@ -99,10 +99,7 @@ public class PublishDnsUpdatesActionTest {
|
||||
registrySupportEmail = Lazies.of(new InternetAddress("registry@test.com"));
|
||||
registryCcEmail = Lazies.of(new InternetAddress("registry-cc@test.com"));
|
||||
persistResource(
|
||||
Registry.get("xn--q9jyb4c")
|
||||
.asBuilder()
|
||||
.setDnsWriters(ImmutableSet.of("correctWriter"))
|
||||
.build());
|
||||
Tld.get("xn--q9jyb4c").asBuilder().setDnsWriters(ImmutableSet.of("correctWriter")).build());
|
||||
Domain domain1 = persistActiveDomain("example.xn--q9jyb4c");
|
||||
persistActiveSubordinateHost("ns1.example.xn--q9jyb4c", domain1);
|
||||
persistActiveSubordinateHost("ns2.example.xn--q9jyb4c", domain1);
|
||||
@@ -231,7 +228,7 @@ public class PublishDnsUpdatesActionTest {
|
||||
|
||||
@Test
|
||||
void testAction_acquiresCorrectLock() {
|
||||
persistResource(Registry.get("xn--q9jyb4c").asBuilder().setNumDnsPublishLocks(4).build());
|
||||
persistResource(Tld.get("xn--q9jyb4c").asBuilder().setNumDnsPublishLocks(4).build());
|
||||
LockHandler mockLockHandler = mock(LockHandler.class);
|
||||
when(mockLockHandler.executeWithLocks(any(), any(), any(), any())).thenReturn(true);
|
||||
action =
|
||||
@@ -561,7 +558,7 @@ public class PublishDnsUpdatesActionTest {
|
||||
|
||||
@Test
|
||||
void testParam_invalidLockIndex() {
|
||||
persistResource(Registry.get("xn--q9jyb4c").asBuilder().setNumDnsPublishLocks(4).build());
|
||||
persistResource(Tld.get("xn--q9jyb4c").asBuilder().setNumDnsPublishLocks(4).build());
|
||||
action =
|
||||
createActionWithCustomLocks(
|
||||
"xn--q9jyb4c",
|
||||
@@ -589,7 +586,7 @@ public class PublishDnsUpdatesActionTest {
|
||||
|
||||
@Test
|
||||
void testRegistryParam_mismatchedMaxLocks() {
|
||||
persistResource(Registry.get("xn--q9jyb4c").asBuilder().setNumDnsPublishLocks(4).build());
|
||||
persistResource(Tld.get("xn--q9jyb4c").asBuilder().setNumDnsPublishLocks(4).build());
|
||||
action =
|
||||
createActionWithCustomLocks(
|
||||
"xn--q9jyb4c",
|
||||
|
||||
@@ -39,8 +39,8 @@ import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.hash.Hashing;
|
||||
import com.google.common.net.InternetDomainName;
|
||||
import google.registry.dns.DnsConstants.TargetType;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Registry.TldType;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.model.tld.Tld.TldType;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
||||
import google.registry.testing.CloudTasksHelper;
|
||||
@@ -82,18 +82,16 @@ public class ReadDnsQueueActionTest {
|
||||
// To make sure it's never in the past, we set the date far-far into the future
|
||||
clock.setTo(DateTime.parse("3000-01-01TZ"));
|
||||
createTlds("com", "net", "example", "multilock.uk");
|
||||
persistResource(Tld.get("com").asBuilder().setDnsWriters(ImmutableSet.of("comWriter")).build());
|
||||
persistResource(Tld.get("net").asBuilder().setDnsWriters(ImmutableSet.of("netWriter")).build());
|
||||
persistResource(
|
||||
Registry.get("com").asBuilder().setDnsWriters(ImmutableSet.of("comWriter")).build());
|
||||
persistResource(
|
||||
Registry.get("net").asBuilder().setDnsWriters(ImmutableSet.of("netWriter")).build());
|
||||
persistResource(
|
||||
Registry.get("example")
|
||||
Tld.get("example")
|
||||
.asBuilder()
|
||||
.setTldType(TldType.TEST)
|
||||
.setDnsWriters(ImmutableSet.of("exampleWriter"))
|
||||
.build());
|
||||
persistResource(
|
||||
Registry.get("multilock.uk")
|
||||
Tld.get("multilock.uk")
|
||||
.asBuilder()
|
||||
.setNumDnsPublishLocks(1000)
|
||||
.setDnsWriters(ImmutableSet.of("multilockWriter"))
|
||||
@@ -217,7 +215,7 @@ public class ReadDnsQueueActionTest {
|
||||
@RetryingTest(4)
|
||||
void testSuccess_twoDnsWriters() {
|
||||
persistResource(
|
||||
Registry.get("com")
|
||||
Tld.get("com")
|
||||
.asBuilder()
|
||||
.setDnsWriters(ImmutableSet.of("comWriter", "otherWriter"))
|
||||
.build());
|
||||
@@ -256,7 +254,7 @@ public class ReadDnsQueueActionTest {
|
||||
|
||||
@RetryingTest(4)
|
||||
void testSuccess_oneTldPaused_returnedToQueue() {
|
||||
persistResource(Registry.get("net").asBuilder().setDnsPaused(true).build());
|
||||
persistResource(Tld.get("net").asBuilder().setDnsPaused(true).build());
|
||||
dnsQueue.addDomainRefreshTask("domain.com");
|
||||
dnsQueue.addDomainRefreshTask("domain.net");
|
||||
dnsQueue.addDomainRefreshTask("domain.example");
|
||||
|
||||
@@ -43,7 +43,7 @@ import com.google.common.collect.Ordering;
|
||||
import google.registry.dns.DnsConstants.TargetType;
|
||||
import google.registry.model.common.DnsRefreshRequest;
|
||||
import google.registry.model.common.DnsRefreshRequestTest;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
||||
import google.registry.testing.CloudTasksHelper;
|
||||
@@ -151,7 +151,7 @@ public class ReadDnsRefreshRequestsActionTest {
|
||||
@Test
|
||||
void testSuccess_runAction_twoBatches() {
|
||||
// Make the read batch size 2 * 1 = 2.
|
||||
persistResource(Registry.get("tld").asBuilder().setNumDnsPublishLocks(1).build());
|
||||
persistResource(Tld.get("tld").asBuilder().setNumDnsPublishLocks(1).build());
|
||||
doReturn(1).when(action).getLockIndex(anyInt(), any(DnsRefreshRequest.class));
|
||||
doAnswer(
|
||||
invocation -> {
|
||||
@@ -181,7 +181,7 @@ public class ReadDnsRefreshRequestsActionTest {
|
||||
@Test
|
||||
void testSuccess_runAction_timeOutAfterFirstRead() {
|
||||
// Make the process batch size 2 * 1 = 2.
|
||||
persistResource(Registry.get("tld").asBuilder().setNumDnsPublishLocks(1).build());
|
||||
persistResource(Tld.get("tld").asBuilder().setNumDnsPublishLocks(1).build());
|
||||
// Both requests in the first batch will be bucketed to the same bucket.
|
||||
doReturn(1).when(action).getLockIndex(anyInt(), any(DnsRefreshRequest.class));
|
||||
doAnswer(
|
||||
|
||||
@@ -33,8 +33,8 @@ import com.google.cloud.storage.contrib.nio.testing.LocalStorageHelper;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.net.MediaType;
|
||||
import google.registry.gcs.GcsUtils;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Registry.TldType;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.model.tld.Tld.TldType;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
||||
import google.registry.storage.drive.DriveConnection;
|
||||
@@ -62,8 +62,8 @@ class ExportDomainListsActionTest {
|
||||
void beforeEach() {
|
||||
createTld("tld");
|
||||
createTld("testtld");
|
||||
persistResource(Registry.get("tld").asBuilder().setDriveFolderId("brouhaha").build());
|
||||
persistResource(Registry.get("testtld").asBuilder().setTldType(TldType.TEST).build());
|
||||
persistResource(Tld.get("tld").asBuilder().setDriveFolderId("brouhaha").build());
|
||||
persistResource(Tld.get("testtld").asBuilder().setTldType(TldType.TEST).build());
|
||||
|
||||
action = new ExportDomainListsAction();
|
||||
action.gcsBucket = "outputbucket";
|
||||
@@ -118,7 +118,7 @@ class ExportDomainListsActionTest {
|
||||
@Test
|
||||
void test_outputsDomainsFromDifferentTldsToMultipleFiles() throws Exception {
|
||||
createTld("tldtwo");
|
||||
persistResource(Registry.get("tldtwo").asBuilder().setDriveFolderId("hooray").build());
|
||||
persistResource(Tld.get("tldtwo").asBuilder().setDriveFolderId("hooray").build());
|
||||
|
||||
createTld("tldthree");
|
||||
// You'd think this test was written around Christmas, but it wasn't.
|
||||
|
||||
@@ -36,7 +36,7 @@ import static org.mockito.Mockito.when;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.net.MediaType;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.model.tld.label.PremiumList;
|
||||
import google.registry.model.tld.label.PremiumListDao;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||
@@ -70,7 +70,7 @@ public class ExportPremiumTermsActionTest {
|
||||
action.response = response;
|
||||
action.driveConnection = driveConnection;
|
||||
action.exportDisclaimer = DISCLAIMER_WITH_NEWLINE;
|
||||
action.tld = tld;
|
||||
action.tldStr = tld;
|
||||
action.run();
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ public class ExportPremiumTermsActionTest {
|
||||
createTld("tld");
|
||||
PremiumList pl = PremiumListDao.save("pl-name", USD, PREMIUM_NAMES);
|
||||
persistResource(
|
||||
Registry.get("tld").asBuilder().setPremiumList(pl).setDriveFolderId("folder_id").build());
|
||||
Tld.get("tld").asBuilder().setPremiumList(pl).setDriveFolderId("folder_id").build());
|
||||
when(driveConnection.createOrUpdateFile(
|
||||
anyString(), any(MediaType.class), eq("folder_id"), any(byte[].class)))
|
||||
.thenReturn("file_id");
|
||||
@@ -108,7 +108,7 @@ public class ExportPremiumTermsActionTest {
|
||||
|
||||
@Test
|
||||
void test_exportPremiumTerms_doNothing_listNotConfigured() {
|
||||
persistResource(Registry.get("tld").asBuilder().setPremiumList(null).build());
|
||||
persistResource(Tld.get("tld").asBuilder().setPremiumList(null).build());
|
||||
runAction("tld");
|
||||
|
||||
verifyNoInteractions(driveConnection);
|
||||
@@ -120,7 +120,7 @@ public class ExportPremiumTermsActionTest {
|
||||
|
||||
@Test
|
||||
void testExportPremiumTerms_doNothing_driveIdNotConfiguredInTld() {
|
||||
persistResource(Registry.get("tld").asBuilder().setDriveFolderId(null).build());
|
||||
persistResource(Tld.get("tld").asBuilder().setDriveFolderId(null).build());
|
||||
runAction("tld");
|
||||
|
||||
verifyNoInteractions(driveConnection);
|
||||
@@ -157,7 +157,7 @@ public class ExportPremiumTermsActionTest {
|
||||
|
||||
@Test
|
||||
void testExportPremiumTerms_failure_driveIdThrowsException() throws IOException {
|
||||
persistResource(Registry.get("tld").asBuilder().setDriveFolderId("bad_folder_id").build());
|
||||
persistResource(Tld.get("tld").asBuilder().setDriveFolderId("bad_folder_id").build());
|
||||
assertThrows(RuntimeException.class, () -> runAction("tld"));
|
||||
|
||||
verify(driveConnection)
|
||||
|
||||
@@ -32,7 +32,7 @@ import static org.mockito.Mockito.when;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.net.MediaType;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.model.tld.label.ReservedList;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
||||
@@ -57,7 +57,7 @@ public class ExportReservedTermsActionTest {
|
||||
action.response = response;
|
||||
action.driveConnection = driveConnection;
|
||||
action.exportUtils = new ExportUtils("# This is a disclaimer.");
|
||||
action.tld = tld;
|
||||
action.tldStr = tld;
|
||||
action.run();
|
||||
}
|
||||
|
||||
@@ -68,9 +68,8 @@ public class ExportReservedTermsActionTest {
|
||||
"lol,FULLY_BLOCKED",
|
||||
"cat,FULLY_BLOCKED");
|
||||
createTld("tld");
|
||||
persistResource(Registry.get("tld").asBuilder()
|
||||
.setReservedLists(rl)
|
||||
.setDriveFolderId("brouhaha").build());
|
||||
persistResource(
|
||||
Tld.get("tld").asBuilder().setReservedLists(rl).setDriveFolderId("brouhaha").build());
|
||||
when(driveConnection.createOrUpdateFile(
|
||||
anyString(),
|
||||
any(MediaType.class),
|
||||
@@ -91,7 +90,7 @@ public class ExportReservedTermsActionTest {
|
||||
@Test
|
||||
void test_uploadFileToDrive_doesNothingIfReservedListsNotConfigured() {
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setReservedLists(ImmutableSet.of())
|
||||
.setDriveFolderId(null)
|
||||
@@ -103,7 +102,7 @@ public class ExportReservedTermsActionTest {
|
||||
|
||||
@Test
|
||||
void test_uploadFileToDrive_doesNothingWhenDriveFolderIdIsNull() {
|
||||
persistResource(Registry.get("tld").asBuilder().setDriveFolderId(null).build());
|
||||
persistResource(Tld.get("tld").asBuilder().setDriveFolderId(null).build());
|
||||
runAction("tld");
|
||||
verify(response).setStatus(SC_OK);
|
||||
verify(response)
|
||||
@@ -129,6 +128,6 @@ public class ExportReservedTermsActionTest {
|
||||
assertThat(thrown)
|
||||
.hasCauseThat()
|
||||
.hasMessageThat()
|
||||
.isEqualTo("No registry object(s) found for fakeTld");
|
||||
.isEqualTo("No TLD object(s) found for fakeTld");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ import static google.registry.testing.DatabaseHelper.createTld;
|
||||
import static google.registry.testing.DatabaseHelper.persistReservedList;
|
||||
import static google.registry.testing.DatabaseHelper.persistResource;
|
||||
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.model.tld.label.ReservedList;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
||||
@@ -48,9 +48,9 @@ class ExportUtilsTest {
|
||||
false,
|
||||
"tine,FULLY_BLOCKED");
|
||||
createTld("tld");
|
||||
persistResource(Registry.get("tld").asBuilder().setReservedLists(rl1, rl2, rl3).build());
|
||||
persistResource(Tld.get("tld").asBuilder().setReservedLists(rl1, rl2, rl3).build());
|
||||
// Should not contain jimmy, tine, or oval.
|
||||
assertThat(new ExportUtils("# This is a disclaimer.").exportReservedTerms(Registry.get("tld")))
|
||||
assertThat(new ExportUtils("# This is a disclaimer.").exportReservedTerms(Tld.get("tld")))
|
||||
.isEqualTo("# This is a disclaimer.\ncat\nlol\nsnow\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +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.tld.Registry.TldState.PREDELEGATION;
|
||||
import static google.registry.model.tld.Tld.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 +28,7 @@ import static google.registry.testing.DatabaseHelper.persistReservedList;
|
||||
import static google.registry.testing.DatabaseHelper.persistResource;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.monitoring.whitebox.CheckApiMetric;
|
||||
import google.registry.monitoring.whitebox.CheckApiMetric.Availability;
|
||||
import google.registry.monitoring.whitebox.CheckApiMetric.Status;
|
||||
@@ -68,7 +68,7 @@ class CheckApiActionTest {
|
||||
void beforeEach() {
|
||||
createTld("example");
|
||||
persistResource(
|
||||
Registry.get("example")
|
||||
Tld.get("example")
|
||||
.asBuilder()
|
||||
.setReservedLists(
|
||||
persistReservedList(
|
||||
|
||||
@@ -18,9 +18,9 @@ import static google.registry.model.EppResourceUtils.loadByForeignKey;
|
||||
import static google.registry.model.eppoutput.Result.Code.SUCCESS;
|
||||
import static google.registry.model.eppoutput.Result.Code.SUCCESS_AND_CLOSE;
|
||||
import static google.registry.model.eppoutput.Result.Code.SUCCESS_WITH_ACTION_PENDING;
|
||||
import static google.registry.model.tld.Registry.TldState.GENERAL_AVAILABILITY;
|
||||
import static google.registry.model.tld.Registry.TldState.PREDELEGATION;
|
||||
import static google.registry.model.tld.Registry.TldState.START_DATE_SUNRISE;
|
||||
import static google.registry.model.tld.Tld.TldState.GENERAL_AVAILABILITY;
|
||||
import static google.registry.model.tld.Tld.TldState.PREDELEGATION;
|
||||
import static google.registry.model.tld.Tld.TldState.START_DATE_SUNRISE;
|
||||
import static google.registry.testing.DatabaseHelper.assertBillingEventsForResource;
|
||||
import static google.registry.testing.DatabaseHelper.createTld;
|
||||
import static google.registry.testing.DatabaseHelper.createTlds;
|
||||
@@ -44,8 +44,8 @@ import google.registry.model.billing.BillingEvent.Reason;
|
||||
import google.registry.model.domain.Domain;
|
||||
import google.registry.model.domain.DomainHistory;
|
||||
import google.registry.model.reporting.HistoryEntry.Type;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Registry.TldState;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.model.tld.Tld.TldState;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
||||
import google.registry.testing.TaskQueueExtension;
|
||||
@@ -512,13 +512,16 @@ class EppLifecycleDomainTest extends EppTestCase {
|
||||
|
||||
// Set the EAP schedule.
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setEapFeeSchedule(
|
||||
ImmutableSortedMap.of(
|
||||
START_OF_TIME, Money.of(USD, 0),
|
||||
DateTime.parse("2000-06-01T00:00:00Z"), Money.of(USD, 100),
|
||||
DateTime.parse("2000-06-02T00:00:00Z"), Money.of(USD, 0)))
|
||||
START_OF_TIME,
|
||||
Money.of(USD, 0),
|
||||
DateTime.parse("2000-06-01T00:00:00Z"),
|
||||
Money.of(USD, 100),
|
||||
DateTime.parse("2000-06-02T00:00:00Z"),
|
||||
Money.of(USD, 0)))
|
||||
.build());
|
||||
|
||||
// Create domain example.tld, which should have an EAP fee of USD 100.
|
||||
@@ -546,7 +549,7 @@ class EppLifecycleDomainTest extends EppTestCase {
|
||||
.setPeriodYears(1)
|
||||
.setCost(Money.parse("USD 100.00"))
|
||||
.setEventTime(createTime)
|
||||
.setBillingTime(createTime.plus(Registry.get("tld").getRenewGracePeriodLength()))
|
||||
.setBillingTime(createTime.plus(Tld.get("tld").getRenewGracePeriodLength()))
|
||||
.setDomainHistory(
|
||||
getOnlyHistoryEntryOfType(domain, Type.DOMAIN_CREATE, DomainHistory.class))
|
||||
.build();
|
||||
|
||||
@@ -36,7 +36,7 @@ import google.registry.model.domain.Domain;
|
||||
import google.registry.model.domain.DomainHistory;
|
||||
import google.registry.model.eppcommon.EppXmlTransformer;
|
||||
import google.registry.model.reporting.HistoryEntry.Type;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.monitoring.whitebox.EppMetric;
|
||||
import google.registry.persistence.VKey;
|
||||
import google.registry.testing.FakeClock;
|
||||
@@ -310,7 +310,7 @@ public class EppTestCase {
|
||||
.setCost(Money.parse("USD 26.00"))
|
||||
.setPeriodYears(2)
|
||||
.setEventTime(createTime)
|
||||
.setBillingTime(createTime.plus(Registry.get(domain.getTld()).getAddGracePeriodLength()))
|
||||
.setBillingTime(createTime.plus(Tld.get(domain.getTld()).getAddGracePeriodLength()))
|
||||
.setDomainHistory(
|
||||
getOnlyHistoryEntryOfType(domain, Type.DOMAIN_CREATE, DomainHistory.class))
|
||||
.build();
|
||||
@@ -325,7 +325,7 @@ public class EppTestCase {
|
||||
.setCost(Money.parse("USD 33.00"))
|
||||
.setPeriodYears(3)
|
||||
.setEventTime(renewTime)
|
||||
.setBillingTime(renewTime.plus(Registry.get(domain.getTld()).getRenewGracePeriodLength()))
|
||||
.setBillingTime(renewTime.plus(Tld.get(domain.getTld()).getRenewGracePeriodLength()))
|
||||
.setDomainHistory(getOnlyHistoryEntryOfType(domain, Type.DOMAIN_RENEW, DomainHistory.class))
|
||||
.build();
|
||||
}
|
||||
@@ -372,7 +372,7 @@ public class EppTestCase {
|
||||
.setRegistrarId(domain.getCurrentSponsorRegistrarId())
|
||||
.setEventTime(deleteTime)
|
||||
.setOneTimeEventKey(findKeyToActualOneTimeBillingEvent(billingEventToCancel))
|
||||
.setBillingTime(createTime.plus(Registry.get(domain.getTld()).getAddGracePeriodLength()))
|
||||
.setBillingTime(createTime.plus(Tld.get(domain.getTld()).getAddGracePeriodLength()))
|
||||
.setReason(Reason.CREATE)
|
||||
.setDomainHistory(
|
||||
getOnlyHistoryEntryOfType(domain, Type.DOMAIN_DELETE, DomainHistory.class))
|
||||
@@ -387,7 +387,7 @@ public class EppTestCase {
|
||||
.setRegistrarId(domain.getCurrentSponsorRegistrarId())
|
||||
.setEventTime(deleteTime)
|
||||
.setOneTimeEventKey(findKeyToActualOneTimeBillingEvent(billingEventToCancel))
|
||||
.setBillingTime(renewTime.plus(Registry.get(domain.getTld()).getRenewGracePeriodLength()))
|
||||
.setBillingTime(renewTime.plus(Tld.get(domain.getTld()).getRenewGracePeriodLength()))
|
||||
.setReason(Reason.RENEW)
|
||||
.setDomainHistory(
|
||||
getOnlyHistoryEntryOfType(domain, Type.DOMAIN_DELETE, DomainHistory.class))
|
||||
|
||||
@@ -44,7 +44,7 @@ import google.registry.model.poll.PendingActionNotificationResponse;
|
||||
import google.registry.model.poll.PollMessage;
|
||||
import google.registry.model.reporting.HistoryEntry;
|
||||
import google.registry.model.reporting.HistoryEntry.Type;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.model.transfer.TransferData;
|
||||
import google.registry.model.transfer.TransferResponse;
|
||||
import google.registry.model.transfer.TransferStatus;
|
||||
@@ -90,7 +90,7 @@ class ContactDeleteFlowTest extends ResourceFlowTestCase<ContactDeleteFlow, Cont
|
||||
persistContactWithPendingTransfer(
|
||||
persistActiveContact(getUniqueIdFromCommand()),
|
||||
transferRequestTime,
|
||||
transferRequestTime.plus(Registry.DEFAULT_TRANSFER_GRACE_PERIOD),
|
||||
transferRequestTime.plus(Tld.DEFAULT_TRANSFER_GRACE_PERIOD),
|
||||
clock.nowUtc())
|
||||
.getTransferData();
|
||||
clock.advanceOneMilli();
|
||||
|
||||
@@ -23,7 +23,7 @@ import google.registry.flows.Flow;
|
||||
import google.registry.flows.ResourceFlowTestCase;
|
||||
import google.registry.model.EppResource;
|
||||
import google.registry.model.contact.Contact;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.model.transfer.TransferStatus;
|
||||
import google.registry.persistence.transaction.JpaTransactionManagerExtension;
|
||||
import org.joda.time.DateTime;
|
||||
@@ -44,13 +44,13 @@ abstract class ContactTransferFlowTestCase<F extends Flow, R extends EppResource
|
||||
|
||||
private static final DateTime TRANSFER_REQUEST_TIME = DateTime.parse("2000-06-06T22:00:00.0Z");
|
||||
private static final DateTime TRANSFER_EXPIRATION_TIME =
|
||||
TRANSFER_REQUEST_TIME.plus(Registry.DEFAULT_TRANSFER_GRACE_PERIOD);
|
||||
TRANSFER_REQUEST_TIME.plus(Tld.DEFAULT_TRANSFER_GRACE_PERIOD);
|
||||
private static final Duration TIME_SINCE_REQUEST = Duration.standardDays(3);
|
||||
|
||||
protected Contact contact;
|
||||
|
||||
ContactTransferFlowTestCase() {
|
||||
checkState(!Registry.DEFAULT_TRANSFER_GRACE_PERIOD.isShorterThan(TIME_SINCE_REQUEST));
|
||||
checkState(!Tld.DEFAULT_TRANSFER_GRACE_PERIOD.isShorterThan(TIME_SINCE_REQUEST));
|
||||
clock.setTo(TRANSFER_REQUEST_TIME.plus(TIME_SINCE_REQUEST));
|
||||
}
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@ import static google.registry.model.domain.token.AllocationToken.TokenType.DEFAU
|
||||
import static google.registry.model.domain.token.AllocationToken.TokenType.SINGLE_USE;
|
||||
import static google.registry.model.domain.token.AllocationToken.TokenType.UNLIMITED_USE;
|
||||
import static google.registry.model.eppoutput.CheckData.DomainCheck.create;
|
||||
import static google.registry.model.tld.Registry.TldState.PREDELEGATION;
|
||||
import static google.registry.model.tld.Registry.TldState.START_DATE_SUNRISE;
|
||||
import static google.registry.model.tld.Tld.TldState.PREDELEGATION;
|
||||
import static google.registry.model.tld.Tld.TldState.START_DATE_SUNRISE;
|
||||
import static google.registry.testing.DatabaseHelper.createTld;
|
||||
import static google.registry.testing.DatabaseHelper.createTlds;
|
||||
import static google.registry.testing.DatabaseHelper.loadRegistrar;
|
||||
@@ -81,8 +81,8 @@ import google.registry.model.domain.token.AllocationToken.TokenStatus;
|
||||
import google.registry.model.eppcommon.StatusValue;
|
||||
import google.registry.model.reporting.HistoryEntry;
|
||||
import google.registry.model.reporting.HistoryEntry.HistoryEntryId;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Registry.TldState;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.model.tld.Tld.TldState;
|
||||
import google.registry.model.tld.label.ReservedList;
|
||||
import google.registry.testing.DatabaseHelper;
|
||||
import java.math.BigDecimal;
|
||||
@@ -119,7 +119,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||
@BeforeEach
|
||||
void initCheckTest() {
|
||||
createTld("tld", TldState.QUIET_PERIOD);
|
||||
persistResource(Registry.get("tld").asBuilder().setReservedLists(createReservedList()).build());
|
||||
persistResource(Tld.get("tld").asBuilder().setReservedLists(createReservedList()).build());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -195,7 +195,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||
void testSuccess_allocationToken_premiumAnchorTenant_noFee() throws Exception {
|
||||
createTld("example");
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setPremiumList(persistPremiumList("example1", USD, "example1,USD 100"))
|
||||
.build());
|
||||
@@ -509,7 +509,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||
@Test
|
||||
void testSuccess_oneReservedInSunrise() throws Exception {
|
||||
createTld("tld", START_DATE_SUNRISE);
|
||||
persistResource(Registry.get("tld").asBuilder().setReservedLists(createReservedList()).build());
|
||||
persistResource(Tld.get("tld").asBuilder().setReservedLists(createReservedList()).build());
|
||||
setEppInput("domain_check_one_tld_reserved.xml");
|
||||
doCheckTest(
|
||||
create(false, "reserved.tld", "Reserved"),
|
||||
@@ -531,7 +531,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||
@Test
|
||||
void testSuccess_domainWithMultipleReservationType_useMostSevereMessage() throws Exception {
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setReservedLists(
|
||||
createReservedList(),
|
||||
@@ -567,7 +567,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||
void testSuccess_multipartTld_oneReserved() throws Exception {
|
||||
createTld("tld.foo");
|
||||
persistResource(
|
||||
Registry.get("tld.foo")
|
||||
Tld.get("tld.foo")
|
||||
.asBuilder()
|
||||
.setReservedLists(
|
||||
persistReservedList(
|
||||
@@ -643,7 +643,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||
@Test
|
||||
void testFailure_missingBillingAccount() {
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setCurrency(JPY)
|
||||
.setCreateBillingCost(Money.ofMajor(JPY, 800))
|
||||
@@ -797,7 +797,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||
.setDiscountFraction(0.5)
|
||||
.build());
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setDefaultPromoTokens(ImmutableList.of(defaultToken.createVKey()))
|
||||
.build());
|
||||
@@ -814,7 +814,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||
@Test
|
||||
void testFeeExtension_multipleReservations() throws Exception {
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setReservedLists(
|
||||
persistReservedList("example-sunrise", "allowedinsunrise,ALLOWED_IN_SUNRISE"))
|
||||
@@ -940,7 +940,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||
.setDiscountFraction(0.5)
|
||||
.build());
|
||||
persistResource(
|
||||
Registry.get("example")
|
||||
Tld.get("example")
|
||||
.asBuilder()
|
||||
.setDefaultPromoTokens(ImmutableList.of(defaultToken.createVKey()))
|
||||
.build());
|
||||
@@ -962,7 +962,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||
.setDiscountFraction(0.5)
|
||||
.build());
|
||||
persistResource(
|
||||
Registry.get("example")
|
||||
Tld.get("example")
|
||||
.asBuilder()
|
||||
.setDefaultPromoTokens(ImmutableList.of(defaultToken.createVKey()))
|
||||
.build());
|
||||
@@ -984,7 +984,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||
.setDiscountFraction(0.5)
|
||||
.build());
|
||||
persistResource(
|
||||
Registry.get("example")
|
||||
Tld.get("example")
|
||||
.asBuilder()
|
||||
.setDefaultPromoTokens(ImmutableList.of(defaultToken.createVKey()))
|
||||
.build());
|
||||
@@ -1030,7 +1030,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||
setEppInput("domain_check_fee_premium_v06.xml");
|
||||
clock.setTo(DateTime.parse("2010-01-01T10:00:00Z"));
|
||||
persistResource(
|
||||
Registry.get("example")
|
||||
Tld.get("example")
|
||||
.asBuilder()
|
||||
.setEapFeeSchedule(
|
||||
new ImmutableSortedMap.Builder<DateTime, Money>(Ordering.natural())
|
||||
@@ -1059,7 +1059,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||
persistPendingDeleteDomain("rich.example");
|
||||
setEppInput("domain_check_fee_premium_v06.xml");
|
||||
persistResource(
|
||||
Registry.get("example")
|
||||
Tld.get("example")
|
||||
.asBuilder()
|
||||
.setEapFeeSchedule(
|
||||
new ImmutableSortedMap.Builder<DateTime, Money>(Ordering.natural())
|
||||
@@ -1136,8 +1136,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||
// Note that the response xml expects to see "11.10" with two digits after the decimal point.
|
||||
// This works because Money.getAmount(), used in the flow, returns a BigDecimal that is set to
|
||||
// display the number of digits that is conventional for the given currency.
|
||||
persistResource(
|
||||
Registry.get("tld").asBuilder().setCreateBillingCost(Money.of(USD, 11.1)).build());
|
||||
persistResource(Tld.get("tld").asBuilder().setCreateBillingCost(Money.of(USD, 11.1)).build());
|
||||
setEppInput("domain_check_fee_fractional.xml");
|
||||
runFlowAssertResponse(loadFile("domain_check_fee_fractional_response.xml"));
|
||||
}
|
||||
@@ -1146,7 +1145,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||
@Test
|
||||
void testFeeExtension_reservedName_v06() throws Exception {
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setReservedLists(createReservedList())
|
||||
.setPremiumList(persistPremiumList("tld", USD, "premiumcollision,USD 70"))
|
||||
@@ -1158,7 +1157,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||
@Test
|
||||
void testFeeExtension_reservedName_restoreFeeWithDupes_v06() throws Exception {
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setReservedLists(createReservedList())
|
||||
.setPremiumList(persistPremiumList("tld", USD, "premiumcollision,USD 70"))
|
||||
@@ -1173,7 +1172,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||
@Test
|
||||
void testFeeExtension_reservedName_v11_create() throws Exception {
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setReservedLists(createReservedList())
|
||||
.setPremiumList(persistPremiumList("tld", USD, "premiumcollision,USD 70"))
|
||||
@@ -1185,7 +1184,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||
@Test
|
||||
void testFeeExtension_reservedName_v11_renew() throws Exception {
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setReservedLists(createReservedList())
|
||||
.setPremiumList(persistPremiumList("tld", USD, "premiumcollision,USD 70"))
|
||||
@@ -1197,7 +1196,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||
@Test
|
||||
void testFeeExtension_reservedName_v11_transfer() throws Exception {
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setReservedLists(createReservedList())
|
||||
.setPremiumList(persistPremiumList("tld", USD, "premiumcollision,USD 70"))
|
||||
@@ -1209,7 +1208,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||
@Test
|
||||
void testFeeExtension_reservedName_v11_restore() throws Exception {
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setReservedLists(createReservedList())
|
||||
.setPremiumList(persistPremiumList("tld", USD, "premiumcollision,USD 70"))
|
||||
@@ -1221,7 +1220,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||
@Test
|
||||
void testFeeExtension_reservedName_v11_restore_withRenewals() throws Exception {
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setReservedLists(createReservedList())
|
||||
.setPremiumList(persistPremiumList("tld", USD, "premiumcollision,USD 70"))
|
||||
@@ -1238,7 +1237,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||
@Test
|
||||
void testFeeExtension_reservedName_v12() throws Exception {
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setReservedLists(createReservedList())
|
||||
.setPremiumList(persistPremiumList("tld", USD, "premiumcollision,USD 70"))
|
||||
@@ -1250,7 +1249,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||
@Test
|
||||
void testFeeExtension_reservedName_restoreFeeWithDupes_v12() throws Exception {
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setReservedLists(createReservedList())
|
||||
.setPremiumList(persistPremiumList("tld", USD, "premiumcollision,USD 70"))
|
||||
@@ -1265,7 +1264,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||
void testFeeExtension_feesNotOmittedOnReservedNamesInSunrise_v06() throws Exception {
|
||||
createTld("tld", START_DATE_SUNRISE);
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setReservedLists(createReservedList())
|
||||
.setPremiumList(persistPremiumList("tld", USD, "premiumcollision,USD 70"))
|
||||
@@ -1279,7 +1278,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||
throws Exception {
|
||||
createTld("tld", START_DATE_SUNRISE);
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setReservedLists(createReservedList())
|
||||
.setPremiumList(persistPremiumList("tld", USD, "premiumcollision,USD 70"))
|
||||
@@ -1297,7 +1296,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||
void testFeeExtension_feesNotOmittedOnReservedNamesInSunrise_v11_create() throws Exception {
|
||||
createTld("tld", START_DATE_SUNRISE);
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setReservedLists(createReservedList())
|
||||
.setPremiumList(persistPremiumList("tld", USD, "premiumcollision,USD 70"))
|
||||
@@ -1310,7 +1309,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||
void testFeeExtension_feesNotOmittedOnReservedNamesInSunrise_v11_renew() throws Exception {
|
||||
createTld("tld", START_DATE_SUNRISE);
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setReservedLists(createReservedList())
|
||||
.setPremiumList(persistPremiumList("tld", USD, "premiumcollision,USD 70"))
|
||||
@@ -1323,7 +1322,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||
void testFeeExtension_feesNotOmittedOnReservedNamesInSunrise_v11_transfer() throws Exception {
|
||||
createTld("tld", START_DATE_SUNRISE);
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setReservedLists(createReservedList())
|
||||
.setPremiumList(persistPremiumList("tld", USD, "premiumcollision,USD 70"))
|
||||
@@ -1336,7 +1335,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||
void testFeeExtension_feesNotOmittedOnReservedNamesInSunrise_v11_restore() throws Exception {
|
||||
createTld("tld", START_DATE_SUNRISE);
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setReservedLists(createReservedList())
|
||||
.setPremiumList(persistPremiumList("tld", USD, "premiumcollision,USD 70"))
|
||||
@@ -1349,7 +1348,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||
void testFeeExtension_feesNotOmittedOnReservedNamesInSunrise_v12() throws Exception {
|
||||
createTld("tld", START_DATE_SUNRISE);
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setReservedLists(createReservedList())
|
||||
.setPremiumList(persistPremiumList("tld", USD, "premiumcollision,USD 70"))
|
||||
@@ -1546,7 +1545,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
|
||||
clock.setTo(DateTime.parse("2010-01-01T10:00:00Z"));
|
||||
persistActiveDomain("example1.tld");
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setEapFeeSchedule(
|
||||
new ImmutableSortedMap.Builder<DateTime, Money>(Ordering.natural())
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
package google.registry.flows.domain;
|
||||
|
||||
import static google.registry.model.tld.Registry.TldState.PREDELEGATION;
|
||||
import static google.registry.model.tld.Tld.TldState.PREDELEGATION;
|
||||
import static google.registry.testing.DatabaseHelper.assertNoBillingEvents;
|
||||
import static google.registry.testing.DatabaseHelper.createTld;
|
||||
import static google.registry.testing.DatabaseHelper.createTlds;
|
||||
@@ -39,8 +39,8 @@ import google.registry.flows.domain.DomainFlowUtils.NotAuthorizedForTldException
|
||||
import google.registry.flows.domain.DomainFlowUtils.TldDoesNotExistException;
|
||||
import google.registry.flows.exceptions.TooManyResourceChecksException;
|
||||
import google.registry.model.domain.Domain;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Registry.TldState;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.model.tld.Tld.TldState;
|
||||
import org.joda.money.Money;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -131,7 +131,7 @@ public class DomainClaimsCheckFlowTest extends ResourceFlowTestCase<DomainClaims
|
||||
@Test
|
||||
void testFailure_missingBillingAccount() {
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setCurrency(JPY)
|
||||
.setCreateBillingCost(Money.ofMajor(JPY, 800))
|
||||
@@ -180,7 +180,7 @@ public class DomainClaimsCheckFlowTest extends ResourceFlowTestCase<DomainClaims
|
||||
void testFailure_multipleTlds_oneHasEndedClaims() {
|
||||
createTlds("tld1", "tld2");
|
||||
persistResource(
|
||||
Registry.get("tld2").asBuilder().setClaimsPeriodEnd(clock.nowUtc().minusMillis(1)).build());
|
||||
Tld.get("tld2").asBuilder().setClaimsPeriodEnd(clock.nowUtc().minusMillis(1)).build());
|
||||
setEppInput("domain_check_claims_multiple_tlds.xml");
|
||||
EppException thrown = assertThrows(ClaimsPeriodEndedException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
|
||||
@@ -32,10 +32,10 @@ import static google.registry.model.domain.token.AllocationToken.TokenType.SINGL
|
||||
import static google.registry.model.domain.token.AllocationToken.TokenType.UNLIMITED_USE;
|
||||
import static google.registry.model.eppcommon.StatusValue.PENDING_DELETE;
|
||||
import static google.registry.model.eppcommon.StatusValue.SERVER_HOLD;
|
||||
import static google.registry.model.tld.Registry.TldState.GENERAL_AVAILABILITY;
|
||||
import static google.registry.model.tld.Registry.TldState.PREDELEGATION;
|
||||
import static google.registry.model.tld.Registry.TldState.QUIET_PERIOD;
|
||||
import static google.registry.model.tld.Registry.TldState.START_DATE_SUNRISE;
|
||||
import static google.registry.model.tld.Tld.TldState.GENERAL_AVAILABILITY;
|
||||
import static google.registry.model.tld.Tld.TldState.PREDELEGATION;
|
||||
import static google.registry.model.tld.Tld.TldState.QUIET_PERIOD;
|
||||
import static google.registry.model.tld.Tld.TldState.START_DATE_SUNRISE;
|
||||
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
||||
import static google.registry.pricing.PricingEngineProxy.isDomainPremium;
|
||||
import static google.registry.testing.DatabaseHelper.assertBillingEvents;
|
||||
@@ -168,9 +168,9 @@ import google.registry.model.reporting.DomainTransactionRecord;
|
||||
import google.registry.model.reporting.DomainTransactionRecord.TransactionReportField;
|
||||
import google.registry.model.reporting.HistoryEntry;
|
||||
import google.registry.model.reporting.HistoryEntry.HistoryEntryId;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Registry.TldState;
|
||||
import google.registry.model.tld.Registry.TldType;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.model.tld.Tld.TldState;
|
||||
import google.registry.model.tld.Tld.TldType;
|
||||
import google.registry.monitoring.whitebox.EppMetric;
|
||||
import google.registry.persistence.VKey;
|
||||
import google.registry.testing.DatabaseHelper;
|
||||
@@ -229,7 +229,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||
.setDomainName("anchor.tld")
|
||||
.build());
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setReservedLists(
|
||||
persistReservedList(
|
||||
@@ -291,12 +291,12 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||
.build();
|
||||
Money eapFee =
|
||||
Money.of(
|
||||
Registry.get(domainTld).getCurrency(),
|
||||
Registry.get(domainTld).getEapFeeFor(clock.nowUtc()).getCost());
|
||||
Tld.get(domainTld).getCurrency(),
|
||||
Tld.get(domainTld).getEapFeeFor(clock.nowUtc()).getCost());
|
||||
DateTime billingTime =
|
||||
isAnchorTenant
|
||||
? clock.nowUtc().plus(Registry.get(domainTld).getAnchorTenantAddGracePeriodLength())
|
||||
: clock.nowUtc().plus(Registry.get(domainTld).getAddGracePeriodLength());
|
||||
? clock.nowUtc().plus(Tld.get(domainTld).getAnchorTenantAddGracePeriodLength())
|
||||
: clock.nowUtc().plus(Tld.get(domainTld).getAddGracePeriodLength());
|
||||
assertLastHistoryContainsResource(domain);
|
||||
DomainHistory historyEntry = getHistoryEntries(domain, DomainHistory.class).get(0);
|
||||
assertAboutDomains()
|
||||
@@ -818,7 +818,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||
setEppInput("domain_create_premium_eap.xml");
|
||||
persistContactsAndHosts("net");
|
||||
persistResource(
|
||||
Registry.get("example")
|
||||
Tld.get("example")
|
||||
.asBuilder()
|
||||
.setEapFeeSchedule(
|
||||
ImmutableSortedMap.of(
|
||||
@@ -851,10 +851,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||
@Test
|
||||
void testSuccess_nonDefaultAddGracePeriod() throws Exception {
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
.asBuilder()
|
||||
.setAddGracePeriodLength(Duration.standardMinutes(6))
|
||||
.build());
|
||||
Tld.get("tld").asBuilder().setAddGracePeriodLength(Duration.standardMinutes(6)).build());
|
||||
persistContactsAndHosts();
|
||||
doSuccessfulTest();
|
||||
}
|
||||
@@ -956,7 +953,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||
.setTokenType(SINGLE_USE)
|
||||
.build());
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setTldStateTransitions(
|
||||
ImmutableSortedMap.of(
|
||||
@@ -980,7 +977,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||
void testSuccess_noClaimsNotice_forClaimsListName_afterClaimsPeriodEnd() throws Exception {
|
||||
persistClaimsList(ImmutableMap.of("example", CLAIMS_KEY));
|
||||
persistContactsAndHosts();
|
||||
persistResource(Registry.get("tld").asBuilder().setClaimsPeriodEnd(clock.nowUtc()).build());
|
||||
persistResource(Tld.get("tld").asBuilder().setClaimsPeriodEnd(clock.nowUtc()).build());
|
||||
runFlowAssertResponse(
|
||||
loadFile("domain_create_response.xml", ImmutableMap.of("DOMAIN", "example.tld")));
|
||||
assertSuccessfulCreate("tld", ImmutableSet.of());
|
||||
@@ -1009,7 +1006,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||
setEppInput("domain_create_claim_notice.xml");
|
||||
persistClaimsList(ImmutableMap.of("example-one", CLAIMS_KEY));
|
||||
persistContactsAndHosts();
|
||||
persistResource(Registry.get("tld").asBuilder().setClaimsPeriodEnd(clock.nowUtc()).build());
|
||||
persistResource(Tld.get("tld").asBuilder().setClaimsPeriodEnd(clock.nowUtc()).build());
|
||||
EppException thrown = assertThrows(ClaimsPeriodEndedException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
@@ -1065,8 +1062,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||
@Test
|
||||
void testFailure_wrongFeeAmount_v06() {
|
||||
setEppInput("domain_create_fee.xml", ImmutableMap.of("FEE_VERSION", "0.6", "CURRENCY", "USD"));
|
||||
persistResource(
|
||||
Registry.get("tld").asBuilder().setCreateBillingCost(Money.of(USD, 20)).build());
|
||||
persistResource(Tld.get("tld").asBuilder().setCreateBillingCost(Money.of(USD, 20)).build());
|
||||
persistContactsAndHosts();
|
||||
EppException thrown = assertThrows(FeesMismatchException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
@@ -1084,7 +1080,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||
.setDiscountFraction(0.5)
|
||||
.build());
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setDefaultPromoTokens(ImmutableList.of(defaultToken.createVKey()))
|
||||
.setCreateBillingCost(Money.of(USD, 8))
|
||||
@@ -1111,7 +1107,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||
.setDiscountFraction(0.5)
|
||||
.build());
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setDefaultPromoTokens(ImmutableList.of(defaultToken.createVKey()))
|
||||
.setCreateBillingCost(Money.of(USD, 100))
|
||||
@@ -1126,8 +1122,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||
@Test
|
||||
void testFailure_wrongFeeAmount_v11() {
|
||||
setEppInput("domain_create_fee.xml", ImmutableMap.of("FEE_VERSION", "0.11", "CURRENCY", "USD"));
|
||||
persistResource(
|
||||
Registry.get("tld").asBuilder().setCreateBillingCost(Money.of(USD, 20)).build());
|
||||
persistResource(Tld.get("tld").asBuilder().setCreateBillingCost(Money.of(USD, 20)).build());
|
||||
persistContactsAndHosts();
|
||||
EppException thrown = assertThrows(FeesMismatchException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
@@ -1145,7 +1140,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||
.setDiscountFraction(0.5)
|
||||
.build());
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setDefaultPromoTokens(ImmutableList.of(defaultToken.createVKey()))
|
||||
.setCreateBillingCost(Money.of(USD, 8))
|
||||
@@ -1172,7 +1167,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||
.setDiscountFraction(0.5)
|
||||
.build());
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setDefaultPromoTokens(ImmutableList.of(defaultToken.createVKey()))
|
||||
.setCreateBillingCost(Money.of(USD, 100))
|
||||
@@ -1187,8 +1182,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||
@Test
|
||||
void testFailure_wrongFeeAmount_v12() {
|
||||
setEppInput("domain_create_fee.xml", ImmutableMap.of("FEE_VERSION", "0.12", "CURRENCY", "USD"));
|
||||
persistResource(
|
||||
Registry.get("tld").asBuilder().setCreateBillingCost(Money.of(USD, 20)).build());
|
||||
persistResource(Tld.get("tld").asBuilder().setCreateBillingCost(Money.of(USD, 20)).build());
|
||||
persistContactsAndHosts();
|
||||
EppException thrown = assertThrows(FeesMismatchException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
@@ -1206,7 +1200,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||
.setDiscountFraction(0.5)
|
||||
.build());
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setDefaultPromoTokens(ImmutableList.of(defaultToken.createVKey()))
|
||||
.setCreateBillingCost(Money.of(USD, 8))
|
||||
@@ -1233,7 +1227,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||
.setDiscountFraction(0.5)
|
||||
.build());
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setDefaultPromoTokens(ImmutableList.of(defaultToken.createVKey()))
|
||||
.setCreateBillingCost(Money.of(USD, 100))
|
||||
@@ -1377,7 +1371,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||
.setTokenType(SINGLE_USE)
|
||||
.build());
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setReservedLists(
|
||||
persistReservedList("anchor-with-claims", "example-one,RESERVED_FOR_ANCHOR_TENANT"))
|
||||
@@ -1447,7 +1441,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||
.setTokenType(SINGLE_USE)
|
||||
.build());
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setReservedLists(
|
||||
persistReservedList("anchor_tenants", "test-validate,RESERVED_FOR_ANCHOR_TENANT"))
|
||||
@@ -1475,7 +1469,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||
@Test
|
||||
void testSuccess_anchorTenant_duringQuietPeriodBeforeSunrise() throws Exception {
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setTldStateTransitions(
|
||||
new ImmutableSortedMap.Builder<DateTime, TldState>(Ordering.natural())
|
||||
@@ -1518,7 +1512,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||
@Test
|
||||
void testSuccess_reservedDomain_viaAllocationTokenExtension_inQuietPeriod() throws Exception {
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setTldStateTransitions(ImmutableSortedMap.of(START_OF_TIME, QUIET_PERIOD))
|
||||
.build());
|
||||
@@ -1816,7 +1810,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||
.setAllowedTlds(ImmutableSet.of("tld"))
|
||||
.build());
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setDefaultPromoTokens(
|
||||
ImmutableList.of(defaultToken1.createVKey(), defaultToken2.createVKey()))
|
||||
@@ -1850,7 +1844,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||
.setAllowedTlds(ImmutableSet.of("tld"))
|
||||
.build());
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setDefaultPromoTokens(
|
||||
ImmutableList.of(defaultToken1.createVKey(), defaultToken2.createVKey()))
|
||||
@@ -1888,7 +1882,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||
.setAllowedTlds(ImmutableSet.of("tld"))
|
||||
.build());
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setDefaultPromoTokens(
|
||||
ImmutableList.of(defaultToken1.createVKey(), defaultToken2.createVKey()))
|
||||
@@ -1915,7 +1909,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||
.setAllowedTlds(ImmutableSet.of("tld"))
|
||||
.build());
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setDefaultPromoTokens(
|
||||
ImmutableList.of(defaultToken1.createVKey(), defaultToken2.createVKey()))
|
||||
@@ -1942,7 +1936,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||
.setAllowedTlds(ImmutableSet.of("tld"))
|
||||
.build());
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setDefaultPromoTokens(
|
||||
ImmutableList.of(defaultToken1.createVKey(), defaultToken2.createVKey()))
|
||||
@@ -1972,7 +1966,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||
.setAllowedTlds(ImmutableSet.of("tld"))
|
||||
.build());
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setDefaultPromoTokens(
|
||||
ImmutableList.of(defaultToken1.createVKey(), defaultToken2.createVKey()))
|
||||
@@ -2002,7 +1996,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||
.setAllowedTlds(ImmutableSet.of("tld"))
|
||||
.build());
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setDefaultPromoTokens(
|
||||
ImmutableList.of(defaultToken1.createVKey(), defaultToken2.createVKey()))
|
||||
@@ -2039,7 +2033,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||
.build())
|
||||
.build());
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setDefaultPromoTokens(
|
||||
ImmutableList.of(defaultToken1.createVKey(), defaultToken2.createVKey()))
|
||||
@@ -2077,7 +2071,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||
void testSuccess_reservedNameCollisionDomain_inSunrise_setsServerHoldAndPollMessage()
|
||||
throws Exception {
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setTldStateTransitions(ImmutableSortedMap.of(START_OF_TIME, START_DATE_SUNRISE))
|
||||
.build());
|
||||
@@ -2772,7 +2766,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||
void testFailure_missingBillingAccountMap() {
|
||||
persistContactsAndHosts();
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setCurrency(JPY)
|
||||
.setCreateBillingCost(Money.ofMajor(JPY, 800))
|
||||
@@ -2792,7 +2786,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||
persistActiveContact("someone");
|
||||
persistContactsAndHosts();
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setAllowedRegistrantContactIds(ImmutableSet.of("someone"))
|
||||
.build());
|
||||
@@ -2805,7 +2799,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||
void testFailure_nameserverNotAllowListed() {
|
||||
persistContactsAndHosts();
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns2.example.net"))
|
||||
.build());
|
||||
@@ -2818,7 +2812,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||
void testFailure_emptyNameserverFailsAllowList() {
|
||||
setEppInput("domain_create_no_hosts_or_dsdata.xml", ImmutableMap.of("DOMAIN", "example.tld"));
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("somethingelse.example.net"))
|
||||
.build());
|
||||
@@ -2832,7 +2826,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||
@Test
|
||||
void testSuccess_nameserverAndRegistrantAllowListed() throws Exception {
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setAllowedRegistrantContactIds(ImmutableSet.of("jd1234"))
|
||||
.setAllowedFullyQualifiedHostNames(
|
||||
@@ -3024,7 +3018,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||
|
||||
private void setEapForTld(String tld) {
|
||||
persistResource(
|
||||
Registry.get(tld)
|
||||
Tld.get(tld)
|
||||
.asBuilder()
|
||||
.setEapFeeSchedule(
|
||||
ImmutableSortedMap.of(
|
||||
@@ -3041,7 +3035,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||
void testSuccess_eapFee_beforeEntireSchedule() throws Exception {
|
||||
persistContactsAndHosts();
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setEapFeeSchedule(
|
||||
ImmutableSortedMap.of(
|
||||
@@ -3059,7 +3053,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||
void testSuccess_eapFee_afterEntireSchedule() throws Exception {
|
||||
persistContactsAndHosts();
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setEapFeeSchedule(
|
||||
ImmutableSortedMap.of(
|
||||
@@ -3095,10 +3089,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||
void testIcannTransactionRecord_getsStored() throws Exception {
|
||||
persistContactsAndHosts();
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
.asBuilder()
|
||||
.setAddGracePeriodLength(Duration.standardMinutes(9))
|
||||
.build());
|
||||
Tld.get("tld").asBuilder().setAddGracePeriodLength(Duration.standardMinutes(9)).build());
|
||||
runFlow();
|
||||
Domain domain = reloadResourceByForeignKey();
|
||||
DomainHistory historyEntry = (DomainHistory) getHistoryEntries(domain).get(0);
|
||||
@@ -3114,7 +3105,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||
@Test
|
||||
void testIcannTransactionRecord_testTld_notStored() throws Exception {
|
||||
persistContactsAndHosts();
|
||||
persistResource(Registry.get("tld").asBuilder().setTldType(TldType.TEST).build());
|
||||
persistResource(Tld.get("tld").asBuilder().setTldType(TldType.TEST).build());
|
||||
runFlow();
|
||||
Domain domain = reloadResourceByForeignKey();
|
||||
DomainHistory historyEntry = (DomainHistory) getHistoryEntries(domain).get(0);
|
||||
@@ -3267,7 +3258,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||
"domain_create_allocationtoken.xml",
|
||||
ImmutableMap.of("DOMAIN", "example.tld", "YEARS", "2"));
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setTldStateTransitions(ImmutableSortedMap.of(START_OF_TIME, QUIET_PERIOD))
|
||||
.build());
|
||||
@@ -3289,7 +3280,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||
"domain_create_allocationtoken.xml",
|
||||
ImmutableMap.of("DOMAIN", "example.tld", "YEARS", "2"));
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setTldStateTransitions(ImmutableSortedMap.of(START_OF_TIME, QUIET_PERIOD))
|
||||
.build());
|
||||
@@ -3306,7 +3297,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||
"domain_create_allocationtoken.xml",
|
||||
ImmutableMap.of("DOMAIN", "example.tld", "YEARS", "2"));
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setTldStateTransitions(ImmutableSortedMap.of(START_OF_TIME, QUIET_PERIOD))
|
||||
.build());
|
||||
@@ -3325,7 +3316,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||
// Trademarked domains using a bypass-tld-state token should fail if we're in a quiet period
|
||||
// before the sunrise period
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setTldStateTransitions(
|
||||
ImmutableSortedMap.of(
|
||||
@@ -3348,7 +3339,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||
// Trademarked domains using a bypass-tld-state token should succeed if we're in a quiet period
|
||||
// after the sunrise period
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setTldStateTransitions(
|
||||
ImmutableSortedMap.of(
|
||||
@@ -3496,7 +3487,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||
@Test
|
||||
void testSuccess_anchorTenant_quietPeriodAfterSunrise_nonTrademarked_viaToken() throws Exception {
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setTldStateTransitions(
|
||||
ImmutableSortedMap.of(
|
||||
@@ -3527,7 +3518,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||
void testSuccess_anchorTenant_quietPeriodAfterSunrise_trademarked_withClaims_viaToken()
|
||||
throws Exception {
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setTldStateTransitions(
|
||||
ImmutableSortedMap.of(
|
||||
@@ -3553,7 +3544,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
|
||||
@Test
|
||||
void testFailure_anchorTenant_quietPeriodAfterSunrise_trademarked_withoutClaims_viaToken() {
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setTldStateTransitions(
|
||||
ImmutableSortedMap.of(
|
||||
|
||||
@@ -32,7 +32,7 @@ import static google.registry.model.reporting.DomainTransactionRecord.Transactio
|
||||
import static google.registry.model.reporting.HistoryEntry.Type.DOMAIN_CREATE;
|
||||
import static google.registry.model.reporting.HistoryEntry.Type.DOMAIN_DELETE;
|
||||
import static google.registry.model.reporting.HistoryEntry.Type.DOMAIN_TRANSFER_REQUEST;
|
||||
import static google.registry.model.tld.Registry.TldState.PREDELEGATION;
|
||||
import static google.registry.model.tld.Tld.TldState.PREDELEGATION;
|
||||
import static google.registry.testing.DatabaseHelper.assertBillingEvents;
|
||||
import static google.registry.testing.DatabaseHelper.assertPollMessages;
|
||||
import static google.registry.testing.DatabaseHelper.createTld;
|
||||
@@ -93,8 +93,8 @@ import google.registry.model.poll.PendingActionNotificationResponse.DomainPendin
|
||||
import google.registry.model.poll.PollMessage;
|
||||
import google.registry.model.reporting.DomainTransactionRecord;
|
||||
import google.registry.model.reporting.HistoryEntry;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Registry.TldType;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.model.tld.Tld.TldType;
|
||||
import google.registry.model.transfer.DomainTransferData;
|
||||
import google.registry.model.transfer.TransferResponse;
|
||||
import google.registry.model.transfer.TransferStatus;
|
||||
@@ -181,7 +181,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
|
||||
|
||||
private void setUpGracePeriodDurations() {
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setAddGracePeriodLength(standardDays(3))
|
||||
.setRenewGracePeriodLength(standardDays(2))
|
||||
@@ -291,7 +291,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
|
||||
@Test
|
||||
void testSuccess_asyncActionsAreEnqueued() throws Exception {
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setRedemptionGracePeriodLength(standardDays(3))
|
||||
.setPendingDeleteLength(standardDays(2))
|
||||
@@ -365,7 +365,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
|
||||
@Test
|
||||
void testSuccess_updatedEppUpdateTimeAfterPendingRedemption() throws Exception {
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setRedemptionGracePeriodLength(standardDays(3))
|
||||
.setPendingDeleteLength(standardDays(2))
|
||||
@@ -443,8 +443,8 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
|
||||
.hasDeletionTime(
|
||||
clock
|
||||
.nowUtc()
|
||||
.plus(Registry.get("tld").getRedemptionGracePeriodLength())
|
||||
.plus(Registry.get("tld").getPendingDeleteLength()))
|
||||
.plus(Tld.get("tld").getRedemptionGracePeriodLength())
|
||||
.plus(Tld.get("tld").getPendingDeleteLength()))
|
||||
.and()
|
||||
.hasExactlyStatusValues(StatusValue.INACTIVE, StatusValue.PENDING_DELETE)
|
||||
.and()
|
||||
@@ -464,7 +464,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
|
||||
GracePeriod.create(
|
||||
GracePeriodStatus.REDEMPTION,
|
||||
domain.getRepoId(),
|
||||
clock.nowUtc().plus(Registry.get("tld").getRedemptionGracePeriodLength()),
|
||||
clock.nowUtc().plus(Tld.get("tld").getRedemptionGracePeriodLength()),
|
||||
"TheRegistrar",
|
||||
null,
|
||||
resource.getGracePeriods().iterator().next().getGracePeriodId()));
|
||||
@@ -531,7 +531,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
|
||||
void testSuccess_nonDefaultRedemptionGracePeriod() throws Exception {
|
||||
sessionMetadata.setServiceExtensionUris(ImmutableSet.of());
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setRedemptionGracePeriodLength(Duration.standardMinutes(7))
|
||||
.build());
|
||||
@@ -542,10 +542,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
|
||||
void testSuccess_nonDefaultPendingDeleteLength() throws Exception {
|
||||
sessionMetadata.setServiceExtensionUris(ImmutableSet.of());
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
.asBuilder()
|
||||
.setPendingDeleteLength(Duration.standardMinutes(8))
|
||||
.build());
|
||||
Tld.get("tld").asBuilder().setPendingDeleteLength(Duration.standardMinutes(8)).build());
|
||||
doSuccessfulTest_noAddGracePeriod("domain_delete_response_pending.xml");
|
||||
}
|
||||
|
||||
@@ -578,7 +575,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
|
||||
removeServiceExtensionUri(ServiceExtension.FEE_0_11.getUri());
|
||||
removeServiceExtensionUri(ServiceExtension.FEE_0_12.getUri());
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setRenewBillingCostTransitions(
|
||||
ImmutableSortedMap.of(
|
||||
@@ -596,7 +593,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
|
||||
void testSuccess_autoRenewGracePeriod_priceChanges_v11() throws Exception {
|
||||
removeServiceExtensionUri(ServiceExtension.FEE_0_12.getUri());
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setRenewBillingCostTransitions(
|
||||
ImmutableSortedMap.of(
|
||||
@@ -613,7 +610,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
|
||||
@Test
|
||||
void testSuccess_autoRenewGracePeriod_priceChanges_v12() throws Exception {
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setRenewBillingCostTransitions(
|
||||
ImmutableSortedMap.of(
|
||||
@@ -656,8 +653,8 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
|
||||
.hasDeletionTime(
|
||||
clock
|
||||
.nowUtc()
|
||||
.plus(Registry.get("tld").getRedemptionGracePeriodLength())
|
||||
.plus(Registry.get("tld").getPendingDeleteLength()))
|
||||
.plus(Tld.get("tld").getRedemptionGracePeriodLength())
|
||||
.plus(Tld.get("tld").getPendingDeleteLength()))
|
||||
.and()
|
||||
.hasOneHistoryEntryEachOfTypes(DOMAIN_CREATE, DOMAIN_TRANSFER_REQUEST, DOMAIN_DELETE);
|
||||
// All existing grace periods should be gone, and a new REDEMPTION one should be added.
|
||||
@@ -666,7 +663,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
|
||||
GracePeriod.create(
|
||||
GracePeriodStatus.REDEMPTION,
|
||||
domain.getRepoId(),
|
||||
clock.nowUtc().plus(Registry.get("tld").getRedemptionGracePeriodLength()),
|
||||
clock.nowUtc().plus(Tld.get("tld").getRedemptionGracePeriodLength()),
|
||||
"TheRegistrar",
|
||||
null,
|
||||
domain.getGracePeriods().iterator().next().getGracePeriodId()));
|
||||
@@ -960,7 +957,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
|
||||
void testIcannTransactionRecord_testTld_notStored() throws Exception {
|
||||
setUpSuccessfulTest();
|
||||
setUpGracePeriodDurations();
|
||||
persistResource(Registry.get("tld").asBuilder().setTldType(TldType.TEST).build());
|
||||
persistResource(Tld.get("tld").asBuilder().setTldType(TldType.TEST).build());
|
||||
clock.advanceOneMilli();
|
||||
earlierHistoryEntry =
|
||||
persistResource(
|
||||
|
||||
@@ -17,7 +17,7 @@ package google.registry.flows.domain;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.flows.domain.DomainFlowUtils.checkHasBillingAccount;
|
||||
import static google.registry.testing.DatabaseHelper.createTld;
|
||||
import static google.registry.testing.DatabaseHelper.newRegistry;
|
||||
import static google.registry.testing.DatabaseHelper.newTld;
|
||||
import static google.registry.testing.DatabaseHelper.persistResource;
|
||||
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
|
||||
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||
@@ -38,7 +38,7 @@ import google.registry.flows.domain.DomainFlowUtils.MissingBillingAccountMapExce
|
||||
import google.registry.flows.domain.DomainFlowUtils.TldDoesNotExistException;
|
||||
import google.registry.flows.domain.DomainFlowUtils.TrailingDashException;
|
||||
import google.registry.model.domain.Domain;
|
||||
import google.registry.model.tld.Registry.TldType;
|
||||
import google.registry.model.tld.Tld.TldType;
|
||||
import google.registry.persistence.transaction.JpaTransactionManagerExtension;
|
||||
import org.joda.money.Money;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
@@ -182,7 +182,7 @@ class DomainFlowUtilsTest extends ResourceFlowTestCase<DomainInfoFlow, Domain> {
|
||||
|
||||
private void persistFoobarTld(TldType tldType) {
|
||||
persistResource(
|
||||
newRegistry("foobar", "FOOBAR")
|
||||
newTld("foobar", "FOOBAR")
|
||||
.asBuilder()
|
||||
.setTldType(tldType)
|
||||
.setCurrency(CHF)
|
||||
|
||||
@@ -20,7 +20,7 @@ import static google.registry.model.billing.BillingEvent.RenewalPriceBehavior.DE
|
||||
import static google.registry.model.billing.BillingEvent.RenewalPriceBehavior.NONPREMIUM;
|
||||
import static google.registry.model.billing.BillingEvent.RenewalPriceBehavior.SPECIFIED;
|
||||
import static google.registry.model.eppcommon.EppXmlTransformer.marshal;
|
||||
import static google.registry.model.tld.Registry.TldState.QUIET_PERIOD;
|
||||
import static google.registry.model.tld.Tld.TldState.QUIET_PERIOD;
|
||||
import static google.registry.testing.DatabaseHelper.assertNoBillingEvents;
|
||||
import static google.registry.testing.DatabaseHelper.createTld;
|
||||
import static google.registry.testing.DatabaseHelper.persistActiveContact;
|
||||
@@ -72,7 +72,7 @@ import google.registry.model.eppcommon.StatusValue;
|
||||
import google.registry.model.eppoutput.EppOutput;
|
||||
import google.registry.model.host.Host;
|
||||
import google.registry.model.reporting.HistoryEntry;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.persistence.VKey;
|
||||
import google.registry.persistence.transaction.JpaTransactionManagerExtension;
|
||||
import google.registry.testing.DatabaseHelper;
|
||||
@@ -322,7 +322,7 @@ class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Domain> {
|
||||
@Test
|
||||
void testSuccess_inQuietPeriod() throws Exception {
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setTldStateTransitions(ImmutableSortedMap.of(START_OF_TIME, QUIET_PERIOD))
|
||||
.build());
|
||||
@@ -853,7 +853,7 @@ class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Domain> {
|
||||
void testFeeExtension_renewCommandPremium_anchorTenant() throws Exception {
|
||||
createTld("tld");
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setPremiumList(persistPremiumList("tld", USD, "example,USD 70"))
|
||||
.build());
|
||||
@@ -873,7 +873,7 @@ class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Domain> {
|
||||
void testFeeExtension_renewCommandPremium_internalRegistration() throws Exception {
|
||||
createTld("tld");
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setPremiumList(persistPremiumList("tld", USD, "example,USD 70"))
|
||||
.build());
|
||||
@@ -893,7 +893,7 @@ class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Domain> {
|
||||
void testFeeExtension_renewCommandPremium_anchorTenant_multiYear() throws Exception {
|
||||
createTld("tld");
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setPremiumList(persistPremiumList("tld", USD, "example,USD 70"))
|
||||
.build());
|
||||
@@ -913,7 +913,7 @@ class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Domain> {
|
||||
void testFeeExtension_renewCommandPremium_internalRegistration_multiYear() throws Exception {
|
||||
createTld("tld");
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setPremiumList(persistPremiumList("tld", USD, "example,USD 70"))
|
||||
.build());
|
||||
|
||||
@@ -49,7 +49,7 @@ import google.registry.model.domain.DomainHistory;
|
||||
import google.registry.model.domain.fee.Fee;
|
||||
import google.registry.model.domain.token.AllocationToken;
|
||||
import google.registry.model.eppinput.EppInput;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
||||
import google.registry.testing.DatabaseHelper;
|
||||
@@ -77,7 +77,7 @@ public class DomainPricingLogicTest {
|
||||
@Mock EppInput eppInput;
|
||||
SessionMetadata sessionMetadata;
|
||||
@Mock FlowMetadata flowMetadata;
|
||||
Registry registry;
|
||||
Tld registry;
|
||||
Domain domain;
|
||||
|
||||
@BeforeEach
|
||||
@@ -89,7 +89,7 @@ public class DomainPricingLogicTest {
|
||||
new DomainPricingCustomLogic(eppInput, sessionMetadata, flowMetadata));
|
||||
registry =
|
||||
persistResource(
|
||||
Registry.get("example")
|
||||
Tld.get("example")
|
||||
.asBuilder()
|
||||
.setRenewBillingCostTransitions(
|
||||
ImmutableSortedMap.of(
|
||||
|
||||
@@ -99,7 +99,7 @@ import google.registry.model.reporting.DomainTransactionRecord;
|
||||
import google.registry.model.reporting.DomainTransactionRecord.TransactionReportField;
|
||||
import google.registry.model.reporting.HistoryEntry;
|
||||
import google.registry.model.reporting.HistoryEntry.HistoryEntryId;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.persistence.VKey;
|
||||
import google.registry.testing.DatabaseHelper;
|
||||
import java.util.Map;
|
||||
@@ -281,7 +281,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||
.setCost(totalRenewCost)
|
||||
.setPeriodYears(renewalYears)
|
||||
.setEventTime(clock.nowUtc())
|
||||
.setBillingTime(clock.nowUtc().plus(Registry.get("tld").getRenewGracePeriodLength()))
|
||||
.setBillingTime(clock.nowUtc().plus(Tld.get("tld").getRenewGracePeriodLength()))
|
||||
.setDomainHistory(historyEntryDomainRenew)
|
||||
.build();
|
||||
assertBillingEvents(
|
||||
@@ -327,7 +327,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||
GracePeriod.create(
|
||||
GracePeriodStatus.RENEW,
|
||||
domain.getRepoId(),
|
||||
clock.nowUtc().plus(Registry.get("tld").getRenewGracePeriodLength()),
|
||||
clock.nowUtc().plus(Tld.get("tld").getRenewGracePeriodLength()),
|
||||
renewalClientId,
|
||||
null),
|
||||
renewBillingEvent));
|
||||
@@ -397,7 +397,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||
@Test
|
||||
void testSuccess_internalRegiration_premiumDomain() throws Exception {
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setPremiumList(persistPremiumList("tld", USD, "example,USD 100"))
|
||||
.build());
|
||||
@@ -434,7 +434,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||
@Test
|
||||
void testSuccess_anchorTenant_premiumDomain() throws Exception {
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setPremiumList(persistPremiumList("tld", USD, "example,USD 100"))
|
||||
.build());
|
||||
@@ -842,10 +842,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||
@Test
|
||||
void testSuccess_nonDefaultRenewGracePeriod() throws Exception {
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
.asBuilder()
|
||||
.setRenewGracePeriodLength(Duration.standardMinutes(9))
|
||||
.build());
|
||||
Tld.get("tld").asBuilder().setRenewGracePeriodLength(Duration.standardMinutes(9)).build());
|
||||
persistDomain();
|
||||
doSuccessfulTest(
|
||||
"domain_renew_response.xml",
|
||||
@@ -994,7 +991,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||
void testFailure_wrongFeeAmount_v06() throws Exception {
|
||||
setEppInput("domain_renew_fee.xml", FEE_06_MAP);
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setRenewBillingCostTransitions(ImmutableSortedMap.of(START_OF_TIME, Money.of(USD, 20)))
|
||||
.build());
|
||||
@@ -1007,7 +1004,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||
void testFailure_wrongFeeAmount_v11() throws Exception {
|
||||
setEppInput("domain_renew_fee.xml", FEE_11_MAP);
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setRenewBillingCostTransitions(ImmutableSortedMap.of(START_OF_TIME, Money.of(USD, 20)))
|
||||
.build());
|
||||
@@ -1020,7 +1017,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||
void testFailure_wrongFeeAmount_v12() throws Exception {
|
||||
setEppInput("domain_renew_fee.xml", FEE_12_MAP);
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setRenewBillingCostTransitions(ImmutableSortedMap.of(START_OF_TIME, Money.of(USD, 20)))
|
||||
.build());
|
||||
@@ -1033,7 +1030,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||
void testFailure_wrongCurrency_v06() throws Exception {
|
||||
setEppInput("domain_renew_fee.xml", FEE_06_MAP);
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setCurrency(EUR)
|
||||
.setCreateBillingCost(Money.of(EUR, 13))
|
||||
@@ -1052,7 +1049,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||
void testFailure_wrongCurrency_v11() throws Exception {
|
||||
setEppInput("domain_renew_fee.xml", FEE_11_MAP);
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setCurrency(EUR)
|
||||
.setCreateBillingCost(Money.of(EUR, 13))
|
||||
@@ -1071,7 +1068,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||
void testFailure_wrongCurrency_v12() throws Exception {
|
||||
setEppInput("domain_renew_fee.xml", FEE_12_MAP);
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setCurrency(EUR)
|
||||
.setCreateBillingCost(Money.of(EUR, 13))
|
||||
@@ -1114,7 +1111,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||
void testFailure_missingBillingAccountMap() throws Exception {
|
||||
persistDomain();
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setCurrency(JPY)
|
||||
.setCreateBillingCost(Money.ofMajor(JPY, 800))
|
||||
@@ -1236,10 +1233,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||
persistDomain();
|
||||
// Test with a nonstandard Renew period to ensure the reporting time is correct regardless
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
.asBuilder()
|
||||
.setRenewGracePeriodLength(Duration.standardMinutes(9))
|
||||
.build());
|
||||
Tld.get("tld").asBuilder().setRenewGracePeriodLength(Duration.standardMinutes(9)).build());
|
||||
runFlow();
|
||||
Domain domain = reloadResourceByForeignKey();
|
||||
DomainHistory historyEntry =
|
||||
@@ -1401,7 +1395,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||
.setAllowedTlds(ImmutableSet.of("tld"))
|
||||
.build());
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setDefaultPromoTokens(
|
||||
ImmutableList.of(defaultToken1.createVKey(), defaultToken2.createVKey()))
|
||||
@@ -1452,7 +1446,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||
.setAllowedTlds(ImmutableSet.of("tld"))
|
||||
.build());
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setDefaultPromoTokens(
|
||||
ImmutableList.of(defaultToken1.createVKey(), defaultToken2.createVKey()))
|
||||
@@ -1495,7 +1489,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||
.setAllowedTlds(ImmutableSet.of("tld"))
|
||||
.build());
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setDefaultPromoTokens(
|
||||
ImmutableList.of(defaultToken1.createVKey(), defaultToken2.createVKey()))
|
||||
@@ -1544,7 +1538,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||
.setAllowedTlds(ImmutableSet.of("tld"))
|
||||
.build());
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setDefaultPromoTokens(
|
||||
ImmutableList.of(
|
||||
@@ -1588,7 +1582,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||
.setAllowedTlds(ImmutableSet.of("tld"))
|
||||
.build());
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setDefaultPromoTokens(
|
||||
ImmutableList.of(defaultToken1.createVKey(), defaultToken2.createVKey()))
|
||||
@@ -1621,7 +1615,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||
.setAllowedTlds(ImmutableSet.of("tld"))
|
||||
.build());
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setDefaultPromoTokens(ImmutableList.of(defaultToken1.createVKey()))
|
||||
.build());
|
||||
@@ -1659,7 +1653,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||
.setAllowedTlds(ImmutableSet.of("tld"))
|
||||
.build());
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setDefaultPromoTokens(ImmutableList.of(defaultToken1.createVKey()))
|
||||
.setRenewBillingCostTransitions(ImmutableSortedMap.of(START_OF_TIME, Money.of(USD, 20)))
|
||||
@@ -1682,7 +1676,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||
.setAllowedTlds(ImmutableSet.of("tld"))
|
||||
.build());
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setDefaultPromoTokens(ImmutableList.of(defaultToken1.createVKey()))
|
||||
.build());
|
||||
@@ -1720,7 +1714,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||
.setAllowedTlds(ImmutableSet.of("tld"))
|
||||
.build());
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setDefaultPromoTokens(ImmutableList.of(defaultToken1.createVKey()))
|
||||
.setRenewBillingCostTransitions(ImmutableSortedMap.of(START_OF_TIME, Money.of(USD, 20)))
|
||||
@@ -1743,7 +1737,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||
.setAllowedTlds(ImmutableSet.of("tld"))
|
||||
.build());
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setDefaultPromoTokens(ImmutableList.of(defaultToken1.createVKey()))
|
||||
.build());
|
||||
@@ -1781,7 +1775,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, Domain>
|
||||
.setAllowedTlds(ImmutableSet.of("tld"))
|
||||
.build());
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setDefaultPromoTokens(ImmutableList.of(defaultToken1.createVKey()))
|
||||
.setRenewBillingCostTransitions(ImmutableSortedMap.of(START_OF_TIME, Money.of(USD, 20)))
|
||||
|
||||
@@ -72,7 +72,7 @@ import google.registry.model.registrar.Registrar.State;
|
||||
import google.registry.model.reporting.DomainTransactionRecord;
|
||||
import google.registry.model.reporting.DomainTransactionRecord.TransactionReportField;
|
||||
import google.registry.model.reporting.HistoryEntry;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.testing.DatabaseHelper;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
@@ -469,7 +469,7 @@ class DomainRestoreRequestFlowTest extends ResourceFlowTestCase<DomainRestoreReq
|
||||
@Test
|
||||
void testSuccess_superuserOverridesReservedList() throws Exception {
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setReservedLists(persistReservedList("tld-reserved", "example,FULLY_BLOCKED"))
|
||||
.build());
|
||||
@@ -529,8 +529,7 @@ class DomainRestoreRequestFlowTest extends ResourceFlowTestCase<DomainRestoreReq
|
||||
void testFailure_wrongFeeAmount_v06() throws Exception {
|
||||
setEppInput("domain_update_restore_request_fee.xml", FEE_06_MAP);
|
||||
persistPendingDeleteDomain();
|
||||
persistResource(
|
||||
Registry.get("tld").asBuilder().setRestoreBillingCost(Money.of(USD, 100)).build());
|
||||
persistResource(Tld.get("tld").asBuilder().setRestoreBillingCost(Money.of(USD, 100)).build());
|
||||
EppException thrown = assertThrows(FeesMismatchException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
@@ -539,8 +538,7 @@ class DomainRestoreRequestFlowTest extends ResourceFlowTestCase<DomainRestoreReq
|
||||
void testFailure_wrongFeeAmount_v11() throws Exception {
|
||||
setEppInput("domain_update_restore_request_fee.xml", FEE_11_MAP);
|
||||
persistPendingDeleteDomain();
|
||||
persistResource(
|
||||
Registry.get("tld").asBuilder().setRestoreBillingCost(Money.of(USD, 100)).build());
|
||||
persistResource(Tld.get("tld").asBuilder().setRestoreBillingCost(Money.of(USD, 100)).build());
|
||||
EppException thrown = assertThrows(FeesMismatchException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
@@ -549,8 +547,7 @@ class DomainRestoreRequestFlowTest extends ResourceFlowTestCase<DomainRestoreReq
|
||||
void testFailure_wrongFeeAmount_v12() throws Exception {
|
||||
setEppInput("domain_update_restore_request_fee.xml", FEE_12_MAP);
|
||||
persistPendingDeleteDomain();
|
||||
persistResource(
|
||||
Registry.get("tld").asBuilder().setRestoreBillingCost(Money.of(USD, 100)).build());
|
||||
persistResource(Tld.get("tld").asBuilder().setRestoreBillingCost(Money.of(USD, 100)).build());
|
||||
EppException thrown = assertThrows(FeesMismatchException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
@@ -559,7 +556,7 @@ class DomainRestoreRequestFlowTest extends ResourceFlowTestCase<DomainRestoreReq
|
||||
setEppInput("domain_update_restore_request_fee.xml", substitutions);
|
||||
persistPendingDeleteDomain();
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setCurrency(EUR)
|
||||
.setCreateBillingCost(Money.of(EUR, 13))
|
||||
@@ -702,7 +699,7 @@ class DomainRestoreRequestFlowTest extends ResourceFlowTestCase<DomainRestoreReq
|
||||
void testFailure_missingBillingAccount() throws Exception {
|
||||
persistPendingDeleteDomain();
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setCurrency(JPY)
|
||||
.setCreateBillingCost(Money.ofMajor(JPY, 800))
|
||||
@@ -741,7 +738,7 @@ class DomainRestoreRequestFlowTest extends ResourceFlowTestCase<DomainRestoreReq
|
||||
void testFailure_reservedBlocked() throws Exception {
|
||||
createTld("tld");
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setReservedLists(persistReservedList("tld-reserved", "example,FULLY_BLOCKED"))
|
||||
.build());
|
||||
|
||||
+10
-11
@@ -83,7 +83,7 @@ import google.registry.model.poll.PollMessage;
|
||||
import google.registry.model.reporting.DomainTransactionRecord;
|
||||
import google.registry.model.reporting.HistoryEntry;
|
||||
import google.registry.model.reporting.HistoryEntry.HistoryEntryId;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.model.tld.label.PremiumList;
|
||||
import google.registry.model.tld.label.PremiumListDao;
|
||||
import google.registry.model.transfer.DomainTransferData;
|
||||
@@ -114,7 +114,7 @@ class DomainTransferApproveFlowTest
|
||||
// moment that the transfer is approved.
|
||||
createTld("tld");
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setRenewBillingCostTransitions(
|
||||
new ImmutableSortedMap.Builder<DateTime, Money>(Ordering.natural())
|
||||
@@ -185,7 +185,7 @@ class DomainTransferApproveFlowTest
|
||||
DateTime expectedExpirationTime)
|
||||
throws Exception {
|
||||
setEppLoader(commandFilename);
|
||||
Registry registry = Registry.get(tld);
|
||||
Tld registry = Tld.get(tld);
|
||||
domain = reloadResourceByForeignKey();
|
||||
// Make sure the implicit billing event is there; it will be deleted by the flow.
|
||||
// We also expect to see autorenew events for the gaining and losing registrars.
|
||||
@@ -271,7 +271,7 @@ class DomainTransferApproveFlowTest
|
||||
int expectedYearsToCharge,
|
||||
BillingEvent.Cancellation.Builder... expectedCancellationBillingEvents)
|
||||
throws Exception {
|
||||
Registry registry = Registry.get(tld);
|
||||
Tld registry = Tld.get(tld);
|
||||
domain = reloadResourceByForeignKey();
|
||||
final DomainHistory historyEntryTransferApproved =
|
||||
getOnlyHistoryEntryOfType(domain, DOMAIN_TRANSFER_APPROVE, DomainHistory.class);
|
||||
@@ -471,7 +471,7 @@ class DomainTransferApproveFlowTest
|
||||
// with the new transfer grace period in mind.
|
||||
createTld("net");
|
||||
persistResource(
|
||||
Registry.get("net")
|
||||
Tld.get("net")
|
||||
.asBuilder()
|
||||
.setTransferGracePeriodLength(Duration.standardMinutes(10))
|
||||
.build());
|
||||
@@ -515,8 +515,7 @@ class DomainTransferApproveFlowTest
|
||||
.setTargetId("example.tld")
|
||||
.setRegistrarId("TheRegistrar")
|
||||
.setEventTime(clock.nowUtc()) // The cancellation happens at the moment of transfer.
|
||||
.setBillingTime(
|
||||
oldExpirationTime.plus(Registry.get("tld").getAutoRenewGracePeriodLength()))
|
||||
.setBillingTime(oldExpirationTime.plus(Tld.get("tld").getAutoRenewGracePeriodLength()))
|
||||
.setRecurringEventKey(domain.getAutorenewBillingEvent()));
|
||||
}
|
||||
|
||||
@@ -529,7 +528,7 @@ class DomainTransferApproveFlowTest
|
||||
.setName("tld")
|
||||
.setLabelsToPrices(ImmutableMap.of("example", new BigDecimal("67.89")))
|
||||
.build());
|
||||
persistResource(Registry.get("tld").asBuilder().setPremiumList(pl).build());
|
||||
persistResource(Tld.get("tld").asBuilder().setPremiumList(pl).build());
|
||||
domain = loadByEntity(domain);
|
||||
persistResource(
|
||||
loadByKey(domain.getAutorenewBillingEvent())
|
||||
@@ -575,7 +574,7 @@ class DomainTransferApproveFlowTest
|
||||
.setName("tld")
|
||||
.setLabelsToPrices(ImmutableMap.of("example", new BigDecimal("67.89")))
|
||||
.build());
|
||||
persistResource(Registry.get("tld").asBuilder().setPremiumList(pl).build());
|
||||
persistResource(Tld.get("tld").asBuilder().setPremiumList(pl).build());
|
||||
domain = loadByEntity(domain);
|
||||
persistResource(
|
||||
loadByKey(domain.getAutorenewBillingEvent())
|
||||
@@ -773,7 +772,7 @@ class DomainTransferApproveFlowTest
|
||||
|
||||
private void setUpGracePeriodDurations() {
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setAutomaticTransferLength(Duration.standardDays(2))
|
||||
.setTransferGracePeriodLength(Duration.standardDays(3))
|
||||
@@ -863,7 +862,7 @@ class DomainTransferApproveFlowTest
|
||||
GracePeriod.createForRecurring(
|
||||
GracePeriodStatus.AUTO_RENEW,
|
||||
domain.getRepoId(),
|
||||
autorenewTime.plus(Registry.get("tld").getAutoRenewGracePeriodLength()),
|
||||
autorenewTime.plus(Tld.get("tld").getAutoRenewGracePeriodLength()),
|
||||
"TheRegistrar",
|
||||
existingAutorenewEvent))
|
||||
.build());
|
||||
|
||||
@@ -52,7 +52,7 @@ import google.registry.model.eppcommon.AuthInfo.PasswordAuth;
|
||||
import google.registry.model.poll.PollMessage;
|
||||
import google.registry.model.reporting.DomainTransactionRecord;
|
||||
import google.registry.model.reporting.HistoryEntry;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.model.transfer.DomainTransferData;
|
||||
import google.registry.model.transfer.TransferResponse.DomainTransferResponse;
|
||||
import google.registry.model.transfer.TransferStatus;
|
||||
@@ -391,7 +391,7 @@ class DomainTransferCancelFlowTest
|
||||
void testIcannTransactionRecord_cancelsPreviousRecords() throws Exception {
|
||||
clock.advanceOneMilli();
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setAutomaticTransferLength(Duration.standardDays(2))
|
||||
.setTransferGracePeriodLength(Duration.standardDays(3))
|
||||
|
||||
@@ -41,7 +41,7 @@ import google.registry.model.domain.DomainHistory;
|
||||
import google.registry.model.eppcommon.StatusValue;
|
||||
import google.registry.model.host.Host;
|
||||
import google.registry.model.reporting.HistoryEntry;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.model.transfer.TransferData;
|
||||
import google.registry.model.transfer.TransferStatus;
|
||||
import google.registry.persistence.transaction.JpaTransactionManagerExtension;
|
||||
@@ -63,7 +63,7 @@ abstract class DomainTransferFlowTestCase<F extends Flow, R extends EppResource>
|
||||
|
||||
static final DateTime TRANSFER_REQUEST_TIME = DateTime.parse("2000-06-06T22:00:00.0Z");
|
||||
static final DateTime TRANSFER_EXPIRATION_TIME =
|
||||
TRANSFER_REQUEST_TIME.plus(Registry.DEFAULT_AUTOMATIC_TRANSFER_LENGTH);
|
||||
TRANSFER_REQUEST_TIME.plus(Tld.DEFAULT_AUTOMATIC_TRANSFER_LENGTH);
|
||||
private static final Duration TIME_SINCE_REQUEST = Duration.standardDays(3);
|
||||
private static final int EXTENDED_REGISTRATION_YEARS = 1;
|
||||
private static final DateTime REGISTRATION_EXPIRATION_TIME =
|
||||
@@ -77,7 +77,7 @@ abstract class DomainTransferFlowTestCase<F extends Flow, R extends EppResource>
|
||||
private DomainHistory historyEntryDomainCreate;
|
||||
|
||||
DomainTransferFlowTestCase() {
|
||||
checkState(!Registry.DEFAULT_TRANSFER_GRACE_PERIOD.isShorterThan(TIME_SINCE_REQUEST));
|
||||
checkState(!Tld.DEFAULT_TRANSFER_GRACE_PERIOD.isShorterThan(TIME_SINCE_REQUEST));
|
||||
clock.setTo(TRANSFER_REQUEST_TIME.plus(TIME_SINCE_REQUEST));
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ import google.registry.model.poll.PendingActionNotificationResponse;
|
||||
import google.registry.model.poll.PollMessage;
|
||||
import google.registry.model.reporting.DomainTransactionRecord;
|
||||
import google.registry.model.reporting.HistoryEntry;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.model.transfer.TransferData;
|
||||
import google.registry.model.transfer.TransferResponse;
|
||||
import google.registry.model.transfer.TransferStatus;
|
||||
@@ -343,7 +343,7 @@ class DomainTransferRejectFlowTest
|
||||
|
||||
private void setUpGracePeriodDurations() {
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setAutomaticTransferLength(Duration.standardDays(2))
|
||||
.setTransferGracePeriodLength(Duration.standardDays(3))
|
||||
|
||||
+25
-26
@@ -27,7 +27,7 @@ import static google.registry.model.domain.token.AllocationToken.TokenType.UNLIM
|
||||
import static google.registry.model.reporting.DomainTransactionRecord.TransactionReportField.TRANSFER_SUCCESSFUL;
|
||||
import static google.registry.model.reporting.HistoryEntry.Type.DOMAIN_CREATE;
|
||||
import static google.registry.model.reporting.HistoryEntry.Type.DOMAIN_TRANSFER_REQUEST;
|
||||
import static google.registry.model.tld.Registry.TldState.QUIET_PERIOD;
|
||||
import static google.registry.model.tld.Tld.TldState.QUIET_PERIOD;
|
||||
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
||||
import static google.registry.testing.DatabaseHelper.assertBillingEvents;
|
||||
import static google.registry.testing.DatabaseHelper.assertBillingEventsEqual;
|
||||
@@ -115,7 +115,7 @@ import google.registry.model.registrar.Registrar.State;
|
||||
import google.registry.model.reporting.DomainTransactionRecord;
|
||||
import google.registry.model.reporting.HistoryEntry;
|
||||
import google.registry.model.reporting.HistoryEntry.HistoryEntryId;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.model.tld.label.PremiumList;
|
||||
import google.registry.model.tld.label.PremiumListDao;
|
||||
import google.registry.model.transfer.DomainTransferData;
|
||||
@@ -259,7 +259,7 @@ class DomainTransferRequestFlowTest
|
||||
ImmutableSet<GracePeriod> originalGracePeriods,
|
||||
boolean expectTransferBillingEvent,
|
||||
BillingEvent.Cancellation.Builder... extraExpectedBillingEvents) {
|
||||
Registry registry = Registry.get(domain.getTld());
|
||||
Tld registry = Tld.get(domain.getTld());
|
||||
final DomainHistory historyEntryTransferRequest =
|
||||
getOnlyHistoryEntryOfType(domain, DOMAIN_TRANSFER_REQUEST, DomainHistory.class);
|
||||
|
||||
@@ -435,7 +435,7 @@ class DomainTransferRequestFlowTest
|
||||
private void assertAboutDomainAfterAutomaticTransfer(
|
||||
DateTime expectedExpirationTime, DateTime implicitTransferTime, Period expectedPeriod)
|
||||
throws Exception {
|
||||
Registry registry = Registry.get(domain.getTld());
|
||||
Tld registry = Tld.get(domain.getTld());
|
||||
Domain domainAfterAutomaticTransfer = domain.cloneProjectedAtTime(implicitTransferTime);
|
||||
assertTransferApproved(domainAfterAutomaticTransfer, implicitTransferTime, expectedPeriod);
|
||||
assertAboutDomains()
|
||||
@@ -477,7 +477,7 @@ class DomainTransferRequestFlowTest
|
||||
// For all of the other transfer flow tests, 'now' corresponds to day 3 of the transfer, but
|
||||
// for the request test we want that same 'now' to be the initial request time, so we shift
|
||||
// the transfer timeline 3 days later by adjusting the implicit transfer time here.
|
||||
Registry registry = Registry.get(domain.getTld());
|
||||
Tld registry = Tld.get(domain.getTld());
|
||||
DateTime implicitTransferTime = clock.nowUtc().plus(registry.getAutomaticTransferLength());
|
||||
// Setup done; run the test.
|
||||
assertTransactionalFlow(true);
|
||||
@@ -845,7 +845,7 @@ class DomainTransferRequestFlowTest
|
||||
void testSuccess_nonDefaultAutomaticTransferLength() throws Exception {
|
||||
setupDomain("example", "tld");
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setAutomaticTransferLength(Duration.standardMinutes(15))
|
||||
.build());
|
||||
@@ -857,7 +857,7 @@ class DomainTransferRequestFlowTest
|
||||
void testSuccess_nonDefaultTransferGracePeriod() throws Exception {
|
||||
setupDomain("example", "tld");
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setTransferGracePeriodLength(Duration.standardMinutes(5))
|
||||
.build());
|
||||
@@ -888,7 +888,7 @@ class DomainTransferRequestFlowTest
|
||||
void testSuccess_inQuietPeriod() throws Exception {
|
||||
setupDomain("example", "tld");
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setTldStateTransitions(ImmutableSortedMap.of(START_OF_TIME, QUIET_PERIOD))
|
||||
.build());
|
||||
@@ -966,7 +966,7 @@ class DomainTransferRequestFlowTest
|
||||
GracePeriod.createForRecurring(
|
||||
GracePeriodStatus.AUTO_RENEW,
|
||||
domain.getRepoId(),
|
||||
autorenewTime.plus(Registry.get("tld").getAutoRenewGracePeriodLength()),
|
||||
autorenewTime.plus(Tld.get("tld").getAutoRenewGracePeriodLength()),
|
||||
"TheRegistrar",
|
||||
existingAutorenewEvent))
|
||||
.build());
|
||||
@@ -1023,7 +1023,7 @@ class DomainTransferRequestFlowTest
|
||||
doSuccessfulTest(
|
||||
"domain_transfer_request.xml",
|
||||
"domain_transfer_request_response_10_year_cap.xml",
|
||||
clock.nowUtc().plus(Registry.get("tld").getAutomaticTransferLength()).plusYears(10));
|
||||
clock.nowUtc().plus(Tld.get("tld").getAutomaticTransferLength()).plusYears(10));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -1070,7 +1070,7 @@ class DomainTransferRequestFlowTest
|
||||
void testFailure_missingBillingAccount() {
|
||||
setupDomain("example", "tld");
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setCurrency(JPY)
|
||||
.setCreateBillingCost(Money.ofMajor(JPY, 800))
|
||||
@@ -1106,7 +1106,7 @@ class DomainTransferRequestFlowTest
|
||||
// Set the domain to have auto-renewed long enough ago that it is still in the autorenew grace
|
||||
// period at the transfer request time, but will have exited it by the automatic transfer time.
|
||||
DateTime autorenewTime =
|
||||
clock.nowUtc().minus(Registry.get("tld").getAutoRenewGracePeriodLength()).plusDays(1);
|
||||
clock.nowUtc().minus(Tld.get("tld").getAutoRenewGracePeriodLength()).plusDays(1);
|
||||
DateTime expirationTime = autorenewTime.plusYears(1);
|
||||
domain =
|
||||
persistResource(
|
||||
@@ -1117,7 +1117,7 @@ class DomainTransferRequestFlowTest
|
||||
GracePeriod.createForRecurring(
|
||||
GracePeriodStatus.AUTO_RENEW,
|
||||
domain.getRepoId(),
|
||||
autorenewTime.plus(Registry.get("tld").getAutoRenewGracePeriodLength()),
|
||||
autorenewTime.plus(Tld.get("tld").getAutoRenewGracePeriodLength()),
|
||||
"TheRegistrar",
|
||||
domain.getAutorenewBillingEvent()))
|
||||
.build());
|
||||
@@ -1147,7 +1147,7 @@ class DomainTransferRequestFlowTest
|
||||
GracePeriod.createForRecurring(
|
||||
GracePeriodStatus.AUTO_RENEW,
|
||||
domain.getRepoId(),
|
||||
autorenewTime.plus(Registry.get("tld").getAutoRenewGracePeriodLength()),
|
||||
autorenewTime.plus(Tld.get("tld").getAutoRenewGracePeriodLength()),
|
||||
"TheRegistrar",
|
||||
existingAutorenewEvent))
|
||||
.build());
|
||||
@@ -1163,8 +1163,8 @@ class DomainTransferRequestFlowTest
|
||||
.setTargetId("example.tld")
|
||||
.setRegistrarId("TheRegistrar")
|
||||
// The cancellation happens at the moment of transfer.
|
||||
.setEventTime(clock.nowUtc().plus(Registry.get("tld").getAutomaticTransferLength()))
|
||||
.setBillingTime(autorenewTime.plus(Registry.get("tld").getAutoRenewGracePeriodLength()))
|
||||
.setEventTime(clock.nowUtc().plus(Tld.get("tld").getAutomaticTransferLength()))
|
||||
.setBillingTime(autorenewTime.plus(Tld.get("tld").getAutoRenewGracePeriodLength()))
|
||||
// The cancellation should refer to the old autorenew billing event.
|
||||
.setRecurringEventKey(existingAutorenewEvent));
|
||||
}
|
||||
@@ -1190,9 +1190,8 @@ class DomainTransferRequestFlowTest
|
||||
.setTargetId("example.tld")
|
||||
.setRegistrarId("TheRegistrar")
|
||||
// The cancellation happens at the moment of transfer.
|
||||
.setEventTime(clock.nowUtc().plus(Registry.get("tld").getAutomaticTransferLength()))
|
||||
.setBillingTime(
|
||||
expirationTime.plus(Registry.get("tld").getAutoRenewGracePeriodLength()))
|
||||
.setEventTime(clock.nowUtc().plus(Tld.get("tld").getAutomaticTransferLength()))
|
||||
.setBillingTime(expirationTime.plus(Tld.get("tld").getAutoRenewGracePeriodLength()))
|
||||
// The cancellation should refer to the old autorenew billing event.
|
||||
.setRecurringEventKey(existingAutorenewEvent));
|
||||
}
|
||||
@@ -1226,7 +1225,7 @@ class DomainTransferRequestFlowTest
|
||||
.setName("tld")
|
||||
.setLabelsToPrices(ImmutableMap.of("example", new BigDecimal("67.89")))
|
||||
.build());
|
||||
persistResource(Registry.get("tld").asBuilder().setPremiumList(pl).build());
|
||||
persistResource(Tld.get("tld").asBuilder().setPremiumList(pl).build());
|
||||
domain = loadByEntity(domain);
|
||||
persistResource(
|
||||
loadByKey(domain.getAutorenewBillingEvent())
|
||||
@@ -1281,7 +1280,7 @@ class DomainTransferRequestFlowTest
|
||||
.setName("tld")
|
||||
.setLabelsToPrices(ImmutableMap.of("example", new BigDecimal("67.89")))
|
||||
.build());
|
||||
persistResource(Registry.get("tld").asBuilder().setPremiumList(pl).build());
|
||||
persistResource(Tld.get("tld").asBuilder().setPremiumList(pl).build());
|
||||
domain = loadByEntity(domain);
|
||||
persistResource(
|
||||
loadByKey(domain.getAutorenewBillingEvent())
|
||||
@@ -1329,7 +1328,7 @@ class DomainTransferRequestFlowTest
|
||||
@Test
|
||||
void testSuccess_specifiedRenewalPrice_notCarriedOverForPackageName() throws Exception {
|
||||
setupDomain("example", "tld");
|
||||
persistResource(Registry.get("tld").asBuilder().build());
|
||||
persistResource(Tld.get("tld").asBuilder().build());
|
||||
domain = loadByEntity(domain);
|
||||
persistResource(
|
||||
loadByKey(domain.getAutorenewBillingEvent())
|
||||
@@ -1388,7 +1387,7 @@ class DomainTransferRequestFlowTest
|
||||
@Test
|
||||
void testSuccess_defaultRenewalPrice_carriedOverForPackageName() throws Exception {
|
||||
setupDomain("example", "tld");
|
||||
persistResource(Registry.get("tld").asBuilder().build());
|
||||
persistResource(Tld.get("tld").asBuilder().build());
|
||||
domain = loadByEntity(domain);
|
||||
persistResource(
|
||||
loadByKey(domain.getAutorenewBillingEvent())
|
||||
@@ -1445,7 +1444,7 @@ class DomainTransferRequestFlowTest
|
||||
@Test
|
||||
void testSuccess_packageName_zeroPeriod() throws Exception {
|
||||
setupDomain("example", "tld");
|
||||
persistResource(Registry.get("tld").asBuilder().build());
|
||||
persistResource(Tld.get("tld").asBuilder().build());
|
||||
domain = loadByEntity(domain);
|
||||
persistResource(
|
||||
loadByKey(domain.getAutorenewBillingEvent())
|
||||
@@ -1544,7 +1543,7 @@ class DomainTransferRequestFlowTest
|
||||
|
||||
private void runWrongFeeAmountTest(Map<String, String> substitutions) {
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setRenewBillingCostTransitions(ImmutableSortedMap.of(START_OF_TIME, Money.of(USD, 20)))
|
||||
.build());
|
||||
@@ -1818,7 +1817,7 @@ class DomainTransferRequestFlowTest
|
||||
void testIcannTransactionRecord_getsStored() throws Exception {
|
||||
setupDomain("example", "tld");
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setAutomaticTransferLength(Duration.standardDays(2))
|
||||
.setTransferGracePeriodLength(Duration.standardDays(3))
|
||||
|
||||
@@ -28,7 +28,7 @@ import static google.registry.model.eppcommon.StatusValue.SERVER_TRANSFER_PROHIB
|
||||
import static google.registry.model.eppcommon.StatusValue.SERVER_UPDATE_PROHIBITED;
|
||||
import static google.registry.model.reporting.HistoryEntry.Type.DOMAIN_CREATE;
|
||||
import static google.registry.model.reporting.HistoryEntry.Type.DOMAIN_UPDATE;
|
||||
import static google.registry.model.tld.Registry.TldState.QUIET_PERIOD;
|
||||
import static google.registry.model.tld.Tld.TldState.QUIET_PERIOD;
|
||||
import static google.registry.testing.DatabaseHelper.assertBillingEvents;
|
||||
import static google.registry.testing.DatabaseHelper.assertNoBillingEvents;
|
||||
import static google.registry.testing.DatabaseHelper.assertPollMessagesForResource;
|
||||
@@ -101,7 +101,7 @@ import google.registry.model.eppcommon.Trid;
|
||||
import google.registry.model.host.Host;
|
||||
import google.registry.model.poll.PendingActionNotificationResponse.DomainPendingActionNotificationResponse;
|
||||
import google.registry.model.poll.PollMessage;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.persistence.VKey;
|
||||
import google.registry.testing.DatabaseHelper;
|
||||
import java.util.Optional;
|
||||
@@ -265,7 +265,7 @@ class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow, Domain
|
||||
@Test
|
||||
void testSuccess_inQuietPeriod() throws Exception {
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setTldStateTransitions(ImmutableSortedMap.of(START_OF_TIME, QUIET_PERIOD))
|
||||
.build());
|
||||
@@ -1529,7 +1529,7 @@ class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow, Domain
|
||||
persistReferencedEntities();
|
||||
persistDomain();
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setAllowedRegistrantContactIds(ImmutableSet.of("contact1234"))
|
||||
.build());
|
||||
@@ -1543,7 +1543,7 @@ class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow, Domain
|
||||
persistReferencedEntities();
|
||||
persistDomain();
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns1.example.foo"))
|
||||
.build());
|
||||
@@ -1560,7 +1560,7 @@ class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow, Domain
|
||||
persistDomain();
|
||||
// No registrant is given but both nameserver and registrant allow list exist.
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setAllowedRegistrantContactIds(ImmutableSet.of("sh8013"))
|
||||
.setAllowedFullyQualifiedHostNames(
|
||||
@@ -1582,7 +1582,7 @@ class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow, Domain
|
||||
persistDomain();
|
||||
// Only changes registrant, with both nameserver and registrant allow list on the TLD.
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setAllowedRegistrantContactIds(ImmutableSet.of("sh8013"))
|
||||
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns1.example.foo"))
|
||||
@@ -1622,7 +1622,7 @@ class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow, Domain
|
||||
persistReferencedEntities();
|
||||
persistDomain();
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setAllowedRegistrantContactIds(ImmutableSet.of("sh8013"))
|
||||
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns2.example.foo"))
|
||||
@@ -1642,7 +1642,7 @@ class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow, Domain
|
||||
loadByForeignKey(Host.class, "ns2.example.foo", clock.nowUtc()).get().createVKey())
|
||||
.build());
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setAllowedFullyQualifiedHostNames(
|
||||
ImmutableSet.of("ns1.example.foo", "ns2.example.foo"))
|
||||
@@ -1665,7 +1665,7 @@ class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow, Domain
|
||||
persistDomain();
|
||||
setEppInput("domain_update_remove_nameserver.xml");
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns1.example.foo"))
|
||||
.build());
|
||||
|
||||
+12
-12
@@ -50,7 +50,7 @@ import google.registry.model.domain.token.AllocationToken;
|
||||
import google.registry.model.domain.token.AllocationToken.TokenStatus;
|
||||
import google.registry.model.domain.token.AllocationTokenExtension;
|
||||
import google.registry.model.reporting.HistoryEntry.HistoryEntryId;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
||||
import google.registry.testing.DatabaseHelper;
|
||||
@@ -92,7 +92,7 @@ class AllocationTokenFlowUtilsTest {
|
||||
flowUtils
|
||||
.verifyAllocationTokenCreateIfPresent(
|
||||
createCommand("blah.tld"),
|
||||
Registry.get("tld"),
|
||||
Tld.get("tld"),
|
||||
"TheRegistrar",
|
||||
DateTime.now(UTC),
|
||||
Optional.of(allocationTokenExtension))
|
||||
@@ -114,7 +114,7 @@ class AllocationTokenFlowUtilsTest {
|
||||
flowUtils
|
||||
.verifyAllocationTokenIfPresent(
|
||||
DatabaseHelper.newDomain("blah.tld"),
|
||||
Registry.get("tld"),
|
||||
Tld.get("tld"),
|
||||
"TheRegistrar",
|
||||
DateTime.now(UTC),
|
||||
CommandName.RENEW,
|
||||
@@ -133,7 +133,7 @@ class AllocationTokenFlowUtilsTest {
|
||||
flowUtils
|
||||
.verifyAllocationTokenIfPresent(
|
||||
DatabaseHelper.newDomain("blah.tld"),
|
||||
Registry.get("tld"),
|
||||
Tld.get("tld"),
|
||||
"TheRegistrar",
|
||||
DateTime.now(UTC),
|
||||
CommandName.RENEW,
|
||||
@@ -161,7 +161,7 @@ class AllocationTokenFlowUtilsTest {
|
||||
() ->
|
||||
flowUtils.verifyAllocationTokenCreateIfPresent(
|
||||
createCommand("blah.tld"),
|
||||
Registry.get("tld"),
|
||||
Tld.get("tld"),
|
||||
"TheRegistrar",
|
||||
DateTime.now(UTC),
|
||||
Optional.of(allocationTokenExtension))))
|
||||
@@ -177,7 +177,7 @@ class AllocationTokenFlowUtilsTest {
|
||||
() ->
|
||||
flowUtils.verifyAllocationTokenIfPresent(
|
||||
DatabaseHelper.newDomain("blah.tld"),
|
||||
Registry.get("tld"),
|
||||
Tld.get("tld"),
|
||||
"TheRegistrar",
|
||||
DateTime.now(UTC),
|
||||
CommandName.RENEW,
|
||||
@@ -198,7 +198,7 @@ class AllocationTokenFlowUtilsTest {
|
||||
() ->
|
||||
failingFlowUtils.verifyAllocationTokenCreateIfPresent(
|
||||
createCommand("blah.tld"),
|
||||
Registry.get("tld"),
|
||||
Tld.get("tld"),
|
||||
"TheRegistrar",
|
||||
DateTime.now(UTC),
|
||||
Optional.of(allocationTokenExtension)));
|
||||
@@ -218,7 +218,7 @@ class AllocationTokenFlowUtilsTest {
|
||||
() ->
|
||||
failingFlowUtils.verifyAllocationTokenIfPresent(
|
||||
DatabaseHelper.newDomain("blah.tld"),
|
||||
Registry.get("tld"),
|
||||
Tld.get("tld"),
|
||||
"TheRegistrar",
|
||||
DateTime.now(UTC),
|
||||
CommandName.RENEW,
|
||||
@@ -434,7 +434,7 @@ class AllocationTokenFlowUtilsTest {
|
||||
() ->
|
||||
flowUtils.verifyAllocationTokenCreateIfPresent(
|
||||
createCommand("blah.tld"),
|
||||
Registry.get("tld"),
|
||||
Tld.get("tld"),
|
||||
"TheRegistrar",
|
||||
DateTime.now(UTC),
|
||||
Optional.of(allocationTokenExtension))))
|
||||
@@ -449,7 +449,7 @@ class AllocationTokenFlowUtilsTest {
|
||||
() ->
|
||||
flowUtils.verifyAllocationTokenIfPresent(
|
||||
DatabaseHelper.newDomain("blah.tld"),
|
||||
Registry.get("tld"),
|
||||
Tld.get("tld"),
|
||||
"TheRegistrar",
|
||||
DateTime.now(UTC),
|
||||
CommandName.RENEW,
|
||||
@@ -483,7 +483,7 @@ class AllocationTokenFlowUtilsTest {
|
||||
public AllocationToken validateToken(
|
||||
DomainCommand.Create command,
|
||||
AllocationToken token,
|
||||
Registry registry,
|
||||
Tld tld,
|
||||
String registrarId,
|
||||
DateTime now) {
|
||||
throw new IllegalStateException("failed for tests");
|
||||
@@ -491,7 +491,7 @@ class AllocationTokenFlowUtilsTest {
|
||||
|
||||
@Override
|
||||
public AllocationToken validateToken(
|
||||
Domain domain, AllocationToken token, Registry registry, String registrarId, DateTime now) {
|
||||
Domain domain, AllocationToken token, Tld tld, String registrarId, DateTime now) {
|
||||
throw new IllegalStateException("failed for tests");
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ import google.registry.model.domain.Domain;
|
||||
import google.registry.model.eppcommon.StatusValue;
|
||||
import google.registry.model.host.Host;
|
||||
import google.registry.model.reporting.HistoryEntry.Type;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.model.transfer.DomainTransferData;
|
||||
import google.registry.model.transfer.TransferStatus;
|
||||
import google.registry.testing.DatabaseHelper;
|
||||
@@ -198,7 +198,7 @@ class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, Host> {
|
||||
createTld("tld");
|
||||
// Setup a transfer that should have been server approved a day ago.
|
||||
DateTime now = clock.nowUtc();
|
||||
DateTime requestTime = now.minusDays(1).minus(Registry.DEFAULT_AUTOMATIC_TRANSFER_LENGTH);
|
||||
DateTime requestTime = now.minusDays(1).minus(Tld.DEFAULT_AUTOMATIC_TRANSFER_LENGTH);
|
||||
DateTime transferExpirationTime = now.minusDays(1);
|
||||
Domain domain =
|
||||
persistResource(
|
||||
@@ -232,7 +232,7 @@ class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, Host> {
|
||||
createTld("tld");
|
||||
// Setup a transfer that should have been server approved a day ago.
|
||||
DateTime now = clock.nowUtc();
|
||||
DateTime requestTime = now.minusDays(1).minus(Registry.DEFAULT_AUTOMATIC_TRANSFER_LENGTH);
|
||||
DateTime requestTime = now.minusDays(1).minus(Tld.DEFAULT_AUTOMATIC_TRANSFER_LENGTH);
|
||||
DateTime transferExpirationTime = now.minusDays(1);
|
||||
Domain domain =
|
||||
persistResource(
|
||||
|
||||
@@ -73,7 +73,7 @@ import google.registry.model.domain.Domain;
|
||||
import google.registry.model.eppcommon.StatusValue;
|
||||
import google.registry.model.host.Host;
|
||||
import google.registry.model.reporting.HistoryEntry;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.model.transfer.DomainTransferData;
|
||||
import google.registry.model.transfer.TransferStatus;
|
||||
import google.registry.persistence.VKey;
|
||||
@@ -112,7 +112,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Host> {
|
||||
*/
|
||||
private Domain createDomainWithServerApprovedTransfer(String domainName) {
|
||||
DateTime now = clock.nowUtc();
|
||||
DateTime requestTime = now.minusDays(1).minus(Registry.DEFAULT_AUTOMATIC_TRANSFER_LENGTH);
|
||||
DateTime requestTime = now.minusDays(1).minus(Tld.DEFAULT_AUTOMATIC_TRANSFER_LENGTH);
|
||||
DateTime transferExpirationTime = now.minusDays(1);
|
||||
return DatabaseHelper.newDomain(domainName)
|
||||
.asBuilder()
|
||||
|
||||
@@ -16,8 +16,8 @@ package google.registry.model;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static com.google.common.truth.Truth8.assertThat;
|
||||
import static google.registry.model.tld.Registry.TldState.GENERAL_AVAILABILITY;
|
||||
import static google.registry.model.tld.Registry.TldState.START_DATE_SUNRISE;
|
||||
import static google.registry.model.tld.Tld.TldState.GENERAL_AVAILABILITY;
|
||||
import static google.registry.model.tld.Tld.TldState.START_DATE_SUNRISE;
|
||||
import static google.registry.persistence.transaction.JpaTransactionManagerExtension.makeRegistrar1;
|
||||
import static google.registry.testing.CertificateSamples.SAMPLE_CERT;
|
||||
import static google.registry.testing.CertificateSamples.SAMPLE_CERT_HASH;
|
||||
@@ -31,8 +31,8 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import google.registry.model.registrar.Registrar;
|
||||
import google.registry.model.registrar.RegistrarPoc;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Registry.TldState;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.model.tld.Tld.TldState;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
||||
import google.registry.util.CidrAddressBlock;
|
||||
@@ -67,7 +67,7 @@ public final class OteAccountBuilderTest {
|
||||
}
|
||||
|
||||
private static void assertTldExists(String tld, TldState tldState, Money eapFee) {
|
||||
Registry registry = Registry.get(tld);
|
||||
Tld registry = Tld.get(tld);
|
||||
assertThat(registry).isNotNull();
|
||||
assertThat(registry.getPremiumListName()).hasValue("default_sandbox_list");
|
||||
assertThat(registry.getTldStateTransitions()).containsExactly(START_OF_TIME, tldState);
|
||||
|
||||
@@ -24,7 +24,7 @@ import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
import google.registry.model.EntityTestCase;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.util.SerializeUtils;
|
||||
import org.joda.time.DateTime;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
@@ -53,7 +53,7 @@ public class CursorTest extends EntityTestCase {
|
||||
|
||||
@Test
|
||||
void testSuccess_persistScopedCursor() {
|
||||
Registry tld = createTld("tld");
|
||||
Tld tld = createTld("tld");
|
||||
this.fakeClock.advanceOneMilli();
|
||||
final DateTime time = DateTime.parse("2012-07-12T03:30:00.000Z");
|
||||
Cursor cursor = Cursor.createScoped(RDE_UPLOAD, time, tld);
|
||||
@@ -78,7 +78,7 @@ public class CursorTest extends EntityTestCase {
|
||||
|
||||
@Test
|
||||
void testFailure_VKeyWrongScope() {
|
||||
Registry tld = createTld("tld");
|
||||
Tld tld = createTld("tld");
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> Cursor.createGlobalVKey(RDE_UPLOAD),
|
||||
@@ -106,7 +106,7 @@ public class CursorTest extends EntityTestCase {
|
||||
NullPointerException thrown =
|
||||
assertThrows(
|
||||
NullPointerException.class,
|
||||
() -> Cursor.createScoped(null, START_OF_TIME, Registry.get("tld")));
|
||||
() -> Cursor.createScoped(null, START_OF_TIME, Tld.get("tld")));
|
||||
assertThat(thrown).hasMessageThat().contains("Cursor type cannot be null");
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ public class CursorTest extends EntityTestCase {
|
||||
NullPointerException thrown =
|
||||
assertThrows(
|
||||
NullPointerException.class,
|
||||
() -> Cursor.createScoped(RDE_UPLOAD, null, Registry.get("tld")));
|
||||
() -> Cursor.createScoped(RDE_UPLOAD, null, Tld.get("tld")));
|
||||
assertThat(thrown).hasMessageThat().contains("Cursor time cannot be null");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ import google.registry.model.eppcommon.Trid;
|
||||
import google.registry.model.host.Host;
|
||||
import google.registry.model.poll.PollMessage;
|
||||
import google.registry.model.reporting.HistoryEntry;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.model.transfer.DomainTransferData;
|
||||
import google.registry.model.transfer.TransferStatus;
|
||||
import google.registry.persistence.VKey;
|
||||
@@ -414,7 +414,7 @@ public class DomainTest {
|
||||
fakeClock
|
||||
.nowUtc()
|
||||
.plusDays(1)
|
||||
.plus(Registry.get("com").getTransferGracePeriodLength()))
|
||||
.plus(Tld.get("com").getTransferGracePeriodLength()))
|
||||
.setCost(Money.of(USD, 11))
|
||||
.setPeriodYears(1)
|
||||
.setDomainHistory(historyEntry)
|
||||
@@ -457,20 +457,14 @@ public class DomainTest {
|
||||
GracePeriod.create(
|
||||
GracePeriodStatus.TRANSFER,
|
||||
domain.getRepoId(),
|
||||
fakeClock
|
||||
.nowUtc()
|
||||
.plusDays(1)
|
||||
.plus(Registry.get("com").getTransferGracePeriodLength()),
|
||||
fakeClock.nowUtc().plusDays(1).plus(Tld.get("com").getTransferGracePeriodLength()),
|
||||
"TheRegistrar",
|
||||
transferBillingEvent.createVKey(),
|
||||
afterTransfer.getGracePeriods().iterator().next().getGracePeriodId()));
|
||||
// If we project after the grace period expires all should be the same except the grace period.
|
||||
Domain afterGracePeriod =
|
||||
domain.cloneProjectedAtTime(
|
||||
fakeClock
|
||||
.nowUtc()
|
||||
.plusDays(2)
|
||||
.plus(Registry.get("com").getTransferGracePeriodLength()));
|
||||
fakeClock.nowUtc().plusDays(2).plus(Tld.get("com").getTransferGracePeriodLength()));
|
||||
assertTransferred(afterGracePeriod, newExpirationTime, serverApproveAutorenewEvent);
|
||||
assertThat(afterGracePeriod.getGracePeriods()).isEmpty();
|
||||
}
|
||||
@@ -676,7 +670,7 @@ public class DomainTest {
|
||||
// autorenew time as the lookup time for the cost.
|
||||
DateTime oldExpirationTime = domain.getRegistrationExpirationTime();
|
||||
persistResource(
|
||||
Registry.get("com")
|
||||
Tld.get("com")
|
||||
.asBuilder()
|
||||
.setRenewBillingCostTransitions(
|
||||
new ImmutableSortedMap.Builder<DateTime, Money>(Ordering.natural())
|
||||
@@ -698,9 +692,7 @@ public class DomainTest {
|
||||
GracePeriod.createForRecurring(
|
||||
GracePeriodStatus.AUTO_RENEW,
|
||||
domain.getRepoId(),
|
||||
oldExpirationTime
|
||||
.plusYears(2)
|
||||
.plus(Registry.get("com").getAutoRenewGracePeriodLength()),
|
||||
oldExpirationTime.plusYears(2).plus(Tld.get("com").getAutoRenewGracePeriodLength()),
|
||||
renewedThreeTimes.getCurrentSponsorRegistrarId(),
|
||||
renewedThreeTimes.autorenewBillingEvent,
|
||||
renewedThreeTimes.getGracePeriods().iterator().next().getGracePeriodId()));
|
||||
|
||||
@@ -24,7 +24,7 @@ import static google.registry.testing.CertificateSamples.SAMPLE_CERT2_HASH;
|
||||
import static google.registry.testing.CertificateSamples.SAMPLE_CERT_HASH;
|
||||
import static google.registry.testing.DatabaseHelper.cloneAndSetAutoTimestamps;
|
||||
import static google.registry.testing.DatabaseHelper.createTld;
|
||||
import static google.registry.testing.DatabaseHelper.newRegistry;
|
||||
import static google.registry.testing.DatabaseHelper.newTld;
|
||||
import static google.registry.testing.DatabaseHelper.persistResource;
|
||||
import static google.registry.testing.DatabaseHelper.persistSimpleResource;
|
||||
import static google.registry.testing.DatabaseHelper.persistSimpleResources;
|
||||
@@ -43,8 +43,8 @@ import google.registry.model.EntityTestCase;
|
||||
import google.registry.model.registrar.Registrar.State;
|
||||
import google.registry.model.registrar.Registrar.Type;
|
||||
import google.registry.model.tld.Registries;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Registry.TldType;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.model.tld.Tld.TldType;
|
||||
import google.registry.util.CidrAddressBlock;
|
||||
import google.registry.util.SerializeUtils;
|
||||
import java.math.BigDecimal;
|
||||
@@ -63,7 +63,7 @@ class RegistrarTest extends EntityTestCase {
|
||||
void setUp() {
|
||||
createTld("tld");
|
||||
persistResource(
|
||||
newRegistry("xn--q9jyb4c", "MINNA")
|
||||
newTld("xn--q9jyb4c", "MINNA")
|
||||
.asBuilder()
|
||||
.setCurrency(JPY)
|
||||
.setCreateBillingCost(Money.of(JPY, new BigDecimal(1300)))
|
||||
@@ -608,7 +608,7 @@ class RegistrarTest extends EntityTestCase {
|
||||
// This is also important because getTlds fills out the cache when used.
|
||||
assertThat(Registries.getTlds()).doesNotContain("newtld");
|
||||
// We can't use createTld here because it fails when the cache is used.
|
||||
persistResource(newRegistry("newtld", "NEWTLD"));
|
||||
persistResource(newTld("newtld", "NEWTLD"));
|
||||
// Make sure we set up the cache correctly, so the newly created TLD isn't in the cache
|
||||
assertThat(Registries.getTlds()).doesNotContain("newtld");
|
||||
|
||||
@@ -703,7 +703,7 @@ class RegistrarTest extends EntityTestCase {
|
||||
|
||||
@Test
|
||||
void testSuccess_nonRealTldDoesntNeedEntryInBillingMap() {
|
||||
persistResource(Registry.get("xn--q9jyb4c").asBuilder().setTldType(TldType.TEST).build());
|
||||
persistResource(Tld.get("xn--q9jyb4c").asBuilder().setTldType(TldType.TEST).build());
|
||||
// xn--q9jyb4c bills in JPY and we don't have a JPY entry in this billing account map, but it
|
||||
// should succeed without throwing an error because xn--q9jyb4c is set to be a TEST TLD.
|
||||
registrar
|
||||
|
||||
@@ -17,12 +17,12 @@ package google.registry.model.tld;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static com.google.common.truth.Truth8.assertThat;
|
||||
import static google.registry.testing.DatabaseHelper.createTlds;
|
||||
import static google.registry.testing.DatabaseHelper.newRegistry;
|
||||
import static google.registry.testing.DatabaseHelper.newTld;
|
||||
import static google.registry.testing.DatabaseHelper.persistResource;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
import com.google.common.net.InternetDomainName;
|
||||
import google.registry.model.tld.Registry.TldType;
|
||||
import google.registry.model.tld.Tld.TldType;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -48,11 +48,10 @@ class RegistriesTest {
|
||||
@Test
|
||||
void test_getTldEntities() {
|
||||
initTestTlds();
|
||||
persistResource(newRegistry("testtld", "TESTTLD").asBuilder().setTldType(TldType.TEST).build());
|
||||
persistResource(newTld("testtld", "TESTTLD").asBuilder().setTldType(TldType.TEST).build());
|
||||
assertThat(Registries.getTldEntitiesOfType(TldType.REAL))
|
||||
.containsExactly(Registry.get("foo"), Registry.get("a.b.c"));
|
||||
assertThat(Registries.getTldEntitiesOfType(TldType.TEST))
|
||||
.containsExactly(Registry.get("testtld"));
|
||||
.containsExactly(Tld.get("foo"), Tld.get("a.b.c"));
|
||||
assertThat(Registries.getTldEntitiesOfType(TldType.TEST)).containsExactly(Tld.get("testtld"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+80
-95
@@ -19,13 +19,13 @@ import static com.google.common.truth.Truth.assertWithMessage;
|
||||
import static com.google.common.truth.Truth8.assertThat;
|
||||
import static google.registry.model.domain.token.AllocationToken.TokenType.DEFAULT_PROMO;
|
||||
import static google.registry.model.domain.token.AllocationToken.TokenType.SINGLE_USE;
|
||||
import static google.registry.model.tld.Registry.TldState.GENERAL_AVAILABILITY;
|
||||
import static google.registry.model.tld.Registry.TldState.PREDELEGATION;
|
||||
import static google.registry.model.tld.Registry.TldState.QUIET_PERIOD;
|
||||
import static google.registry.model.tld.Registry.TldState.START_DATE_SUNRISE;
|
||||
import static google.registry.model.tld.Tld.TldState.GENERAL_AVAILABILITY;
|
||||
import static google.registry.model.tld.Tld.TldState.PREDELEGATION;
|
||||
import static google.registry.model.tld.Tld.TldState.QUIET_PERIOD;
|
||||
import static google.registry.model.tld.Tld.TldState.START_DATE_SUNRISE;
|
||||
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
||||
import static google.registry.testing.DatabaseHelper.createTld;
|
||||
import static google.registry.testing.DatabaseHelper.newRegistry;
|
||||
import static google.registry.testing.DatabaseHelper.newTld;
|
||||
import static google.registry.testing.DatabaseHelper.persistPremiumList;
|
||||
import static google.registry.testing.DatabaseHelper.persistReservedList;
|
||||
import static google.registry.testing.DatabaseHelper.persistResource;
|
||||
@@ -42,8 +42,8 @@ import com.google.common.collect.ImmutableSortedMap;
|
||||
import google.registry.dns.writer.VoidDnsWriter;
|
||||
import google.registry.model.EntityTestCase;
|
||||
import google.registry.model.domain.token.AllocationToken;
|
||||
import google.registry.model.tld.Registry.RegistryNotFoundException;
|
||||
import google.registry.model.tld.Registry.TldState;
|
||||
import google.registry.model.tld.Tld.TldNotFoundException;
|
||||
import google.registry.model.tld.Tld.TldState;
|
||||
import google.registry.model.tld.label.PremiumList;
|
||||
import google.registry.model.tld.label.PremiumListDao;
|
||||
import google.registry.model.tld.label.ReservedList;
|
||||
@@ -56,10 +56,10 @@ import org.joda.time.DateTime;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/** Unit tests for {@link Registry}. */
|
||||
public final class RegistryTest extends EntityTestCase {
|
||||
/** Unit tests for {@link Tld}. */
|
||||
public final class TldTest extends EntityTestCase {
|
||||
|
||||
RegistryTest() {
|
||||
TldTest() {
|
||||
super(JpaEntityCoverageCheck.ENABLED);
|
||||
}
|
||||
|
||||
@@ -72,47 +72,45 @@ public final class RegistryTest extends EntityTestCase {
|
||||
void testPersistence_updateReservedAndPremiumListSuccessfully() {
|
||||
ReservedList rl15 = persistReservedList("tld-reserved15", "potato,FULLY_BLOCKED");
|
||||
PremiumList pl = persistPremiumList("tld2", USD, "lol,USD 50", "cat,USD 700");
|
||||
Registry registry =
|
||||
Registry.get("tld").asBuilder().setReservedLists(rl15).setPremiumList(pl).build();
|
||||
Tld registry = Tld.get("tld").asBuilder().setReservedLists(rl15).setPremiumList(pl).build();
|
||||
tm().transact(() -> tm().put(registry));
|
||||
Registry persisted = tm().transact(() -> tm().loadByKey(Registry.createVKey(registry.tldStr)));
|
||||
Tld persisted = tm().transact(() -> tm().loadByKey(Tld.createVKey(registry.tldStr)));
|
||||
assertThat(persisted).isEqualTo(registry);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testPersistence() {
|
||||
assertWithMessage("Registry not found").that(Registry.get("tld")).isNotNull();
|
||||
assertThat(tm().transact(() -> tm().loadByKey(Registry.createVKey("tld"))))
|
||||
.isEqualTo(Registry.get("tld"));
|
||||
assertWithMessage("Registry not found").that(Tld.get("tld")).isNotNull();
|
||||
assertThat(tm().transact(() -> tm().loadByKey(Tld.createVKey("tld"))))
|
||||
.isEqualTo(Tld.get("tld"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSerializable() {
|
||||
ReservedList rl15 = persistReservedList("tld-reserved15", "potato,FULLY_BLOCKED");
|
||||
Registry registry = Registry.get("tld").asBuilder().setReservedLists(rl15).build();
|
||||
Tld registry = Tld.get("tld").asBuilder().setReservedLists(rl15).build();
|
||||
tm().transact(() -> tm().put(registry));
|
||||
Registry persisted = tm().transact(() -> tm().loadByKey(Registry.createVKey(registry.tldStr)));
|
||||
Tld persisted = tm().transact(() -> tm().loadByKey(Tld.createVKey(registry.tldStr)));
|
||||
assertThat(SerializeUtils.serializeDeserialize(persisted)).isEqualTo(persisted);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFailure_registryNotFound() {
|
||||
createTld("foo");
|
||||
assertThrows(RegistryNotFoundException.class, () -> Registry.get("baz"));
|
||||
assertThrows(TldNotFoundException.class, () -> Tld.get("baz"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSettingEscrowEnabled_null() {
|
||||
assertThat(Registry.get("tld").asBuilder().setEscrowEnabled(true).build().getEscrowEnabled())
|
||||
assertThat(Tld.get("tld").asBuilder().setEscrowEnabled(true).build().getEscrowEnabled())
|
||||
.isTrue();
|
||||
assertThat(Registry.get("tld").asBuilder().setEscrowEnabled(false).build().getEscrowEnabled())
|
||||
assertThat(Tld.get("tld").asBuilder().setEscrowEnabled(false).build().getEscrowEnabled())
|
||||
.isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSettingCreateBillingCost() {
|
||||
Registry registry =
|
||||
Registry.get("tld").asBuilder().setCreateBillingCost(Money.of(USD, 42)).build();
|
||||
Tld registry = Tld.get("tld").asBuilder().setCreateBillingCost(Money.of(USD, 42)).build();
|
||||
assertThat(registry.getStandardCreateCost()).isEqualTo(Money.of(USD, 42));
|
||||
// The default value of 17 is set in createTld().
|
||||
assertThat(registry.getStandardRestoreCost()).isEqualTo(Money.of(USD, 17));
|
||||
@@ -120,8 +118,7 @@ public final class RegistryTest extends EntityTestCase {
|
||||
|
||||
@Test
|
||||
void testSettingRestoreBillingCost() {
|
||||
Registry registry =
|
||||
Registry.get("tld").asBuilder().setRestoreBillingCost(Money.of(USD, 42)).build();
|
||||
Tld registry = Tld.get("tld").asBuilder().setRestoreBillingCost(Money.of(USD, 42)).build();
|
||||
// The default value of 13 is set in createTld().
|
||||
assertThat(registry.getStandardCreateCost()).isEqualTo(Money.of(USD, 13));
|
||||
assertThat(registry.getStandardRestoreCost()).isEqualTo(Money.of(USD, 42));
|
||||
@@ -129,13 +126,13 @@ public final class RegistryTest extends EntityTestCase {
|
||||
|
||||
@Test
|
||||
void testDefaultNumDnsPublishShards_equalToOne() {
|
||||
Registry registry = Registry.get("tld").asBuilder().build();
|
||||
Tld registry = Tld.get("tld").asBuilder().build();
|
||||
assertThat(registry.getNumDnsPublishLocks()).isEqualTo(1);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSettingNumDnsPublishShards() {
|
||||
Registry registry = Registry.get("tld").asBuilder().setNumDnsPublishLocks(2).build();
|
||||
Tld registry = Tld.get("tld").asBuilder().setNumDnsPublishLocks(2).build();
|
||||
assertThat(registry.getNumDnsPublishLocks()).isEqualTo(2);
|
||||
}
|
||||
|
||||
@@ -159,21 +156,17 @@ public final class RegistryTest extends EntityTestCase {
|
||||
.setShouldPublish(true)
|
||||
.setCreationTimestamp(fakeClock.nowUtc())
|
||||
.build());
|
||||
Registry registry1 =
|
||||
newRegistry("propter", "PROPTER")
|
||||
.asBuilder()
|
||||
.setReservedLists(ImmutableSet.of(rl15))
|
||||
.build();
|
||||
Tld registry1 =
|
||||
newTld("propter", "PROPTER").asBuilder().setReservedLists(ImmutableSet.of(rl15)).build();
|
||||
assertThat(registry1.getReservedListNames()).hasSize(1);
|
||||
Registry registry2 =
|
||||
registry1.asBuilder().setReservedLists(ImmutableSet.of(rl15, rl16)).build();
|
||||
Tld registry2 = registry1.asBuilder().setReservedLists(ImmutableSet.of(rl15, rl16)).build();
|
||||
assertThat(registry1.getReservedListNames()).hasSize(1);
|
||||
assertThat(registry2.getReservedListNames()).hasSize(2);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testGetReservedLists_doesntReturnNullWhenUninitialized() {
|
||||
Registry registry = newRegistry("foo", "FOO");
|
||||
Tld registry = newTld("foo", "FOO");
|
||||
assertThat(registry.getReservedListNames()).isNotNull();
|
||||
assertThat(registry.getReservedListNames()).isEmpty();
|
||||
}
|
||||
@@ -181,13 +174,12 @@ public final class RegistryTest extends EntityTestCase {
|
||||
@Test
|
||||
void testGetAll() {
|
||||
createTld("foo");
|
||||
assertThat(Registry.get(ImmutableSet.of("foo", "tld")))
|
||||
assertThat(Tld.get(ImmutableSet.of("foo", "tld")))
|
||||
.containsExactlyElementsIn(
|
||||
tm().transact(
|
||||
() ->
|
||||
tm().loadByKeys(
|
||||
ImmutableSet.of(
|
||||
Registry.createVKey("foo"), Registry.createVKey("tld"))))
|
||||
ImmutableSet.of(Tld.createVKey("foo"), Tld.createVKey("tld"))))
|
||||
.values());
|
||||
}
|
||||
|
||||
@@ -211,10 +203,9 @@ public final class RegistryTest extends EntityTestCase {
|
||||
.setShouldPublish(true)
|
||||
.setCreationTimestamp(fakeClock.nowUtc())
|
||||
.build());
|
||||
Registry r =
|
||||
Registry.get("tld").asBuilder().setReservedLists(ImmutableSet.of(rl5, rl6)).build();
|
||||
Tld r = Tld.get("tld").asBuilder().setReservedLists(ImmutableSet.of(rl5, rl6)).build();
|
||||
assertThat(r.getReservedListNames()).containsExactly("tld-reserved5", "tld-reserved6");
|
||||
r = Registry.get("tld").asBuilder().setReservedLists(ImmutableSet.of()).build();
|
||||
r = Tld.get("tld").asBuilder().setReservedLists(ImmutableSet.of()).build();
|
||||
assertThat(r.getReservedListNames()).isEmpty();
|
||||
}
|
||||
|
||||
@@ -236,20 +227,20 @@ public final class RegistryTest extends EntityTestCase {
|
||||
.setShouldPublish(true)
|
||||
.setCreationTimestamp(fakeClock.nowUtc())
|
||||
.build());
|
||||
Registry r =
|
||||
Registry.get("tld")
|
||||
Tld r =
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setReservedListsByName(ImmutableSet.of("tld-reserved15", "tld-reserved16"))
|
||||
.build();
|
||||
assertThat(r.getReservedListNames()).containsExactly("tld-reserved15", "tld-reserved16");
|
||||
r = Registry.get("tld").asBuilder().setReservedListsByName(ImmutableSet.of()).build();
|
||||
r = Tld.get("tld").asBuilder().setReservedListsByName(ImmutableSet.of()).build();
|
||||
assertThat(r.getReservedListNames()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSetPremiumList() {
|
||||
PremiumList pl2 = persistPremiumList("tld2", USD, "lol,USD 50", "cat,USD 700");
|
||||
Registry registry = Registry.get("tld").asBuilder().setPremiumList(pl2).build();
|
||||
Tld registry = Tld.get("tld").asBuilder().setPremiumList(pl2).build();
|
||||
Optional<String> pl = registry.getPremiumListName();
|
||||
assertThat(pl).hasValue("tld2");
|
||||
assertThat(PremiumListDao.getLatestRevision("tld2")).isPresent();
|
||||
@@ -258,20 +249,20 @@ public final class RegistryTest extends EntityTestCase {
|
||||
|
||||
@Test
|
||||
void testSettingServerStatusChangeBillingCost() {
|
||||
Registry registry =
|
||||
Registry.get("tld").asBuilder().setServerStatusChangeBillingCost(Money.of(USD, 42)).build();
|
||||
Tld registry =
|
||||
Tld.get("tld").asBuilder().setServerStatusChangeBillingCost(Money.of(USD, 42)).build();
|
||||
assertThat(registry.getServerStatusChangeCost()).isEqualTo(Money.of(USD, 42));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSettingLordnUsername() {
|
||||
Registry registry = Registry.get("tld").asBuilder().setLordnUsername("username").build();
|
||||
Tld registry = Tld.get("tld").asBuilder().setLordnUsername("username").build();
|
||||
assertThat(registry.getLordnUsername()).isEqualTo("username");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSettingDnsWriters() {
|
||||
Registry registry = Registry.get("tld");
|
||||
Tld registry = Tld.get("tld");
|
||||
assertThat(registry.getDnsWriters()).containsExactly(VoidDnsWriter.NAME);
|
||||
registry = registry.asBuilder().setDnsWriters(ImmutableSet.of("baz", "bang")).build();
|
||||
assertThat(registry.getDnsWriters()).containsExactly("baz", "bang");
|
||||
@@ -279,8 +270,8 @@ public final class RegistryTest extends EntityTestCase {
|
||||
|
||||
@Test
|
||||
void testPdtLooksLikeGa() {
|
||||
Registry registry =
|
||||
Registry.get("tld")
|
||||
Tld registry =
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setTldStateTransitions(ImmutableSortedMap.of(START_OF_TIME, TldState.PDT))
|
||||
.build();
|
||||
@@ -289,8 +280,8 @@ public final class RegistryTest extends EntityTestCase {
|
||||
|
||||
@Test
|
||||
void testTldStateTransitionTimes() {
|
||||
Registry registry =
|
||||
Registry.get("tld")
|
||||
Tld registry =
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setTldStateTransitions(
|
||||
ImmutableSortedMap.<DateTime, TldState>naturalOrder()
|
||||
@@ -324,7 +315,7 @@ public final class RegistryTest extends EntityTestCase {
|
||||
|
||||
@Test
|
||||
void testQuietPeriodCanAppearMultipleTimesAnywhere() {
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setTldStateTransitions(
|
||||
ImmutableSortedMap.<DateTime, TldState>naturalOrder()
|
||||
@@ -339,8 +330,8 @@ public final class RegistryTest extends EntityTestCase {
|
||||
|
||||
@Test
|
||||
void testRenewBillingCostTransitionTimes() {
|
||||
Registry registry =
|
||||
Registry.get("tld")
|
||||
Tld registry =
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setRenewBillingCostTransitions(
|
||||
ImmutableSortedMap.of(
|
||||
@@ -378,7 +369,7 @@ public final class RegistryTest extends EntityTestCase {
|
||||
|
||||
@Test
|
||||
void testRenewBillingCostNoTransitions() {
|
||||
Registry registry = Registry.get("tld");
|
||||
Tld registry = Tld.get("tld");
|
||||
// The default value of 11 is set in createTld().
|
||||
assertThat(registry.getStandardRenewCost(START_OF_TIME)).isEqualTo(Money.of(USD, 11));
|
||||
assertThat(registry.getStandardRenewCost(fakeClock.nowUtc().minusMillis(1)))
|
||||
@@ -392,14 +383,14 @@ public final class RegistryTest extends EntityTestCase {
|
||||
@Test
|
||||
void testFailure_tldNeverSet() {
|
||||
IllegalArgumentException thrown =
|
||||
assertThrows(IllegalArgumentException.class, () -> new Registry.Builder().build());
|
||||
assertThrows(IllegalArgumentException.class, () -> new Tld.Builder().build());
|
||||
assertThat(thrown).hasMessageThat().contains("No registry TLD specified");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFailure_setTldStr_null() {
|
||||
IllegalArgumentException thrown =
|
||||
assertThrows(IllegalArgumentException.class, () -> new Registry.Builder().setTldStr(null));
|
||||
assertThrows(IllegalArgumentException.class, () -> new Tld.Builder().setTldStr(null));
|
||||
assertThat(thrown).hasMessageThat().contains("TLD must not be null");
|
||||
}
|
||||
|
||||
@@ -407,7 +398,7 @@ public final class RegistryTest extends EntityTestCase {
|
||||
void testFailure_setTldStr_invalidTld() {
|
||||
IllegalArgumentException thrown =
|
||||
assertThrows(
|
||||
IllegalArgumentException.class, () -> new Registry.Builder().setTldStr(".tld").build());
|
||||
IllegalArgumentException.class, () -> new Tld.Builder().setTldStr(".tld").build());
|
||||
assertThat(thrown)
|
||||
.hasMessageThat()
|
||||
.contains("Cannot create registry for TLD that is not a valid, canonical domain name");
|
||||
@@ -417,7 +408,7 @@ public final class RegistryTest extends EntityTestCase {
|
||||
void testFailure_setTldStr_nonCanonicalTld() {
|
||||
IllegalArgumentException thrown =
|
||||
assertThrows(
|
||||
IllegalArgumentException.class, () -> new Registry.Builder().setTldStr("TLD").build());
|
||||
IllegalArgumentException.class, () -> new Tld.Builder().setTldStr("TLD").build());
|
||||
assertThat(thrown)
|
||||
.hasMessageThat()
|
||||
.contains("Cannot create registry for TLD that is not a valid, canonical domain name");
|
||||
@@ -428,7 +419,7 @@ public final class RegistryTest extends EntityTestCase {
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setTldStateTransitions(
|
||||
ImmutableSortedMap.of(
|
||||
@@ -442,7 +433,7 @@ public final class RegistryTest extends EntityTestCase {
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setTldStateTransitions(
|
||||
ImmutableSortedMap.of(
|
||||
@@ -455,8 +446,7 @@ public final class RegistryTest extends EntityTestCase {
|
||||
void testFailure_pricingEngineIsRequired() {
|
||||
IllegalArgumentException thrown =
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> new Registry.Builder().setTldStr("invalid").build());
|
||||
IllegalArgumentException.class, () -> new Tld.Builder().setTldStr("invalid").build());
|
||||
assertThat(thrown)
|
||||
.hasMessageThat()
|
||||
.contains("All registries must have a configured pricing engine");
|
||||
@@ -468,7 +458,7 @@ public final class RegistryTest extends EntityTestCase {
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setRenewBillingCostTransitions(
|
||||
ImmutableSortedMap.of(START_OF_TIME, Money.of(USD, -42))));
|
||||
@@ -480,7 +470,7 @@ public final class RegistryTest extends EntityTestCase {
|
||||
IllegalArgumentException thrown =
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> Registry.get("tld").asBuilder().setCreateBillingCost(Money.of(USD, -42)));
|
||||
() -> Tld.get("tld").asBuilder().setCreateBillingCost(Money.of(USD, -42)));
|
||||
assertThat(thrown).hasMessageThat().contains("createBillingCost cannot be negative");
|
||||
}
|
||||
|
||||
@@ -489,7 +479,7 @@ public final class RegistryTest extends EntityTestCase {
|
||||
IllegalArgumentException thrown =
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> Registry.get("tld").asBuilder().setRestoreBillingCost(Money.of(USD, -42)));
|
||||
() -> Tld.get("tld").asBuilder().setRestoreBillingCost(Money.of(USD, -42)));
|
||||
assertThat(thrown).hasMessageThat().contains("restoreBillingCost cannot be negative");
|
||||
}
|
||||
|
||||
@@ -498,7 +488,7 @@ public final class RegistryTest extends EntityTestCase {
|
||||
IllegalArgumentException thrown =
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> Registry.get("tld").asBuilder().setNumDnsPublishLocks(-1));
|
||||
() -> Tld.get("tld").asBuilder().setNumDnsPublishLocks(-1));
|
||||
assertThat(thrown)
|
||||
.hasMessageThat()
|
||||
.contains(
|
||||
@@ -506,7 +496,7 @@ public final class RegistryTest extends EntityTestCase {
|
||||
thrown =
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> Registry.get("tld").asBuilder().setNumDnsPublishLocks(0));
|
||||
() -> Tld.get("tld").asBuilder().setNumDnsPublishLocks(0));
|
||||
assertThat(thrown)
|
||||
.hasMessageThat()
|
||||
.contains(
|
||||
@@ -518,10 +508,7 @@ public final class RegistryTest extends EntityTestCase {
|
||||
IllegalArgumentException thrown =
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
Registry.get("tld")
|
||||
.asBuilder()
|
||||
.setServerStatusChangeBillingCost(Money.of(USD, -42)));
|
||||
() -> Tld.get("tld").asBuilder().setServerStatusChangeBillingCost(Money.of(USD, -42)));
|
||||
assertThat(thrown).hasMessageThat().contains("billing cost cannot be negative");
|
||||
}
|
||||
|
||||
@@ -531,12 +518,12 @@ public final class RegistryTest extends EntityTestCase {
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setRenewBillingCostTransitions(
|
||||
ImmutableSortedMap.of(START_OF_TIME, Money.of(EUR, 42)))
|
||||
.build());
|
||||
assertThat(thrown).hasMessageThat().contains("cost must be in the registry's currency");
|
||||
assertThat(thrown).hasMessageThat().contains("cost must be in the TLD's currency");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -544,8 +531,8 @@ public final class RegistryTest extends EntityTestCase {
|
||||
IllegalArgumentException thrown =
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> Registry.get("tld").asBuilder().setCreateBillingCost(Money.of(EUR, 42)).build());
|
||||
assertThat(thrown).hasMessageThat().contains("cost must be in the registry's currency");
|
||||
() -> Tld.get("tld").asBuilder().setCreateBillingCost(Money.of(EUR, 42)).build());
|
||||
assertThat(thrown).hasMessageThat().contains("cost must be in the tld's currency");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -553,8 +540,8 @@ public final class RegistryTest extends EntityTestCase {
|
||||
IllegalArgumentException thrown =
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> Registry.get("tld").asBuilder().setRestoreBillingCost(Money.of(EUR, 42)).build());
|
||||
assertThat(thrown).hasMessageThat().contains("cost must be in the registry's currency");
|
||||
() -> Tld.get("tld").asBuilder().setRestoreBillingCost(Money.of(EUR, 42)).build());
|
||||
assertThat(thrown).hasMessageThat().contains("cost must be in the TLD's currency");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -563,16 +550,16 @@ public final class RegistryTest extends EntityTestCase {
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setServerStatusChangeBillingCost(Money.of(EUR, 42))
|
||||
.build());
|
||||
assertThat(thrown).hasMessageThat().contains("cost must be in the registry's currency");
|
||||
assertThat(thrown).hasMessageThat().contains("cost must be in the TLD's currency");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testEapFee_undefined() {
|
||||
assertThat(Registry.get("tld").getEapFeeFor(fakeClock.nowUtc()).getCost())
|
||||
assertThat(Tld.get("tld").getEapFeeFor(fakeClock.nowUtc()).getCost())
|
||||
.isEqualTo(BigDecimal.ZERO.setScale(2, UNNECESSARY));
|
||||
}
|
||||
|
||||
@@ -580,8 +567,8 @@ public final class RegistryTest extends EntityTestCase {
|
||||
void testEapFee_specified() {
|
||||
DateTime a = fakeClock.nowUtc().minusDays(1);
|
||||
DateTime b = fakeClock.nowUtc().plusDays(1);
|
||||
Registry registry =
|
||||
Registry.get("tld")
|
||||
Tld registry =
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setEapFeeSchedule(
|
||||
ImmutableSortedMap.of(
|
||||
@@ -604,11 +591,11 @@ public final class RegistryTest extends EntityTestCase {
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setEapFeeSchedule(ImmutableSortedMap.of(START_OF_TIME, Money.zero(EUR)))
|
||||
.build());
|
||||
assertThat(thrown).hasMessageThat().contains("All EAP fees must be in the registry's currency");
|
||||
assertThat(thrown).hasMessageThat().contains("All EAP fees must be in the TLD's currency");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -616,27 +603,25 @@ public final class RegistryTest extends EntityTestCase {
|
||||
IllegalArgumentException e =
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> Registry.get("tld").asBuilder().setRoidSuffix("123456789"));
|
||||
() -> Tld.get("tld").asBuilder().setRoidSuffix("123456789"));
|
||||
assertThat(e).hasMessageThat().isEqualTo("ROID suffix must be in format ^[A-Z\\d_]{1,8}$");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFailure_roidSuffixNotUppercased() {
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> Registry.get("tld").asBuilder().setRoidSuffix("abcd"));
|
||||
IllegalArgumentException.class, () -> Tld.get("tld").asBuilder().setRoidSuffix("abcd"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFailure_roidSuffixContainsInvalidCharacters() {
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> Registry.get("tld").asBuilder().setRoidSuffix("ABC-DEF"));
|
||||
IllegalArgumentException.class, () -> Tld.get("tld").asBuilder().setRoidSuffix("ABC-DEF"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_setDefaultPromoTokens() {
|
||||
Registry registry = Registry.get("tld");
|
||||
Tld registry = Tld.get("tld");
|
||||
assertThat(registry.getDefaultPromoTokens()).isEmpty();
|
||||
AllocationToken token1 =
|
||||
persistResource(
|
||||
@@ -662,7 +647,7 @@ public final class RegistryTest extends EntityTestCase {
|
||||
|
||||
@Test
|
||||
void testFailure_setDefaultPromoTokensWrongTokenType() {
|
||||
Registry registry = Registry.get("tld");
|
||||
Tld registry = Tld.get("tld");
|
||||
assertThat(registry.getDefaultPromoTokens()).isEmpty();
|
||||
AllocationToken token1 =
|
||||
persistResource(
|
||||
@@ -688,7 +673,7 @@ public final class RegistryTest extends EntityTestCase {
|
||||
|
||||
@Test
|
||||
void testFailure_setDefaultPromoTokensNotValidForTld() {
|
||||
Registry registry = Registry.get("tld");
|
||||
Tld registry = Tld.get("tld");
|
||||
assertThat(registry.getDefaultPromoTokens()).isEmpty();
|
||||
AllocationToken token1 =
|
||||
persistResource(
|
||||
@@ -18,7 +18,7 @@ import static com.google.common.collect.ImmutableMap.toImmutableMap;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static com.google.common.truth.Truth8.assertThat;
|
||||
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
||||
import static google.registry.testing.DatabaseHelper.newRegistry;
|
||||
import static google.registry.testing.DatabaseHelper.newTld;
|
||||
import static google.registry.testing.DatabaseHelper.persistResource;
|
||||
import static org.joda.money.CurrencyUnit.JPY;
|
||||
import static org.joda.money.CurrencyUnit.USD;
|
||||
@@ -205,8 +205,7 @@ public class PremiumListDaoTest {
|
||||
.setLabelsToPrices(TEST_PRICES)
|
||||
.setCreationTimestamp(fakeClock.nowUtc())
|
||||
.build());
|
||||
persistResource(
|
||||
newRegistry("foobar", "FOOBAR").asBuilder().setPremiumList(premiumList).build());
|
||||
persistResource(newTld("foobar", "FOOBAR").asBuilder().setPremiumList(premiumList).build());
|
||||
assertThat(PremiumListDao.getPremiumPrice("premlist", "silver")).hasValue(Money.of(USD, 10.23));
|
||||
assertThat(PremiumListDao.getPremiumPrice("premlist", "gold")).hasValue(Money.of(USD, 1305.47));
|
||||
assertThat(PremiumListDao.getPremiumPrice("premlist", "zirconium")).isEmpty();
|
||||
@@ -229,8 +228,7 @@ public class PremiumListDaoTest {
|
||||
BigDecimal.valueOf(15000)))
|
||||
.setCreationTimestamp(fakeClock.nowUtc())
|
||||
.build());
|
||||
persistResource(
|
||||
newRegistry("foobar", "FOOBAR").asBuilder().setPremiumList(premiumList).build());
|
||||
persistResource(newTld("foobar", "FOOBAR").asBuilder().setPremiumList(premiumList).build());
|
||||
assertThat(PremiumListDao.getPremiumPrice("premlist", "silver")).hasValue(moneyOf(JPY, 10));
|
||||
assertThat(PremiumListDao.getPremiumPrice("premlist", "gold")).hasValue(moneyOf(JPY, 1000));
|
||||
assertThat(PremiumListDao.getPremiumPrice("premlist", "palladium"))
|
||||
|
||||
@@ -27,7 +27,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.hash.BloomFilter;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.model.tld.label.PremiumList.PremiumEntry;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
||||
@@ -51,7 +51,7 @@ public class PremiumListTest {
|
||||
PremiumList pl =
|
||||
persistPremiumList(
|
||||
"tld", USD, "lol, 999", "rich, 1999", "icann, 100", "johnny-be-goode, 20.50");
|
||||
persistResource(Registry.get("tld").asBuilder().setPremiumList(pl).build());
|
||||
persistResource(Tld.get("tld").asBuilder().setPremiumList(pl).build());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -33,7 +33,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
||||
import google.registry.testing.FakeClock;
|
||||
@@ -73,7 +73,7 @@ class ReservedListTest {
|
||||
|
||||
@Test
|
||||
void testGetReservationTypes_allLabelsAreUnreserved_withNoReservedLists() {
|
||||
assertThat(Registry.get("tld").getReservedListNames()).isEmpty();
|
||||
assertThat(Tld.get("tld").getReservedListNames()).isEmpty();
|
||||
assertThat(getReservationTypes("doodle", "tld")).isEmpty();
|
||||
assertThat(getReservationTypes("access", "tld")).isEmpty();
|
||||
assertThat(getReservationTypes("rich", "tld")).isEmpty();
|
||||
@@ -114,7 +114,7 @@ class ReservedListTest {
|
||||
"roflcopter,FULLY_BLOCKED",
|
||||
"snowcrash,FULLY_BLOCKED");
|
||||
createTld("tld");
|
||||
persistResource(Registry.get("tld").asBuilder().setReservedLists(rl1, rl2).build());
|
||||
persistResource(Tld.get("tld").asBuilder().setReservedLists(rl1, rl2).build());
|
||||
|
||||
assertThat(getReservationTypes("lol", "tld")).containsExactly(FULLY_BLOCKED);
|
||||
assertThat(getReservationTypes("cat", "tld")).containsExactly(FULLY_BLOCKED);
|
||||
@@ -152,7 +152,7 @@ class ReservedListTest {
|
||||
ReservedList rl2 =
|
||||
persistReservedList("reserved2", "lol,ALLOWED_IN_SUNRISE", "snowcrash,FULLY_BLOCKED");
|
||||
createTld("tld");
|
||||
persistResource(Registry.get("tld").asBuilder().setReservedLists(rl1, rl2).build());
|
||||
persistResource(Tld.get("tld").asBuilder().setReservedLists(rl1, rl2).build());
|
||||
|
||||
assertThat(getReservationTypes("lol", "tld"))
|
||||
.containsExactly(NAME_COLLISION, ALLOWED_IN_SUNRISE);
|
||||
@@ -167,9 +167,9 @@ class ReservedListTest {
|
||||
ReservedList rl2 = persistReservedList(
|
||||
"reserved2", "roflcopter,FULLY_BLOCKED", "snowcrash,FULLY_BLOCKED");
|
||||
createTld("tld");
|
||||
persistResource(Registry.get("tld").asBuilder().setReservedLists(rl1, rl2).build());
|
||||
persistResource(Tld.get("tld").asBuilder().setReservedLists(rl1, rl2).build());
|
||||
assertThat(getReservationTypes("roflcopter", "tld")).containsExactly(FULLY_BLOCKED);
|
||||
persistResource(Registry.get("tld").asBuilder().setReservedLists(rl1).build());
|
||||
persistResource(Tld.get("tld").asBuilder().setReservedLists(rl1).build());
|
||||
assertWithMessage(
|
||||
"roflcopter.tld should be unreserved"
|
||||
+ " after unsetting the registry's second reserved list")
|
||||
@@ -199,7 +199,7 @@ class ReservedListTest {
|
||||
"reserved1", "lol,NAME_COLLISION", "roflcopter,ALLOWED_IN_SUNRISE");
|
||||
ReservedList rl2 = persistReservedList("reserved2", "lol,FULLY_BLOCKED");
|
||||
createTld("tld");
|
||||
persistResource(Registry.get("tld").asBuilder().setReservedLists(rl1, rl2).build());
|
||||
persistResource(Tld.get("tld").asBuilder().setReservedLists(rl1, rl2).build());
|
||||
assertThat(getReservationTypes("lol", "tld")).containsExactly(FULLY_BLOCKED, NAME_COLLISION);
|
||||
assertThat(getReservationTypes("roflcopter", "tld")).containsExactly(ALLOWED_IN_SUNRISE);
|
||||
assertThat(reservedListChecks)
|
||||
@@ -228,7 +228,7 @@ class ReservedListTest {
|
||||
void testSave() {
|
||||
ReservedList rl = persistReservedList("tld-reserved", "lol,FULLY_BLOCKED # yup");
|
||||
createTld("tld");
|
||||
persistResource(Registry.get("tld").asBuilder().setReservedLists(rl).build());
|
||||
persistResource(Tld.get("tld").asBuilder().setReservedLists(rl).build());
|
||||
assertThat(getReservationTypes("lol", "tld")).containsExactly(FULLY_BLOCKED);
|
||||
}
|
||||
|
||||
@@ -260,7 +260,7 @@ class ReservedListTest {
|
||||
@Test
|
||||
void testIsInUse_returnsTrueWhenInUse() {
|
||||
ReservedList rl = persistReservedList("reserved", "trombone,FULLY_BLOCKED");
|
||||
persistResource(Registry.get("tld").asBuilder().setReservedLists(ImmutableSet.of(rl)).build());
|
||||
persistResource(Tld.get("tld").asBuilder().setReservedLists(ImmutableSet.of(rl)).build());
|
||||
assertThat(rl.isInUse()).isTrue();
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||
import com.google.common.collect.ImmutableSortedMap;
|
||||
import google.registry.model.ImmutableObject;
|
||||
import google.registry.model.common.TimedTransitionProperty;
|
||||
import google.registry.model.tld.Registry.TldState;
|
||||
import google.registry.model.tld.Tld.TldState;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions.JpaUnitTestExtension;
|
||||
import javax.persistence.Entity;
|
||||
|
||||
@@ -26,7 +26,7 @@ import static org.joda.money.CurrencyUnit.USD;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
import com.google.common.collect.ImmutableSortedMap;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.model.tld.label.PremiumList;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
||||
@@ -53,7 +53,7 @@ public class PricingEngineProxyTest {
|
||||
persistPremiumList(
|
||||
"premium list", USD, "rich,USD 100", "richer,USD 999", "fraction,USD 20.50");
|
||||
createTld("moka");
|
||||
persistResource(Registry.get("moka").asBuilder().setPremiumList(premiumList).build());
|
||||
persistResource(Tld.get("moka").asBuilder().setPremiumList(premiumList).build());
|
||||
clock = new FakeClock(DateTime.parse("2016-03-17T12:01:00Z"));
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ public class PricingEngineProxyTest {
|
||||
// The example tld has a premium price for "rich".
|
||||
createTld("example");
|
||||
persistResource(
|
||||
Registry.get("example")
|
||||
Tld.get("example")
|
||||
.asBuilder()
|
||||
.setRenewBillingCostTransitions(
|
||||
ImmutableSortedMap.of(
|
||||
@@ -126,7 +126,7 @@ public class PricingEngineProxyTest {
|
||||
@Test
|
||||
void testFailure_cantLoadPricingEngine() {
|
||||
createTld("example");
|
||||
persistResource(Registry.get("example").asBuilder().setPremiumPricingEngine("fake").build());
|
||||
persistResource(Tld.get("example").asBuilder().setPremiumPricingEngine("fake").build());
|
||||
IllegalStateException thrown =
|
||||
assertThrows(
|
||||
IllegalStateException.class,
|
||||
|
||||
@@ -33,7 +33,7 @@ import google.registry.model.domain.Period;
|
||||
import google.registry.model.host.Host;
|
||||
import google.registry.model.registrar.Registrar;
|
||||
import google.registry.model.reporting.HistoryEntry;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.rdap.RdapMetrics.EndpointType;
|
||||
import google.registry.rdap.RdapMetrics.SearchType;
|
||||
import google.registry.rdap.RdapMetrics.WildcardType;
|
||||
@@ -372,7 +372,7 @@ class RdapDomainActionTest extends RdapActionBaseTestCase<RdapDomainAction> {
|
||||
@Disabled
|
||||
@Test
|
||||
void testDomainInTestTld_notFound() {
|
||||
persistResource(Registry.get("lol").asBuilder().setTldType(Registry.TldType.TEST).build());
|
||||
persistResource(Tld.get("lol").asBuilder().setTldType(Tld.TldType.TEST).build());
|
||||
generateActualJson("cat.lol");
|
||||
assertThat(response.getStatus()).isEqualTo(404);
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ import google.registry.model.domain.Period;
|
||||
import google.registry.model.host.Host;
|
||||
import google.registry.model.registrar.Registrar;
|
||||
import google.registry.model.reporting.HistoryEntry;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.persistence.VKey;
|
||||
import google.registry.rdap.RdapMetrics.EndpointType;
|
||||
import google.registry.rdap.RdapMetrics.SearchType;
|
||||
@@ -1024,7 +1024,7 @@ class RdapDomainSearchActionTest extends RdapSearchActionTestCase<RdapDomainSear
|
||||
@Disabled
|
||||
@Test
|
||||
void testDomainMatchDomainInTestTld_notFound() {
|
||||
persistResource(Registry.get("lol").asBuilder().setTldType(Registry.TldType.TEST).build());
|
||||
persistResource(Tld.get("lol").asBuilder().setTldType(Tld.TldType.TEST).build());
|
||||
runNotFoundTest(RequestType.NAME, "cat.lol", "No domains found");
|
||||
verifyErrorMetrics(SearchType.BY_DOMAIN_NAME);
|
||||
}
|
||||
@@ -1392,7 +1392,7 @@ class RdapDomainSearchActionTest extends RdapSearchActionTestCase<RdapDomainSear
|
||||
@Disabled
|
||||
@Test
|
||||
void testNameserverMatchDomainsInTestTld_notFound() {
|
||||
persistResource(Registry.get("lol").asBuilder().setTldType(Registry.TldType.TEST).build());
|
||||
persistResource(Tld.get("lol").asBuilder().setTldType(Tld.TldType.TEST).build());
|
||||
runNotFoundTest(RequestType.NS_LDH_NAME, "ns2.cat.lol", "No matching nameservers found");
|
||||
}
|
||||
|
||||
@@ -1663,8 +1663,8 @@ class RdapDomainSearchActionTest extends RdapSearchActionTestCase<RdapDomainSear
|
||||
@Disabled
|
||||
@Test
|
||||
void testAddressMatchDomainsInTestTld_notFound() {
|
||||
persistResource(Registry.get("lol").asBuilder().setTldType(Registry.TldType.TEST).build());
|
||||
persistResource(Registry.get("example").asBuilder().setTldType(Registry.TldType.TEST).build());
|
||||
persistResource(Tld.get("lol").asBuilder().setTldType(Tld.TldType.TEST).build());
|
||||
persistResource(Tld.get("example").asBuilder().setTldType(Tld.TldType.TEST).build());
|
||||
runNotFoundTest(RequestType.NS_IP, "127.0.0.1", "No matching nameservers found");
|
||||
verifyErrorMetrics(SearchType.BY_NAMESERVER_ADDRESS);
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ import google.registry.keyring.api.Keyring;
|
||||
import google.registry.model.common.Cursor;
|
||||
import google.registry.model.rde.RdeMode;
|
||||
import google.registry.model.rde.RdeRevision;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
||||
import google.registry.request.HttpException.NoContentException;
|
||||
@@ -126,13 +126,13 @@ public class BrdaCopyActionTest {
|
||||
() -> {
|
||||
RdeRevision.saveRevision("lol", DateTime.parse("2010-10-17TZ"), RdeMode.THIN, 0);
|
||||
});
|
||||
persistResource(Cursor.createScoped(BRDA, action.watermark.plusDays(1), Registry.get("lol")));
|
||||
persistResource(Cursor.createScoped(BRDA, action.watermark.plusDays(1), Tld.get("lol")));
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ValueSource(strings = {"", "job-name/"})
|
||||
void testRun_stagingNotFinished_throws204(String prefix) throws Exception {
|
||||
persistResource(Cursor.createScoped(BRDA, action.watermark, Registry.get("lol")));
|
||||
persistResource(Cursor.createScoped(BRDA, action.watermark, Tld.get("lol")));
|
||||
NoContentException thrown = assertThrows(NoContentException.class, () -> runAction(prefix));
|
||||
assertThat(thrown)
|
||||
.hasMessageThat()
|
||||
|
||||
@@ -26,7 +26,7 @@ import static org.mockito.Mockito.verify;
|
||||
|
||||
import google.registry.model.common.Cursor;
|
||||
import google.registry.model.common.Cursor.CursorType;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
||||
import google.registry.rde.EscrowTaskRunner.EscrowTask;
|
||||
@@ -53,12 +53,12 @@ public class EscrowTaskRunnerTest {
|
||||
|
||||
private DateTimeZone previousDateTimeZone;
|
||||
private EscrowTaskRunner runner;
|
||||
private Registry registry;
|
||||
private Tld registry;
|
||||
|
||||
@BeforeEach
|
||||
void beforeEach() {
|
||||
createTld("lol");
|
||||
registry = Registry.get("lol");
|
||||
registry = Tld.get("lol");
|
||||
runner = new EscrowTaskRunner();
|
||||
runner.clock = clock;
|
||||
runner.lockHandler = new FakeLockHandler(true);
|
||||
|
||||
@@ -31,7 +31,7 @@ import com.google.common.collect.ImmutableSetMultimap;
|
||||
import com.google.common.truth.Truth8;
|
||||
import google.registry.model.common.Cursor;
|
||||
import google.registry.model.common.Cursor.CursorType;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
||||
import google.registry.testing.FakeClock;
|
||||
@@ -94,7 +94,7 @@ public class PendingDepositCheckerTest {
|
||||
clock.setTo(DateTime.parse("2000-01-01TZ")); // Saturday
|
||||
createTldWithEscrowEnabled("lol");
|
||||
clock.advanceOneMilli();
|
||||
Registry registry = Registry.get("lol");
|
||||
Tld registry = Tld.get("lol");
|
||||
Truth8.assertThat(loadByKeyIfPresent(Cursor.createScopedVKey(RDE_STAGING, registry))).isEmpty();
|
||||
checker.getTldsAndWatermarksPendingDepositForRdeAndBrda();
|
||||
assertThat(loadByKey(Cursor.createScopedVKey(RDE_STAGING, registry)).getCursorTime())
|
||||
@@ -107,10 +107,10 @@ public class PendingDepositCheckerTest {
|
||||
createTldWithEscrowEnabled("lol");
|
||||
clock.advanceOneMilli();
|
||||
DateTime yesterday = DateTime.parse("1999-12-31TZ");
|
||||
setCursor(Registry.get("lol"), RDE_STAGING, yesterday);
|
||||
setCursor(Tld.get("lol"), RDE_STAGING, yesterday);
|
||||
clock.advanceOneMilli();
|
||||
checker.getTldsAndWatermarksPendingDepositForRdeAndBrda();
|
||||
Cursor cursor = loadByKey(Cursor.createScopedVKey(RDE_STAGING, Registry.get("lol")));
|
||||
Cursor cursor = loadByKey(Cursor.createScopedVKey(RDE_STAGING, Tld.get("lol")));
|
||||
assertThat(cursor.getCursorTime()).isEqualTo(yesterday);
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ public class PendingDepositCheckerTest {
|
||||
void testMethod_firstBrdaDepositButNotOnBrdaDay_doesntInitializeCursor() {
|
||||
clock.setTo(DateTime.parse("2000-01-01TZ")); // Saturday
|
||||
createTldWithEscrowEnabled("lol");
|
||||
Registry registry = Registry.get("lol");
|
||||
Tld registry = Tld.get("lol");
|
||||
clock.advanceOneMilli();
|
||||
setCursor(registry, RDE_STAGING, DateTime.parse("2000-01-02TZ")); // assume rde is already done
|
||||
clock.advanceOneMilli();
|
||||
@@ -132,7 +132,7 @@ public class PendingDepositCheckerTest {
|
||||
clock.setTo(DateTime.parse("2000-01-01TZ"));
|
||||
createTldWithEscrowEnabled("lol");
|
||||
clock.advanceOneMilli();
|
||||
setCursor(Registry.get("lol"), RDE_STAGING, DateTime.parse("1999-12-30TZ"));
|
||||
setCursor(Tld.get("lol"), RDE_STAGING, DateTime.parse("1999-12-30TZ"));
|
||||
clock.advanceOneMilli();
|
||||
assertThat(checker.getTldsAndWatermarksPendingDepositForRdeAndBrda()).isEqualTo(
|
||||
ImmutableSetMultimap.of(
|
||||
@@ -163,13 +163,13 @@ public class PendingDepositCheckerTest {
|
||||
}
|
||||
|
||||
private static void setCursor(
|
||||
final Registry registry, final CursorType cursorType, final DateTime value) {
|
||||
final Tld registry, final CursorType cursorType, final DateTime value) {
|
||||
tm().transact(() -> tm().put(Cursor.createScoped(cursorType, value, registry)));
|
||||
}
|
||||
|
||||
private static void createTldWithEscrowEnabled(final String tld) {
|
||||
createTld(tld);
|
||||
persistResource(Registry.get(tld).asBuilder().setEscrowEnabled(true).build());
|
||||
persistResource(Tld.get(tld).asBuilder().setEscrowEnabled(true).build());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ import com.google.common.io.ByteSource;
|
||||
import google.registry.gcs.GcsUtils;
|
||||
import google.registry.model.common.Cursor;
|
||||
import google.registry.model.rde.RdeRevision;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
||||
import google.registry.request.HttpException.InternalServerErrorException;
|
||||
@@ -96,7 +96,7 @@ public class RdeReportActionTest {
|
||||
private final GcsUtils gcsUtils = new GcsUtils(LocalStorageHelper.getOptions());
|
||||
private final BlobId reportFile =
|
||||
BlobId.of("tub", "test_2006-06-06_full_S1_R0-report.xml.ghostryde");
|
||||
private Registry registry;
|
||||
private Tld registry;
|
||||
|
||||
private RdeReportAction createAction() {
|
||||
RdeReporter reporter = new RdeReporter();
|
||||
@@ -133,8 +133,9 @@ public class RdeReportActionTest {
|
||||
RdeReportAction action = createAction();
|
||||
action.tld = "lol";
|
||||
action.run();
|
||||
verify(runner).lockRunAndRollForward(
|
||||
action, Registry.get("lol"), standardSeconds(30), RDE_REPORT, standardDays(1));
|
||||
verify(runner)
|
||||
.lockRunAndRollForward(
|
||||
action, Tld.get("lol"), standardSeconds(30), RDE_REPORT, standardDays(1));
|
||||
verifyNoMoreInteractions(runner);
|
||||
}
|
||||
|
||||
@@ -209,7 +210,7 @@ public class RdeReportActionTest {
|
||||
}
|
||||
|
||||
void testRunWithLock_nonexistentCursor_throws204() {
|
||||
tm().transact(() -> tm().delete(Cursor.createScopedVKey(RDE_UPLOAD, Registry.get("test"))));
|
||||
tm().transact(() -> tm().delete(Cursor.createScopedVKey(RDE_UPLOAD, Tld.get("test"))));
|
||||
NoContentException thrown =
|
||||
assertThrows(
|
||||
NoContentException.class, () -> createAction().runWithLock(loadRdeReportCursor()));
|
||||
@@ -223,7 +224,7 @@ public class RdeReportActionTest {
|
||||
@Test
|
||||
void testRunWithLock_uploadNotFinished_throws204() {
|
||||
persistResource(
|
||||
Cursor.createScoped(RDE_UPLOAD, DateTime.parse("2006-06-06TZ"), Registry.get("test")));
|
||||
Cursor.createScoped(RDE_UPLOAD, DateTime.parse("2006-06-06TZ"), Tld.get("test")));
|
||||
NoContentException thrown =
|
||||
assertThrows(
|
||||
NoContentException.class, () -> createAction().runWithLock(loadRdeReportCursor()));
|
||||
|
||||
@@ -29,7 +29,7 @@ import com.google.cloud.storage.contrib.nio.testing.LocalStorageHelper;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import google.registry.beam.BeamActionTestBase;
|
||||
import google.registry.gcs.GcsUtils;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
||||
import google.registry.request.HttpException.BadRequestException;
|
||||
@@ -127,7 +127,7 @@ public class RdeStagingActionTest extends BeamActionTestBase {
|
||||
@Test
|
||||
void testRun_tldWithoutEscrowEnabled_returns204() {
|
||||
createTld("lol");
|
||||
persistResource(Registry.get("lol").asBuilder().setEscrowEnabled(false).build());
|
||||
persistResource(Tld.get("lol").asBuilder().setEscrowEnabled(false).build());
|
||||
clock.setTo(DateTime.parse("2000-01-01TZ"));
|
||||
action.run();
|
||||
assertThat(response.getStatus()).isEqualTo(204);
|
||||
@@ -259,6 +259,6 @@ public class RdeStagingActionTest extends BeamActionTestBase {
|
||||
|
||||
private static void createTldWithEscrowEnabled(final String tld) {
|
||||
createTld(tld);
|
||||
persistResource(Registry.get(tld).asBuilder().setEscrowEnabled(true).build());
|
||||
persistResource(Tld.get(tld).asBuilder().setEscrowEnabled(true).build());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ import google.registry.keyring.api.Keyring;
|
||||
import google.registry.model.common.Cursor;
|
||||
import google.registry.model.common.Cursor.CursorType;
|
||||
import google.registry.model.rde.RdeRevision;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
||||
import google.registry.rde.JSchSshSession.JSchSshSessionFactory;
|
||||
@@ -224,11 +224,7 @@ public class RdeUploadActionTest {
|
||||
action.run();
|
||||
verify(runner)
|
||||
.lockRunAndRollForward(
|
||||
action,
|
||||
Registry.get("lol"),
|
||||
standardSeconds(23),
|
||||
CursorType.RDE_UPLOAD,
|
||||
standardDays(1));
|
||||
action, Tld.get("lol"), standardSeconds(23), CursorType.RDE_UPLOAD, standardDays(1));
|
||||
cloudTasksHelper.assertTasksEnqueued(
|
||||
"rde-report",
|
||||
new TaskMatcher().url(RdeReportAction.PATH).param(RequestParameters.PARAM_TLD, "lol"));
|
||||
@@ -244,11 +240,7 @@ public class RdeUploadActionTest {
|
||||
action.run();
|
||||
verify(runner)
|
||||
.lockRunAndRollForward(
|
||||
action,
|
||||
Registry.get("lol"),
|
||||
standardSeconds(23),
|
||||
CursorType.RDE_UPLOAD,
|
||||
standardDays(1));
|
||||
action, Tld.get("lol"), standardSeconds(23), CursorType.RDE_UPLOAD, standardDays(1));
|
||||
cloudTasksHelper.assertTasksEnqueued(
|
||||
"rde-report",
|
||||
new TaskMatcher()
|
||||
@@ -264,7 +256,7 @@ public class RdeUploadActionTest {
|
||||
URI uploadUrl = URI.create(String.format("sftp://user:password@localhost:%d/", port));
|
||||
DateTime stagingCursor = DateTime.parse("2010-10-18TZ");
|
||||
DateTime uploadCursor = DateTime.parse("2010-10-17TZ");
|
||||
persistResource(Cursor.createScoped(RDE_STAGING, stagingCursor, Registry.get("tld")));
|
||||
persistResource(Cursor.createScoped(RDE_STAGING, stagingCursor, Tld.get("tld")));
|
||||
RdeUploadAction action = createAction(uploadUrl);
|
||||
action.lazyJsch = Lazies.of(createThrowingJSchSpy(action.lazyJsch.get(), 2));
|
||||
action.runWithLock(uploadCursor);
|
||||
@@ -283,7 +275,7 @@ public class RdeUploadActionTest {
|
||||
URI uploadUrl = URI.create(String.format("sftp://user:password@localhost:%d/", port));
|
||||
DateTime stagingCursor = DateTime.parse("2010-10-18TZ");
|
||||
DateTime uploadCursor = DateTime.parse("2010-10-17TZ");
|
||||
persistResource(Cursor.createScoped(RDE_STAGING, stagingCursor, Registry.get("tld")));
|
||||
persistResource(Cursor.createScoped(RDE_STAGING, stagingCursor, Tld.get("tld")));
|
||||
RdeUploadAction action = createAction(uploadUrl);
|
||||
action.lazyJsch = Lazies.of(createThrowingJSchSpy(action.lazyJsch.get(), 3));
|
||||
RuntimeException thrown =
|
||||
@@ -297,7 +289,7 @@ public class RdeUploadActionTest {
|
||||
URI uploadUrl = URI.create(String.format("sftp://user:password@localhost:%d/", port));
|
||||
DateTime stagingCursor = DateTime.parse("2010-10-18TZ");
|
||||
DateTime uploadCursor = DateTime.parse("2010-10-17TZ");
|
||||
persistResource(Cursor.createScoped(RDE_STAGING, stagingCursor, Registry.get("tld")));
|
||||
persistResource(Cursor.createScoped(RDE_STAGING, stagingCursor, Tld.get("tld")));
|
||||
gcsUtils.delete(GHOSTRYDE_FILE_WITH_PREFIX);
|
||||
gcsUtils.delete(LENGTH_FILE_WITH_PREFIX);
|
||||
gcsUtils.delete(REPORT_FILE_WITH_PREFIX);
|
||||
@@ -317,7 +309,7 @@ public class RdeUploadActionTest {
|
||||
URI uploadUrl = URI.create(String.format("sftp://user:password@localhost:%d/", port));
|
||||
DateTime stagingCursor = DateTime.parse("2010-10-18TZ");
|
||||
DateTime uploadCursor = DateTime.parse("2010-10-17TZ");
|
||||
persistResource(Cursor.createScoped(RDE_STAGING, stagingCursor, Registry.get("tld")));
|
||||
persistResource(Cursor.createScoped(RDE_STAGING, stagingCursor, Tld.get("tld")));
|
||||
RdeUploadAction action = createAction(uploadUrl);
|
||||
action.prefix = Optional.of(JOB_PREFIX + "-job-name/");
|
||||
gcsUtils.delete(GHOSTRYDE_FILE);
|
||||
@@ -346,7 +338,7 @@ public class RdeUploadActionTest {
|
||||
URI uploadUrl = URI.create(String.format("sftp://user:password@localhost:%d/", port));
|
||||
DateTime stagingCursor = DateTime.parse("2010-10-18TZ");
|
||||
DateTime uploadCursor = DateTime.parse("2010-10-17TZ");
|
||||
persistResource(Cursor.createScoped(RDE_STAGING, stagingCursor, Registry.get("tld")));
|
||||
persistResource(Cursor.createScoped(RDE_STAGING, stagingCursor, Tld.get("tld")));
|
||||
RdeUploadAction action = createAction(uploadUrl);
|
||||
gcsUtils.delete(GHOSTRYDE_FILE);
|
||||
gcsUtils.delete(LENGTH_FILE);
|
||||
@@ -387,7 +379,7 @@ public class RdeUploadActionTest {
|
||||
URI uploadUrl = URI.create(String.format("sftp://user:password@localhost:%d/", port));
|
||||
DateTime stagingCursor = DateTime.parse("2010-10-18TZ");
|
||||
DateTime uploadCursor = DateTime.parse("2010-10-17TZ");
|
||||
persistSimpleResource(Cursor.createScoped(RDE_STAGING, stagingCursor, Registry.get("tld")));
|
||||
persistSimpleResource(Cursor.createScoped(RDE_STAGING, stagingCursor, Tld.get("tld")));
|
||||
BlobId ghostrydeR1FileWithPrefix =
|
||||
BlobId.of("bucket", JOB_PREFIX + "-job-name/tld_2010-10-17_full_S1_R1.xml.ghostryde");
|
||||
BlobId lengthR1FileWithPrefix =
|
||||
@@ -418,7 +410,7 @@ public class RdeUploadActionTest {
|
||||
URI uploadUrl = URI.create(String.format("sftp://user:password@localhost:%d/", port));
|
||||
DateTime stagingCursor = DateTime.parse("2010-10-18TZ");
|
||||
DateTime uploadCursor = DateTime.parse("2010-10-17TZ");
|
||||
persistResource(Cursor.createScoped(RDE_STAGING, stagingCursor, Registry.get("tld")));
|
||||
persistResource(Cursor.createScoped(RDE_STAGING, stagingCursor, Tld.get("tld")));
|
||||
createAction(uploadUrl).runWithLock(uploadCursor);
|
||||
// Only verify signature for SFTP versions, since we check elsewhere that the GCS files are
|
||||
// identical to the ones sent over SFTP.
|
||||
@@ -456,7 +448,7 @@ public class RdeUploadActionTest {
|
||||
URI url = URI.create("sftp://user:password@localhost:32323/");
|
||||
DateTime stagingCursor = DateTime.parse("2010-10-17TZ");
|
||||
DateTime uploadCursor = DateTime.parse("2010-10-17TZ");
|
||||
persistResource(Cursor.createScoped(RDE_STAGING, stagingCursor, Registry.get("tld")));
|
||||
persistResource(Cursor.createScoped(RDE_STAGING, stagingCursor, Tld.get("tld")));
|
||||
NoContentException thrown =
|
||||
assertThrows(NoContentException.class, () -> createAction(url).runWithLock(uploadCursor));
|
||||
assertThat(thrown)
|
||||
@@ -473,8 +465,8 @@ public class RdeUploadActionTest {
|
||||
DateTime stagingCursor = DateTime.parse("2010-10-18TZ");
|
||||
DateTime uploadCursor = DateTime.parse("2010-10-17TZ");
|
||||
DateTime sftpCursor = uploadCursor.minusMinutes(97); // Within the 2 hour cooldown period.
|
||||
persistResource(Cursor.createScoped(RDE_STAGING, stagingCursor, Registry.get("tld")));
|
||||
persistResource(Cursor.createScoped(RDE_UPLOAD_SFTP, sftpCursor, Registry.get("tld")));
|
||||
persistResource(Cursor.createScoped(RDE_STAGING, stagingCursor, Tld.get("tld")));
|
||||
persistResource(Cursor.createScoped(RDE_UPLOAD_SFTP, sftpCursor, Tld.get("tld")));
|
||||
NoContentException thrown =
|
||||
assertThrows(NoContentException.class, () -> action.runWithLock(uploadCursor));
|
||||
assertThat(thrown)
|
||||
|
||||
+14
-14
@@ -33,7 +33,7 @@ import com.google.common.testing.TestLogHandler;
|
||||
import google.registry.gcs.GcsUtils;
|
||||
import google.registry.model.common.Cursor;
|
||||
import google.registry.model.common.Cursor.CursorType;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
||||
import google.registry.request.HttpException.ServiceUnavailableException;
|
||||
@@ -104,16 +104,16 @@ class IcannReportingUploadActionTest {
|
||||
clock.setTo(DateTime.parse("2006-07-05T00:30:00Z"));
|
||||
persistResource(
|
||||
Cursor.createScoped(
|
||||
CursorType.ICANN_UPLOAD_ACTIVITY, DateTime.parse("2006-07-01TZ"), Registry.get("tld")));
|
||||
CursorType.ICANN_UPLOAD_ACTIVITY, DateTime.parse("2006-07-01TZ"), Tld.get("tld")));
|
||||
persistResource(
|
||||
Cursor.createScoped(
|
||||
CursorType.ICANN_UPLOAD_TX, DateTime.parse("2006-07-01TZ"), Registry.get("tld")));
|
||||
CursorType.ICANN_UPLOAD_TX, DateTime.parse("2006-07-01TZ"), Tld.get("tld")));
|
||||
persistResource(
|
||||
Cursor.createScoped(
|
||||
CursorType.ICANN_UPLOAD_ACTIVITY, DateTime.parse("2006-07-01TZ"), Registry.get("foo")));
|
||||
CursorType.ICANN_UPLOAD_ACTIVITY, DateTime.parse("2006-07-01TZ"), Tld.get("foo")));
|
||||
persistResource(
|
||||
Cursor.createScoped(
|
||||
CursorType.ICANN_UPLOAD_TX, DateTime.parse("2006-07-01TZ"), Registry.get("foo")));
|
||||
CursorType.ICANN_UPLOAD_TX, DateTime.parse("2006-07-01TZ"), Tld.get("foo")));
|
||||
loggerToIntercept.addHandler(logHandler);
|
||||
}
|
||||
|
||||
@@ -145,10 +145,10 @@ class IcannReportingUploadActionTest {
|
||||
clock.setTo(DateTime.parse("2006-01-22T00:30:00Z"));
|
||||
persistResource(
|
||||
Cursor.createScoped(
|
||||
CursorType.ICANN_UPLOAD_ACTIVITY, DateTime.parse("2006-01-01TZ"), Registry.get("tld")));
|
||||
CursorType.ICANN_UPLOAD_ACTIVITY, DateTime.parse("2006-01-01TZ"), Tld.get("tld")));
|
||||
persistResource(
|
||||
Cursor.createScoped(
|
||||
CursorType.ICANN_UPLOAD_TX, DateTime.parse("2006-01-01TZ"), Registry.get("tld")));
|
||||
CursorType.ICANN_UPLOAD_TX, DateTime.parse("2006-01-01TZ"), Tld.get("tld")));
|
||||
gcsUtils.createFromBytes(
|
||||
BlobId.of("basin/icann/monthly/2005-12", "tld-transactions-200512.csv"), PAYLOAD_SUCCESS);
|
||||
gcsUtils.createFromBytes(
|
||||
@@ -181,7 +181,7 @@ class IcannReportingUploadActionTest {
|
||||
IcannReportingUploadAction action = createAction();
|
||||
action.run();
|
||||
Cursor cursor =
|
||||
loadByKey(Cursor.createScopedVKey(CursorType.ICANN_UPLOAD_ACTIVITY, Registry.get("tld")));
|
||||
loadByKey(Cursor.createScopedVKey(CursorType.ICANN_UPLOAD_ACTIVITY, Tld.get("tld")));
|
||||
assertThat(cursor.getCursorTime()).isEqualTo(DateTime.parse("2006-08-01TZ"));
|
||||
}
|
||||
|
||||
@@ -238,7 +238,7 @@ class IcannReportingUploadActionTest {
|
||||
runTest_nonRetryableException(
|
||||
new IOException("Your IP address 25.147.130.158 is not allowed to connect"));
|
||||
Cursor cursor =
|
||||
loadByKey(Cursor.createScopedVKey(CursorType.ICANN_UPLOAD_ACTIVITY, Registry.get("tld")));
|
||||
loadByKey(Cursor.createScopedVKey(CursorType.ICANN_UPLOAD_ACTIVITY, Tld.get("tld")));
|
||||
assertThat(cursor.getCursorTime()).isEqualTo(DateTime.parse("2006-07-01TZ"));
|
||||
}
|
||||
|
||||
@@ -248,7 +248,7 @@ class IcannReportingUploadActionTest {
|
||||
IcannReportingUploadAction action = createAction();
|
||||
action.run();
|
||||
Cursor cursor =
|
||||
loadByKey(Cursor.createScopedVKey(CursorType.ICANN_UPLOAD_ACTIVITY, Registry.get("foo")));
|
||||
loadByKey(Cursor.createScopedVKey(CursorType.ICANN_UPLOAD_ACTIVITY, Tld.get("foo")));
|
||||
assertThat(cursor.getCursorTime()).isEqualTo(DateTime.parse("2006-07-01TZ"));
|
||||
verifyNoMoreInteractions(mockReporter);
|
||||
}
|
||||
@@ -284,7 +284,7 @@ class IcannReportingUploadActionTest {
|
||||
clock.setTo(DateTime.parse("2006-01-22T00:30:00Z"));
|
||||
persistResource(
|
||||
Cursor.createScoped(
|
||||
CursorType.ICANN_UPLOAD_ACTIVITY, DateTime.parse("2006-01-01TZ"), Registry.get("tld")));
|
||||
CursorType.ICANN_UPLOAD_ACTIVITY, DateTime.parse("2006-01-01TZ"), Tld.get("tld")));
|
||||
IcannReportingUploadAction action = createAction();
|
||||
action.run();
|
||||
assertAboutLogs()
|
||||
@@ -300,7 +300,7 @@ class IcannReportingUploadActionTest {
|
||||
void testWarning_fileNotStagedYet() throws Exception {
|
||||
persistResource(
|
||||
Cursor.createScoped(
|
||||
CursorType.ICANN_UPLOAD_ACTIVITY, DateTime.parse("2006-08-01TZ"), Registry.get("foo")));
|
||||
CursorType.ICANN_UPLOAD_ACTIVITY, DateTime.parse("2006-08-01TZ"), Tld.get("foo")));
|
||||
clock.setTo(DateTime.parse("2006-08-01T00:30:00Z"));
|
||||
IcannReportingUploadAction action = createAction();
|
||||
action.run();
|
||||
@@ -349,10 +349,10 @@ class IcannReportingUploadActionTest {
|
||||
new InternetAddress("sender@example.com")));
|
||||
|
||||
Cursor newActivityCursor =
|
||||
loadByKey(Cursor.createScopedVKey(CursorType.ICANN_UPLOAD_ACTIVITY, Registry.get("new")));
|
||||
loadByKey(Cursor.createScopedVKey(CursorType.ICANN_UPLOAD_ACTIVITY, Tld.get("new")));
|
||||
assertThat(newActivityCursor.getCursorTime()).isEqualTo(DateTime.parse("2006-08-01TZ"));
|
||||
Cursor newTransactionCursor =
|
||||
loadByKey(Cursor.createScopedVKey(CursorType.ICANN_UPLOAD_TX, Registry.get("new")));
|
||||
loadByKey(Cursor.createScopedVKey(CursorType.ICANN_UPLOAD_TX, Tld.get("new")));
|
||||
assertThat(newTransactionCursor.getCursorTime()).isEqualTo(DateTime.parse("2006-08-01TZ"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ import google.registry.model.server.LockTest;
|
||||
import google.registry.model.server.ServerSecretTest;
|
||||
import google.registry.model.smd.SignedMarkRevocationListDaoTest;
|
||||
import google.registry.model.tld.RegistryLockDaoTest;
|
||||
import google.registry.model.tld.RegistryTest;
|
||||
import google.registry.model.tld.TldTest;
|
||||
import google.registry.model.tld.label.PremiumListDaoTest;
|
||||
import google.registry.model.tld.label.ReservedListDaoTest;
|
||||
import google.registry.model.tmch.ClaimsListDaoTest;
|
||||
@@ -96,7 +96,7 @@ import org.junit.runner.RunWith;
|
||||
PremiumListDaoTest.class,
|
||||
RdeRevisionTest.class,
|
||||
RegistrarDaoTest.class,
|
||||
RegistryTest.class,
|
||||
TldTest.class,
|
||||
ReservedListDaoTest.class,
|
||||
RegistryLockDaoTest.class,
|
||||
ServerSecretTest.class,
|
||||
|
||||
@@ -32,7 +32,7 @@ import static google.registry.model.IdService.allocateId;
|
||||
import static google.registry.model.ImmutableObjectSubject.assertAboutImmutableObjects;
|
||||
import static google.registry.model.ImmutableObjectSubject.immutableObjectCorrespondence;
|
||||
import static google.registry.model.ResourceTransferUtils.createTransferResponse;
|
||||
import static google.registry.model.tld.Registry.TldState.GENERAL_AVAILABILITY;
|
||||
import static google.registry.model.tld.Tld.TldState.GENERAL_AVAILABILITY;
|
||||
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
||||
import static google.registry.pricing.PricingEngineProxy.getDomainRenewCost;
|
||||
import static google.registry.util.CollectionUtils.difference;
|
||||
@@ -91,9 +91,9 @@ import google.registry.model.registrar.Registrar.State;
|
||||
import google.registry.model.registrar.RegistrarAddress;
|
||||
import google.registry.model.reporting.HistoryEntry;
|
||||
import google.registry.model.reporting.HistoryEntryDao;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Registry.TldState;
|
||||
import google.registry.model.tld.Registry.TldType;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.model.tld.Tld.TldState;
|
||||
import google.registry.model.tld.Tld.TldType;
|
||||
import google.registry.model.tld.label.PremiumList;
|
||||
import google.registry.model.tld.label.PremiumList.PremiumEntry;
|
||||
import google.registry.model.tld.label.PremiumListDao;
|
||||
@@ -211,29 +211,29 @@ public final class DatabaseHelper {
|
||||
.build();
|
||||
}
|
||||
|
||||
public static Registry newRegistry(String tld, String roidSuffix) {
|
||||
return newRegistry(tld, roidSuffix, ImmutableSortedMap.of(START_OF_TIME, GENERAL_AVAILABILITY));
|
||||
public static Tld newTld(String tld, String roidSuffix) {
|
||||
return newTld(tld, roidSuffix, ImmutableSortedMap.of(START_OF_TIME, GENERAL_AVAILABILITY));
|
||||
}
|
||||
|
||||
public static Registry newRegistry(
|
||||
public static Tld newTld(
|
||||
String tld, String roidSuffix, ImmutableSortedMap<DateTime, TldState> tldStates) {
|
||||
return setupRegistry(new Registry.Builder(), tld, roidSuffix, tldStates);
|
||||
return setupTld(new Tld.Builder(), tld, roidSuffix, tldStates);
|
||||
}
|
||||
|
||||
public static Registry newRegistry(
|
||||
public static Tld newTld(
|
||||
String tld,
|
||||
String roidSuffix,
|
||||
ImmutableSortedMap<DateTime, TldState> tldStates,
|
||||
TldType tldType) {
|
||||
return setupRegistry(new Registry.Builder().setTldType(tldType), tld, roidSuffix, tldStates);
|
||||
return setupTld(new Tld.Builder().setTldType(tldType), tld, roidSuffix, tldStates);
|
||||
}
|
||||
|
||||
private static Registry setupRegistry(
|
||||
Registry.Builder registryBuilder,
|
||||
private static Tld setupTld(
|
||||
Tld.Builder tldBuilder,
|
||||
String tld,
|
||||
String roidSuffix,
|
||||
ImmutableSortedMap<DateTime, TldState> tldStates) {
|
||||
return registryBuilder
|
||||
return tldBuilder
|
||||
.setTldStr(tld)
|
||||
.setRoidSuffix(roidSuffix)
|
||||
.setTldStateTransitions(tldStates)
|
||||
@@ -396,11 +396,11 @@ public final class DatabaseHelper {
|
||||
}
|
||||
|
||||
/** Creates and persists a tld. */
|
||||
public static Registry createTld(String tld) {
|
||||
public static Tld createTld(String tld) {
|
||||
return createTld(tld, GENERAL_AVAILABILITY);
|
||||
}
|
||||
|
||||
public static Registry createTld(String tld, String roidSuffix) {
|
||||
public static Tld createTld(String tld, String roidSuffix) {
|
||||
return createTld(tld, roidSuffix, ImmutableSortedMap.of(START_OF_TIME, GENERAL_AVAILABILITY));
|
||||
}
|
||||
|
||||
@@ -411,11 +411,11 @@ public final class DatabaseHelper {
|
||||
}
|
||||
}
|
||||
|
||||
public static Registry createTld(String tld, TldState tldState) {
|
||||
public static Tld createTld(String tld, TldState tldState) {
|
||||
return createTld(tld, ImmutableSortedMap.of(START_OF_TIME, tldState));
|
||||
}
|
||||
|
||||
public static Registry createTld(String tld, ImmutableSortedMap<DateTime, TldState> tldStates) {
|
||||
public static Tld createTld(String tld, ImmutableSortedMap<DateTime, TldState> tldStates) {
|
||||
// Coerce the TLD string into a valid ROID suffix.
|
||||
String roidSuffix =
|
||||
Ascii.toUpperCase(tld.replaceFirst(ACE_PREFIX_REGEX, "").replace('.', '_'))
|
||||
@@ -424,16 +424,16 @@ public final class DatabaseHelper {
|
||||
tld, roidSuffix.length() > 8 ? roidSuffix.substring(0, 8) : roidSuffix, tldStates);
|
||||
}
|
||||
|
||||
public static Registry createTld(
|
||||
public static Tld createTld(
|
||||
String tld, String roidSuffix, ImmutableSortedMap<DateTime, TldState> tldStates) {
|
||||
Registry registry = persistResource(newRegistry(tld, roidSuffix, tldStates));
|
||||
Tld registry = persistResource(newTld(tld, roidSuffix, tldStates));
|
||||
allowRegistrarAccess("TheRegistrar", tld);
|
||||
allowRegistrarAccess("NewRegistrar", tld);
|
||||
return registry;
|
||||
}
|
||||
|
||||
public static void deleteTld(String tld) {
|
||||
deleteResource(Registry.get(tld));
|
||||
deleteResource(Tld.get(tld));
|
||||
disallowRegistrarAccess("TheRegistrar", tld);
|
||||
disallowRegistrarAccess("NewRegistrar", tld);
|
||||
}
|
||||
@@ -527,8 +527,7 @@ public final class DatabaseHelper {
|
||||
.setReason(Reason.TRANSFER)
|
||||
.setTargetId(domain.getDomainName())
|
||||
.setEventTime(eventTime)
|
||||
.setBillingTime(
|
||||
eventTime.plus(Registry.get(domain.getTld()).getTransferGracePeriodLength()))
|
||||
.setBillingTime(eventTime.plus(Tld.get(domain.getTld()).getTransferGracePeriodLength()))
|
||||
.setRegistrarId("NewRegistrar")
|
||||
.setPeriodYears(1)
|
||||
.setCost(getDomainRenewCost(domain.getDomainName(), costLookupTime, 1))
|
||||
|
||||
@@ -42,7 +42,7 @@ import com.google.common.base.VerifyException;
|
||||
import google.registry.batch.CloudTasksUtils;
|
||||
import google.registry.model.domain.Domain;
|
||||
import google.registry.model.domain.launch.LaunchNotice;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.persistence.VKey;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
||||
@@ -114,7 +114,7 @@ class NordnUploadActionTest {
|
||||
persistResource(loadRegistrar("TheRegistrar").asBuilder().setIanaIdentifier(99999L).build());
|
||||
persistResource(loadRegistrar("NewRegistrar").asBuilder().setIanaIdentifier(88888L).build());
|
||||
createTld("tld");
|
||||
persistResource(Registry.get("tld").asBuilder().setLordnUsername("lolcat").build());
|
||||
persistResource(Tld.get("tld").asBuilder().setLordnUsername("lolcat").build());
|
||||
persistSunriseModeDomain();
|
||||
clock.advanceBy(Duration.standardDays(1));
|
||||
persistClaimsModeDomain();
|
||||
@@ -172,7 +172,7 @@ class NordnUploadActionTest {
|
||||
|
||||
@Test
|
||||
void testFailure_nullRegistryUser() {
|
||||
persistResource(Registry.get("tld").asBuilder().setLordnUsername(null).build());
|
||||
persistResource(Tld.get("tld").asBuilder().setLordnUsername(null).build());
|
||||
VerifyException thrown = assertThrows(VerifyException.class, action::run);
|
||||
assertThat(thrown).hasMessageThat().contains("lordnUsername is not set for tld.");
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
||||
import google.registry.request.HttpException.ConflictException;
|
||||
@@ -89,7 +89,7 @@ class NordnVerifyActionTest {
|
||||
@BeforeEach
|
||||
void beforeEach() throws Exception {
|
||||
createTld("gtld");
|
||||
persistResource(Registry.get("gtld").asBuilder().setLordnUsername("lolcat").build());
|
||||
persistResource(Tld.get("gtld").asBuilder().setLordnUsername("lolcat").build());
|
||||
action.tld = "gtld";
|
||||
action.urlConnectionService = urlConnectionService;
|
||||
when(httpUrlConnection.getResponseCode()).thenReturn(SC_OK);
|
||||
|
||||
@@ -21,7 +21,7 @@ import static org.joda.money.CurrencyUnit.JPY;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
import com.beust.jcommander.ParameterException;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.testing.DeterministicStringGenerator;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -75,7 +75,7 @@ class CreateAnchorTenantCommandTest extends EppToolCommandTestCase<CreateAnchorT
|
||||
void testSuccess_feePremium() throws Exception {
|
||||
createTld("tld");
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
Tld.get("tld")
|
||||
.asBuilder()
|
||||
.setPremiumList(persistPremiumList("tld", JPY, "premium,JPY 20000"))
|
||||
.build());
|
||||
|
||||
@@ -26,7 +26,7 @@ import com.beust.jcommander.ParameterException;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import google.registry.dns.writer.VoidDnsWriter;
|
||||
import google.registry.model.pricing.StaticPremiumListPricingEngine;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.model.tld.label.PremiumListDao;
|
||||
import google.registry.testing.DeterministicStringGenerator;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
@@ -135,8 +135,8 @@ class CreateDomainCommandTest extends EppToolCommandTestCase<CreateDomainCommand
|
||||
|
||||
@Test
|
||||
void testSuccess_premiumListNull() throws Exception {
|
||||
Registry registry =
|
||||
new Registry.Builder()
|
||||
Tld registry =
|
||||
new Tld.Builder()
|
||||
.setTldStr("abc")
|
||||
.setPremiumPricingEngine(StaticPremiumListPricingEngine.NAME)
|
||||
.setDnsWriters(ImmutableSet.of(VoidDnsWriter.NAME))
|
||||
@@ -160,7 +160,7 @@ class CreateDomainCommandTest extends EppToolCommandTestCase<CreateDomainCommand
|
||||
createTld("baar");
|
||||
persistPremiumList("baar", JPY, "parajiumu,JPY 96083");
|
||||
persistResource(
|
||||
Registry.get("baar")
|
||||
Tld.get("baar")
|
||||
.asBuilder()
|
||||
.setPremiumList(PremiumListDao.getLatestRevision("baar").get())
|
||||
.build());
|
||||
|
||||
+8
-8
@@ -14,9 +14,9 @@
|
||||
|
||||
package google.registry.tools;
|
||||
|
||||
import static google.registry.model.tld.Registry.TldState.GENERAL_AVAILABILITY;
|
||||
import static google.registry.model.tld.Tld.TldState.GENERAL_AVAILABILITY;
|
||||
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
||||
import static google.registry.testing.DatabaseHelper.newRegistry;
|
||||
import static google.registry.testing.DatabaseHelper.newTld;
|
||||
import static google.registry.testing.DatabaseHelper.persistPremiumList;
|
||||
import static google.registry.testing.DatabaseHelper.persistResource;
|
||||
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||
@@ -28,8 +28,8 @@ import com.google.common.collect.ImmutableSortedMap;
|
||||
import com.google.common.io.Files;
|
||||
import google.registry.dns.writer.VoidDnsWriter;
|
||||
import google.registry.model.pricing.StaticPremiumListPricingEngine;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Registry.TldType;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.model.tld.Tld.TldType;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import org.joda.money.CurrencyUnit;
|
||||
@@ -52,11 +52,11 @@ abstract class CreateOrUpdatePremiumListCommandTestCase<T extends CreateOrUpdate
|
||||
premiumTermsPath = premiumTermsFile.getPath();
|
||||
}
|
||||
|
||||
Registry createRegistry(String tldStr, CurrencyUnit currency, String premiumListInput) {
|
||||
Registry registry;
|
||||
Tld createTld(String tldStr, CurrencyUnit currency, String premiumListInput) {
|
||||
Tld registry;
|
||||
if (premiumListInput != null) {
|
||||
registry =
|
||||
newRegistry(
|
||||
newTld(
|
||||
tldStr,
|
||||
Ascii.toUpperCase(tldStr),
|
||||
ImmutableSortedMap.of(START_OF_TIME, GENERAL_AVAILABILITY),
|
||||
@@ -65,7 +65,7 @@ abstract class CreateOrUpdatePremiumListCommandTestCase<T extends CreateOrUpdate
|
||||
persistResource(registry);
|
||||
} else {
|
||||
registry =
|
||||
new Registry.Builder()
|
||||
new Tld.Builder()
|
||||
.setTldStr(tldStr)
|
||||
.setPremiumPricingEngine(StaticPremiumListPricingEngine.NAME)
|
||||
.setDnsWriters(ImmutableSet.of(VoidDnsWriter.NAME))
|
||||
|
||||
@@ -19,8 +19,9 @@ import static google.registry.testing.DatabaseHelper.createTld;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
import com.google.common.io.Files;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.model.tld.label.PremiumListDao;
|
||||
import google.registry.testing.DatabaseHelper;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
@@ -29,11 +30,11 @@ import org.junit.jupiter.api.Test;
|
||||
/** Unit tests for {@link CreatePremiumListCommand}. */
|
||||
class CreatePremiumListCommandTest<C extends CreatePremiumListCommand>
|
||||
extends CreateOrUpdatePremiumListCommandTestCase<C> {
|
||||
Registry registry;
|
||||
Tld registry;
|
||||
|
||||
@BeforeEach
|
||||
void beforeEach() {
|
||||
registry = createRegistry(TLD_TEST, null, null);
|
||||
registry = createTld(TLD_TEST, null, null);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -82,7 +83,7 @@ class CreatePremiumListCommandTest<C extends CreatePremiumListCommand>
|
||||
@Test
|
||||
void commandPrompt_failurePremiumListAlreadyExists() {
|
||||
String randomStr = "random";
|
||||
createTld(randomStr);
|
||||
DatabaseHelper.createTld(randomStr);
|
||||
CreatePremiumListCommand command = new CreatePremiumListCommand();
|
||||
command.name = randomStr;
|
||||
command.currencyUnit = "USD";
|
||||
|
||||
@@ -20,7 +20,7 @@ import static google.registry.testing.CertificateSamples.SAMPLE_CERT;
|
||||
import static google.registry.testing.CertificateSamples.SAMPLE_CERT3;
|
||||
import static google.registry.testing.CertificateSamples.SAMPLE_CERT3_HASH;
|
||||
import static google.registry.testing.DatabaseHelper.createTlds;
|
||||
import static google.registry.testing.DatabaseHelper.newRegistry;
|
||||
import static google.registry.testing.DatabaseHelper.newTld;
|
||||
import static google.registry.testing.DatabaseHelper.persistNewRegistrar;
|
||||
import static google.registry.testing.DatabaseHelper.persistResource;
|
||||
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||
@@ -611,7 +611,7 @@ class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarCommand>
|
||||
@Test
|
||||
void testSuccess_billingAccountMap_onlyAppliesToRealRegistrar() throws Exception {
|
||||
persistResource(
|
||||
newRegistry("foo", "FOO")
|
||||
newTld("foo", "FOO")
|
||||
.asBuilder()
|
||||
.setCurrency(JPY)
|
||||
.setCreateBillingCost(Money.of(JPY, new BigDecimal(1300)))
|
||||
|
||||
@@ -24,7 +24,7 @@ import static google.registry.tools.CreateReservedListCommand.INVALID_FORMAT_ERR
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
import com.google.common.io.Files;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.model.tld.label.ReservedList;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
@@ -80,7 +80,7 @@ class CreateReservedListCommandTest
|
||||
@Test
|
||||
void testFailure_reservedListWithThatNameAlreadyExists() {
|
||||
ReservedList rl = persistReservedList("xn--q9jyb4c_foo", "jones,FULLY_BLOCKED");
|
||||
persistResource(Registry.get("xn--q9jyb4c").asBuilder().setReservedLists(rl).build());
|
||||
persistResource(Tld.get("xn--q9jyb4c").asBuilder().setReservedLists(rl).build());
|
||||
IllegalArgumentException thrown =
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
|
||||
@@ -17,8 +17,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.domain.token.AllocationToken.TokenType.DEFAULT_PROMO;
|
||||
import static google.registry.model.tld.Registry.TldState.GENERAL_AVAILABILITY;
|
||||
import static google.registry.model.tld.Registry.TldState.PREDELEGATION;
|
||||
import static google.registry.model.tld.Tld.TldState.GENERAL_AVAILABILITY;
|
||||
import static google.registry.model.tld.Tld.TldState.PREDELEGATION;
|
||||
import static google.registry.testing.DatabaseHelper.createTld;
|
||||
import static google.registry.testing.DatabaseHelper.persistPremiumList;
|
||||
import static google.registry.testing.DatabaseHelper.persistReservedList;
|
||||
@@ -35,7 +35,7 @@ import com.beust.jcommander.ParameterException;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Range;
|
||||
import google.registry.model.domain.token.AllocationToken;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.tldconfig.idn.IdnTableEnum;
|
||||
import java.math.BigDecimal;
|
||||
import org.joda.money.Money;
|
||||
@@ -63,17 +63,17 @@ class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
||||
runCommandForced("xn--q9jyb4c", "--roid_suffix=Q9JYB4C", "--dns_writers=FooDnsWriter");
|
||||
DateTime after = fakeClock.nowUtc();
|
||||
|
||||
Registry registry = Registry.get("xn--q9jyb4c");
|
||||
Tld registry = Tld.get("xn--q9jyb4c");
|
||||
assertThat(registry).isNotNull();
|
||||
assertThat(registry.getAddGracePeriodLength()).isEqualTo(Registry.DEFAULT_ADD_GRACE_PERIOD);
|
||||
assertThat(registry.getAddGracePeriodLength()).isEqualTo(Tld.DEFAULT_ADD_GRACE_PERIOD);
|
||||
assertThat(registry.getCreationTime()).isIn(Range.closed(before, after));
|
||||
assertThat(registry.getDnsWriters()).containsExactly("FooDnsWriter");
|
||||
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);
|
||||
.isEqualTo(Tld.DEFAULT_REDEMPTION_GRACE_PERIOD);
|
||||
assertThat(registry.getPendingDeleteLength()).isEqualTo(Tld.DEFAULT_PENDING_DELETE_LENGTH);
|
||||
assertThat(registry.getRegistryLockOrUnlockBillingCost())
|
||||
.isEqualTo(Registry.DEFAULT_REGISTRY_LOCK_OR_UNLOCK_BILLING_COST);
|
||||
.isEqualTo(Tld.DEFAULT_REGISTRY_LOCK_OR_UNLOCK_BILLING_COST);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -85,7 +85,7 @@ class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
||||
"--dns_a_plus_aaaa_ttl=PT300S",
|
||||
"--dns_ds_ttl=PT240S",
|
||||
"--dns_ns_ttl=PT180S");
|
||||
Registry registry = Registry.get("xn--q9jyb4c");
|
||||
Tld registry = Tld.get("xn--q9jyb4c");
|
||||
assertThat(registry).isNotNull();
|
||||
assertThat(registry.getDnsAPlusAaaaTtl()).isEqualTo(standardMinutes(5));
|
||||
assertThat(registry.getDnsDsTtl()).isEqualTo(standardMinutes(4));
|
||||
@@ -121,7 +121,7 @@ class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
||||
"--roid_suffix=Q9JYB4C",
|
||||
"--dns_writers=VoidDnsWriter",
|
||||
"xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getTldState(DateTime.now(UTC)))
|
||||
assertThat(Tld.get("xn--q9jyb4c").getTldState(DateTime.now(UTC)))
|
||||
.isEqualTo(GENERAL_AVAILABILITY);
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
||||
"--roid_suffix=Q9JYB4C",
|
||||
"--dns_writers=VoidDnsWriter",
|
||||
"xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getStandardRenewCost(DateTime.now(UTC)))
|
||||
assertThat(Tld.get("xn--q9jyb4c").getStandardRenewCost(DateTime.now(UTC)))
|
||||
.isEqualTo(Money.of(USD, 42.42));
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
||||
"--dns_writers=VoidDnsWriter",
|
||||
"xn--q9jyb4c");
|
||||
|
||||
Registry registry = Registry.get("xn--q9jyb4c");
|
||||
Tld registry = Tld.get("xn--q9jyb4c");
|
||||
assertThat(registry.getEapFeeFor(now.minusHours(1)).getCost())
|
||||
.isEqualTo(BigDecimal.ZERO.setScale(2, ROUND_UNNECESSARY));
|
||||
assertThat(registry.getEapFeeFor(now.plusHours(1)).getCost())
|
||||
@@ -164,27 +164,27 @@ class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
||||
"--roid_suffix=Q9JYB4C",
|
||||
"--dns_writers=VoidDnsWriter",
|
||||
"xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getAddGracePeriodLength()).isEqualTo(standardMinutes(5));
|
||||
assertThat(Tld.get("xn--q9jyb4c").getAddGracePeriodLength()).isEqualTo(standardMinutes(5));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_roidSuffixWorks() throws Exception {
|
||||
runCommandForced("--roid_suffix=RSUFFIX", "--dns_writers=VoidDnsWriter", "tld");
|
||||
assertThat(Registry.get("tld").getRoidSuffix()).isEqualTo("RSUFFIX");
|
||||
assertThat(Tld.get("tld").getRoidSuffix()).isEqualTo("RSUFFIX");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_escrow() throws Exception {
|
||||
runCommandForced(
|
||||
"--escrow=true", "--roid_suffix=Q9JYB4C", "--dns_writers=VoidDnsWriter", "xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getEscrowEnabled()).isTrue();
|
||||
assertThat(Tld.get("xn--q9jyb4c").getEscrowEnabled()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_noEscrow() throws Exception {
|
||||
runCommandForced(
|
||||
"--escrow=false", "--roid_suffix=Q9JYB4C", "--dns_writers=VoidDnsWriter", "xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getEscrowEnabled()).isFalse();
|
||||
assertThat(Tld.get("xn--q9jyb4c").getEscrowEnabled()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -194,7 +194,7 @@ class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
||||
"--roid_suffix=Q9JYB4C",
|
||||
"--dns_writers=VoidDnsWriter",
|
||||
"xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getRedemptionGracePeriodLength())
|
||||
assertThat(Tld.get("xn--q9jyb4c").getRedemptionGracePeriodLength())
|
||||
.isEqualTo(standardMinutes(5));
|
||||
}
|
||||
|
||||
@@ -205,7 +205,7 @@ class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
||||
"--roid_suffix=Q9JYB4C",
|
||||
"--dns_writers=VoidDnsWriter",
|
||||
"xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getPendingDeleteLength()).isEqualTo(standardMinutes(5));
|
||||
assertThat(Tld.get("xn--q9jyb4c").getPendingDeleteLength()).isEqualTo(standardMinutes(5));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -215,8 +215,7 @@ class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
||||
"--roid_suffix=Q9JYB4C",
|
||||
"--dns_writers=VoidDnsWriter",
|
||||
"xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getAutomaticTransferLength())
|
||||
.isEqualTo(standardMinutes(5));
|
||||
assertThat(Tld.get("xn--q9jyb4c").getAutomaticTransferLength()).isEqualTo(standardMinutes(5));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -226,7 +225,7 @@ class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
||||
"--roid_suffix=Q9JYB4C",
|
||||
"--dns_writers=VoidDnsWriter",
|
||||
"xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getStandardCreateCost()).isEqualTo(Money.of(USD, 42.42));
|
||||
assertThat(Tld.get("xn--q9jyb4c").getStandardCreateCost()).isEqualTo(Money.of(USD, 42.42));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -236,8 +235,7 @@ class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
||||
"--roid_suffix=Q9JYB4C",
|
||||
"--dns_writers=VoidDnsWriter",
|
||||
"xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getStandardRestoreCost())
|
||||
.isEqualTo(Money.of(USD, 42.42));
|
||||
assertThat(Tld.get("xn--q9jyb4c").getStandardRestoreCost()).isEqualTo(Money.of(USD, 42.42));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -247,8 +245,7 @@ class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
||||
"--roid_suffix=Q9JYB4C",
|
||||
"--dns_writers=VoidDnsWriter",
|
||||
"xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getServerStatusChangeCost())
|
||||
.isEqualTo(Money.of(USD, 42.42));
|
||||
assertThat(Tld.get("xn--q9jyb4c").getServerStatusChangeCost()).isEqualTo(Money.of(USD, 42.42));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -258,7 +255,7 @@ class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
||||
"--roid_suffix=Q9JYB4C",
|
||||
"--dns_writers=VoidDnsWriter",
|
||||
"xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getRegistryLockOrUnlockBillingCost())
|
||||
assertThat(Tld.get("xn--q9jyb4c").getRegistryLockOrUnlockBillingCost())
|
||||
.isEqualTo(Money.of(USD, 42.42));
|
||||
}
|
||||
|
||||
@@ -273,7 +270,7 @@ class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
||||
"--roid_suffix=Q9JYB4C",
|
||||
"--dns_writers=VoidDnsWriter",
|
||||
"xn--q9jyb4c");
|
||||
Registry registry = Registry.get("xn--q9jyb4c");
|
||||
Tld registry = Tld.get("xn--q9jyb4c");
|
||||
assertThat(registry.getStandardCreateCost()).isEqualTo(Money.ofMajor(JPY, 12345));
|
||||
assertThat(registry.getStandardRestoreCost()).isEqualTo(Money.ofMajor(JPY, 67890));
|
||||
assertThat(registry.getStandardRenewCost(START_OF_TIME)).isEqualTo(Money.ofMajor(JPY, 101112));
|
||||
@@ -283,12 +280,12 @@ class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
||||
void testSuccess_multipartTld() throws Exception {
|
||||
runCommandForced("co.uk", "--roid_suffix=COUK", "--dns_writers=VoidDnsWriter");
|
||||
|
||||
Registry registry = Registry.get("co.uk");
|
||||
Tld registry = Tld.get("co.uk");
|
||||
assertThat(registry.getTldState(new DateTime())).isEqualTo(PREDELEGATION);
|
||||
assertThat(registry.getAddGracePeriodLength()).isEqualTo(Registry.DEFAULT_ADD_GRACE_PERIOD);
|
||||
assertThat(registry.getAddGracePeriodLength()).isEqualTo(Tld.DEFAULT_ADD_GRACE_PERIOD);
|
||||
assertThat(registry.getRedemptionGracePeriodLength())
|
||||
.isEqualTo(Registry.DEFAULT_REDEMPTION_GRACE_PERIOD);
|
||||
assertThat(registry.getPendingDeleteLength()).isEqualTo(Registry.DEFAULT_PENDING_DELETE_LENGTH);
|
||||
.isEqualTo(Tld.DEFAULT_REDEMPTION_GRACE_PERIOD);
|
||||
assertThat(registry.getPendingDeleteLength()).isEqualTo(Tld.DEFAULT_PENDING_DELETE_LENGTH);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -298,7 +295,7 @@ class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
||||
"--roid_suffix=Q9JYB4C",
|
||||
"--dns_writers=VoidDnsWriter",
|
||||
"xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getReservedListNames())
|
||||
assertThat(Tld.get("xn--q9jyb4c").getReservedListNames())
|
||||
.containsExactly("xn--q9jyb4c_abuse", "common_abuse");
|
||||
}
|
||||
|
||||
@@ -402,7 +399,7 @@ class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
||||
"--roid_suffix=Q9JYB4C",
|
||||
"--dns_writers=VoidDnsWriter",
|
||||
"xn--q9jyb4c"));
|
||||
assertThat(thrown).hasMessageThat().contains("All EAP fees must be in the registry's currency");
|
||||
assertThat(thrown).hasMessageThat().contains("All EAP fees must be in the TLD's currency");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -450,7 +447,7 @@ class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
||||
"--roid_suffix=Q9JYB4C",
|
||||
"--dns_writers=VoidDnsWriter",
|
||||
"xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getAllowedRegistrantContactIds())
|
||||
assertThat(Tld.get("xn--q9jyb4c").getAllowedRegistrantContactIds())
|
||||
.containsExactly("alice", "bob");
|
||||
}
|
||||
|
||||
@@ -461,7 +458,7 @@ class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
||||
"--roid_suffix=Q9JYB4C",
|
||||
"--dns_writers=FooDnsWriter",
|
||||
"xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getAllowedFullyQualifiedHostNames())
|
||||
assertThat(Tld.get("xn--q9jyb4c").getAllowedFullyQualifiedHostNames())
|
||||
.containsExactly("ns1.example.com", "ns2.example.com");
|
||||
}
|
||||
|
||||
@@ -538,7 +535,7 @@ class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
||||
"--roid_suffix=Q9JYB4C",
|
||||
"--dns_writers=FooDnsWriter",
|
||||
"xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getPremiumListName()).hasValue("xn--q9jyb4c");
|
||||
assertThat(Tld.get("xn--q9jyb4c").getPremiumListName()).hasValue("xn--q9jyb4c");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -548,7 +545,7 @@ class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
||||
"--roid_suffix=Q9JYB4C",
|
||||
"--dns_writers=VoidDnsWriter",
|
||||
"xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getDriveFolderId()).isEqualTo("madmax2030");
|
||||
assertThat(Tld.get("xn--q9jyb4c").getDriveFolderId()).isEqualTo("madmax2030");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -558,7 +555,7 @@ class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
||||
"--roid_suffix=Q9JYB4C",
|
||||
"--dns_writers=VoidDnsWriter",
|
||||
"xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getDriveFolderId()).isNull();
|
||||
assertThat(Tld.get("xn--q9jyb4c").getDriveFolderId()).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -568,7 +565,7 @@ class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
||||
"--roid_suffix=ASDF",
|
||||
"--dns_writers=VoidDnsWriter",
|
||||
"xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getIdnTables())
|
||||
assertThat(Tld.get("xn--q9jyb4c").getIdnTables())
|
||||
.containsExactly(IdnTableEnum.EXTENDED_LATIN, IdnTableEnum.JA);
|
||||
}
|
||||
|
||||
@@ -632,8 +629,7 @@ class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
||||
"--roid_suffix=Q9JYB4C",
|
||||
"--dns_writers=FooDnsWriter",
|
||||
"xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getDefaultPromoTokens())
|
||||
.containsExactly(token.createVKey());
|
||||
assertThat(Tld.get("xn--q9jyb4c").getDefaultPromoTokens()).containsExactly(token.createVKey());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -659,7 +655,7 @@ class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
||||
"--roid_suffix=Q9JYB4C",
|
||||
"--dns_writers=FooDnsWriter",
|
||||
"xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getDefaultPromoTokens())
|
||||
assertThat(Tld.get("xn--q9jyb4c").getDefaultPromoTokens())
|
||||
.containsExactly(token.createVKey(), token2.createVKey());
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ import static google.registry.testing.DatabaseHelper.persistResource;
|
||||
import static org.joda.money.CurrencyUnit.USD;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.model.tld.label.PremiumList;
|
||||
import google.registry.model.tld.label.PremiumListDao;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -52,7 +52,7 @@ class DeletePremiumListCommandTest extends CommandTestCase<DeletePremiumListComm
|
||||
void testFailure_whenPremiumListIsInUse() {
|
||||
PremiumList premiumList = persistPremiumList("xn--q9jyb4c", USD, "blah,USD 100");
|
||||
createTld("xn--q9jyb4c");
|
||||
persistResource(Registry.get("xn--q9jyb4c").asBuilder().setPremiumList(premiumList).build());
|
||||
persistResource(Tld.get("xn--q9jyb4c").asBuilder().setPremiumList(premiumList).build());
|
||||
IllegalArgumentException thrown =
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
|
||||
@@ -21,7 +21,7 @@ import static google.registry.testing.DatabaseHelper.persistReservedList;
|
||||
import static google.registry.testing.DatabaseHelper.persistResource;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.model.tld.label.ReservedList;
|
||||
import google.registry.model.tld.label.ReservedListDao;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
@@ -58,7 +58,7 @@ class DeleteReservedListCommandTest extends CommandTestCase<DeleteReservedListCo
|
||||
@Test
|
||||
void testFailure_whenReservedListIsInUse() {
|
||||
createTld("xn--q9jyb4c");
|
||||
persistResource(Registry.get("xn--q9jyb4c").asBuilder().setReservedLists(reservedList).build());
|
||||
persistResource(Tld.get("xn--q9jyb4c").asBuilder().setReservedLists(reservedList).build());
|
||||
IllegalArgumentException thrown =
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
|
||||
package google.registry.tools;
|
||||
|
||||
import static google.registry.model.tld.Registry.TldState.GENERAL_AVAILABILITY;
|
||||
import static google.registry.model.tld.Tld.TldState.GENERAL_AVAILABILITY;
|
||||
import static google.registry.testing.DatabaseHelper.allowRegistrarAccess;
|
||||
import static google.registry.testing.DatabaseHelper.newRegistry;
|
||||
import static google.registry.testing.DatabaseHelper.newTld;
|
||||
import static google.registry.testing.DatabaseHelper.persistDeletedDomain;
|
||||
import static google.registry.testing.DatabaseHelper.persistResource;
|
||||
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||
@@ -24,9 +24,9 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
import com.google.common.base.Ascii;
|
||||
import com.google.common.collect.ImmutableSortedMap;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Registry.RegistryNotFoundException;
|
||||
import google.registry.model.tld.Registry.TldType;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.model.tld.Tld.TldNotFoundException;
|
||||
import google.registry.model.tld.Tld.TldType;
|
||||
import org.joda.time.DateTime;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -40,13 +40,13 @@ class DeleteTldCommandTest extends CommandTestCase<DeleteTldCommand> {
|
||||
@BeforeEach
|
||||
void beforeEach() {
|
||||
persistResource(
|
||||
newRegistry(
|
||||
newTld(
|
||||
TLD_REAL,
|
||||
Ascii.toUpperCase(TLD_REAL),
|
||||
ImmutableSortedMap.of(START_OF_TIME, GENERAL_AVAILABILITY),
|
||||
TldType.REAL));
|
||||
persistResource(
|
||||
newRegistry(
|
||||
newTld(
|
||||
TLD_TEST,
|
||||
Ascii.toUpperCase(TLD_TEST),
|
||||
ImmutableSortedMap.of(START_OF_TIME, GENERAL_AVAILABILITY),
|
||||
@@ -57,13 +57,13 @@ class DeleteTldCommandTest extends CommandTestCase<DeleteTldCommand> {
|
||||
void testSuccess_otherTldUnaffected() throws Exception {
|
||||
runCommandForced("--tld=" + TLD_TEST);
|
||||
|
||||
Registry.get(TLD_REAL);
|
||||
assertThrows(RegistryNotFoundException.class, () -> Registry.get(TLD_TEST));
|
||||
Tld.get(TLD_REAL);
|
||||
assertThrows(TldNotFoundException.class, () -> Tld.get(TLD_TEST));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFailure_whenTldDoesNotExist() {
|
||||
assertThrows(RegistryNotFoundException.class, () -> runCommandForced("--tld=nonexistenttld"));
|
||||
assertThrows(TldNotFoundException.class, () -> runCommandForced("--tld=nonexistenttld"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -42,7 +42,7 @@ import google.registry.model.domain.DomainHistory;
|
||||
import google.registry.model.domain.RegistryLock;
|
||||
import google.registry.model.host.Host;
|
||||
import google.registry.model.reporting.HistoryEntry;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
||||
import google.registry.testing.CloudTasksHelper;
|
||||
@@ -566,7 +566,7 @@ public final class DomainLockUtilsTest {
|
||||
.setReason(Reason.SERVER_STATUS)
|
||||
.setTargetId(domain.getForeignKey())
|
||||
.setRegistrarId(domain.getCurrentSponsorRegistrarId())
|
||||
.setCost(Registry.get(domain.getTld()).getRegistryLockOrUnlockBillingCost())
|
||||
.setCost(Tld.get(domain.getTld()).getRegistryLockOrUnlockBillingCost())
|
||||
.setEventTime(clock.nowUtc())
|
||||
.setBillingTime(clock.nowUtc())
|
||||
.setDomainHistory(entry)
|
||||
|
||||
@@ -23,7 +23,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import com.beust.jcommander.ParameterException;
|
||||
import google.registry.model.common.Cursor;
|
||||
import google.registry.model.common.Cursor.CursorType;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import org.joda.time.DateTime;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -58,7 +58,7 @@ public class ListCursorsCommandTest extends CommandTestCase<ListCursorsCommand>
|
||||
void testListCursors_twoTldsOneAbsent_printsAbsentAndTimestampSorted() throws Exception {
|
||||
createTlds("foo", "bar");
|
||||
persistResource(
|
||||
Cursor.createScoped(CursorType.BRDA, DateTime.parse("1984-12-18TZ"), Registry.get("bar")));
|
||||
Cursor.createScoped(CursorType.BRDA, DateTime.parse("1984-12-18TZ"), Tld.get("bar")));
|
||||
runCommand("--type=BRDA");
|
||||
assertThat(getStdoutAsLines())
|
||||
.containsExactly(
|
||||
@@ -84,7 +84,7 @@ public class ListCursorsCommandTest extends CommandTestCase<ListCursorsCommand>
|
||||
@Test
|
||||
void testListCursors_filterEscrowEnabled_doesWhatItSays() throws Exception {
|
||||
createTlds("foo", "bar");
|
||||
persistResource(Registry.get("bar").asBuilder().setEscrowEnabled(true).build());
|
||||
persistResource(Tld.get("bar").asBuilder().setEscrowEnabled(true).build());
|
||||
runCommand("--type=BRDA", "--escrow_enabled");
|
||||
assertThat(getStdoutAsLines())
|
||||
.containsExactly(
|
||||
|
||||
@@ -16,7 +16,7 @@ package google.registry.tools;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.testing.DatabaseHelper.createTlds;
|
||||
import static google.registry.testing.DatabaseHelper.newRegistry;
|
||||
import static google.registry.testing.DatabaseHelper.newTld;
|
||||
import static google.registry.testing.DatabaseHelper.persistResource;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
@@ -25,7 +25,7 @@ import static org.mockito.Mockito.verify;
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.net.MediaType;
|
||||
import google.registry.model.tld.Registry.TldType;
|
||||
import google.registry.model.tld.Tld.TldType;
|
||||
import google.registry.tools.server.ListDomainsAction;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.junit.jupiter.MockitoSettings;
|
||||
@@ -73,7 +73,7 @@ public class ListDomainsCommandTest extends ListObjectsCommandTestCase<ListDomai
|
||||
@Test
|
||||
void test_defaultsToAllRealTlds() throws Exception {
|
||||
createTlds("tldone", "tldtwo");
|
||||
persistResource(newRegistry("fake", "FAKE").asBuilder().setTldType(TldType.TEST).build());
|
||||
persistResource(newTld("fake", "FAKE").asBuilder().setTldType(TldType.TEST).build());
|
||||
runCommand();
|
||||
verify(connection)
|
||||
.sendPostRequest(
|
||||
|
||||
@@ -17,8 +17,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.registrar.Registrar.State.ACTIVE;
|
||||
import static google.registry.model.tld.Registry.TldState.GENERAL_AVAILABILITY;
|
||||
import static google.registry.model.tld.Registry.TldState.START_DATE_SUNRISE;
|
||||
import static google.registry.model.tld.Tld.TldState.GENERAL_AVAILABILITY;
|
||||
import static google.registry.model.tld.Tld.TldState.START_DATE_SUNRISE;
|
||||
import static google.registry.testing.CertificateSamples.SAMPLE_CERT_HASH;
|
||||
import static google.registry.testing.DatabaseHelper.createTld;
|
||||
import static google.registry.testing.DatabaseHelper.loadRegistrar;
|
||||
@@ -34,8 +34,8 @@ import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.ImmutableSortedMap;
|
||||
import google.registry.model.registrar.Registrar;
|
||||
import google.registry.model.registrar.RegistrarPoc;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Registry.TldState;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.model.tld.Tld.TldState;
|
||||
import google.registry.testing.DeterministicStringGenerator;
|
||||
import google.registry.testing.FakeClock;
|
||||
import google.registry.util.CidrAddressBlock;
|
||||
@@ -67,7 +67,7 @@ class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
|
||||
String roidSuffix,
|
||||
TldState tldState,
|
||||
boolean isEarlyAccess) {
|
||||
Registry registry = Registry.get(tldName);
|
||||
Tld registry = Tld.get(tldName);
|
||||
assertThat(registry).isNotNull();
|
||||
assertThat(registry.getRoidSuffix()).isEqualTo(roidSuffix);
|
||||
assertThat(registry.getTldState(DateTime.now(UTC))).isEqualTo(tldState);
|
||||
@@ -330,7 +330,7 @@ class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
|
||||
"--registrar=blobio",
|
||||
"--email=contact@email.com",
|
||||
"--certfile=" + getCertFilename()));
|
||||
assertThat(thrown).hasMessageThat().contains("VKey<Registry>(sql:blobio-sunrise)");
|
||||
assertThat(thrown).hasMessageThat().contains("VKey<Tld>(sql:blobio-sunrise)");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -25,8 +25,8 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import com.beust.jcommander.ParameterException;
|
||||
import google.registry.model.common.Cursor;
|
||||
import google.registry.model.common.Cursor.CursorType;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Registry.RegistryNotFoundException;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.model.tld.Tld.TldNotFoundException;
|
||||
import org.joda.time.DateTime;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -34,7 +34,7 @@ import org.junit.jupiter.api.Test;
|
||||
/** Unit tests for {@link UpdateCursorsCommand}. */
|
||||
class UpdateCursorsCommandTest extends CommandTestCase<UpdateCursorsCommand> {
|
||||
|
||||
private Registry registry;
|
||||
private Tld registry;
|
||||
|
||||
@BeforeEach
|
||||
void beforeEach() {
|
||||
@@ -88,8 +88,8 @@ class UpdateCursorsCommandTest extends CommandTestCase<UpdateCursorsCommand> {
|
||||
|
||||
@Test
|
||||
void testSuccess_multipleTlds_hasOldValue() throws Exception {
|
||||
Registry barRegistry = createTld("bar");
|
||||
Registry registry2 = Registry.get("bar");
|
||||
Tld barRegistry = createTld("bar");
|
||||
Tld registry2 = Tld.get("bar");
|
||||
persistResource(Cursor.createScoped(CursorType.BRDA, DateTime.parse("1950-12-18TZ"), registry));
|
||||
persistResource(
|
||||
Cursor.createScoped(CursorType.BRDA, DateTime.parse("1950-12-18TZ"), registry2));
|
||||
@@ -107,7 +107,7 @@ class UpdateCursorsCommandTest extends CommandTestCase<UpdateCursorsCommand> {
|
||||
|
||||
@Test
|
||||
void testSuccess_multipleTlds_oldValueisEmpty() throws Exception {
|
||||
Registry barRegistry = createTld("bar");
|
||||
Tld barRegistry = createTld("bar");
|
||||
assertThat(loadByKeyIfPresent(Cursor.createScopedVKey(CursorType.BRDA, registry))).isEmpty();
|
||||
assertThat(loadByKeyIfPresent(Cursor.createScopedVKey(CursorType.BRDA, barRegistry))).isEmpty();
|
||||
runCommandForced("--type=brda", "--timestamp=1984-12-18T00:00:00Z", "foo", "bar");
|
||||
@@ -125,7 +125,7 @@ class UpdateCursorsCommandTest extends CommandTestCase<UpdateCursorsCommand> {
|
||||
@Test
|
||||
void testFailure_badTld() {
|
||||
assertThrows(
|
||||
RegistryNotFoundException.class,
|
||||
TldNotFoundException.class,
|
||||
() -> runCommandForced("--type=brda", "--timestamp=1984-12-18T00:00:00Z", "bar"));
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ import static org.joda.money.CurrencyUnit.USD;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
import com.google.common.io.Files;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.model.tld.label.PremiumList;
|
||||
import google.registry.model.tld.label.PremiumList.PremiumEntry;
|
||||
import google.registry.model.tld.label.PremiumListDao;
|
||||
@@ -37,11 +37,11 @@ import org.junit.jupiter.api.Test;
|
||||
/** Unit tests for {@link UpdatePremiumListCommand}. */
|
||||
class UpdatePremiumListCommandTest<C extends UpdatePremiumListCommand>
|
||||
extends CreateOrUpdatePremiumListCommandTestCase<C> {
|
||||
Registry registry;
|
||||
Tld registry;
|
||||
|
||||
@BeforeEach
|
||||
void beforeEach() {
|
||||
registry = createRegistry(TLD_TEST, USD, initialPremiumListData);
|
||||
registry = createTld(TLD_TEST, USD, initialPremiumListData);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -135,7 +135,7 @@ class UpdatePremiumListCommandTest<C extends UpdatePremiumListCommand>
|
||||
@Test
|
||||
void commandPrompt_failureNoPreviousVersion() {
|
||||
String fileName = "random";
|
||||
registry = createRegistry(fileName, null, null);
|
||||
registry = createTld(fileName, null, null);
|
||||
UpdatePremiumListCommand command = new UpdatePremiumListCommand();
|
||||
command.name = fileName;
|
||||
IllegalArgumentException thrown = assertThrows(IllegalArgumentException.class, command::prompt);
|
||||
|
||||
@@ -21,7 +21,7 @@ import static google.registry.testing.CertificateSamples.SAMPLE_CERT3;
|
||||
import static google.registry.testing.CertificateSamples.SAMPLE_CERT3_HASH;
|
||||
import static google.registry.testing.DatabaseHelper.createTlds;
|
||||
import static google.registry.testing.DatabaseHelper.loadRegistrar;
|
||||
import static google.registry.testing.DatabaseHelper.newRegistry;
|
||||
import static google.registry.testing.DatabaseHelper.newTld;
|
||||
import static google.registry.testing.DatabaseHelper.persistResource;
|
||||
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||
import static org.joda.money.CurrencyUnit.JPY;
|
||||
@@ -403,7 +403,7 @@ class UpdateRegistrarCommandTest extends CommandTestCase<UpdateRegistrarCommand>
|
||||
@Test
|
||||
void testSuccess_billingAccountMap_onlyAppliesToRealRegistrar() throws Exception {
|
||||
persistResource(
|
||||
newRegistry("foo", "FOO")
|
||||
newTld("foo", "FOO")
|
||||
.asBuilder()
|
||||
.setCurrency(JPY)
|
||||
.setCreateBillingCost(Money.of(JPY, new BigDecimal(1300)))
|
||||
|
||||
@@ -17,10 +17,10 @@ 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.domain.token.AllocationToken.TokenType.DEFAULT_PROMO;
|
||||
import static google.registry.model.tld.Registry.TldState.GENERAL_AVAILABILITY;
|
||||
import static google.registry.model.tld.Registry.TldState.PREDELEGATION;
|
||||
import static google.registry.model.tld.Registry.TldState.QUIET_PERIOD;
|
||||
import static google.registry.model.tld.Registry.TldState.START_DATE_SUNRISE;
|
||||
import static google.registry.model.tld.Tld.TldState.GENERAL_AVAILABILITY;
|
||||
import static google.registry.model.tld.Tld.TldState.PREDELEGATION;
|
||||
import static google.registry.model.tld.Tld.TldState.QUIET_PERIOD;
|
||||
import static google.registry.model.tld.Tld.TldState.START_DATE_SUNRISE;
|
||||
import static google.registry.testing.DatabaseHelper.createTld;
|
||||
import static google.registry.testing.DatabaseHelper.persistPremiumList;
|
||||
import static google.registry.testing.DatabaseHelper.persistReservedList;
|
||||
@@ -38,7 +38,7 @@ import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.ImmutableSortedMap;
|
||||
import google.registry.model.domain.token.AllocationToken;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.tldconfig.idn.IdnTableEnum;
|
||||
import java.util.Optional;
|
||||
import org.joda.money.Money;
|
||||
@@ -77,7 +77,7 @@ class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
||||
START_OF_TIME, sunriseStart, quietPeriodStart, gaStart),
|
||||
"xn--q9jyb4c");
|
||||
|
||||
Registry registry = Registry.get("xn--q9jyb4c");
|
||||
Tld registry = Tld.get("xn--q9jyb4c");
|
||||
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);
|
||||
@@ -93,13 +93,12 @@ class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
||||
@Test
|
||||
void testSuccess_setTldState() throws Exception {
|
||||
persistResource(
|
||||
Registry.get("xn--q9jyb4c")
|
||||
Tld.get("xn--q9jyb4c")
|
||||
.asBuilder()
|
||||
.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)))
|
||||
.isEqualTo(START_DATE_SUNRISE);
|
||||
assertThat(Tld.get("xn--q9jyb4c").getTldState(now.plusDays(1))).isEqualTo(START_DATE_SUNRISE);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -113,7 +112,7 @@ class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
||||
later),
|
||||
"xn--q9jyb4c");
|
||||
|
||||
Registry registry = Registry.get("xn--q9jyb4c");
|
||||
Tld registry = Tld.get("xn--q9jyb4c");
|
||||
assertThat(registry.getStandardRenewCost(START_OF_TIME)).isEqualTo(Money.of(USD, 1));
|
||||
assertThat(registry.getStandardRenewCost(now.minusMillis(1))).isEqualTo(Money.of(USD, 1));
|
||||
assertThat(registry.getStandardRenewCost(now)).isEqualTo(Money.of(USD, 2));
|
||||
@@ -126,55 +125,52 @@ class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
||||
|
||||
@Test
|
||||
void testSuccess_multipleArguments() throws Exception {
|
||||
assertThat(Registry.get("xn--q9jyb4c").getAddGracePeriodLength())
|
||||
.isNotEqualTo(standardMinutes(5));
|
||||
assertThat(Tld.get("xn--q9jyb4c").getAddGracePeriodLength()).isNotEqualTo(standardMinutes(5));
|
||||
createTld("example");
|
||||
assertThat(Registry.get("example").getAddGracePeriodLength()).isNotEqualTo(standardMinutes(5));
|
||||
assertThat(Tld.get("example").getAddGracePeriodLength()).isNotEqualTo(standardMinutes(5));
|
||||
|
||||
runCommandForced("--add_grace_period=PT300S", "xn--q9jyb4c", "example");
|
||||
|
||||
assertThat(Registry.get("xn--q9jyb4c").getAddGracePeriodLength()).isEqualTo(standardMinutes(5));
|
||||
assertThat(Registry.get("example").getAddGracePeriodLength()).isEqualTo(standardMinutes(5));
|
||||
assertThat(Tld.get("xn--q9jyb4c").getAddGracePeriodLength()).isEqualTo(standardMinutes(5));
|
||||
assertThat(Tld.get("example").getAddGracePeriodLength()).isEqualTo(standardMinutes(5));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_addGracePeriodFlag() throws Exception {
|
||||
assertThat(Registry.get("xn--q9jyb4c").getAddGracePeriodLength())
|
||||
.isNotEqualTo(standardMinutes(5));
|
||||
assertThat(Tld.get("xn--q9jyb4c").getAddGracePeriodLength()).isNotEqualTo(standardMinutes(5));
|
||||
runCommandForced("--add_grace_period=PT300S", "xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getAddGracePeriodLength()).isEqualTo(standardMinutes(5));
|
||||
assertThat(Tld.get("xn--q9jyb4c").getAddGracePeriodLength()).isEqualTo(standardMinutes(5));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_redemptionGracePeriodFlag() throws Exception {
|
||||
assertThat(Registry.get("xn--q9jyb4c").getRedemptionGracePeriodLength())
|
||||
assertThat(Tld.get("xn--q9jyb4c").getRedemptionGracePeriodLength())
|
||||
.isNotEqualTo(standardMinutes(5));
|
||||
runCommandForced("--redemption_grace_period=PT300S", "xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getRedemptionGracePeriodLength())
|
||||
assertThat(Tld.get("xn--q9jyb4c").getRedemptionGracePeriodLength())
|
||||
.isEqualTo(standardMinutes(5));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_pendingDeleteLengthFlag() throws Exception {
|
||||
assertThat(Registry.get("xn--q9jyb4c").getPendingDeleteLength())
|
||||
.isNotEqualTo(standardMinutes(5));
|
||||
assertThat(Tld.get("xn--q9jyb4c").getPendingDeleteLength()).isNotEqualTo(standardMinutes(5));
|
||||
runCommandForced("--pending_delete_length=PT300S", "xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getPendingDeleteLength()).isEqualTo(standardMinutes(5));
|
||||
assertThat(Tld.get("xn--q9jyb4c").getPendingDeleteLength()).isEqualTo(standardMinutes(5));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_dnsWriter() throws Exception {
|
||||
assertThat(Registry.get("xn--q9jyb4c").getDnsWriters()).containsExactly("VoidDnsWriter");
|
||||
assertThat(Tld.get("xn--q9jyb4c").getDnsWriters()).containsExactly("VoidDnsWriter");
|
||||
runCommandForced("--dns_writers=FooDnsWriter", "xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getDnsWriters()).containsExactly("FooDnsWriter");
|
||||
assertThat(Tld.get("xn--q9jyb4c").getDnsWriters()).containsExactly("FooDnsWriter");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_multipleDnsWriters() throws Exception {
|
||||
assertThat(Registry.get("xn--q9jyb4c").getDnsWriters()).containsExactly("VoidDnsWriter");
|
||||
assertThat(Tld.get("xn--q9jyb4c").getDnsWriters()).containsExactly("VoidDnsWriter");
|
||||
|
||||
runCommandForced("--dns_writers=FooDnsWriter,VoidDnsWriter", "xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getDnsWriters())
|
||||
assertThat(Tld.get("xn--q9jyb4c").getDnsWriters())
|
||||
.containsExactly("FooDnsWriter", "VoidDnsWriter");
|
||||
}
|
||||
|
||||
@@ -188,10 +184,9 @@ class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
||||
.setTokenType(DEFAULT_PROMO)
|
||||
.setAllowedTlds(ImmutableSet.of("xn--q9jyb4c"))
|
||||
.build());
|
||||
assertThat(Registry.get("xn--q9jyb4c").getDefaultPromoTokens()).isEmpty();
|
||||
assertThat(Tld.get("xn--q9jyb4c").getDefaultPromoTokens()).isEmpty();
|
||||
runCommandForced("--default_tokens=abc123", "xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getDefaultPromoTokens())
|
||||
.containsExactly(token.createVKey());
|
||||
assertThat(Tld.get("xn--q9jyb4c").getDefaultPromoTokens()).containsExactly(token.createVKey());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -212,9 +207,9 @@ class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
||||
.setTokenType(DEFAULT_PROMO)
|
||||
.setAllowedTlds(ImmutableSet.of("xn--q9jyb4c"))
|
||||
.build());
|
||||
assertThat(Registry.get("xn--q9jyb4c").getDefaultPromoTokens()).isEmpty();
|
||||
assertThat(Tld.get("xn--q9jyb4c").getDefaultPromoTokens()).isEmpty();
|
||||
runCommandForced("--default_tokens=abc123,token", "xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getDefaultPromoTokens())
|
||||
assertThat(Tld.get("xn--q9jyb4c").getDefaultPromoTokens())
|
||||
.containsExactly(token.createVKey(), token2.createVKey());
|
||||
}
|
||||
|
||||
@@ -228,16 +223,15 @@ class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
||||
.setTokenType(DEFAULT_PROMO)
|
||||
.setAllowedTlds(ImmutableSet.of("xn--q9jyb4c"))
|
||||
.build());
|
||||
assertThat(Registry.get("xn--q9jyb4c").getDefaultPromoTokens()).isEmpty();
|
||||
assertThat(Tld.get("xn--q9jyb4c").getDefaultPromoTokens()).isEmpty();
|
||||
persistResource(
|
||||
Registry.get("xn--q9jyb4c")
|
||||
Tld.get("xn--q9jyb4c")
|
||||
.asBuilder()
|
||||
.setDefaultPromoTokens(ImmutableList.of(token.createVKey()))
|
||||
.build());
|
||||
assertThat(Registry.get("xn--q9jyb4c").getDefaultPromoTokens())
|
||||
.containsExactly(token.createVKey());
|
||||
assertThat(Tld.get("xn--q9jyb4c").getDefaultPromoTokens()).containsExactly(token.createVKey());
|
||||
runCommandForced("--default_tokens=", "xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getDefaultPromoTokens()).isEmpty();
|
||||
assertThat(Tld.get("xn--q9jyb4c").getDefaultPromoTokens()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -266,16 +260,16 @@ class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
||||
.setTokenType(DEFAULT_PROMO)
|
||||
.setAllowedTlds(ImmutableSet.of("xn--q9jyb4c"))
|
||||
.build());
|
||||
assertThat(Registry.get("xn--q9jyb4c").getDefaultPromoTokens()).isEmpty();
|
||||
assertThat(Tld.get("xn--q9jyb4c").getDefaultPromoTokens()).isEmpty();
|
||||
persistResource(
|
||||
Registry.get("xn--q9jyb4c")
|
||||
Tld.get("xn--q9jyb4c")
|
||||
.asBuilder()
|
||||
.setDefaultPromoTokens(ImmutableList.of(token.createVKey(), token2.createVKey()))
|
||||
.build());
|
||||
assertThat(Registry.get("xn--q9jyb4c").getDefaultPromoTokens())
|
||||
assertThat(Tld.get("xn--q9jyb4c").getDefaultPromoTokens())
|
||||
.containsExactly(token.createVKey(), token2.createVKey());
|
||||
runCommandForced("--default_tokens=token,othertoken", "xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getDefaultPromoTokens())
|
||||
assertThat(Tld.get("xn--q9jyb4c").getDefaultPromoTokens())
|
||||
.containsExactly(token2.createVKey(), token3.createVKey());
|
||||
}
|
||||
|
||||
@@ -293,32 +287,31 @@ class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
||||
@Test
|
||||
void testSuccess_escrow() throws Exception {
|
||||
runCommandForced("--escrow=true", "xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getEscrowEnabled()).isTrue();
|
||||
assertThat(Tld.get("xn--q9jyb4c").getEscrowEnabled()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_noEscrow() throws Exception {
|
||||
runCommandForced("--escrow=false", "xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getEscrowEnabled()).isFalse();
|
||||
assertThat(Tld.get("xn--q9jyb4c").getEscrowEnabled()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_createBillingCostFlag() throws Exception {
|
||||
runCommandForced("--create_billing_cost=\"USD 42.42\"", "xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getStandardCreateCost()).isEqualTo(Money.of(USD, 42.42));
|
||||
assertThat(Tld.get("xn--q9jyb4c").getStandardCreateCost()).isEqualTo(Money.of(USD, 42.42));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_restoreBillingCostFlag() throws Exception {
|
||||
runCommandForced("--restore_billing_cost=\"USD 42.42\"", "xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getStandardRestoreCost())
|
||||
.isEqualTo(Money.of(USD, 42.42));
|
||||
assertThat(Tld.get("xn--q9jyb4c").getStandardRestoreCost()).isEqualTo(Money.of(USD, 42.42));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_nonUsdBillingCostFlag() throws Exception {
|
||||
persistResource(
|
||||
Registry.get("xn--q9jyb4c")
|
||||
Tld.get("xn--q9jyb4c")
|
||||
.asBuilder()
|
||||
.setCurrency(JPY)
|
||||
.setCreateBillingCost(Money.ofMajor(JPY, 1))
|
||||
@@ -336,7 +329,7 @@ class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
||||
"--server_status_change_cost=\"JPY 97865\"",
|
||||
"--registry_lock_or_unlock_cost=\"JPY 9001\"",
|
||||
"xn--q9jyb4c");
|
||||
Registry registry = Registry.get("xn--q9jyb4c");
|
||||
Tld registry = Tld.get("xn--q9jyb4c");
|
||||
assertThat(registry.getStandardCreateCost()).isEqualTo(Money.ofMajor(JPY, 12345));
|
||||
assertThat(registry.getStandardRestoreCost()).isEqualTo(Money.ofMajor(JPY, 67890));
|
||||
assertThat(registry.getStandardRenewCost(START_OF_TIME)).isEqualTo(Money.ofMajor(JPY, 101112));
|
||||
@@ -347,173 +340,183 @@ class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
||||
@Test
|
||||
void testSuccess_setLordnUsername() throws Exception {
|
||||
runCommandForced("--lordn_username=lordn000", "xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getLordnUsername()).isEqualTo("lordn000");
|
||||
assertThat(Tld.get("xn--q9jyb4c").getLordnUsername()).isEqualTo("lordn000");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_setOptionalParamsNullString() throws Exception {
|
||||
persistResource(Registry.get("xn--q9jyb4c").asBuilder().setLordnUsername("lordn000").build());
|
||||
persistResource(Tld.get("xn--q9jyb4c").asBuilder().setLordnUsername("lordn000").build());
|
||||
runCommandForced("--lordn_username=null", "xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getLordnUsername()).isNull();
|
||||
assertThat(Tld.get("xn--q9jyb4c").getLordnUsername()).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_setOptionalParamsEmptyString() throws Exception {
|
||||
persistResource(Registry.get("xn--q9jyb4c").asBuilder().setLordnUsername("lordn000").build());
|
||||
persistResource(Tld.get("xn--q9jyb4c").asBuilder().setLordnUsername("lordn000").build());
|
||||
runCommandForced("--lordn_username=", "xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getLordnUsername()).isNull();
|
||||
assertThat(Tld.get("xn--q9jyb4c").getLordnUsername()).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_setReservedLists() throws Exception {
|
||||
runCommandForced("--reserved_lists=xn--q9jyb4c_r1,xn--q9jyb4c_r2", "xn--q9jyb4c");
|
||||
|
||||
assertThat(Registry.get("xn--q9jyb4c").getReservedListNames())
|
||||
assertThat(Tld.get("xn--q9jyb4c").getReservedListNames())
|
||||
.containsExactly("xn--q9jyb4c_r1", "xn--q9jyb4c_r2");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_setReservedListsOverwrites() throws Exception {
|
||||
persistResource(Registry.get("xn--q9jyb4c").asBuilder()
|
||||
.setReservedListsByName(ImmutableSet.of("xn--q9jyb4c_r1", "xn--q9jyb4c_r2"))
|
||||
.build());
|
||||
persistResource(
|
||||
Tld.get("xn--q9jyb4c")
|
||||
.asBuilder()
|
||||
.setReservedListsByName(ImmutableSet.of("xn--q9jyb4c_r1", "xn--q9jyb4c_r2"))
|
||||
.build());
|
||||
runCommandForced("--reserved_lists=xn--q9jyb4c_r2", "xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getReservedListNames())
|
||||
.containsExactly("xn--q9jyb4c_r2");
|
||||
assertThat(Tld.get("xn--q9jyb4c").getReservedListNames()).containsExactly("xn--q9jyb4c_r2");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_addReservedLists() throws Exception {
|
||||
persistResource(Registry.get("xn--q9jyb4c").asBuilder()
|
||||
.setReservedListsByName(ImmutableSet.of("xn--q9jyb4c_r1"))
|
||||
.build());
|
||||
persistResource(
|
||||
Tld.get("xn--q9jyb4c")
|
||||
.asBuilder()
|
||||
.setReservedListsByName(ImmutableSet.of("xn--q9jyb4c_r1"))
|
||||
.build());
|
||||
runCommandForced("--add_reserved_lists=xn--q9jyb4c_r2", "xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getReservedListNames())
|
||||
assertThat(Tld.get("xn--q9jyb4c").getReservedListNames())
|
||||
.containsExactly("xn--q9jyb4c_r1", "xn--q9jyb4c_r2");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_removeAllReservedLists() throws Exception {
|
||||
persistResource(Registry.get("xn--q9jyb4c").asBuilder()
|
||||
.setReservedListsByName(ImmutableSet.of("xn--q9jyb4c_r1", "xn--q9jyb4c_r2"))
|
||||
.build());
|
||||
persistResource(
|
||||
Tld.get("xn--q9jyb4c")
|
||||
.asBuilder()
|
||||
.setReservedListsByName(ImmutableSet.of("xn--q9jyb4c_r1", "xn--q9jyb4c_r2"))
|
||||
.build());
|
||||
runCommandForced("--remove_reserved_lists=xn--q9jyb4c_r1,xn--q9jyb4c_r2", "xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getReservedListNames()).isEmpty();
|
||||
assertThat(Tld.get("xn--q9jyb4c").getReservedListNames()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_removeSomeReservedLists() throws Exception {
|
||||
persistResource(Registry.get("xn--q9jyb4c").asBuilder()
|
||||
.setReservedListsByName(ImmutableSet.of("xn--q9jyb4c_r1", "xn--q9jyb4c_r2"))
|
||||
.build());
|
||||
persistResource(
|
||||
Tld.get("xn--q9jyb4c")
|
||||
.asBuilder()
|
||||
.setReservedListsByName(ImmutableSet.of("xn--q9jyb4c_r1", "xn--q9jyb4c_r2"))
|
||||
.build());
|
||||
runCommandForced("--remove_reserved_lists=xn--q9jyb4c_r1", "xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getReservedListNames())
|
||||
.containsExactly("xn--q9jyb4c_r2");
|
||||
assertThat(Tld.get("xn--q9jyb4c").getReservedListNames()).containsExactly("xn--q9jyb4c_r2");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_setAllowedRegistrants() throws Exception {
|
||||
runCommandForced("--allowed_registrants=alice,bob", "xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getAllowedRegistrantContactIds())
|
||||
assertThat(Tld.get("xn--q9jyb4c").getAllowedRegistrantContactIds())
|
||||
.containsExactly("alice", "bob");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_setAllowedRegistrantsOverwrites() throws Exception {
|
||||
persistResource(
|
||||
Registry.get("xn--q9jyb4c").asBuilder()
|
||||
Tld.get("xn--q9jyb4c")
|
||||
.asBuilder()
|
||||
.setAllowedRegistrantContactIds(ImmutableSet.of("jane", "john"))
|
||||
.build());
|
||||
runCommandForced("--allowed_registrants=alice,bob", "xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getAllowedRegistrantContactIds())
|
||||
assertThat(Tld.get("xn--q9jyb4c").getAllowedRegistrantContactIds())
|
||||
.containsExactly("alice", "bob");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_addAllowedRegistrants() throws Exception {
|
||||
persistResource(
|
||||
Registry.get("xn--q9jyb4c").asBuilder()
|
||||
Tld.get("xn--q9jyb4c")
|
||||
.asBuilder()
|
||||
.setAllowedRegistrantContactIds(ImmutableSet.of("alice"))
|
||||
.build());
|
||||
runCommandForced("--add_allowed_registrants=bob", "xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getAllowedRegistrantContactIds())
|
||||
assertThat(Tld.get("xn--q9jyb4c").getAllowedRegistrantContactIds())
|
||||
.containsExactly("alice", "bob");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_removeAllAllowedRegistrants() throws Exception {
|
||||
persistResource(
|
||||
Registry.get("xn--q9jyb4c").asBuilder()
|
||||
Tld.get("xn--q9jyb4c")
|
||||
.asBuilder()
|
||||
.setAllowedRegistrantContactIds(ImmutableSet.of("alice", "bob"))
|
||||
.build());
|
||||
runCommandForced("--remove_allowed_registrants=alice,bob", "xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getAllowedRegistrantContactIds()).isEmpty();
|
||||
assertThat(Tld.get("xn--q9jyb4c").getAllowedRegistrantContactIds()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_removeSomeAllowedRegistrants() throws Exception {
|
||||
persistResource(
|
||||
Registry.get("xn--q9jyb4c").asBuilder()
|
||||
Tld.get("xn--q9jyb4c")
|
||||
.asBuilder()
|
||||
.setAllowedRegistrantContactIds(ImmutableSet.of("alice", "bob"))
|
||||
.build());
|
||||
runCommandForced("--remove_allowed_registrants=alice", "xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getAllowedRegistrantContactIds()).containsExactly("bob");
|
||||
assertThat(Tld.get("xn--q9jyb4c").getAllowedRegistrantContactIds()).containsExactly("bob");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_setAllowedNameservers() throws Exception {
|
||||
runCommandForced("--allowed_nameservers=ns1.example.com,ns2.example.com", "xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getAllowedFullyQualifiedHostNames())
|
||||
assertThat(Tld.get("xn--q9jyb4c").getAllowedFullyQualifiedHostNames())
|
||||
.containsExactly("ns1.example.com", "ns2.example.com");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_setAllowedNameserversOverwrites() throws Exception {
|
||||
persistResource(
|
||||
Registry.get("xn--q9jyb4c")
|
||||
Tld.get("xn--q9jyb4c")
|
||||
.asBuilder()
|
||||
.setAllowedFullyQualifiedHostNames(
|
||||
ImmutableSet.of("ns1.example.tld", "ns2.example.tld"))
|
||||
.build());
|
||||
runCommandForced("--allowed_nameservers=ns1.example.com,ns2.example.com", "xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getAllowedFullyQualifiedHostNames())
|
||||
assertThat(Tld.get("xn--q9jyb4c").getAllowedFullyQualifiedHostNames())
|
||||
.containsExactly("ns1.example.com", "ns2.example.com");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_addAllowedNameservers() throws Exception {
|
||||
persistResource(
|
||||
Registry.get("xn--q9jyb4c")
|
||||
Tld.get("xn--q9jyb4c")
|
||||
.asBuilder()
|
||||
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns1.example.com"))
|
||||
.build());
|
||||
runCommandForced("--add_allowed_nameservers=ns2.example.com", "xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getAllowedFullyQualifiedHostNames())
|
||||
assertThat(Tld.get("xn--q9jyb4c").getAllowedFullyQualifiedHostNames())
|
||||
.containsExactly("ns1.example.com", "ns2.example.com");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_removeAllAllowedNameservers() throws Exception {
|
||||
persistResource(
|
||||
Registry.get("xn--q9jyb4c")
|
||||
Tld.get("xn--q9jyb4c")
|
||||
.asBuilder()
|
||||
.setAllowedFullyQualifiedHostNames(
|
||||
ImmutableSet.of("ns1.example.com", "ns2.example.com"))
|
||||
.build());
|
||||
runCommandForced("--remove_allowed_nameservers=ns1.example.com,ns2.example.com", "xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getAllowedFullyQualifiedHostNames()).isEmpty();
|
||||
assertThat(Tld.get("xn--q9jyb4c").getAllowedFullyQualifiedHostNames()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_removeSomeAllowedNameservers() throws Exception {
|
||||
persistResource(
|
||||
Registry.get("xn--q9jyb4c")
|
||||
Tld.get("xn--q9jyb4c")
|
||||
.asBuilder()
|
||||
.setAllowedFullyQualifiedHostNames(
|
||||
ImmutableSet.of("ns1.example.com", "ns2.example.com"))
|
||||
.build());
|
||||
runCommandForced("--remove_allowed_nameservers=ns1.example.com", "xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getAllowedFullyQualifiedHostNames())
|
||||
assertThat(Tld.get("xn--q9jyb4c").getAllowedFullyQualifiedHostNames())
|
||||
.containsExactly("ns2.example.com");
|
||||
}
|
||||
|
||||
@@ -648,11 +651,11 @@ class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
||||
@Test
|
||||
void testFailure_setCurrentTldState_outOfOrder() {
|
||||
persistResource(
|
||||
Registry.get("xn--q9jyb4c").asBuilder()
|
||||
Tld.get("xn--q9jyb4c")
|
||||
.asBuilder()
|
||||
.setTldStateTransitions(
|
||||
ImmutableSortedMap.of(
|
||||
START_OF_TIME, PREDELEGATION,
|
||||
now.minusMonths(1), GENERAL_AVAILABILITY))
|
||||
START_OF_TIME, PREDELEGATION, now.minusMonths(1), GENERAL_AVAILABILITY))
|
||||
.build());
|
||||
IllegalArgumentException thrown =
|
||||
assertThrows(
|
||||
@@ -664,11 +667,11 @@ class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
||||
@Test
|
||||
void testFailure_setCurrentTldState_laterTransitionScheduled() {
|
||||
persistResource(
|
||||
Registry.get("xn--q9jyb4c").asBuilder()
|
||||
Tld.get("xn--q9jyb4c")
|
||||
.asBuilder()
|
||||
.setTldStateTransitions(
|
||||
ImmutableSortedMap.of(
|
||||
START_OF_TIME, PREDELEGATION,
|
||||
now.plusMonths(1), GENERAL_AVAILABILITY))
|
||||
START_OF_TIME, PREDELEGATION, now.plusMonths(1), GENERAL_AVAILABILITY))
|
||||
.build());
|
||||
IllegalArgumentException thrown =
|
||||
assertThrows(
|
||||
@@ -682,11 +685,11 @@ class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
||||
@Test
|
||||
void testFailure_setCurrentTldState_inProduction() {
|
||||
persistResource(
|
||||
Registry.get("xn--q9jyb4c").asBuilder()
|
||||
Tld.get("xn--q9jyb4c")
|
||||
.asBuilder()
|
||||
.setTldStateTransitions(
|
||||
ImmutableSortedMap.of(
|
||||
START_OF_TIME, PREDELEGATION,
|
||||
now.minusMonths(1), GENERAL_AVAILABILITY))
|
||||
START_OF_TIME, PREDELEGATION, now.minusMonths(1), GENERAL_AVAILABILITY))
|
||||
.build());
|
||||
IllegalArgumentException thrown =
|
||||
assertThrows(
|
||||
@@ -825,9 +828,11 @@ class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
||||
|
||||
@Test
|
||||
void testFailure_cantAddDuplicateReservedList() {
|
||||
persistResource(Registry.get("xn--q9jyb4c").asBuilder()
|
||||
.setReservedListsByName(ImmutableSet.of("xn--q9jyb4c_r1", "xn--q9jyb4c_r2"))
|
||||
.build());
|
||||
persistResource(
|
||||
Tld.get("xn--q9jyb4c")
|
||||
.asBuilder()
|
||||
.setReservedListsByName(ImmutableSet.of("xn--q9jyb4c_r1", "xn--q9jyb4c_r2"))
|
||||
.build());
|
||||
IllegalArgumentException thrown =
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
@@ -837,9 +842,11 @@ class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
||||
|
||||
@Test
|
||||
void testFailure_cantRemoveReservedListThatIsntPresent() {
|
||||
persistResource(Registry.get("xn--q9jyb4c").asBuilder()
|
||||
.setReservedListsByName(ImmutableSet.of("xn--q9jyb4c_r1", "xn--q9jyb4c_r2"))
|
||||
.build());
|
||||
persistResource(
|
||||
Tld.get("xn--q9jyb4c")
|
||||
.asBuilder()
|
||||
.setReservedListsByName(ImmutableSet.of("xn--q9jyb4c_r1", "xn--q9jyb4c_r2"))
|
||||
.build());
|
||||
IllegalArgumentException thrown =
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
@@ -863,9 +870,10 @@ class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
||||
@Test
|
||||
void testFailure_cantAddDuplicateAllowedRegistrants() {
|
||||
persistResource(
|
||||
Registry.get("xn--q9jyb4c").asBuilder()
|
||||
.setAllowedRegistrantContactIds(ImmutableSet.of("alice", "bob"))
|
||||
.build());
|
||||
Tld.get("xn--q9jyb4c")
|
||||
.asBuilder()
|
||||
.setAllowedRegistrantContactIds(ImmutableSet.of("alice", "bob"))
|
||||
.build());
|
||||
IllegalArgumentException thrown =
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
@@ -876,9 +884,10 @@ class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
||||
@Test
|
||||
void testFailure_cantRemoveAllowedRegistrantThatIsntPresent() {
|
||||
persistResource(
|
||||
Registry.get("xn--q9jyb4c").asBuilder()
|
||||
.setAllowedRegistrantContactIds(ImmutableSet.of("alice"))
|
||||
.build());
|
||||
Tld.get("xn--q9jyb4c")
|
||||
.asBuilder()
|
||||
.setAllowedRegistrantContactIds(ImmutableSet.of("alice"))
|
||||
.build());
|
||||
IllegalArgumentException thrown =
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
@@ -902,7 +911,7 @@ class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
||||
@Test
|
||||
void testFailure_cantAddDuplicateAllowedNameservers() {
|
||||
persistResource(
|
||||
Registry.get("xn--q9jyb4c")
|
||||
Tld.get("xn--q9jyb4c")
|
||||
.asBuilder()
|
||||
.setAllowedFullyQualifiedHostNames(
|
||||
ImmutableSet.of("ns1.example.com", "ns2.example.com"))
|
||||
@@ -917,7 +926,7 @@ class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
||||
@Test
|
||||
void testFailure_cantRemoveAllowedNameserverThatIsntPresent() {
|
||||
persistResource(
|
||||
Registry.get("xn--q9jyb4c")
|
||||
Tld.get("xn--q9jyb4c")
|
||||
.asBuilder()
|
||||
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns1.example.com"))
|
||||
.build());
|
||||
@@ -945,40 +954,40 @@ class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
||||
void testSuccess_canSetRoidSuffixToWhatItAlreadyIs() throws Exception {
|
||||
createTld("foo", "BLAH");
|
||||
runCommandForced("--roid_suffix=BLAH", "foo");
|
||||
assertThat(Registry.get("foo").getRoidSuffix()).isEqualTo("BLAH");
|
||||
assertThat(Tld.get("foo").getRoidSuffix()).isEqualTo("BLAH");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_updateRoidSuffix() throws Exception {
|
||||
createTld("foo", "ARGLE");
|
||||
runCommandForced("--roid_suffix=BARGLE", "foo");
|
||||
assertThat(Registry.get("foo").getRoidSuffix()).isEqualTo("BARGLE");
|
||||
assertThat(Tld.get("foo").getRoidSuffix()).isEqualTo("BARGLE");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_removePremiumListWithNull() throws Exception {
|
||||
runCommandForced("--premium_list=null", "xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getPremiumListName()).isEmpty();
|
||||
assertThat(Tld.get("xn--q9jyb4c").getPremiumListName()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_removePremiumListWithBlank() throws Exception {
|
||||
runCommandForced("--premium_list=", "xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getPremiumListName()).isEmpty();
|
||||
assertThat(Tld.get("xn--q9jyb4c").getPremiumListName()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_premiumListNotRemovedWhenNotSpecified() throws Exception {
|
||||
runCommandForced("--add_reserved_lists=xn--q9jyb4c_r1,xn--q9jyb4c_r2", "xn--q9jyb4c");
|
||||
Optional<String> premiumListName = Registry.get("xn--q9jyb4c").getPremiumListName();
|
||||
Optional<String> premiumListName = Tld.get("xn--q9jyb4c").getPremiumListName();
|
||||
assertThat(premiumListName).hasValue("xn--q9jyb4c");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_driveFolderId_notRemovedWhenNotSpecified() throws Exception {
|
||||
persistResource(Registry.get("xn--q9jyb4c").asBuilder().setDriveFolderId("foobar").build());
|
||||
persistResource(Tld.get("xn--q9jyb4c").asBuilder().setDriveFolderId("foobar").build());
|
||||
runCommandForced("xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getDriveFolderId()).isEqualTo("foobar");
|
||||
assertThat(Tld.get("xn--q9jyb4c").getDriveFolderId()).isEqualTo("foobar");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -1039,38 +1048,38 @@ class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
||||
@Test
|
||||
void testSuccess_setPremiumList() throws Exception {
|
||||
runCommandForced("--premium_list=xn--q9jyb4c", "xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getPremiumListName()).hasValue("xn--q9jyb4c");
|
||||
assertThat(Tld.get("xn--q9jyb4c").getPremiumListName()).hasValue("xn--q9jyb4c");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_setDriveFolderIdToValue() throws Exception {
|
||||
runCommandForced("--drive_folder_id=madmax2030", "xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getDriveFolderId()).isEqualTo("madmax2030");
|
||||
assertThat(Tld.get("xn--q9jyb4c").getDriveFolderId()).isEqualTo("madmax2030");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_setDriveFolderIdToNull() throws Exception {
|
||||
runCommandForced("--drive_folder_id=null", "xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getDriveFolderId()).isNull();
|
||||
assertThat(Tld.get("xn--q9jyb4c").getDriveFolderId()).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_setsIdnTables() throws Exception {
|
||||
assertThat(Registry.get("xn--q9jyb4c").getIdnTables()).isEmpty();
|
||||
assertThat(Tld.get("xn--q9jyb4c").getIdnTables()).isEmpty();
|
||||
runCommandForced("--idn_tables=extended_latin,ja", "xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getIdnTables())
|
||||
assertThat(Tld.get("xn--q9jyb4c").getIdnTables())
|
||||
.containsExactly(IdnTableEnum.EXTENDED_LATIN, IdnTableEnum.JA);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_removesIndTables() throws Exception {
|
||||
persistResource(
|
||||
Registry.get("xn--q9jyb4c")
|
||||
Tld.get("xn--q9jyb4c")
|
||||
.asBuilder()
|
||||
.setIdnTables(ImmutableSet.of(IdnTableEnum.EXTENDED_LATIN, IdnTableEnum.JA))
|
||||
.build());
|
||||
runCommandForced("--idn_tables=", "xn--q9jyb4c");
|
||||
assertThat(Registry.get("xn--q9jyb4c").getIdnTables()).isEmpty();
|
||||
assertThat(Tld.get("xn--q9jyb4c").getIdnTables()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -1102,7 +1111,7 @@ class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
||||
"--dns_ds_ttl=PT240S",
|
||||
"--dns_ns_ttl=PT180S",
|
||||
"xn--q9jyb4c");
|
||||
Registry registry = Registry.get("xn--q9jyb4c");
|
||||
Tld registry = Tld.get("xn--q9jyb4c");
|
||||
assertThat(registry.getDnsAPlusAaaaTtl()).isEqualTo(standardMinutes(5));
|
||||
assertThat(registry.getDnsDsTtl()).isEqualTo(standardMinutes(4));
|
||||
assertThat(registry.getDnsNsTtl()).isEqualTo(standardMinutes(3));
|
||||
|
||||
@@ -17,7 +17,7 @@ package google.registry.tools.params;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
import google.registry.model.tld.Registry.TldState;
|
||||
import google.registry.model.tld.Tld.TldState;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/** Unit tests for {@link EnumParameter}. */
|
||||
@@ -38,6 +38,6 @@ class EnumParameterTest {
|
||||
assertThrows(IllegalArgumentException.class, () -> instance.convert("FREE_DOMAINS"));
|
||||
assertThat(thrown)
|
||||
.hasMessageThat()
|
||||
.contains("No enum constant google.registry.model.tld.Registry.TldState.FREE_DOMAINS");
|
||||
.contains("No enum constant google.registry.model.tld.Tld.TldState.FREE_DOMAINS");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ import static google.registry.testing.DatabaseHelper.createTld;
|
||||
import static google.registry.testing.DatabaseHelper.persistReservedList;
|
||||
import static google.registry.testing.DatabaseHelper.persistResource;
|
||||
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.model.tld.label.ReservedList;
|
||||
import java.util.Optional;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
@@ -34,7 +34,7 @@ class ListReservedListsActionTest extends ListActionTestCase {
|
||||
ReservedList rl1 = persistReservedList("xn--q9jyb4c-published", true, "blah,FULLY_BLOCKED");
|
||||
ReservedList rl2 = persistReservedList("xn--q9jyb4c-private", false, "dugong,FULLY_BLOCKED");
|
||||
createTld("xn--q9jyb4c");
|
||||
persistResource(Registry.get("xn--q9jyb4c").asBuilder().setReservedLists(rl1, rl2).build());
|
||||
persistResource(Tld.get("xn--q9jyb4c").asBuilder().setReservedLists(rl1, rl2).build());
|
||||
action = new ListReservedListsAction();
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -31,7 +31,7 @@ import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSetMultimap;
|
||||
import google.registry.config.RegistryEnvironment;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
||||
import google.registry.request.Action.Method;
|
||||
@@ -151,7 +151,7 @@ public final class ConsoleOteSetupActionTest {
|
||||
// We just check some samples to make sure OteAccountBuilder was called successfully. We aren't
|
||||
// checking that all the entities are there or that they have the correct values.
|
||||
assertThat(loadByRegistrarId("myclientid-3")).isPresent();
|
||||
assertThat(Registry.get("myclientid-ga")).isNotNull();
|
||||
assertThat(Tld.get("myclientid-ga")).isNotNull();
|
||||
assertThat(
|
||||
loadByRegistrarId("myclientid-5").get().getContacts().asList().get(0).getEmailAddress())
|
||||
.isEqualTo("contact@registry.example");
|
||||
|
||||
+2
-2
@@ -39,7 +39,7 @@ import google.registry.model.domain.DomainHistory;
|
||||
import google.registry.model.domain.RegistryLock;
|
||||
import google.registry.model.host.Host;
|
||||
import google.registry.model.reporting.HistoryEntry;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
||||
import google.registry.request.auth.AuthLevel;
|
||||
@@ -317,7 +317,7 @@ final class RegistryLockVerifyActionTest {
|
||||
.setReason(Reason.SERVER_STATUS)
|
||||
.setTargetId(domain.getForeignKey())
|
||||
.setRegistrarId(domain.getCurrentSponsorRegistrarId())
|
||||
.setCost(Registry.get(domain.getTld()).getRegistryLockOrUnlockBillingCost())
|
||||
.setCost(Tld.get(domain.getTld()).getRegistryLockOrUnlockBillingCost())
|
||||
.setEventTime(fakeClock.nowUtc())
|
||||
.setBillingTime(fakeClock.nowUtc())
|
||||
.setDomainHistory(historyEntry)
|
||||
|
||||
@@ -45,7 +45,7 @@ import google.registry.model.domain.Domain;
|
||||
import google.registry.model.eppcommon.Trid;
|
||||
import google.registry.model.host.Host;
|
||||
import google.registry.model.registrar.Registrar;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.model.transfer.DomainTransferData;
|
||||
import google.registry.model.transfer.TransferStatus;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||
@@ -259,7 +259,7 @@ public class WhoisActionTest {
|
||||
@Disabled
|
||||
@Test
|
||||
void testRun_domainInTestTld_isConsideredNotFound() {
|
||||
persistResource(Registry.get("lol").asBuilder().setTldType(Registry.TldType.TEST).build());
|
||||
persistResource(Tld.get("lol").asBuilder().setTldType(Tld.TldType.TEST).build());
|
||||
Registrar registrar = persistResource(makeRegistrar(
|
||||
"evilregistrar", "Yes Virginia", ACTIVE));
|
||||
persistResource(
|
||||
@@ -500,7 +500,7 @@ public class WhoisActionTest {
|
||||
@Disabled
|
||||
@Test
|
||||
void testRun_nameserverInTestTld_notFound() {
|
||||
persistResource(Registry.get("lol").asBuilder().setTldType(Registry.TldType.TEST).build());
|
||||
persistResource(Tld.get("lol").asBuilder().setTldType(Tld.TldType.TEST).build());
|
||||
persistResource(FullFieldsTestEntityHelper.makeHost("ns1.cat.lol", "1.2.3.4"));
|
||||
newWhoisAction("nameserver ns1.cat.lol").run();
|
||||
assertThat(response.getStatus()).isEqualTo(200);
|
||||
|
||||
@@ -17,7 +17,7 @@ package google.registry.whois;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
||||
import static google.registry.testing.DatabaseHelper.newHost;
|
||||
import static google.registry.testing.DatabaseHelper.newRegistry;
|
||||
import static google.registry.testing.DatabaseHelper.newTld;
|
||||
import static google.registry.testing.DatabaseHelper.persistNewRegistrar;
|
||||
import static google.registry.testing.DatabaseHelper.persistResource;
|
||||
|
||||
@@ -61,7 +61,7 @@ class WhoisCommandFactoryTest {
|
||||
|
||||
@BeforeEach
|
||||
void setUp() throws Exception {
|
||||
persistResource(newRegistry("tld", "TLD"));
|
||||
persistResource(newTld("tld", "TLD"));
|
||||
host =
|
||||
newHost("ns.example.tld")
|
||||
.asBuilder()
|
||||
|
||||
@@ -36,7 +36,7 @@ import static org.mockito.Mockito.when;
|
||||
|
||||
import google.registry.model.contact.Contact;
|
||||
import google.registry.model.registrar.Registrar;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Tld;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
||||
import google.registry.testing.FakeClock;
|
||||
@@ -115,7 +115,7 @@ class WhoisHttpActionTest {
|
||||
@Disabled
|
||||
@Test
|
||||
void testRun_domainInTestTld_isConsideredNotFound() {
|
||||
persistResource(Registry.get("lol").asBuilder().setTldType(Registry.TldType.TEST).build());
|
||||
persistResource(Tld.get("lol").asBuilder().setTldType(Tld.TldType.TEST).build());
|
||||
Registrar registrar = persistResource(makeRegistrar(
|
||||
"evilregistrar", "Yes Virginia", Registrar.State.ACTIVE));
|
||||
persistResource(
|
||||
|
||||
Reference in New Issue
Block a user