From 68c80d32052aa3fb0a195b0b31080f48dfdea3cb Mon Sep 17 00:00:00 2001 From: Ben McIlwain Date: Tue, 2 Aug 2022 16:03:30 -0400 Subject: [PATCH] Rename DomainBase -> Domain (#1725) * Rename DomainBase -> Domain This was a long time coming, but we couldn't do it until we left Datastore, as the Java class name has to match the Datastore entity name. Subsequent PRs will rename ContactResource to Contact and HostResource to Host, so that everything matches the SQL table names (and is shorter!). * Merge branch 'master' into rename-domainbase --- .../batch/DeleteExpiredDomainsAction.java | 15 +- .../batch/DeleteLoadTestDataAction.java | 4 +- .../batch/DeleteProberDataAction.java | 16 +- .../ExpandRecurringBillingEventsAction.java | 4 +- .../registry/batch/RelockDomainAction.java | 8 +- .../common/RegistryPipelineComponent.java | 4 +- .../google/registry/beam/rde/RdePipeline.java | 12 +- .../resave/ResaveAllEppResourcesPipeline.java | 10 +- .../registry/beam/spec11/Spec11Pipeline.java | 13 +- .../google/registry/dns/RefreshDnsAction.java | 4 +- .../dns/writer/clouddns/CloudDnsWriter.java | 13 +- .../dns/writer/dnsupdate/DnsUpdateWriter.java | 15 +- .../default/WEB-INF/datastore-indexes.xml | 22 +- .../google/registry/flows/CheckApiAction.java | 5 +- .../registry/flows/ResourceFlowUtils.java | 8 +- .../custom/DomainCreateFlowCustomLogic.java | 9 +- .../custom/DomainDeleteFlowCustomLogic.java | 14 +- .../custom/DomainInfoFlowCustomLogic.java | 14 +- .../custom/DomainRenewFlowCustomLogic.java | 22 +- .../custom/DomainUpdateFlowCustomLogic.java | 14 +- .../flows/domain/DomainCheckFlow.java | 28 +-- .../flows/domain/DomainCreateFlow.java | 15 +- .../flows/domain/DomainDeleteFlow.java | 18 +- .../flows/domain/DomainFlowUtils.java | 26 +-- .../registry/flows/domain/DomainInfoFlow.java | 10 +- .../flows/domain/DomainRenewFlow.java | 14 +- .../domain/DomainRestoreRequestFlow.java | 17 +- .../domain/DomainTransferApproveFlow.java | 12 +- .../domain/DomainTransferCancelFlow.java | 8 +- .../flows/domain/DomainTransferQueryFlow.java | 4 +- .../domain/DomainTransferRejectFlow.java | 8 +- .../domain/DomainTransferRequestFlow.java | 14 +- .../flows/domain/DomainTransferUtils.java | 9 +- .../flows/domain/DomainUpdateFlow.java | 19 +- .../token/AllocationTokenCustomLogic.java | 4 +- .../token/AllocationTokenFlowUtils.java | 4 +- .../registry/flows/host/HostCreateFlow.java | 6 +- .../registry/flows/host/HostFlowUtils.java | 15 +- .../registry/flows/host/HostInfoFlow.java | 4 +- .../registry/flows/host/HostUpdateFlow.java | 14 +- .../google/registry/model/EntityClasses.java | 4 +- .../registry/model/EppResourceUtils.java | 19 +- .../registry/model/ResourceTransferUtils.java | 4 +- .../model/bulkquery/BulkQueryEntities.java | 20 +- .../model/bulkquery/DomainHistoryLite.java | 12 +- .../{DomainBaseLite.java => DomainLite.java} | 14 +- .../domain/{DomainBase.java => Domain.java} | 24 +- .../registry/model/domain/DomainCommand.java | 25 +-- .../registry/model/domain/DomainContent.java | 15 +- .../registry/model/domain/DomainHistory.java | 22 +- .../registry/model/domain/GracePeriod.java | 4 +- .../registry/model/eppcommon/StatusValue.java | 6 +- .../google/registry/model/host/HostBase.java | 10 +- .../registry/model/index/ForeignKeyIndex.java | 10 +- .../google/registry/model/package-info.java | 2 +- .../registry/model/poll/PollMessage.java | 4 +- .../model/reporting/HistoryEntry.java | 6 +- .../model/reporting/HistoryEntryDao.java | 4 +- .../persistence/DomainHistoryVKey.java | 8 +- .../registry/persistence/EppHistoryVKey.java | 2 +- .../google/registry/persistence/VKey.java | 4 +- .../registry/rdap/RdapDomainAction.java | 10 +- .../registry/rdap/RdapDomainSearchAction.java | 58 ++--- .../registry/rdap/RdapJsonFormatter.java | 43 ++-- .../rdap/RdapNameserverSearchAction.java | 12 +- ...nverter.java => DomainToXjcConverter.java} | 18 +- .../rde/HostResourceToXjcConverter.java | 6 +- .../google/registry/rde/RdeFragmenter.java | 6 +- .../google/registry/rde/RdeMarshaller.java | 13 +- .../google/registry/rde/RdeStagingAction.java | 4 +- .../TransactionsReportingQueryBuilder.java | 210 +++++------------- .../reporting/icann/sql/attempted_adds.sql | 73 ------ .../reporting/icann/sql/registrar_iana_id.sql | 30 --- .../reporting/icann/sql/total_domains.sql | 37 --- .../reporting/icann/sql/total_nameservers.sql | 55 ----- .../icann/sql/transaction_counts.sql | 85 ------- .../sql/transactions_report_aggregation.sql | 100 --------- .../reporting/spec11/Spec11EmailUtils.java | 6 +- .../google/registry/tmch/LordnTaskUtils.java | 16 +- .../registry/tools/CommandUtilities.java | 4 +- .../registry/tools/CountDomainsCommand.java | 4 +- .../registry/tools/DeleteTldCommand.java | 4 +- .../registry/tools/DomainLockUtils.java | 48 ++-- .../tools/EnqueuePollMessageCommand.java | 8 +- .../tools/GenerateDnsReportCommand.java | 10 +- .../registry/tools/GenerateLordnCommand.java | 6 +- .../tools/GetAllocationTokenCommand.java | 25 +-- .../registry/tools/GetDomainCommand.java | 4 +- .../registry/tools/RenewDomainCommand.java | 7 +- .../tools/UniformRapidSuspensionCommand.java | 14 +- .../registry/tools/UnrenewDomainCommand.java | 15 +- .../registry/tools/UpdateDomainCommand.java | 41 ++-- .../params/EppResourceTypeParameter.java | 4 +- .../tools/server/GenerateZoneFilesAction.java | 10 +- .../tools/server/ListDomainsAction.java | 18 +- .../registry/whois/DomainLookupCommand.java | 8 +- .../registry/whois/DomainWhoisResponse.java | 8 +- .../main/resources/META-INF/persistence.xml | 4 +- .../batch/DeleteExpiredDomainsActionTest.java | 34 +-- .../batch/DeleteProberDataActionTest.java | 47 ++-- ...xpandRecurringBillingEventsActionTest.java | 20 +- .../batch/RelockDomainActionTest.java | 8 +- .../batch/ResaveEntityActionTest.java | 15 +- .../beam/common/RegistryJpaReadTest.java | 16 +- .../beam/invoicing/InvoicingPipelineTest.java | 44 ++-- .../registry/beam/rde/RdePipelineTest.java | 18 +- .../ResaveAllEppResourcesPipelineTest.java | 16 +- .../beam/spec11/Spec11PipelineTest.java | 6 +- .../dns/PublishDnsUpdatesActionTest.java | 6 +- .../registry/dns/RefreshDnsActionTest.java | 4 +- .../writer/clouddns/CloudDnsWriterTest.java | 8 +- .../writer/dnsupdate/DnsUpdateWriterTest.java | 26 +-- .../flows/EppLifecycleDomainTest.java | 30 +-- .../registry/flows/EppLifecycleHostTest.java | 13 +- .../registry/flows/EppPointInTimeTest.java | 10 +- .../google/registry/flows/EppTestCase.java | 16 +- .../flows/contact/ContactDeleteFlowTest.java | 5 +- .../flows/contact/ContactInfoFlowTest.java | 4 +- .../flows/domain/DomainCheckFlowTest.java | 16 +- .../domain/DomainClaimsCheckFlowTest.java | 5 +- .../flows/domain/DomainCreateFlowTest.java | 28 +-- .../flows/domain/DomainDeleteFlowTest.java | 46 ++-- .../flows/domain/DomainFlowUtilsTest.java | 4 +- .../flows/domain/DomainInfoFlowTest.java | 12 +- .../flows/domain/DomainPricingLogicTest.java | 8 +- .../flows/domain/DomainRenewFlowTest.java | 24 +- .../domain/DomainRestoreRequestFlowTest.java | 19 +- .../domain/DomainTransferApproveFlowTest.java | 10 +- .../domain/DomainTransferCancelFlowTest.java | 6 +- .../domain/DomainTransferFlowTestCase.java | 11 +- .../domain/DomainTransferQueryFlowTest.java | 6 +- .../domain/DomainTransferRejectFlowTest.java | 6 +- .../domain/DomainTransferRequestFlowTest.java | 19 +- .../flows/domain/DomainUpdateFlowTest.java | 84 +++---- .../token/AllocationTokenFlowUtilsTest.java | 20 +- .../flows/host/HostCreateFlowTest.java | 14 +- .../flows/host/HostDeleteFlowTest.java | 22 +- .../registry/flows/host/HostInfoFlowTest.java | 10 +- .../flows/host/HostUpdateFlowTest.java | 119 +++++----- .../registry/flows/poll/PollAckFlowTest.java | 8 +- .../flows/poll/PollRequestFlowTest.java | 8 +- .../model/billing/BillingEventTest.java | 4 +- .../model/bulkquery/BulkQueryHelper.java | 16 +- ...nBaseLiteTest.java => DomainLiteTest.java} | 38 ++-- .../model/bulkquery/TestSetupHelper.java | 15 +- .../model/common/ClassPathManagerTest.java | 6 +- ...ainBaseSqlTest.java => DomainSqlTest.java} | 70 +++--- .../{DomainBaseTest.java => DomainTest.java} | 85 ++++--- .../domain/token/AllocationTokenTest.java | 8 +- .../registry/model/eppinput/EppInputTest.java | 4 +- .../model/history/DomainHistoryTest.java | 20 +- .../registry/model/host/HostResourceTest.java | 8 +- .../model/index/ForeignKeyIndexTest.java | 8 +- .../registry/model/poll/PollMessageTest.java | 8 +- .../model/reporting/HistoryEntryDaoTest.java | 9 +- .../model/reporting/HistoryEntryTest.java | 4 +- .../reporting/Spec11ThreatMatchDaoTest.java | 20 +- .../reporting/Spec11ThreatMatchTest.java | 6 +- .../model/transfer/TransferDataTest.java | 4 +- .../VKeyTranslatorFactoryTest.java | 14 +- .../persistence/DomainHistoryVKeyTest.java | 6 +- .../google/registry/persistence/VKeyTest.java | 33 ++- .../registry/rdap/RdapDomainActionTest.java | 14 +- .../rdap/RdapDomainSearchActionTest.java | 30 +-- .../registry/rdap/RdapEntityActionTest.java | 11 +- .../registry/rdap/RdapJsonFormatterTest.java | 40 ++-- .../rdap/RdapNameserverSearchActionTest.java | 8 +- ...est.java => DomainToXjcConverterTest.java} | 27 ++- .../rde/HostResourceToXjcConverterTest.java | 8 +- .../java/google/registry/rde/RdeFixtures.java | 8 +- .../google/registry/rde/RdeTestSuite.java | 2 +- .../spec11/Spec11EmailUtilsTest.java | 12 +- .../integration/SqlIntegrationTestSuite.java | 4 +- .../java/google/registry/server/Fixture.java | 6 +- .../registry/testing/DatabaseHelper.java | 72 +++--- .../testing/DatastoreEntityExtension.java | 5 +- ...ainBaseSubject.java => DomainSubject.java} | 45 ++-- .../testing/FullFieldsTestEntityHelper.java | 8 +- .../registry/testing/HostResourceSubject.java | 4 +- .../registry/tmch/LordnTaskUtilsTest.java | 16 +- .../registry/tmch/NordnUploadActionTest.java | 8 +- .../tools/AckPollMessagesCommandTest.java | 7 +- .../DeleteAllocationTokensCommandTest.java | 4 +- .../registry/tools/DomainLockUtilsTest.java | 7 +- .../tools/EnqueuePollMessageCommandTest.java | 4 +- .../registry/tools/EppLifecycleToolsTest.java | 8 +- .../tools/GenerateDnsReportCommandTest.java | 10 +- .../tools/GenerateLordnCommandTest.java | 8 +- .../tools/GetAllocationTokenCommandTest.java | 5 +- .../registry/tools/GetDomainCommandTest.java | 22 +- .../tools/GetHistoryEntriesCommandTest.java | 4 +- .../registry/tools/LockDomainCommandTest.java | 22 +- .../tools/RenewDomainCommandTest.java | 10 +- .../UniformRapidSuspensionCommandTest.java | 42 ++-- .../tools/UnlockDomainCommandTest.java | 22 +- .../tools/UnrenewDomainCommandTest.java | 16 +- .../tools/UpdateDomainCommandTest.java | 22 +- .../server/GenerateZoneFilesActionTest.java | 81 ++++--- .../registrar/RegistryLockPostActionTest.java | 10 +- .../RegistryLockVerifyActionTest.java | 9 +- .../RegistrarConsoleScreenshotTest.java | 28 +-- .../whois/DomainWhoisResponseTest.java | 16 +- .../whois/NameserverWhoisResponseTest.java | 6 +- .../registry/whois/WhoisActionTest.java | 165 +++++++------- .../whois/WhoisCommandFactoryTest.java | 8 +- .../registry/whois/WhoisHttpActionTest.java | 124 ++++++----- .../beam/invoicing/billing_events_test.sql | 1 - .../google/registry/export/backup_kinds.txt | 2 +- .../export/datastore/entity_filter.json | 2 +- .../datastore/export_request_content.json | 2 +- .../registry/export/datastore/metadata.json | 2 +- .../registry/export/datastore/operation.json | 2 +- .../export/datastore/operation_list.json | 4 +- .../datastore/prettyprinted_operation.json | 2 +- .../registry/export/reporting_kinds.txt | 2 +- .../google/registry/model/schema.txt | 12 +- .../reporting/icann/attempted_adds_test.sql | 73 ------ .../icann/registrar_iana_id_test.sql | 30 --- .../reporting/icann/total_domains_test.sql | 37 --- .../icann/total_nameservers_test.sql | 55 ----- .../icann/transaction_counts_test.sql | 85 ------- .../transactions_report_aggregation_test.sql | 100 --------- docs/architecture.md | 2 +- docs/code-structure.md | 2 +- docs/developing.md | 2 +- .../scripts/testdata/datastore-indexes.xml | 16 +- 226 files changed, 1746 insertions(+), 2630 deletions(-) rename core/src/main/java/google/registry/model/bulkquery/{DomainBaseLite.java => DomainLite.java} (72%) rename core/src/main/java/google/registry/model/domain/{DomainBase.java => Domain.java} (90%) rename core/src/main/java/google/registry/rde/{DomainBaseToXjcConverter.java => DomainToXjcConverter.java} (96%) delete mode 100644 core/src/main/java/google/registry/reporting/icann/sql/attempted_adds.sql delete mode 100644 core/src/main/java/google/registry/reporting/icann/sql/registrar_iana_id.sql delete mode 100644 core/src/main/java/google/registry/reporting/icann/sql/total_domains.sql delete mode 100644 core/src/main/java/google/registry/reporting/icann/sql/total_nameservers.sql delete mode 100644 core/src/main/java/google/registry/reporting/icann/sql/transaction_counts.sql delete mode 100644 core/src/main/java/google/registry/reporting/icann/sql/transactions_report_aggregation.sql rename core/src/test/java/google/registry/model/bulkquery/{DomainBaseLiteTest.java => DomainLiteTest.java} (73%) rename core/src/test/java/google/registry/model/domain/{DomainBaseSqlTest.java => DomainSqlTest.java} (91%) rename core/src/test/java/google/registry/model/domain/{DomainBaseTest.java => DomainTest.java} (94%) rename core/src/test/java/google/registry/rde/{DomainBaseToXjcConverterTest.java => DomainToXjcConverterTest.java} (95%) rename core/src/test/java/google/registry/testing/{DomainBaseSubject.java => DomainSubject.java} (65%) delete mode 100644 core/src/test/resources/google/registry/reporting/icann/attempted_adds_test.sql delete mode 100644 core/src/test/resources/google/registry/reporting/icann/registrar_iana_id_test.sql delete mode 100644 core/src/test/resources/google/registry/reporting/icann/total_domains_test.sql delete mode 100644 core/src/test/resources/google/registry/reporting/icann/total_nameservers_test.sql delete mode 100644 core/src/test/resources/google/registry/reporting/icann/transaction_counts_test.sql delete mode 100644 core/src/test/resources/google/registry/reporting/icann/transactions_report_aggregation_test.sql diff --git a/core/src/main/java/google/registry/batch/DeleteExpiredDomainsAction.java b/core/src/main/java/google/registry/batch/DeleteExpiredDomainsAction.java index 806a4cf1f..b46885857 100644 --- a/core/src/main/java/google/registry/batch/DeleteExpiredDomainsAction.java +++ b/core/src/main/java/google/registry/batch/DeleteExpiredDomainsAction.java @@ -32,7 +32,7 @@ import google.registry.flows.EppController; import google.registry.flows.EppRequestSource; import google.registry.flows.PasswordOnlyTransportCredentials; import google.registry.flows.StatelessRequestSessionMetadata; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.eppcommon.ProtocolDefinition; import google.registry.model.eppoutput.EppOutput; import google.registry.persistence.transaction.QueryComposer.Comparator; @@ -128,10 +128,10 @@ public class DeleteExpiredDomainsAction implements Runnable { logger.atInfo().log( "Deleting non-renewing domains with autorenew end times up through %s.", runTime); - ImmutableList domainsToDelete = + ImmutableList domainsToDelete = tm().transact( () -> - tm().createQueryComposer(DomainBase.class) + tm().createQueryComposer(Domain.class) .where("autorenewEndTime", Comparator.LTE, runTime) .where("deletionTime", Comparator.EQ, END_OF_TIME) .list()); @@ -145,10 +145,9 @@ public class DeleteExpiredDomainsAction implements Runnable { "Found %d domains to delete: %s.", domainsToDelete.size(), String.join( - ", ", - domainsToDelete.stream().map(DomainBase::getDomainName).collect(toImmutableList()))); + ", ", domainsToDelete.stream().map(Domain::getDomainName).collect(toImmutableList()))); int successes = 0; - for (DomainBase domain : domainsToDelete) { + for (Domain domain : domainsToDelete) { if (runDomainDeleteFlow(domain)) { successes++; } @@ -163,7 +162,7 @@ public class DeleteExpiredDomainsAction implements Runnable { } /** Runs the actual domain delete flow and returns whether the deletion was successful. */ - private boolean runDomainDeleteFlow(DomainBase domain) { + private boolean runDomainDeleteFlow(Domain domain) { logger.atInfo().log("Attempting to delete domain '%s'.", domain.getDomainName()); // Create a new transaction that the flow's execution will be enlisted in that loads the domain // transactionally. This way we can ensure that nothing else has modified the domain in question @@ -171,7 +170,7 @@ public class DeleteExpiredDomainsAction implements Runnable { Optional eppOutput = tm().transact( () -> { - DomainBase transDomain = tm().loadByKey(domain.createVKey()); + Domain transDomain = tm().loadByKey(domain.createVKey()); if (!domain.getAutorenewEndTime().isPresent() || domain.getAutorenewEndTime().get().isAfter(tm().getTransactionTime())) { logger.atSevere().log( diff --git a/core/src/main/java/google/registry/batch/DeleteLoadTestDataAction.java b/core/src/main/java/google/registry/batch/DeleteLoadTestDataAction.java index 356f5826f..f31cb7e3d 100644 --- a/core/src/main/java/google/registry/batch/DeleteLoadTestDataAction.java +++ b/core/src/main/java/google/registry/batch/DeleteLoadTestDataAction.java @@ -30,7 +30,7 @@ import google.registry.flows.poll.PollFlowUtils; import google.registry.model.EppResource; import google.registry.model.EppResourceUtils; import google.registry.model.contact.ContactResource; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.host.HostResource; import google.registry.model.poll.PollMessage; import google.registry.model.reporting.HistoryEntry; @@ -129,7 +129,7 @@ public class DeleteLoadTestDataAction implements Runnable { } VKey hostVKey = host.createVKey(); // We can remove hosts from linked domains, so we should do so then delete the hosts - ImmutableSet> linkedDomains = + ImmutableSet> linkedDomains = EppResourceUtils.getLinkedDomainKeys(hostVKey, clock.nowUtc(), null); tm().loadByKeys(linkedDomains) .values() diff --git a/core/src/main/java/google/registry/batch/DeleteProberDataAction.java b/core/src/main/java/google/registry/batch/DeleteProberDataAction.java index afe8b3750..3e2a6b5ee 100644 --- a/core/src/main/java/google/registry/batch/DeleteProberDataAction.java +++ b/core/src/main/java/google/registry/batch/DeleteProberDataAction.java @@ -37,7 +37,7 @@ import google.registry.config.RegistryEnvironment; import google.registry.dns.DnsQueue; import google.registry.model.CreateAutoTimestamp; import google.registry.model.EppResourceUtils; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainHistory; import google.registry.model.tld.Registry.TldType; import google.registry.request.Action; @@ -53,8 +53,8 @@ import org.joda.time.DateTime; import org.joda.time.Duration; /** - * Deletes all prober DomainBases and their subordinate history entries, poll messages, and billing - * events, along with their ForeignKeyDomainIndex and EppResourceIndex entities. + * Deletes all prober {@link Domain}s and their subordinate history entries, poll messages, and + * billing events, along with their ForeignKeyDomainIndex and EppResourceIndex entities. */ @Action( service = Action.Service.BACKEND, @@ -154,7 +154,7 @@ public class DeleteProberDataAction implements Runnable { // keeping track of which domains to hard-delete (there can be many, so we batch them up) ScrollableResults scrollableResult = jpaTm() - .query(DOMAIN_QUERY_STRING, DomainBase.class) + .query(DOMAIN_QUERY_STRING, Domain.class) .setParameter("tlds", deletableTlds) .setParameter( "creationTimeCutoff", CreateAutoTimestamp.create(now.minus(DOMAIN_USED_DURATION))) @@ -166,7 +166,7 @@ public class DeleteProberDataAction implements Runnable { ImmutableList.Builder domainRepoIdsToHardDelete = new ImmutableList.Builder<>(); ImmutableList.Builder hostNamesToHardDelete = new ImmutableList.Builder<>(); for (int i = 1; scrollableResult.next(); i = (i + 1) % BATCH_SIZE) { - DomainBase domain = (DomainBase) scrollableResult.get(0); + Domain domain = (Domain) scrollableResult.get(0); processDomain( domain, domainRepoIdsToHardDelete, @@ -187,7 +187,7 @@ public class DeleteProberDataAction implements Runnable { } private void processDomain( - DomainBase domain, + Domain domain, ImmutableList.Builder domainRepoIdsToHardDelete, ImmutableList.Builder hostNamesToHardDelete, AtomicInteger softDeletedDomains, @@ -251,8 +251,8 @@ public class DeleteProberDataAction implements Runnable { } // Take a DNS queue + admin registrar id as input so that it can be called from the mapper as well - private void softDeleteDomain(DomainBase domain) { - DomainBase deletedDomain = + private void softDeleteDomain(Domain domain) { + Domain deletedDomain = domain.asBuilder().setDeletionTime(tm().getTransactionTime()).setStatusValues(null).build(); DomainHistory historyEntry = new DomainHistory.Builder() diff --git a/core/src/main/java/google/registry/batch/ExpandRecurringBillingEventsAction.java b/core/src/main/java/google/registry/batch/ExpandRecurringBillingEventsAction.java index 295692a2b..977da622f 100644 --- a/core/src/main/java/google/registry/batch/ExpandRecurringBillingEventsAction.java +++ b/core/src/main/java/google/registry/batch/ExpandRecurringBillingEventsAction.java @@ -43,7 +43,7 @@ import google.registry.model.billing.BillingEvent.Flag; import google.registry.model.billing.BillingEvent.OneTime; import google.registry.model.billing.BillingEvent.Recurring; import google.registry.model.common.Cursor; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainHistory; import google.registry.model.domain.Period; import google.registry.model.reporting.DomainTransactionRecord; @@ -253,7 +253,7 @@ public class ExpandRecurringBillingEventsAction implements Runnable { final ImmutableSet billingTimes = getBillingTimesInScope(eventTimes, cursorTime, executeTime, tld); - VKey domainKey = VKey.createSql(DomainBase.class, recurring.getDomainRepoId()); + VKey domainKey = VKey.createSql(Domain.class, recurring.getDomainRepoId()); Iterable oneTimesForDomain; oneTimesForDomain = tm().createQueryComposer(OneTime.class) diff --git a/core/src/main/java/google/registry/batch/RelockDomainAction.java b/core/src/main/java/google/registry/batch/RelockDomainAction.java index e0f50b856..412430d46 100644 --- a/core/src/main/java/google/registry/batch/RelockDomainAction.java +++ b/core/src/main/java/google/registry/batch/RelockDomainAction.java @@ -27,7 +27,7 @@ import com.google.common.collect.ImmutableSet; import com.google.common.flogger.FluentLogger; import com.google.common.net.MediaType; import google.registry.config.RegistryConfig.Config; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.RegistryLock; import google.registry.model.eppcommon.StatusValue; import google.registry.model.registrar.Registrar; @@ -125,7 +125,7 @@ public class RelockDomainAction implements Runnable { private void relockDomain() { RegistryLock oldLock = null; - DomainBase domain; + Domain domain; try { oldLock = RegistryLockDao.getByRevisionId(oldUnlockRevisionId) @@ -134,7 +134,7 @@ public class RelockDomainAction implements Runnable { new IllegalArgumentException( String.format("Unknown revision ID %d", oldUnlockRevisionId))); domain = - tm().loadByKey(VKey.create(DomainBase.class, oldLock.getRepoId())) + tm().loadByKey(VKey.create(Domain.class, oldLock.getRepoId())) .cloneProjectedAtTime(tm().getTransactionTime()); } catch (Throwable t) { handleTransientFailure(Optional.ofNullable(oldLock), t); @@ -180,7 +180,7 @@ public class RelockDomainAction implements Runnable { } } - private void verifyDomainAndLockState(RegistryLock oldLock, DomainBase domain) { + private void verifyDomainAndLockState(RegistryLock oldLock, Domain domain) { // Domain shouldn't be deleted or have a pending transfer/delete String domainName = domain.getDomainName(); ImmutableSet statusValues = domain.getStatusValues(); diff --git a/core/src/main/java/google/registry/beam/common/RegistryPipelineComponent.java b/core/src/main/java/google/registry/beam/common/RegistryPipelineComponent.java index cec1beef5..f89d11eaa 100644 --- a/core/src/main/java/google/registry/beam/common/RegistryPipelineComponent.java +++ b/core/src/main/java/google/registry/beam/common/RegistryPipelineComponent.java @@ -20,6 +20,7 @@ import dagger.Lazy; import google.registry.config.CredentialModule; import google.registry.config.RegistryConfig.Config; import google.registry.config.RegistryConfig.ConfigModule; +import google.registry.model.domain.Domain; import google.registry.persistence.PersistenceModule; import google.registry.persistence.PersistenceModule.BeamBulkQueryJpaTm; import google.registry.persistence.PersistenceModule.BeamJpaTm; @@ -53,8 +54,7 @@ public interface RegistryPipelineComponent { /** * Returns a {@link JpaTransactionManager} optimized for bulk loading multi-level JPA entities - * ({@link google.registry.model.domain.DomainBase} and {@link - * google.registry.model.domain.DomainHistory}). Please refer to {@link + * ({@link Domain} and {@link google.registry.model.domain.DomainHistory}). Please refer to {@link * google.registry.model.bulkquery.BulkQueryEntities} for more information. */ @BeamBulkQueryJpaTm diff --git a/core/src/main/java/google/registry/beam/rde/RdePipeline.java b/core/src/main/java/google/registry/beam/rde/RdePipeline.java index 5185228aa..7c853ea1c 100644 --- a/core/src/main/java/google/registry/beam/rde/RdePipeline.java +++ b/core/src/main/java/google/registry/beam/rde/RdePipeline.java @@ -47,7 +47,7 @@ import google.registry.gcs.GcsUtils; import google.registry.model.EppResource; import google.registry.model.contact.ContactHistory; import google.registry.model.contact.ContactResource; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainHistory; import google.registry.model.host.HostHistory; import google.registry.model.host.HostResource; @@ -132,7 +132,7 @@ import org.joda.time.DateTime; * that are soft-deleted by watermark. The history is emitted as pairs of (resource repo ID: history * revision ID) from the SQL query. * - *

{@link DomainBase}

+ *

{@link Domain}

* * After the most recent (live) domain resources are loaded from the corresponding history objects, * we marshall them to deposit fragments and emit the (pending deposit: deposit fragment) pairs for @@ -477,8 +477,8 @@ public class RdePipeline implements Serializable { public void processElement( @Element KV kv, MultiOutputReceiver receiver) { activeDomainCounter.inc(); - DomainBase domain = - (DomainBase) + Domain domain = + (Domain) loadResourceByHistoryEntryId( DomainHistory.class, kv.getKey(), kv.getValue()); pendingDeposits.stream() @@ -654,8 +654,8 @@ public class RdePipeline implements Serializable { TypeDescriptor.of(DepositFragment.class))) .via( (KV kv) -> { - DomainBase superordinateDomain = - (DomainBase) + Domain superordinateDomain = + (Domain) loadResourceByHistoryEntryId( DomainHistory.class, kv.getKey(), diff --git a/core/src/main/java/google/registry/beam/resave/ResaveAllEppResourcesPipeline.java b/core/src/main/java/google/registry/beam/resave/ResaveAllEppResourcesPipeline.java index a2ad13fcf..1979108f3 100644 --- a/core/src/main/java/google/registry/beam/resave/ResaveAllEppResourcesPipeline.java +++ b/core/src/main/java/google/registry/beam/resave/ResaveAllEppResourcesPipeline.java @@ -23,7 +23,7 @@ import google.registry.beam.common.RegistryJpaIO; import google.registry.beam.common.RegistryJpaIO.Read; import google.registry.model.EppResource; import google.registry.model.contact.ContactResource; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.host.HostResource; import google.registry.persistence.PersistenceModule.TransactionIsolationLevel; import google.registry.persistence.transaction.CriteriaQueryBuilder; @@ -51,7 +51,7 @@ import org.joda.time.DateTime; public class ResaveAllEppResourcesPipeline implements Serializable { private static final ImmutableSet> EPP_RESOURCE_CLASSES = - ImmutableSet.of(ContactResource.class, DomainBase.class, HostResource.class); + ImmutableSet.of(ContactResource.class, Domain.class, HostResource.class); /** * There exist three possible situations where we know we'll want to project domains to the @@ -114,13 +114,13 @@ public class ResaveAllEppResourcesPipeline implements Serializable { * google.registry.model.domain.DomainContent#cloneProjectedAtTime(DateTime)}. */ private void fastResaveDomains(Pipeline pipeline) { - Read read = + Read read = RegistryJpaIO.read( DOMAINS_TO_PROJECT_QUERY, ImmutableMap.of("END_OF_TIME", DateTimeUtils.END_OF_TIME), - DomainBase.class, + Domain.class, d -> d); - projectAndResaveResources(pipeline, DomainBase.class, read); + projectAndResaveResources(pipeline, Domain.class, read); } /** Projects all resources to the current time and saves them. */ diff --git a/core/src/main/java/google/registry/beam/spec11/Spec11Pipeline.java b/core/src/main/java/google/registry/beam/spec11/Spec11Pipeline.java index 437de19ed..68f525898 100644 --- a/core/src/main/java/google/registry/beam/spec11/Spec11Pipeline.java +++ b/core/src/main/java/google/registry/beam/spec11/Spec11Pipeline.java @@ -26,7 +26,7 @@ import google.registry.beam.common.RegistryJpaIO; import google.registry.beam.common.RegistryJpaIO.Read; import google.registry.beam.spec11.SafeBrowsingTransforms.EvaluateSafeBrowsingFn; import google.registry.config.RegistryConfig.ConfigModule; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.reporting.Spec11ThreatMatch; import google.registry.model.reporting.Spec11ThreatMatch.ThreatType; import google.registry.persistence.PersistenceModule.TransactionIsolationLevel; @@ -127,22 +127,21 @@ public class Spec11Pipeline implements Serializable { @ProcessElement public void processElement( @Element KV input, OutputReceiver output) { - DomainBase domainBase = + Domain domain = jpaTm() .transact( () -> jpaTm() - .loadByKey( - VKey.createSql(DomainBase.class, input.getKey()))); + .loadByKey(VKey.createSql(Domain.class, input.getKey()))); String emailAddress = input.getValue(); if (emailAddress == null) { emailAddress = ""; } DomainNameInfo domainNameInfo = DomainNameInfo.create( - domainBase.getDomainName(), - domainBase.getRepoId(), - domainBase.getCurrentSponsorRegistrarId(), + domain.getDomainName(), + domain.getRepoId(), + domain.getCurrentSponsorRegistrarId(), emailAddress); output.output(domainNameInfo); } diff --git a/core/src/main/java/google/registry/dns/RefreshDnsAction.java b/core/src/main/java/google/registry/dns/RefreshDnsAction.java index a423ed44f..e131f7c55 100644 --- a/core/src/main/java/google/registry/dns/RefreshDnsAction.java +++ b/core/src/main/java/google/registry/dns/RefreshDnsAction.java @@ -20,7 +20,7 @@ import google.registry.dns.DnsConstants.TargetType; import google.registry.model.EppResource; import google.registry.model.EppResource.ForeignKeyedEppResource; import google.registry.model.annotations.ExternalMessagingName; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.host.HostResource; import google.registry.request.Action; import google.registry.request.HttpException.BadRequestException; @@ -62,7 +62,7 @@ public final class RefreshDnsAction implements Runnable { } switch (type) { case DOMAIN: - loadAndVerifyExistence(DomainBase.class, domainOrHostName); + loadAndVerifyExistence(Domain.class, domainOrHostName); dnsQueue.addDomainRefreshTask(domainOrHostName); break; case HOST: diff --git a/core/src/main/java/google/registry/dns/writer/clouddns/CloudDnsWriter.java b/core/src/main/java/google/registry/dns/writer/clouddns/CloudDnsWriter.java index 8130a67e1..54a7f2ff2 100644 --- a/core/src/main/java/google/registry/dns/writer/clouddns/CloudDnsWriter.java +++ b/core/src/main/java/google/registry/dns/writer/clouddns/CloudDnsWriter.java @@ -36,7 +36,7 @@ import google.registry.config.RegistryConfig.Config; import google.registry.dns.writer.BaseDnsWriter; import google.registry.dns.writer.DnsWriter; import google.registry.dns.writer.DnsWriterZone; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.secdns.DelegationSignerData; import google.registry.model.host.HostResource; import google.registry.model.tld.Registries; @@ -121,13 +121,12 @@ public class CloudDnsWriter extends BaseDnsWriter { String absoluteDomainName = getAbsoluteHostName(domainName); // Load the target domain. Note that it can be absent if this domain was just deleted. - Optional domainBase = - loadByForeignKey(DomainBase.class, domainName, clock.nowUtc()); + Optional domain = loadByForeignKey(Domain.class, domainName, clock.nowUtc()); // Return early if no DNS records should be published. // desiredRecordsBuilder is populated with an empty set to indicate that all existing records // should be deleted. - if (!domainBase.isPresent() || !domainBase.get().shouldPublishToDns()) { + if (!domain.isPresent() || !domain.get().shouldPublishToDns()) { desiredRecords.put(absoluteDomainName, ImmutableSet.of()); return; } @@ -135,7 +134,7 @@ public class CloudDnsWriter extends BaseDnsWriter { ImmutableSet.Builder domainRecords = new ImmutableSet.Builder<>(); // Construct DS records (if any). - Set dsData = domainBase.get().getDsData(); + Set dsData = domain.get().getDsData(); if (!dsData.isEmpty()) { HashSet dsRrData = new HashSet<>(); for (DelegationSignerData ds : dsData) { @@ -154,8 +153,8 @@ public class CloudDnsWriter extends BaseDnsWriter { } // Construct NS records (if any). - Set nameserverData = domainBase.get().loadNameserverHostNames(); - Set subordinateHosts = domainBase.get().getSubordinateHosts(); + Set nameserverData = domain.get().loadNameserverHostNames(); + Set subordinateHosts = domain.get().getSubordinateHosts(); if (!nameserverData.isEmpty()) { HashSet nsRrData = new HashSet<>(); for (String hostName : nameserverData) { diff --git a/core/src/main/java/google/registry/dns/writer/dnsupdate/DnsUpdateWriter.java b/core/src/main/java/google/registry/dns/writer/dnsupdate/DnsUpdateWriter.java index a934cc4f0..cb28ce2e5 100644 --- a/core/src/main/java/google/registry/dns/writer/dnsupdate/DnsUpdateWriter.java +++ b/core/src/main/java/google/registry/dns/writer/dnsupdate/DnsUpdateWriter.java @@ -27,7 +27,7 @@ import com.google.common.net.InternetDomainName; import google.registry.config.RegistryConfig.Config; import google.registry.dns.writer.BaseDnsWriter; import google.registry.dns.writer.DnsWriterZone; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.secdns.DelegationSignerData; import google.registry.model.host.HostResource; import google.registry.model.tld.Registries; @@ -127,12 +127,11 @@ public class DnsUpdateWriter extends BaseDnsWriter { * this domain refresh request */ private void publishDomain(String domainName, String requestingHostName) { - Optional domainOptional = - loadByForeignKey(DomainBase.class, domainName, clock.nowUtc()); + Optional domainOptional = loadByForeignKey(Domain.class, domainName, clock.nowUtc()); update.delete(toAbsoluteName(domainName), Type.ANY); // If the domain is now deleted, then don't update DNS for it. if (domainOptional.isPresent()) { - DomainBase domain = domainOptional.get(); + Domain domain = domainOptional.get(); // As long as the domain exists, orphan glues should be cleaned. deleteSubordinateHostAddressSet(domain, requestingHostName, update); if (domain.shouldPublishToDns()) { @@ -184,7 +183,7 @@ public class DnsUpdateWriter extends BaseDnsWriter { } } - private RRset makeDelegationSignerSet(DomainBase domain) { + private RRset makeDelegationSignerSet(Domain domain) { RRset signerSet = new RRset(); for (DelegationSignerData signerData : domain.getDsData()) { DSRecord dsRecord = @@ -202,7 +201,7 @@ public class DnsUpdateWriter extends BaseDnsWriter { } private void deleteSubordinateHostAddressSet( - DomainBase domain, String additionalHost, Update update) { + Domain domain, String additionalHost, Update update) { for (String hostName : union( domain.getSubordinateHosts(), @@ -213,7 +212,7 @@ public class DnsUpdateWriter extends BaseDnsWriter { } } - private void addInBailiwickNameServerSet(DomainBase domain, Update update) { + private void addInBailiwickNameServerSet(Domain domain, Update update) { for (String hostName : intersection(domain.loadNameserverHostNames(), domain.getSubordinateHosts())) { Optional host = loadByForeignKey(HostResource.class, hostName, clock.nowUtc()); @@ -223,7 +222,7 @@ public class DnsUpdateWriter extends BaseDnsWriter { } } - private RRset makeNameServerSet(DomainBase domain) { + private RRset makeNameServerSet(Domain domain) { RRset nameServerSet = new RRset(); for (String hostName : domain.loadNameserverHostNames()) { NSRecord record = diff --git a/core/src/main/java/google/registry/env/common/default/WEB-INF/datastore-indexes.xml b/core/src/main/java/google/registry/env/common/default/WEB-INF/datastore-indexes.xml index d49daed3e..bad80fa24 100644 --- a/core/src/main/java/google/registry/env/common/default/WEB-INF/datastore-indexes.xml +++ b/core/src/main/java/google/registry/env/common/default/WEB-INF/datastore-indexes.xml @@ -6,22 +6,22 @@ - + - + - + - + @@ -32,22 +32,22 @@ - + - + - + - + @@ -74,16 +74,16 @@ - + - + - + diff --git a/core/src/main/java/google/registry/flows/CheckApiAction.java b/core/src/main/java/google/registry/flows/CheckApiAction.java index 6d255a604..c5e69f930 100644 --- a/core/src/main/java/google/registry/flows/CheckApiAction.java +++ b/core/src/main/java/google/registry/flows/CheckApiAction.java @@ -44,7 +44,7 @@ import dagger.Module; import dagger.Provides; import google.registry.flows.domain.DomainFlowUtils.BadCommandForRegistryPhaseException; import google.registry.flows.domain.DomainFlowUtils.InvalidIdnDomainLabelException; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.index.ForeignKeyIndex; import google.registry.model.tld.Registry; import google.registry.model.tld.label.ReservationType; @@ -156,8 +156,7 @@ public class CheckApiAction implements Runnable { } private boolean checkExists(String domainString, DateTime now) { - return !ForeignKeyIndex.loadCached(DomainBase.class, ImmutableList.of(domainString), now) - .isEmpty(); + return !ForeignKeyIndex.loadCached(Domain.class, ImmutableList.of(domainString), now).isEmpty(); } private Optional checkReserved(InternetDomainName domainName) { diff --git a/core/src/main/java/google/registry/flows/ResourceFlowUtils.java b/core/src/main/java/google/registry/flows/ResourceFlowUtils.java index 89e8f1d37..ba91d135d 100644 --- a/core/src/main/java/google/registry/flows/ResourceFlowUtils.java +++ b/core/src/main/java/google/registry/flows/ResourceFlowUtils.java @@ -39,7 +39,7 @@ import google.registry.model.EppResource; import google.registry.model.EppResource.ForeignKeyedEppResource; import google.registry.model.EppResource.ResourceWithTransferData; import google.registry.model.contact.ContactResource; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainContent; import google.registry.model.domain.Period; import google.registry.model.domain.rgp.GracePeriodStatus; @@ -147,7 +147,7 @@ public final class ResourceFlowUtils { } /** Check that the given AuthInfo is either missing or else is valid for the given resource. */ - public static void verifyOptionalAuthInfo(Optional authInfo, DomainBase domain) + public static void verifyOptionalAuthInfo(Optional authInfo, Domain domain) throws EppException { if (authInfo.isPresent()) { verifyAuthInfo(authInfo.get(), domain); @@ -155,7 +155,7 @@ public final class ResourceFlowUtils { } /** Check that the given {@link AuthInfo} is valid for the given domain. */ - public static void verifyAuthInfo(AuthInfo authInfo, DomainBase domain) throws EppException { + public static void verifyAuthInfo(AuthInfo authInfo, Domain domain) throws EppException { final String authRepoId = authInfo.getPw().getRepoId(); String authPassword = authInfo.getPw().getValue(); if (authRepoId == null) { @@ -246,7 +246,7 @@ public final class ResourceFlowUtils { if (period.getValue() == 0) { inAutoRenew = false; } - return DomainBase.extendRegistrationWithCap( + return Domain.extendRegistrationWithCap( approvalTime, domain.getRegistrationExpirationTime(), period.getValue() - (inAutoRenew ? 1 : 0)); diff --git a/core/src/main/java/google/registry/flows/custom/DomainCreateFlowCustomLogic.java b/core/src/main/java/google/registry/flows/custom/DomainCreateFlowCustomLogic.java index b433b3cdc..685210d3d 100644 --- a/core/src/main/java/google/registry/flows/custom/DomainCreateFlowCustomLogic.java +++ b/core/src/main/java/google/registry/flows/custom/DomainCreateFlowCustomLogic.java @@ -22,7 +22,7 @@ import google.registry.flows.FlowMetadata; import google.registry.flows.SessionMetadata; import google.registry.flows.domain.DomainCreateFlow; import google.registry.model.ImmutableObject; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.eppinput.EppInput; import google.registry.model.eppoutput.EppResponse.ResponseData; import google.registry.model.eppoutput.EppResponse.ResponseExtension; @@ -125,10 +125,9 @@ public class DomainCreateFlowCustomLogic extends BaseFlowCustomLogic { public abstract static class BeforeSaveParameters extends ImmutableObject { /** - * The new {@link DomainBase} entity that is going to be persisted at the end of the - * transaction. + * The new {@link Domain} entity that is going to be persisted at the end of the transaction. */ - public abstract DomainBase newDomain(); + public abstract Domain newDomain(); /** * The new {@link HistoryEntry} entity for the domain's creation that is going to be persisted @@ -162,7 +161,7 @@ public class DomainCreateFlowCustomLogic extends BaseFlowCustomLogic { @AutoValue.Builder public abstract static class Builder { - public abstract Builder setNewDomain(DomainBase newDomain); + public abstract Builder setNewDomain(Domain newDomain); public abstract Builder setHistoryEntry(HistoryEntry historyEntry); diff --git a/core/src/main/java/google/registry/flows/custom/DomainDeleteFlowCustomLogic.java b/core/src/main/java/google/registry/flows/custom/DomainDeleteFlowCustomLogic.java index 13c35a625..a1f3ced20 100644 --- a/core/src/main/java/google/registry/flows/custom/DomainDeleteFlowCustomLogic.java +++ b/core/src/main/java/google/registry/flows/custom/DomainDeleteFlowCustomLogic.java @@ -21,7 +21,7 @@ import google.registry.flows.FlowMetadata; import google.registry.flows.SessionMetadata; import google.registry.flows.domain.DomainDeleteFlow; import google.registry.model.ImmutableObject; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.eppinput.EppInput; import google.registry.model.eppoutput.EppResponse.ResponseExtension; import google.registry.model.eppoutput.Result; @@ -83,7 +83,7 @@ public class DomainDeleteFlowCustomLogic extends BaseFlowCustomLogic { @AutoValue public abstract static class AfterValidationParameters extends ImmutableObject { - public abstract DomainBase existingDomain(); + public abstract Domain existingDomain(); public static Builder newBuilder() { return new AutoValue_DomainDeleteFlowCustomLogic_AfterValidationParameters.Builder(); @@ -93,7 +93,7 @@ public class DomainDeleteFlowCustomLogic extends BaseFlowCustomLogic { @AutoValue.Builder public abstract static class Builder { - public abstract Builder setExistingDomain(DomainBase existingDomain); + public abstract Builder setExistingDomain(Domain existingDomain); public abstract AfterValidationParameters build(); } @@ -109,9 +109,9 @@ public class DomainDeleteFlowCustomLogic extends BaseFlowCustomLogic { @AutoValue public abstract static class BeforeSaveParameters extends ImmutableObject { - public abstract DomainBase existingDomain(); + public abstract Domain existingDomain(); - public abstract DomainBase newDomain(); + public abstract Domain newDomain(); public abstract HistoryEntry historyEntry(); @@ -125,9 +125,9 @@ public class DomainDeleteFlowCustomLogic extends BaseFlowCustomLogic { @AutoValue.Builder public abstract static class Builder { - public abstract Builder setExistingDomain(DomainBase existingDomain); + public abstract Builder setExistingDomain(Domain existingDomain); - public abstract Builder setNewDomain(DomainBase newDomain); + public abstract Builder setNewDomain(Domain newDomain); public abstract Builder setHistoryEntry(HistoryEntry historyEntry); diff --git a/core/src/main/java/google/registry/flows/custom/DomainInfoFlowCustomLogic.java b/core/src/main/java/google/registry/flows/custom/DomainInfoFlowCustomLogic.java index 3b19fd2ea..d8af13495 100644 --- a/core/src/main/java/google/registry/flows/custom/DomainInfoFlowCustomLogic.java +++ b/core/src/main/java/google/registry/flows/custom/DomainInfoFlowCustomLogic.java @@ -21,7 +21,7 @@ import google.registry.flows.FlowMetadata; import google.registry.flows.SessionMetadata; import google.registry.flows.domain.DomainInfoFlow; import google.registry.model.ImmutableObject; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainInfoData; import google.registry.model.eppinput.EppInput; import google.registry.model.eppoutput.EppResponse.ResponseExtension; @@ -53,8 +53,8 @@ public class DomainInfoFlowCustomLogic extends BaseFlowCustomLogic { /** * A hook that runs before the response is returned. * - *

This takes the {@link DomainBase} and {@link ResponseExtension}s as input and returns - * them, potentially with modifications. + *

This takes the {@link Domain} and {@link ResponseExtension}s as input and returns them, + * potentially with modifications. */ @SuppressWarnings("unused") public BeforeResponseReturnData beforeResponse(BeforeResponseParameters parameters) @@ -69,7 +69,7 @@ public class DomainInfoFlowCustomLogic extends BaseFlowCustomLogic { @AutoValue public abstract static class AfterValidationParameters extends ImmutableObject { - public abstract DomainBase domain(); + public abstract Domain domain(); public static Builder newBuilder() { return new AutoValue_DomainInfoFlowCustomLogic_AfterValidationParameters.Builder(); @@ -79,7 +79,7 @@ public class DomainInfoFlowCustomLogic extends BaseFlowCustomLogic { @AutoValue.Builder public abstract static class Builder { - public abstract Builder setDomain(DomainBase domain); + public abstract Builder setDomain(Domain domain); public abstract AfterValidationParameters build(); } @@ -89,7 +89,7 @@ public class DomainInfoFlowCustomLogic extends BaseFlowCustomLogic { @AutoValue public abstract static class BeforeResponseParameters extends ImmutableObject { - public abstract DomainBase domain(); + public abstract Domain domain(); public abstract DomainInfoData resData(); @@ -103,7 +103,7 @@ public class DomainInfoFlowCustomLogic extends BaseFlowCustomLogic { @AutoValue.Builder public abstract static class Builder { - public abstract Builder setDomain(DomainBase domain); + public abstract Builder setDomain(Domain domain); public abstract Builder setResData(DomainInfoData resData); diff --git a/core/src/main/java/google/registry/flows/custom/DomainRenewFlowCustomLogic.java b/core/src/main/java/google/registry/flows/custom/DomainRenewFlowCustomLogic.java index 9403043ae..97e0fecd0 100644 --- a/core/src/main/java/google/registry/flows/custom/DomainRenewFlowCustomLogic.java +++ b/core/src/main/java/google/registry/flows/custom/DomainRenewFlowCustomLogic.java @@ -21,7 +21,7 @@ import google.registry.flows.FlowMetadata; import google.registry.flows.SessionMetadata; import google.registry.flows.domain.DomainRenewFlow; import google.registry.model.ImmutableObject; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.eppinput.EppInput; import google.registry.model.eppoutput.EppResponse.ResponseData; import google.registry.model.eppoutput.EppResponse.ResponseExtension; @@ -68,8 +68,8 @@ public class DomainRenewFlowCustomLogic extends BaseFlowCustomLogic { /** * A hook that runs before the response is returned. * - *

This takes the {@link DomainBase} and {@link ResponseExtension}s as input and returns - * them, potentially with modifications. + *

This takes the {@link Domain} and {@link ResponseExtension}s as input and returns them, + * potentially with modifications. */ @SuppressWarnings("unused") public BeforeResponseReturnData beforeResponse(BeforeResponseParameters parameters) @@ -84,7 +84,7 @@ public class DomainRenewFlowCustomLogic extends BaseFlowCustomLogic { @AutoValue public abstract static class AfterValidationParameters extends ImmutableObject { - public abstract DomainBase existingDomain(); + public abstract Domain existingDomain(); public abstract int years(); @@ -98,7 +98,7 @@ public class DomainRenewFlowCustomLogic extends BaseFlowCustomLogic { @AutoValue.Builder public abstract static class Builder { - public abstract Builder setExistingDomain(DomainBase existingDomain); + public abstract Builder setExistingDomain(Domain existingDomain); public abstract Builder setYears(int years); @@ -118,9 +118,9 @@ public class DomainRenewFlowCustomLogic extends BaseFlowCustomLogic { @AutoValue public abstract static class BeforeSaveParameters extends ImmutableObject { - public abstract DomainBase existingDomain(); + public abstract Domain existingDomain(); - public abstract DomainBase newDomain(); + public abstract Domain newDomain(); public abstract HistoryEntry historyEntry(); @@ -138,9 +138,9 @@ public class DomainRenewFlowCustomLogic extends BaseFlowCustomLogic { @AutoValue.Builder public abstract static class Builder { - public abstract Builder setExistingDomain(DomainBase existingDomain); + public abstract Builder setExistingDomain(Domain existingDomain); - public abstract Builder setNewDomain(DomainBase newDomain); + public abstract Builder setNewDomain(Domain newDomain); public abstract Builder setHistoryEntry(HistoryEntry historyEntry); @@ -158,7 +158,7 @@ public class DomainRenewFlowCustomLogic extends BaseFlowCustomLogic { @AutoValue public abstract static class BeforeResponseParameters extends ImmutableObject { - public abstract DomainBase domain(); + public abstract Domain domain(); public abstract ResponseData resData(); @@ -172,7 +172,7 @@ public class DomainRenewFlowCustomLogic extends BaseFlowCustomLogic { @AutoValue.Builder public abstract static class Builder { - public abstract BeforeResponseParameters.Builder setDomain(DomainBase domain); + public abstract BeforeResponseParameters.Builder setDomain(Domain domain); public abstract BeforeResponseParameters.Builder setResData(ResponseData resData); diff --git a/core/src/main/java/google/registry/flows/custom/DomainUpdateFlowCustomLogic.java b/core/src/main/java/google/registry/flows/custom/DomainUpdateFlowCustomLogic.java index 8355ed63f..4bc8eef58 100644 --- a/core/src/main/java/google/registry/flows/custom/DomainUpdateFlowCustomLogic.java +++ b/core/src/main/java/google/registry/flows/custom/DomainUpdateFlowCustomLogic.java @@ -20,7 +20,7 @@ import google.registry.flows.FlowMetadata; import google.registry.flows.SessionMetadata; import google.registry.flows.domain.DomainUpdateFlow; import google.registry.model.ImmutableObject; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.eppinput.EppInput; import google.registry.model.reporting.HistoryEntry; @@ -65,7 +65,7 @@ public class DomainUpdateFlowCustomLogic extends BaseFlowCustomLogic { @AutoValue public abstract static class AfterValidationParameters extends ImmutableObject { - public abstract DomainBase existingDomain(); + public abstract Domain existingDomain(); public static Builder newBuilder() { return new AutoValue_DomainUpdateFlowCustomLogic_AfterValidationParameters.Builder(); @@ -75,7 +75,7 @@ public class DomainUpdateFlowCustomLogic extends BaseFlowCustomLogic { @AutoValue.Builder public abstract static class Builder { - public abstract Builder setExistingDomain(DomainBase existingDomain); + public abstract Builder setExistingDomain(Domain existingDomain); public abstract AfterValidationParameters build(); } @@ -91,9 +91,9 @@ public class DomainUpdateFlowCustomLogic extends BaseFlowCustomLogic { @AutoValue public abstract static class BeforeSaveParameters extends ImmutableObject { - public abstract DomainBase existingDomain(); + public abstract Domain existingDomain(); - public abstract DomainBase newDomain(); + public abstract Domain newDomain(); public abstract HistoryEntry historyEntry(); @@ -107,9 +107,9 @@ public class DomainUpdateFlowCustomLogic extends BaseFlowCustomLogic { @AutoValue.Builder public abstract static class Builder { - public abstract Builder setExistingDomain(DomainBase existingDomain); + public abstract Builder setExistingDomain(Domain existingDomain); - public abstract Builder setNewDomain(DomainBase newDomain); + public abstract Builder setNewDomain(Domain newDomain); public abstract Builder setHistoryEntry(HistoryEntry historyEntry); diff --git a/core/src/main/java/google/registry/flows/domain/DomainCheckFlow.java b/core/src/main/java/google/registry/flows/domain/DomainCheckFlow.java index 318c81754..c83b66671 100644 --- a/core/src/main/java/google/registry/flows/domain/DomainCheckFlow.java +++ b/core/src/main/java/google/registry/flows/domain/DomainCheckFlow.java @@ -54,7 +54,7 @@ import google.registry.flows.domain.token.AllocationTokenDomainCheckResults; import google.registry.flows.domain.token.AllocationTokenFlowUtils; import google.registry.model.EppResource; import google.registry.model.billing.BillingEvent; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainCommand.Check; import google.registry.model.domain.fee.FeeCheckCommandExtension; import google.registry.model.domain.fee.FeeCheckCommandExtensionItem; @@ -169,8 +169,8 @@ public final class DomainCheckFlow implements Flow { // TODO: Use as of date from fee extension v0.12 instead of now, if specified. .setAsOfDate(now) .build()); - ImmutableMap> existingDomains = - ForeignKeyIndex.load(DomainBase.class, domainNames, now); + ImmutableMap> existingDomains = + ForeignKeyIndex.load(Domain.class, domainNames, now); Optional allocationTokenExtension = eppInput.getSingleExtension(AllocationTokenExtension.class); Optional tokenDomainCheckResults = @@ -227,7 +227,7 @@ public final class DomainCheckFlow implements Flow { private Optional getMessageForCheck( InternetDomainName domainName, - ImmutableMap> existingDomains, + ImmutableMap> existingDomains, ImmutableMap tokenCheckResults, ImmutableMap tldStates, Optional allocationToken) { @@ -251,7 +251,7 @@ public final class DomainCheckFlow implements Flow { /** Handle the fee check extension. */ private ImmutableList getResponseExtensions( ImmutableMap domainNames, - ImmutableMap> existingDomains, + ImmutableMap> existingDomains, ImmutableSet availableDomains, DateTime now, Optional allocationToken) @@ -264,7 +264,7 @@ public final class DomainCheckFlow implements Flow { FeeCheckCommandExtension feeCheck = feeCheckOpt.get(); ImmutableList.Builder responseItems = new ImmutableList.Builder<>(); - ImmutableMap domainObjs = + ImmutableMap domainObjs = loadDomainsForRestoreChecks(feeCheck, domainNames, existingDomains); ImmutableMap recurrences = loadRecurrencesForDomains(domainObjs); @@ -272,12 +272,12 @@ public final class DomainCheckFlow implements Flow { for (FeeCheckCommandExtensionItem feeCheckItem : feeCheck.getItems()) { for (String domainName : getDomainNamesToCheckForFee(feeCheckItem, domainNames.keySet())) { FeeCheckResponseExtensionItem.Builder builder = feeCheckItem.createResponseBuilder(); - Optional domainBase = Optional.ofNullable(domainObjs.get(domainName)); + Optional domain = Optional.ofNullable(domainObjs.get(domainName)); handleFeeRequest( feeCheckItem, builder, domainNames.get(domainName), - domainBase, + domain, feeCheck.getCurrency(), now, pricingLogic, @@ -301,10 +301,10 @@ public final class DomainCheckFlow implements Flow { * nicer in Cloud SQL when we can SELECT just the fields we want rather than having to load the * entire entity. */ - private ImmutableMap loadDomainsForRestoreChecks( + private ImmutableMap loadDomainsForRestoreChecks( FeeCheckCommandExtension feeCheck, ImmutableMap domainNames, - ImmutableMap> existingDomains) { + ImmutableMap> existingDomains) { ImmutableList restoreCheckDomains; if (feeCheck instanceof FeeCheckCommandExtensionV06) { // The V06 fee extension supports specifying the command fees to check on a per-domain basis. @@ -326,25 +326,25 @@ public final class DomainCheckFlow implements Flow { } // Filter down to just domains we know exist and then use the EppResource cache to load them. - ImmutableMap> existingDomainsToLoad = + ImmutableMap> existingDomainsToLoad = restoreCheckDomains.stream() .filter(existingDomains::containsKey) .collect(toImmutableMap(d -> d, d -> existingDomains.get(d).getResourceKey())); ImmutableMap, EppResource> loadedDomains = EppResource.loadCached(ImmutableList.copyOf(existingDomainsToLoad.values())); return ImmutableMap.copyOf( - Maps.transformEntries(existingDomainsToLoad, (k, v) -> (DomainBase) loadedDomains.get(v))); + Maps.transformEntries(existingDomainsToLoad, (k, v) -> (Domain) loadedDomains.get(v))); } private ImmutableMap loadRecurrencesForDomains( - ImmutableMap domainObjs) { + ImmutableMap domainObjs) { return tm().transact( () -> { ImmutableMap, BillingEvent.Recurring> recurrences = tm().loadByKeys( domainObjs.values().stream() - .map(DomainBase::getAutorenewBillingEvent) + .map(Domain::getAutorenewBillingEvent) .collect(toImmutableSet())); return ImmutableMap.copyOf( Maps.transformValues( diff --git a/core/src/main/java/google/registry/flows/domain/DomainCreateFlow.java b/core/src/main/java/google/registry/flows/domain/DomainCreateFlow.java index 76abf1a54..09b7260d8 100644 --- a/core/src/main/java/google/registry/flows/domain/DomainCreateFlow.java +++ b/core/src/main/java/google/registry/flows/domain/DomainCreateFlow.java @@ -83,7 +83,7 @@ import google.registry.model.billing.BillingEvent.Flag; import google.registry.model.billing.BillingEvent.Reason; import google.registry.model.billing.BillingEvent.Recurring; import google.registry.model.billing.BillingEvent.RenewalPriceBehavior; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainCommand; import google.registry.model.domain.DomainCommand.Create; import google.registry.model.domain.DomainHistory; @@ -247,7 +247,7 @@ public final class DomainCreateFlow implements TransactionalFlow { verifyUnitIsYears(period); int years = period.getValue(); validateRegistrationPeriod(years); - verifyResourceDoesNotExist(DomainBase.class, targetId, now, registrarId); + verifyResourceDoesNotExist(Domain.class, targetId, now, registrarId); // Validate that this is actually a legal domain name on a TLD that the registrar has access to. InternetDomainName domainName = validateDomainName(command.getFullyQualifiedDomainName()); String domainLabel = domainName.parts().get(0); @@ -368,8 +368,8 @@ public final class DomainCreateFlow implements TransactionalFlow { reservationTypes.contains(NAME_COLLISION) ? ImmutableSet.of(SERVER_HOLD) : ImmutableSet.of(); - DomainBase domain = - new DomainBase.Builder() + Domain domain = + new Domain.Builder() .setCreationRegistrarId(registrarId) .setPersistedCurrentSponsorRegistrarId(registrarId) .setRepoId(repoId) @@ -530,7 +530,7 @@ public final class DomainCreateFlow implements TransactionalFlow { } private DomainHistory buildDomainHistory( - DomainBase domain, Registry registry, DateTime now, Period period, Duration addGracePeriod) { + Domain domain, Registry registry, DateTime now, Period period, Duration addGracePeriod) { // We ignore prober transactions if (registry.getTldType() == TldType.REAL) { historyBuilder @@ -645,13 +645,12 @@ public final class DomainCreateFlow implements TransactionalFlow { .build(); } - private void enqueueTasks( - DomainBase newDomain, boolean hasSignedMarks, boolean hasClaimsNotice) { + private void enqueueTasks(Domain newDomain, boolean hasSignedMarks, boolean hasClaimsNotice) { if (newDomain.shouldPublishToDns()) { dnsQueue.addDomainRefreshTask(newDomain.getDomainName()); } if (hasClaimsNotice || hasSignedMarks) { - LordnTaskUtils.enqueueDomainBaseTask(newDomain); + LordnTaskUtils.enqueueDomainTask(newDomain); } } diff --git a/core/src/main/java/google/registry/flows/domain/DomainDeleteFlow.java b/core/src/main/java/google/registry/flows/domain/DomainDeleteFlow.java index 4e705e807..1574ca109 100644 --- a/core/src/main/java/google/registry/flows/domain/DomainDeleteFlow.java +++ b/core/src/main/java/google/registry/flows/domain/DomainDeleteFlow.java @@ -64,7 +64,7 @@ import google.registry.flows.custom.DomainDeleteFlowCustomLogic.BeforeSaveParame import google.registry.flows.custom.EntityChanges; import google.registry.model.ImmutableObject; import google.registry.model.billing.BillingEvent; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainHistory; import google.registry.model.domain.DomainHistory.DomainHistoryId; import google.registry.model.domain.GracePeriod; @@ -146,13 +146,13 @@ public final class DomainDeleteFlow implements TransactionalFlow { extensionManager.validate(); DateTime now = tm().getTransactionTime(); // Loads the target resource if it exists - DomainBase existingDomain = loadAndVerifyExistence(DomainBase.class, targetId, now); + Domain existingDomain = loadAndVerifyExistence(Domain.class, targetId, now); Registry registry = Registry.get(existingDomain.getTld()); verifyDeleteAllowed(existingDomain, registry, now); flowCustomLogic.afterValidation( AfterValidationParameters.newBuilder().setExistingDomain(existingDomain).build()); ImmutableSet.Builder entitiesToSave = new ImmutableSet.Builder<>(); - DomainBase.Builder builder; + Domain.Builder builder; if (existingDomain.getStatusValues().contains(StatusValue.PENDING_TRANSFER)) { builder = denyPendingTransfer(existingDomain, TransferStatus.SERVER_CANCELLED, now, registrarId) @@ -253,7 +253,7 @@ public final class DomainDeleteFlow implements TransactionalFlow { } builder.setRegistrationExpirationTime(newExpirationTime); - DomainBase newDomain = builder.build(); + Domain newDomain = builder.build(); DomainHistory domainHistory = buildDomainHistory(newDomain, registry, now, durationUntilDelete, inAddGracePeriod); updateForeignKeyIndexDeletionTime(newDomain); @@ -294,7 +294,7 @@ public final class DomainDeleteFlow implements TransactionalFlow { .build(); } - private void verifyDeleteAllowed(DomainBase existingDomain, Registry registry, DateTime now) + private void verifyDeleteAllowed(Domain existingDomain, Registry registry, DateTime now) throws EppException { verifyNoDisallowedStatuses(existingDomain, DISALLOWED_STATUSES); verifyOptionalAuthInfo(authInfo, existingDomain); @@ -309,7 +309,7 @@ public final class DomainDeleteFlow implements TransactionalFlow { } private DomainHistory buildDomainHistory( - DomainBase domain, + Domain domain, Registry registry, DateTime now, Duration durationUntilDelete, @@ -342,7 +342,7 @@ public final class DomainDeleteFlow implements TransactionalFlow { } private PollMessage.OneTime createDeletePollMessage( - DomainBase existingDomain, Key domainHistoryKey, DateTime deletionTime) { + Domain existingDomain, Key domainHistoryKey, DateTime deletionTime) { Optional metadataExtension = eppInput.getSingleExtension(MetadataExtension.class); boolean hasMetadataMessage = @@ -367,7 +367,7 @@ public final class DomainDeleteFlow implements TransactionalFlow { } private PollMessage.OneTime createImmediateDeletePollMessage( - DomainBase existingDomain, + Domain existingDomain, Key domainHistoryKey, DateTime now, DateTime deletionTime) { @@ -389,7 +389,7 @@ public final class DomainDeleteFlow implements TransactionalFlow { @Nullable private ImmutableList getResponseExtensions( - BillingEvent.Recurring recurringBillingEvent, DomainBase existingDomain, DateTime now) { + BillingEvent.Recurring recurringBillingEvent, Domain existingDomain, DateTime now) { FeeTransformResponseExtension.Builder feeResponseBuilder = getDeleteResponseBuilder(); if (feeResponseBuilder == null) { return ImmutableList.of(); diff --git a/core/src/main/java/google/registry/flows/domain/DomainFlowUtils.java b/core/src/main/java/google/registry/flows/domain/DomainFlowUtils.java index 21bdfcc3e..7814b6757 100644 --- a/core/src/main/java/google/registry/flows/domain/DomainFlowUtils.java +++ b/core/src/main/java/google/registry/flows/domain/DomainFlowUtils.java @@ -25,7 +25,7 @@ import static com.google.common.collect.Iterables.any; import static com.google.common.collect.Sets.difference; import static com.google.common.collect.Sets.intersection; import static com.google.common.collect.Sets.union; -import static google.registry.model.domain.DomainBase.MAX_REGISTRATION_YEARS; +import static google.registry.model.domain.Domain.MAX_REGISTRATION_YEARS; import static google.registry.model.tld.Registries.findTldForName; import static google.registry.model.tld.Registries.getTlds; import static google.registry.model.tld.Registry.TldState.GENERAL_AVAILABILITY; @@ -82,7 +82,7 @@ import google.registry.model.billing.BillingEvent.Recurring; import google.registry.model.contact.ContactResource; import google.registry.model.domain.DesignatedContact; import google.registry.model.domain.DesignatedContact.Type; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainCommand.Create; import google.registry.model.domain.DomainCommand.CreateOrUpdate; import google.registry.model.domain.DomainCommand.InvalidReferencesException; @@ -553,7 +553,7 @@ public class DomainFlowUtils { * Fills in a builder with the data needed for an autorenew billing event for this domain. This * does not copy over the id of the current autorenew billing event. */ - public static BillingEvent.Recurring.Builder newAutorenewBillingEvent(DomainBase domain) { + public static BillingEvent.Recurring.Builder newAutorenewBillingEvent(Domain domain) { return new BillingEvent.Recurring.Builder() .setReason(Reason.RENEW) .setFlags(ImmutableSet.of(Flag.AUTO_RENEW)) @@ -566,7 +566,7 @@ public class DomainFlowUtils { * Fills in a builder with the data needed for an autorenew poll message for this domain. This * does not copy over the id of the current autorenew poll message. */ - public static PollMessage.Autorenew.Builder newAutorenewPollMessage(DomainBase domain) { + public static PollMessage.Autorenew.Builder newAutorenewPollMessage(Domain domain) { return new PollMessage.Autorenew.Builder() .setTargetId(domain.getDomainName()) .setRegistrarId(domain.getCurrentSponsorRegistrarId()) @@ -583,7 +583,7 @@ public class DomainFlowUtils { * *

Returns the new autorenew recurring billing event. */ - public static Recurring updateAutorenewRecurrenceEndTime(DomainBase domain, DateTime newEndTime) { + public static Recurring updateAutorenewRecurrenceEndTime(Domain domain, DateTime newEndTime) { Optional autorenewPollMessage = tm().loadByKeyIfPresent(domain.getAutorenewPollMessage()); @@ -628,7 +628,7 @@ public class DomainFlowUtils { FeeQueryCommandExtensionItem feeRequest, FeeQueryResponseExtensionItem.Builder builder, InternetDomainName domainName, - Optional domain, + Optional domain, @Nullable CurrencyUnit topLevelCurrency, DateTime currentDate, DomainPricingLogic pricingLogic, @@ -878,7 +878,7 @@ public class DomainFlowUtils { /** * Check whether a new expiration time (via a renew) does not extend beyond a maximum number of - * years (e.g. {@link DomainBase#MAX_REGISTRATION_YEARS}) from "now". + * years (e.g. {@link Domain#MAX_REGISTRATION_YEARS}) from "now". * * @throws ExceedsMaxRegistrationYearsException if the new registration period is too long */ @@ -891,7 +891,7 @@ public class DomainFlowUtils { /** * Check that a new registration period (via a create) does not extend beyond a maximum number of - * years (e.g. {@link DomainBase#MAX_REGISTRATION_YEARS}). + * years (e.g. {@link Domain#MAX_REGISTRATION_YEARS}). * * @throws ExceedsMaxRegistrationYearsException if the new registration period is too long */ @@ -947,7 +947,7 @@ public class DomainFlowUtils { } /** If a domain "clientUpdateProhibited" set, updates must clear it or fail. */ - static void verifyClientUpdateNotProhibited(Update command, DomainBase existingResource) + static void verifyClientUpdateNotProhibited(Update command, Domain existingResource) throws ResourceHasClientUpdateProhibitedException { if (existingResource.getStatusValues().contains(StatusValue.CLIENT_UPDATE_PROHIBITED) && !command @@ -1120,13 +1120,13 @@ public class DomainFlowUtils { * the most recent HistoryEntry that fits the above criteria, with negated reportAmounts. */ static ImmutableSet createCancelingRecords( - DomainBase domainBase, + Domain domain, final DateTime now, Duration maxSearchPeriod, final ImmutableSet cancelableFields) { List recentHistoryEntries = - findRecentHistoryEntries(domainBase, now, maxSearchPeriod); + findRecentHistoryEntries(domain, now, maxSearchPeriod); Optional entryToCancel = Streams.findLast( recentHistoryEntries.stream() @@ -1165,14 +1165,14 @@ public class DomainFlowUtils { } private static List findRecentHistoryEntries( - DomainBase domainBase, DateTime now, Duration maxSearchPeriod) { + Domain domain, DateTime now, Duration maxSearchPeriod) { return jpaTm() .query( "FROM DomainHistory WHERE modificationTime >= :beginning AND domainRepoId = " + ":repoId ORDER BY modificationTime ASC", DomainHistory.class) .setParameter("beginning", now.minus(maxSearchPeriod)) - .setParameter("repoId", domainBase.getRepoId()) + .setParameter("repoId", domain.getRepoId()) .getResultList(); } diff --git a/core/src/main/java/google/registry/flows/domain/DomainInfoFlow.java b/core/src/main/java/google/registry/flows/domain/DomainInfoFlow.java index b21fd0840..47adf8a63 100644 --- a/core/src/main/java/google/registry/flows/domain/DomainInfoFlow.java +++ b/core/src/main/java/google/registry/flows/domain/DomainInfoFlow.java @@ -36,7 +36,7 @@ import google.registry.flows.custom.DomainInfoFlowCustomLogic; import google.registry.flows.custom.DomainInfoFlowCustomLogic.AfterValidationParameters; import google.registry.flows.custom.DomainInfoFlowCustomLogic.BeforeResponseParameters; import google.registry.flows.custom.DomainInfoFlowCustomLogic.BeforeResponseReturnData; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainCommand.Info; import google.registry.model.domain.DomainCommand.Info.HostsRequest; import google.registry.model.domain.DomainInfoData; @@ -96,8 +96,8 @@ public final class DomainInfoFlow implements Flow { validateRegistrarIsLoggedIn(registrarId); extensionManager.validate(); DateTime now = clock.nowUtc(); - DomainBase domain = verifyExistence( - DomainBase.class, targetId, loadByForeignKey(DomainBase.class, targetId, now)); + Domain domain = + verifyExistence(Domain.class, targetId, loadByForeignKey(Domain.class, targetId, now)); verifyOptionalAuthInfo(authInfo, domain); flowCustomLogic.afterValidation( AfterValidationParameters.newBuilder().setDomain(domain).build()); @@ -142,8 +142,8 @@ public final class DomainInfoFlow implements Flow { .build(); } - private ImmutableList getDomainResponseExtensions( - DomainBase domain, DateTime now) throws EppException { + private ImmutableList getDomainResponseExtensions(Domain domain, DateTime now) + throws EppException { ImmutableList.Builder extensions = new ImmutableList.Builder<>(); addSecDnsExtensionIfPresent(extensions, domain.getDsData()); ImmutableSet gracePeriodStatuses = domain.getGracePeriodStatuses(); diff --git a/core/src/main/java/google/registry/flows/domain/DomainRenewFlow.java b/core/src/main/java/google/registry/flows/domain/DomainRenewFlow.java index 08a2ad423..d9b438b1d 100644 --- a/core/src/main/java/google/registry/flows/domain/DomainRenewFlow.java +++ b/core/src/main/java/google/registry/flows/domain/DomainRenewFlow.java @@ -57,7 +57,7 @@ import google.registry.model.billing.BillingEvent; import google.registry.model.billing.BillingEvent.OneTime; import google.registry.model.billing.BillingEvent.Reason; import google.registry.model.billing.BillingEvent.Recurring; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainCommand.Renew; import google.registry.model.domain.DomainHistory; import google.registry.model.domain.DomainHistory.DomainHistoryId; @@ -166,7 +166,7 @@ public final class DomainRenewFlow implements TransactionalFlow { DateTime now = tm().getTransactionTime(); Renew command = (Renew) resourceCommand; // Loads the target resource if it exists - DomainBase existingDomain = loadAndVerifyExistence(DomainBase.class, targetId, now); + Domain existingDomain = loadAndVerifyExistence(Domain.class, targetId, now); Optional allocationToken = allocationTokenFlowUtils.verifyAllocationTokenIfPresent( existingDomain, @@ -223,7 +223,7 @@ public final class DomainRenewFlow implements TransactionalFlow { .build(); // End the old autorenew billing event and poll message now. This may delete the poll message. updateAutorenewRecurrenceEndTime(existingDomain, now); - DomainBase newDomain = + Domain newDomain = existingDomain .asBuilder() .setLastEppUpdateTime(now) @@ -275,7 +275,7 @@ public final class DomainRenewFlow implements TransactionalFlow { } private DomainHistory buildDomainHistory( - DomainBase newDomain, DateTime now, Period period, Duration renewGracePeriod) { + Domain newDomain, DateTime now, Period period, Duration renewGracePeriod) { Optional metadataExtensionOpt = eppInput.getSingleExtension(MetadataExtension.class); if (metadataExtensionOpt.isPresent()) { @@ -299,10 +299,8 @@ public final class DomainRenewFlow implements TransactionalFlow { .build(); } - private void verifyRenewAllowed( - Optional authInfo, - DomainBase existingDomain, - Renew command) throws EppException { + private void verifyRenewAllowed(Optional authInfo, Domain existingDomain, Renew command) + throws EppException { verifyOptionalAuthInfo(authInfo, existingDomain); verifyNoDisallowedStatuses(existingDomain, RENEW_DISALLOWED_STATUSES); if (!isSuperuser) { diff --git a/core/src/main/java/google/registry/flows/domain/DomainRestoreRequestFlow.java b/core/src/main/java/google/registry/flows/domain/DomainRestoreRequestFlow.java index 84de79e9d..ee43fec81 100644 --- a/core/src/main/java/google/registry/flows/domain/DomainRestoreRequestFlow.java +++ b/core/src/main/java/google/registry/flows/domain/DomainRestoreRequestFlow.java @@ -50,7 +50,7 @@ import google.registry.model.ImmutableObject; import google.registry.model.billing.BillingEvent; import google.registry.model.billing.BillingEvent.OneTime; import google.registry.model.billing.BillingEvent.Reason; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainCommand.Update; import google.registry.model.domain.DomainHistory; import google.registry.model.domain.DomainHistory.DomainHistoryId; @@ -140,7 +140,7 @@ public final class DomainRestoreRequestFlow implements TransactionalFlow { extensionManager.validate(); Update command = (Update) resourceCommand; DateTime now = tm().getTransactionTime(); - DomainBase existingDomain = loadAndVerifyExistence(DomainBase.class, targetId, now); + Domain existingDomain = loadAndVerifyExistence(Domain.class, targetId, now); boolean isExpired = existingDomain.getRegistrationExpirationTime().isBefore(now); FeesAndCredits feesAndCredits = pricingLogic.getRestorePrice( @@ -180,7 +180,7 @@ public final class DomainRestoreRequestFlow implements TransactionalFlow { new DomainHistoryId( domainHistoryKey.getParent().getName(), domainHistoryKey.getId())) .build(); - DomainBase newDomain = + Domain newDomain = performRestore( existingDomain, newExpirationTime, @@ -199,7 +199,7 @@ public final class DomainRestoreRequestFlow implements TransactionalFlow { .build(); } - private DomainHistory buildDomainHistory(DomainBase newDomain, DateTime now) { + private DomainHistory buildDomainHistory(Domain newDomain, DateTime now) { return historyBuilder .setType(DOMAIN_RESTORE) .setDomain(newDomain) @@ -212,10 +212,11 @@ public final class DomainRestoreRequestFlow implements TransactionalFlow { private void verifyRestoreAllowed( Update command, - DomainBase existingDomain, + Domain existingDomain, Optional feeUpdate, FeesAndCredits feesAndCredits, - DateTime now) throws EppException { + DateTime now) + throws EppException { verifyOptionalAuthInfo(authInfo, existingDomain); if (!isSuperuser) { verifyResourceOwnership(registrarId, existingDomain); @@ -235,8 +236,8 @@ public final class DomainRestoreRequestFlow implements TransactionalFlow { validateFeeChallenge(targetId, now, feeUpdate, feesAndCredits); } - private static DomainBase performRestore( - DomainBase existingDomain, + private static Domain performRestore( + Domain existingDomain, DateTime newExpirationTime, BillingEvent.Recurring autorenewEvent, PollMessage.Autorenew autorenewPollMessage, diff --git a/core/src/main/java/google/registry/flows/domain/DomainTransferApproveFlow.java b/core/src/main/java/google/registry/flows/domain/DomainTransferApproveFlow.java index 2665ac9b1..65fd9156a 100644 --- a/core/src/main/java/google/registry/flows/domain/DomainTransferApproveFlow.java +++ b/core/src/main/java/google/registry/flows/domain/DomainTransferApproveFlow.java @@ -49,7 +49,7 @@ import google.registry.model.ImmutableObject; import google.registry.model.billing.BillingEvent; import google.registry.model.billing.BillingEvent.Flag; import google.registry.model.billing.BillingEvent.Reason; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainHistory; import google.registry.model.domain.DomainHistory.DomainHistoryId; import google.registry.model.domain.GracePeriod; @@ -100,7 +100,7 @@ public final class DomainTransferApproveFlow implements TransactionalFlow { /** * The logic in this flow, which handles client approvals, very closely parallels the logic in - * {@link DomainBase#cloneProjectedAtTime} which handles implicit server approvals. + * {@link Domain#cloneProjectedAtTime} which handles implicit server approvals. */ @Override public EppResponse run() throws EppException { @@ -108,7 +108,7 @@ public final class DomainTransferApproveFlow implements TransactionalFlow { validateRegistrarIsLoggedIn(registrarId); extensionManager.validate(); DateTime now = tm().getTransactionTime(); - DomainBase existingDomain = loadAndVerifyExistence(DomainBase.class, targetId, now); + Domain existingDomain = loadAndVerifyExistence(Domain.class, targetId, now); verifyOptionalAuthInfo(authInfo, existingDomain); verifyHasPendingTransfer(existingDomain); verifyResourceOwnership(registrarId, existingDomain); @@ -190,9 +190,9 @@ public final class DomainTransferApproveFlow implements TransactionalFlow { domainHistoryKey.getParent().getName(), domainHistoryKey.getId())) .build(); // Construct the post-transfer domain. - DomainBase partiallyApprovedDomain = + Domain partiallyApprovedDomain = approvePendingTransfer(existingDomain, TransferStatus.CLIENT_APPROVED, now); - DomainBase newDomain = + Domain newDomain = partiallyApprovedDomain .asBuilder() // Update the transferredRegistrationExpirationTime here since approvePendingTransfer() @@ -246,7 +246,7 @@ public final class DomainTransferApproveFlow implements TransactionalFlow { } private DomainHistory buildDomainHistory( - DomainBase newDomain, Registry registry, DateTime now, String gainingRegistrarId) { + Domain newDomain, Registry registry, DateTime now, String gainingRegistrarId) { ImmutableSet cancelingRecords = createCancelingRecords( newDomain, diff --git a/core/src/main/java/google/registry/flows/domain/DomainTransferCancelFlow.java b/core/src/main/java/google/registry/flows/domain/DomainTransferCancelFlow.java index 102583129..978c819b2 100644 --- a/core/src/main/java/google/registry/flows/domain/DomainTransferCancelFlow.java +++ b/core/src/main/java/google/registry/flows/domain/DomainTransferCancelFlow.java @@ -40,7 +40,7 @@ import google.registry.flows.FlowModule.Superuser; import google.registry.flows.FlowModule.TargetId; import google.registry.flows.TransactionalFlow; import google.registry.flows.annotations.ReportingSpec; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainHistory; import google.registry.model.domain.metadata.MetadataExtension; import google.registry.model.eppcommon.AuthInfo; @@ -90,7 +90,7 @@ public final class DomainTransferCancelFlow implements TransactionalFlow { validateRegistrarIsLoggedIn(registrarId); extensionManager.validate(); DateTime now = tm().getTransactionTime(); - DomainBase existingDomain = loadAndVerifyExistence(DomainBase.class, targetId, now); + Domain existingDomain = loadAndVerifyExistence(Domain.class, targetId, now); verifyOptionalAuthInfo(authInfo, existingDomain); verifyHasPendingTransfer(existingDomain); verifyTransferInitiator(registrarId, existingDomain); @@ -104,7 +104,7 @@ public final class DomainTransferCancelFlow implements TransactionalFlow { .setId(domainHistoryKey.getId()) .setOtherRegistrarId(existingDomain.getTransferData().getLosingRegistrarId()); - DomainBase newDomain = + Domain newDomain = denyPendingTransfer(existingDomain, TransferStatus.CLIENT_CANCELLED, now, registrarId); DomainHistory domainHistory = buildDomainHistory(newDomain, registry, now); tm().putAll( @@ -123,7 +123,7 @@ public final class DomainTransferCancelFlow implements TransactionalFlow { .build(); } - private DomainHistory buildDomainHistory(DomainBase newDomain, Registry registry, DateTime now) { + private DomainHistory buildDomainHistory(Domain newDomain, Registry registry, DateTime now) { ImmutableSet cancelingRecords = createCancelingRecords( newDomain, diff --git a/core/src/main/java/google/registry/flows/domain/DomainTransferQueryFlow.java b/core/src/main/java/google/registry/flows/domain/DomainTransferQueryFlow.java index cf549fb58..db0d1add5 100644 --- a/core/src/main/java/google/registry/flows/domain/DomainTransferQueryFlow.java +++ b/core/src/main/java/google/registry/flows/domain/DomainTransferQueryFlow.java @@ -28,7 +28,7 @@ import google.registry.flows.ResourceFlowUtils; import google.registry.flows.annotations.ReportingSpec; import google.registry.flows.exceptions.NoTransferHistoryToQueryException; import google.registry.flows.exceptions.NotAuthorizedToViewTransferException; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.eppcommon.AuthInfo; import google.registry.model.eppoutput.EppResponse; import google.registry.model.reporting.IcannReportingTypes.ActivityReportField; @@ -71,7 +71,7 @@ public final class DomainTransferQueryFlow implements Flow { validateRegistrarIsLoggedIn(registrarId); extensionManager.validate(); // There are no legal extensions for this flow. DateTime now = clock.nowUtc(); - DomainBase domain = loadAndVerifyExistence(DomainBase.class, targetId, now); + Domain domain = loadAndVerifyExistence(Domain.class, targetId, now); verifyOptionalAuthInfo(authInfo, domain); // Most of the fields on the transfer response are required, so there's no way to return valid // XML if the object has never been transferred (and hence the fields aren't populated). diff --git a/core/src/main/java/google/registry/flows/domain/DomainTransferRejectFlow.java b/core/src/main/java/google/registry/flows/domain/DomainTransferRejectFlow.java index 43ecfa263..551f2ea3c 100644 --- a/core/src/main/java/google/registry/flows/domain/DomainTransferRejectFlow.java +++ b/core/src/main/java/google/registry/flows/domain/DomainTransferRejectFlow.java @@ -42,7 +42,7 @@ import google.registry.flows.FlowModule.Superuser; import google.registry.flows.FlowModule.TargetId; import google.registry.flows.TransactionalFlow; import google.registry.flows.annotations.ReportingSpec; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainHistory; import google.registry.model.domain.metadata.MetadataExtension; import google.registry.model.eppcommon.AuthInfo; @@ -92,7 +92,7 @@ public final class DomainTransferRejectFlow implements TransactionalFlow { validateRegistrarIsLoggedIn(registrarId); extensionManager.validate(); DateTime now = tm().getTransactionTime(); - DomainBase existingDomain = loadAndVerifyExistence(DomainBase.class, targetId, now); + Domain existingDomain = loadAndVerifyExistence(Domain.class, targetId, now); Registry registry = Registry.get(existingDomain.getTld()); Key domainHistoryKey = createHistoryKey(existingDomain, DomainHistory.class); historyBuilder @@ -105,7 +105,7 @@ public final class DomainTransferRejectFlow implements TransactionalFlow { if (!isSuperuser) { checkAllowedAccessToTld(registrarId, existingDomain.getTld()); } - DomainBase newDomain = + Domain newDomain = denyPendingTransfer(existingDomain, TransferStatus.CLIENT_REJECTED, now, registrarId); DomainHistory domainHistory = buildDomainHistory(newDomain, registry, now); tm().putAll( @@ -124,7 +124,7 @@ public final class DomainTransferRejectFlow implements TransactionalFlow { .build(); } - private DomainHistory buildDomainHistory(DomainBase newDomain, Registry registry, DateTime now) { + private DomainHistory buildDomainHistory(Domain newDomain, Registry registry, DateTime now) { ImmutableSet cancelingRecords = createCancelingRecords( newDomain, diff --git a/core/src/main/java/google/registry/flows/domain/DomainTransferRequestFlow.java b/core/src/main/java/google/registry/flows/domain/DomainTransferRequestFlow.java index eecf84bdb..0dd65be1c 100644 --- a/core/src/main/java/google/registry/flows/domain/DomainTransferRequestFlow.java +++ b/core/src/main/java/google/registry/flows/domain/DomainTransferRequestFlow.java @@ -52,7 +52,7 @@ import google.registry.flows.exceptions.InvalidTransferPeriodValueException; import google.registry.flows.exceptions.ObjectAlreadySponsoredException; import google.registry.flows.exceptions.TransferPeriodMustBeOneYearException; import google.registry.flows.exceptions.TransferPeriodZeroAndFeeTransferExtensionException; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainCommand.Transfer; import google.registry.model.domain.DomainHistory; import google.registry.model.domain.Period; @@ -149,7 +149,7 @@ public final class DomainTransferRequestFlow implements TransactionalFlow { verifyRegistrarIsActive(gainingClientId); extensionManager.validate(); DateTime now = tm().getTransactionTime(); - DomainBase existingDomain = loadAndVerifyExistence(DomainBase.class, targetId, now); + Domain existingDomain = loadAndVerifyExistence(Domain.class, targetId, now); Optional superuserExtension = eppInput.getSingleExtension(DomainTransferRequestSuperuserExtension.class); Period period = @@ -190,7 +190,7 @@ public final class DomainTransferRequestFlow implements TransactionalFlow { // // See b/19430703#comment17 and https://www.icann.org/news/advisory-2002-06-06-en for the // policy documentation for transfers subsuming autorenews within the autorenew grace period. - DomainBase domainAtTransferTime = existingDomain.cloneProjectedAtTime(automaticTransferTime); + Domain domainAtTransferTime = existingDomain.cloneProjectedAtTime(automaticTransferTime); // The new expiration time if there is a server approval. DateTime serverApproveNewExpirationTime = computeExDateForApprovalTime(domainAtTransferTime, automaticTransferTime, period); @@ -231,7 +231,7 @@ public final class DomainTransferRequestFlow implements TransactionalFlow { // cloneProjectedAtTime() will replace these old autorenew entities with the server approve ones // that we've created in this flow and stored in pendingTransferData. updateAutorenewRecurrenceEndTime(existingDomain, automaticTransferTime); - DomainBase newDomain = + Domain newDomain = existingDomain .asBuilder() .setTransferData(pendingTransferData) @@ -255,7 +255,7 @@ public final class DomainTransferRequestFlow implements TransactionalFlow { } private void verifyTransferAllowed( - DomainBase existingDomain, + Domain existingDomain, Period period, DateTime now, Optional superuserExtension) @@ -320,7 +320,7 @@ public final class DomainTransferRequestFlow implements TransactionalFlow { } private DomainHistory buildDomainHistory( - DomainBase newDomain, Registry registry, DateTime now, Period period) { + Domain newDomain, Registry registry, DateTime now, Period period) { return historyBuilder .setType(DOMAIN_TRANSFER_REQUEST) .setPeriod(period) @@ -337,7 +337,7 @@ public final class DomainTransferRequestFlow implements TransactionalFlow { } private DomainTransferResponse createResponse( - Period period, DomainBase existingDomain, DomainBase newDomain, DateTime now) { + Period period, Domain existingDomain, Domain newDomain, DateTime now) { // If the registration were approved this instant, this is what the new expiration would be, // because we cap at 10 years from the moment of approval. This is different than the server // approval new expiration time, which is capped at 10 years from the server approve time. diff --git a/core/src/main/java/google/registry/flows/domain/DomainTransferUtils.java b/core/src/main/java/google/registry/flows/domain/DomainTransferUtils.java index a6ada5726..0aff78598 100644 --- a/core/src/main/java/google/registry/flows/domain/DomainTransferUtils.java +++ b/core/src/main/java/google/registry/flows/domain/DomainTransferUtils.java @@ -24,7 +24,7 @@ import com.googlecode.objectify.Key; import google.registry.model.billing.BillingEvent; import google.registry.model.billing.BillingEvent.Flag; import google.registry.model.billing.BillingEvent.Reason; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainHistory; import google.registry.model.domain.DomainHistory.DomainHistoryId; import google.registry.model.domain.GracePeriod; @@ -109,7 +109,7 @@ public final class DomainTransferUtils { DateTime automaticTransferTime, DateTime serverApproveNewExpirationTime, Key domainHistoryKey, - DomainBase existingDomain, + Domain existingDomain, Trid trid, String gainingRegistrarId, Optional transferCost, @@ -276,10 +276,9 @@ public final class DomainTransferUtils { DateTime now, Key domainHistoryKey, String targetId, - DomainBase existingDomain, + Domain existingDomain, Optional transferCost) { - DomainBase domainAtTransferTime = - existingDomain.cloneProjectedAtTime(automaticTransferTime); + Domain domainAtTransferTime = existingDomain.cloneProjectedAtTime(automaticTransferTime); GracePeriod autorenewGracePeriod = getOnlyElement( domainAtTransferTime.getGracePeriodsOfType(GracePeriodStatus.AUTO_RENEW), null); diff --git a/core/src/main/java/google/registry/flows/domain/DomainUpdateFlow.java b/core/src/main/java/google/registry/flows/domain/DomainUpdateFlow.java index fc3f8fa4c..78d112127 100644 --- a/core/src/main/java/google/registry/flows/domain/DomainUpdateFlow.java +++ b/core/src/main/java/google/registry/flows/domain/DomainUpdateFlow.java @@ -67,7 +67,7 @@ import google.registry.model.ImmutableObject; import google.registry.model.billing.BillingEvent; import google.registry.model.billing.BillingEvent.Reason; import google.registry.model.domain.DesignatedContact; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainCommand.Update; import google.registry.model.domain.DomainCommand.Update.AddRemove; import google.registry.model.domain.DomainCommand.Update.Change; @@ -173,11 +173,11 @@ public final class DomainUpdateFlow implements TransactionalFlow { extensionManager.validate(); DateTime now = tm().getTransactionTime(); Update command = cloneAndLinkReferences((Update) resourceCommand, now); - DomainBase existingDomain = loadAndVerifyExistence(DomainBase.class, targetId, now); + Domain existingDomain = loadAndVerifyExistence(Domain.class, targetId, now); verifyUpdateAllowed(command, existingDomain, now); flowCustomLogic.afterValidation( AfterValidationParameters.newBuilder().setExistingDomain(existingDomain).build()); - DomainBase newDomain = performUpdate(command, existingDomain, now); + Domain newDomain = performUpdate(command, existingDomain, now); DomainHistory domainHistory = historyBuilder.setType(DOMAIN_UPDATE).setDomain(newDomain).build(); validateNewState(newDomain); @@ -204,7 +204,7 @@ public final class DomainUpdateFlow implements TransactionalFlow { } /** Fail if the object doesn't exist or was deleted. */ - private void verifyUpdateAllowed(Update command, DomainBase existingDomain, DateTime now) + private void verifyUpdateAllowed(Update command, Domain existingDomain, DateTime now) throws EppException { verifyOptionalAuthInfo(authInfo, existingDomain); AddRemove add = command.getInnerAdd(); @@ -233,8 +233,7 @@ public final class DomainUpdateFlow implements TransactionalFlow { tld, add.getNameserverFullyQualifiedHostNames()); } - private DomainBase performUpdate(Update command, DomainBase domain, DateTime now) - throws EppException { + private Domain performUpdate(Update command, Domain domain, DateTime now) throws EppException { AddRemove add = command.getInnerAdd(); AddRemove remove = command.getInnerRemove(); checkSameValuesNotAddedAndRemoved(add.getNameservers(), remove.getNameservers()); @@ -251,7 +250,7 @@ public final class DomainUpdateFlow implements TransactionalFlow { Sets.union(Sets.difference(domain.getContacts(), remove.getContacts()), add.getContacts()); validateNoDuplicateContacts(newContacts); - DomainBase.Builder domainBuilder = + Domain.Builder domainBuilder = domain .asBuilder() // Handle the secDNS extension. As dsData in secDnsUpdate is read from EPP input and @@ -293,7 +292,7 @@ public final class DomainUpdateFlow implements TransactionalFlow { } } - private void validateNewState(DomainBase newDomain) throws EppException { + private void validateNewState(Domain newDomain) throws EppException { validateRequiredContactsPresent(newDomain.getRegistrant(), newDomain.getContacts()); validateDsData(newDomain.getDsData()); validateNameserversCountForTld( @@ -304,7 +303,7 @@ public final class DomainUpdateFlow implements TransactionalFlow { /** Some status updates cost money. Bill only once no matter how many of them are changed. */ private Optional createBillingEventForStatusUpdates( - DomainBase existingDomain, DomainBase newDomain, DomainHistory historyEntry, DateTime now) { + Domain existingDomain, Domain newDomain, DomainHistory historyEntry, DateTime now) { Optional metadataExtension = eppInput.getSingleExtension(MetadataExtension.class); if (metadataExtension.isPresent() && metadataExtension.get().getRequestedByRegistrar()) { @@ -330,7 +329,7 @@ public final class DomainUpdateFlow implements TransactionalFlow { /** Enqueues a poll message iff a superuser is adding/removing server statuses. */ private Optional createPollMessageForServerStatusUpdates( - DomainBase existingDomain, DomainBase newDomain, DomainHistory historyEntry, DateTime now) { + Domain existingDomain, Domain newDomain, DomainHistory historyEntry, DateTime now) { if (registrarId.equals(existingDomain.getPersistedCurrentSponsorRegistrarId())) { // Don't send a poll message when a superuser registrar is updating its own domain. return Optional.empty(); diff --git a/core/src/main/java/google/registry/flows/domain/token/AllocationTokenCustomLogic.java b/core/src/main/java/google/registry/flows/domain/token/AllocationTokenCustomLogic.java index 2ee8a7210..fdf6fba3b 100644 --- a/core/src/main/java/google/registry/flows/domain/token/AllocationTokenCustomLogic.java +++ b/core/src/main/java/google/registry/flows/domain/token/AllocationTokenCustomLogic.java @@ -19,7 +19,7 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.Maps; import com.google.common.net.InternetDomainName; import google.registry.flows.EppException; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainCommand; import google.registry.model.domain.token.AllocationToken; import google.registry.model.tld.Registry; @@ -46,7 +46,7 @@ public class AllocationTokenCustomLogic { /** Performs additional custom logic for validating a token on an existing domain. */ public AllocationToken validateToken( - DomainBase domain, AllocationToken token, Registry registry, String registrarId, DateTime now) + Domain domain, AllocationToken token, Registry registry, String registrarId, DateTime now) throws EppException { // Do nothing. return token; diff --git a/core/src/main/java/google/registry/flows/domain/token/AllocationTokenFlowUtils.java b/core/src/main/java/google/registry/flows/domain/token/AllocationTokenFlowUtils.java index 3ada1b309..a4a466165 100644 --- a/core/src/main/java/google/registry/flows/domain/token/AllocationTokenFlowUtils.java +++ b/core/src/main/java/google/registry/flows/domain/token/AllocationTokenFlowUtils.java @@ -26,7 +26,7 @@ import google.registry.flows.EppException; import google.registry.flows.EppException.AssociationProhibitsOperationException; import google.registry.flows.EppException.AuthorizationErrorException; import google.registry.flows.EppException.StatusProhibitsOperationException; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainCommand; import google.registry.model.domain.token.AllocationToken; import google.registry.model.domain.token.AllocationToken.TokenStatus; @@ -171,7 +171,7 @@ public class AllocationTokenFlowUtils { /** Verifies and returns the allocation token if one is specified, otherwise does nothing. */ public Optional verifyAllocationTokenIfPresent( - DomainBase existingDomain, + Domain existingDomain, Registry registry, String registrarId, DateTime now, diff --git a/core/src/main/java/google/registry/flows/host/HostCreateFlow.java b/core/src/main/java/google/registry/flows/host/HostCreateFlow.java index 22bac414d..2919205b4 100644 --- a/core/src/main/java/google/registry/flows/host/HostCreateFlow.java +++ b/core/src/main/java/google/registry/flows/host/HostCreateFlow.java @@ -41,7 +41,7 @@ import google.registry.flows.annotations.ReportingSpec; import google.registry.flows.exceptions.ResourceAlreadyExistsForThisClientException; import google.registry.flows.exceptions.ResourceCreateContentionException; import google.registry.model.ImmutableObject; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.metadata.MetadataExtension; import google.registry.model.eppinput.ResourceCommand; import google.registry.model.eppoutput.CreateData.HostCreateData; @@ -109,7 +109,7 @@ public final class HostCreateFlow implements TransactionalFlow { // The superordinate domain of the host object if creating an in-bailiwick host, or null if // creating an external host. This is looked up before we actually create the Host object so // we can detect error conditions earlier. - Optional superordinateDomain = + Optional superordinateDomain = lookupSuperordinateDomain(validateHostName(targetId), now); verifySuperordinateDomainNotInPendingDelete(superordinateDomain.orElse(null)); verifySuperordinateDomainOwnership(registrarId, superordinateDomain.orElse(null)); @@ -128,7 +128,7 @@ public final class HostCreateFlow implements TransactionalFlow { .setHostName(targetId) .setInetAddresses(command.getInetAddresses()) .setRepoId(createRepoId(allocateId(), roidSuffix)) - .setSuperordinateDomain(superordinateDomain.map(DomainBase::createVKey).orElse(null)) + .setSuperordinateDomain(superordinateDomain.map(Domain::createVKey).orElse(null)) .build(); historyBuilder.setType(HOST_CREATE).setHost(newHost); ImmutableSet entitiesToSave = diff --git a/core/src/main/java/google/registry/flows/host/HostFlowUtils.java b/core/src/main/java/google/registry/flows/host/HostFlowUtils.java index 3c35a4e24..6ae5ba50e 100644 --- a/core/src/main/java/google/registry/flows/host/HostFlowUtils.java +++ b/core/src/main/java/google/registry/flows/host/HostFlowUtils.java @@ -29,7 +29,7 @@ import google.registry.flows.EppException.ParameterValuePolicyErrorException; import google.registry.flows.EppException.ParameterValueRangeErrorException; import google.registry.flows.EppException.ParameterValueSyntaxErrorException; import google.registry.flows.EppException.StatusProhibitsOperationException; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.eppcommon.StatusValue; import google.registry.util.Idn; import java.util.Optional; @@ -77,8 +77,8 @@ public class HostFlowUtils { } } - /** Return the {@link DomainBase} this host is subordinate to, or null for external hosts. */ - public static Optional lookupSuperordinateDomain( + /** Return the {@link Domain} this host is subordinate to, or null for external hosts. */ + public static Optional lookupSuperordinateDomain( InternetDomainName hostName, DateTime now) throws EppException { Optional tld = findTldForName(hostName); if (!tld.isPresent()) { @@ -90,8 +90,7 @@ public class HostFlowUtils { hostName.parts().stream() .skip(hostName.parts().size() - (tld.get().parts().size() + 1)) .collect(joining(".")); - Optional superordinateDomain = - loadByForeignKey(DomainBase.class, domainName, now); + Optional superordinateDomain = loadByForeignKey(Domain.class, domainName, now); if (!superordinateDomain.isPresent() || !isActive(superordinateDomain.get(), now)) { throw new SuperordinateDomainDoesNotExistException(domainName); } @@ -101,12 +100,12 @@ public class HostFlowUtils { /** Superordinate domain for this hostname does not exist. */ static class SuperordinateDomainDoesNotExistException extends ObjectDoesNotExistException { public SuperordinateDomainDoesNotExistException(String domainName) { - super(DomainBase.class, domainName); + super(Domain.class, domainName); } } /** Ensure that the superordinate domain is sponsored by the provided registrar ID. */ - static void verifySuperordinateDomainOwnership(String registrarId, DomainBase superordinateDomain) + static void verifySuperordinateDomainOwnership(String registrarId, Domain superordinateDomain) throws EppException { if (superordinateDomain != null && !registrarId.equals(superordinateDomain.getCurrentSponsorRegistrarId())) { @@ -122,7 +121,7 @@ public class HostFlowUtils { } /** Ensure that the superordinate domain is not in pending delete. */ - static void verifySuperordinateDomainNotInPendingDelete(DomainBase superordinateDomain) + static void verifySuperordinateDomainNotInPendingDelete(Domain superordinateDomain) throws EppException { if ((superordinateDomain != null) && superordinateDomain.getStatusValues().contains(StatusValue.PENDING_DELETE)) { diff --git a/core/src/main/java/google/registry/flows/host/HostInfoFlow.java b/core/src/main/java/google/registry/flows/host/HostInfoFlow.java index 95bc870b7..e83036965 100644 --- a/core/src/main/java/google/registry/flows/host/HostInfoFlow.java +++ b/core/src/main/java/google/registry/flows/host/HostInfoFlow.java @@ -27,7 +27,7 @@ import google.registry.flows.Flow; import google.registry.flows.FlowModule.RegistrarId; import google.registry.flows.FlowModule.TargetId; import google.registry.flows.annotations.ReportingSpec; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.eppcommon.StatusValue; import google.registry.model.eppoutput.EppResponse; import google.registry.model.host.HostInfoData; @@ -76,7 +76,7 @@ public final class HostInfoFlow implements Flow { // the client id, last transfer time, and pending transfer status need to be read off of it. If // there is no superordinate domain, the host's own values for these fields will be correct. if (host.isSubordinate()) { - DomainBase superordinateDomain = + Domain superordinateDomain = tm().transact( () -> tm().loadByKey(host.getSuperordinateDomain()).cloneProjectedAtTime(now)); hostInfoDataBuilder diff --git a/core/src/main/java/google/registry/flows/host/HostUpdateFlow.java b/core/src/main/java/google/registry/flows/host/HostUpdateFlow.java index 5921cecc8..a7394729d 100644 --- a/core/src/main/java/google/registry/flows/host/HostUpdateFlow.java +++ b/core/src/main/java/google/registry/flows/host/HostUpdateFlow.java @@ -47,7 +47,7 @@ import google.registry.flows.annotations.ReportingSpec; import google.registry.flows.exceptions.ResourceHasClientUpdateProhibitedException; import google.registry.model.EppResource; import google.registry.model.ImmutableObject; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.metadata.MetadataExtension; import google.registry.model.eppcommon.StatusValue; import google.registry.model.eppinput.ResourceCommand; @@ -137,12 +137,12 @@ public final class HostUpdateFlow implements TransactionalFlow { boolean isHostRename = suppliedNewHostName != null; String oldHostName = targetId; String newHostName = firstNonNull(suppliedNewHostName, oldHostName); - DomainBase oldSuperordinateDomain = + Domain oldSuperordinateDomain = existingHost.isSubordinate() ? tm().loadByKey(existingHost.getSuperordinateDomain()).cloneProjectedAtTime(now) : null; // Note that lookupSuperordinateDomain calls cloneProjectedAtTime on the domain for us. - Optional newSuperordinateDomain = + Optional newSuperordinateDomain = lookupSuperordinateDomain(validateHostName(newHostName), now); verifySuperordinateDomainNotInPendingDelete(newSuperordinateDomain.orElse(null)); EppResource owningResource = firstNonNull(oldSuperordinateDomain, existingHost); @@ -155,8 +155,8 @@ public final class HostUpdateFlow implements TransactionalFlow { AddRemove remove = command.getInnerRemove(); checkSameValuesNotAddedAndRemoved(add.getStatusValues(), remove.getStatusValues()); checkSameValuesNotAddedAndRemoved(add.getInetAddresses(), remove.getInetAddresses()); - VKey newSuperordinateDomainKey = - newSuperordinateDomain.map(DomainBase::createVKey).orElse(null); + VKey newSuperordinateDomainKey = + newSuperordinateDomain.map(Domain::createVKey).orElse(null); // If the superordinateDomain field is changing, set the lastSuperordinateChange to now. DateTime lastSuperordinateChange = Objects.equals(newSuperordinateDomainKey, existingHost.getSuperordinateDomain()) @@ -211,10 +211,10 @@ public final class HostUpdateFlow implements TransactionalFlow { private void verifyUpdateAllowed( Update command, HostResource existingHost, - DomainBase newSuperordinateDomain, + Domain newSuperordinateDomain, EppResource owningResource, boolean isHostRename) - throws EppException { + throws EppException { if (!isSuperuser) { // Verify that the host belongs to this registrar, either directly or because it is currently // subordinate to a domain owned by this registrar. diff --git a/core/src/main/java/google/registry/model/EntityClasses.java b/core/src/main/java/google/registry/model/EntityClasses.java index 0712f6a33..7b9720423 100644 --- a/core/src/main/java/google/registry/model/EntityClasses.java +++ b/core/src/main/java/google/registry/model/EntityClasses.java @@ -20,7 +20,7 @@ import google.registry.model.common.EntityGroupRoot; import google.registry.model.common.GaeUserIdConverter; import google.registry.model.contact.ContactHistory; import google.registry.model.contact.ContactResource; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainHistory; import google.registry.model.domain.token.AllocationToken; import google.registry.model.host.HostHistory; @@ -45,7 +45,7 @@ public final class EntityClasses { AllocationToken.class, ContactHistory.class, ContactResource.class, - DomainBase.class, + Domain.class, DomainHistory.class, EntityGroupRoot.class, EppResourceIndex.class, diff --git a/core/src/main/java/google/registry/model/EppResourceUtils.java b/core/src/main/java/google/registry/model/EppResourceUtils.java index ca83b3b95..c9c0304b9 100644 --- a/core/src/main/java/google/registry/model/EppResourceUtils.java +++ b/core/src/main/java/google/registry/model/EppResourceUtils.java @@ -33,7 +33,7 @@ import google.registry.model.EppResource.BuilderWithTransferData; import google.registry.model.EppResource.ForeignKeyedEppResource; import google.registry.model.EppResource.ResourceWithTransferData; import google.registry.model.contact.ContactResource; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.eppcommon.StatusValue; import google.registry.model.host.HostResource; import google.registry.model.index.ForeignKeyIndex; @@ -342,7 +342,7 @@ public final class EppResourceUtils { * @param now the logical time of the check * @param limit the maximum number of returned keys, unlimited if null */ - public static ImmutableSet> getLinkedDomainKeys( + public static ImmutableSet> getLinkedDomainKeys( VKey key, DateTime now, @Nullable Integer limit) { checkArgument( key.getKind().equals(ContactResource.class) || key.getKind().equals(HostResource.class), @@ -350,16 +350,16 @@ public final class EppResourceUtils { key); boolean isContactKey = key.getKind().equals(ContactResource.class); if (tm().isOfy()) { - com.googlecode.objectify.cmd.Query query = + com.googlecode.objectify.cmd.Query query = auditedOfy() .load() - .type(DomainBase.class) + .type(Domain.class) .filter(isContactKey ? "allContacts.contact" : "nsHosts", key.getOfyKey()) .filter("deletionTime >", now); if (limit != null) { query.limit(limit); } - return query.keys().list().stream().map(DomainBase::createVKey).collect(toImmutableSet()); + return query.keys().list().stream().map(Domain::createVKey).collect(toImmutableSet()); } else { return tm().transact( () -> { @@ -382,16 +382,15 @@ public final class EppResourceUtils { query.setMaxResults(limit); } @SuppressWarnings("unchecked") - ImmutableSet> domainBaseKeySet = - (ImmutableSet>) + ImmutableSet> domainKeySet = + (ImmutableSet>) query .getResultStream() .map( repoId -> - DomainBase.createVKey( - Key.create(DomainBase.class, (String) repoId))) + Domain.createVKey(Key.create(Domain.class, (String) repoId))) .collect(toImmutableSet()); - return domainBaseKeySet; + return domainKeySet; }); } } diff --git a/core/src/main/java/google/registry/model/ResourceTransferUtils.java b/core/src/main/java/google/registry/model/ResourceTransferUtils.java index 478c704f9..d1ae1dbb7 100644 --- a/core/src/main/java/google/registry/model/ResourceTransferUtils.java +++ b/core/src/main/java/google/registry/model/ResourceTransferUtils.java @@ -26,7 +26,7 @@ import google.registry.model.EppResource.BuilderWithTransferData; import google.registry.model.EppResource.ForeignKeyedEppResource; import google.registry.model.EppResource.ResourceWithTransferData; import google.registry.model.contact.ContactResource; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.eppcommon.StatusValue; import google.registry.model.eppcommon.Trid; import google.registry.model.index.ForeignKeyIndex; @@ -101,7 +101,7 @@ public final class ResourceTransferUtils { } private static void assertIsContactOrDomain(EppResource eppResource) { - checkState(eppResource instanceof ContactResource || eppResource instanceof DomainBase); + checkState(eppResource instanceof ContactResource || eppResource instanceof Domain); } /** Update the relevant {@link ForeignKeyIndex} to cache the new deletion time. */ diff --git a/core/src/main/java/google/registry/model/bulkquery/BulkQueryEntities.java b/core/src/main/java/google/registry/model/bulkquery/BulkQueryEntities.java index 8c86f8d06..647a0e601 100644 --- a/core/src/main/java/google/registry/model/bulkquery/BulkQueryEntities.java +++ b/core/src/main/java/google/registry/model/bulkquery/BulkQueryEntities.java @@ -19,7 +19,7 @@ import static com.google.common.collect.ImmutableSet.toImmutableSet; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainContent; import google.registry.model.domain.DomainHistory; import google.registry.model.domain.GracePeriod; @@ -33,14 +33,14 @@ import google.registry.persistence.transaction.JpaTransactionManager; /** * Utilities for managing an alternative JPA entity model optimized for bulk loading multi-level - * entities such as {@link DomainBase} and {@link DomainHistory}. + * entities such as {@link Domain} and {@link DomainHistory}. * *

In a bulk query for a multi-level JPA entity type, the JPA framework only generates a bulk * query (SELECT * FROM table) for the base table. Then, for each row in the base table, additional * queries are issued to load associated rows in child tables. This can be very slow when an entity * type has multiple child tables. * - *

We have defined an alternative entity model for {@code DomainBase} and {@code DomainHistory}, + *

We have defined an alternative entity model for {@link Domain} and {@link DomainHistory}, * where the base table as well as the child tables are mapped to single-level entity types. The * idea is to load each of these types using a bulk query, and assemble them into the target type in * memory in a pipeline. The main use case is Datastore-Cloud SQL validation during the Registry @@ -53,8 +53,8 @@ public class BulkQueryEntities { */ public static final ImmutableMap JPA_ENTITIES_REPLACEMENTS = ImmutableMap.of( - DomainBase.class.getCanonicalName(), - DomainBaseLite.class.getCanonicalName(), + Domain.class.getCanonicalName(), + DomainLite.class.getCanonicalName(), DomainHistory.class.getCanonicalName(), DomainHistoryLite.class.getCanonicalName()); @@ -64,18 +64,18 @@ public class BulkQueryEntities { ImmutableList.of( DomainHost.class.getCanonicalName(), DomainHistoryHost.class.getCanonicalName()); - public static DomainBase assembleDomainBase( - DomainBaseLite domainBaseLite, + public static Domain assembleDomain( + DomainLite domainLite, ImmutableSet gracePeriods, ImmutableSet delegationSignerData, ImmutableSet> nsHosts) { - DomainBase.Builder builder = new DomainBase.Builder(); - builder.copyFrom(domainBaseLite); + Domain.Builder builder = new Domain.Builder(); + builder.copyFrom(domainLite); builder.setGracePeriods(gracePeriods); builder.setDsData(delegationSignerData); builder.setNameservers(nsHosts); // Restore the original update timestamp (this gets cleared when we set nameservers or DS data). - builder.setUpdateTimestamp(domainBaseLite.getUpdateTimestamp()); + builder.setUpdateTimestamp(domainLite.getUpdateTimestamp()); return builder.build(); } diff --git a/core/src/main/java/google/registry/model/bulkquery/DomainHistoryLite.java b/core/src/main/java/google/registry/model/bulkquery/DomainHistoryLite.java index 11af0cde5..db6584881 100644 --- a/core/src/main/java/google/registry/model/bulkquery/DomainHistoryLite.java +++ b/core/src/main/java/google/registry/model/bulkquery/DomainHistoryLite.java @@ -15,7 +15,7 @@ package google.registry.model.bulkquery; import com.googlecode.objectify.Key; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainContent; import google.registry.model.domain.DomainHistory; import google.registry.model.domain.DomainHistory.DomainHistoryId; @@ -49,7 +49,7 @@ import javax.persistence.PostLoad; @IdClass(DomainHistoryId.class) public class DomainHistoryLite extends HistoryEntry { - // Store DomainContent instead of DomainBase so we don't pick up its @Id + // Store DomainContent instead of Domain so we don't pick up its @Id // Nullable for the sake of pre-Registry-3.0 history objects @Nullable DomainContent domainContent; @@ -64,7 +64,7 @@ public class DomainHistoryLite extends HistoryEntry { /** This method is private because it is only used by Hibernate. */ @SuppressWarnings("unused") private void setDomainRepoId(String domainRepoId) { - parent = Key.create(DomainBase.class, domainRepoId); + parent = Key.create(Domain.class, domainRepoId); } @Override @@ -101,9 +101,9 @@ public class DomainHistoryLite extends HistoryEntry { return super.getId(); } - /** The key to the {@link DomainBase} this is based off of. */ - public VKey getParentVKey() { - return VKey.create(DomainBase.class, getDomainRepoId()); + /** The key to the {@link Domain} this is based off of. */ + public VKey getParentVKey() { + return VKey.create(Domain.class, getDomainRepoId()); } public DomainHistoryId getDomainHistoryId() { diff --git a/core/src/main/java/google/registry/model/bulkquery/DomainBaseLite.java b/core/src/main/java/google/registry/model/bulkquery/DomainLite.java similarity index 72% rename from core/src/main/java/google/registry/model/bulkquery/DomainBaseLite.java rename to core/src/main/java/google/registry/model/bulkquery/DomainLite.java index 7fc845ab2..75410e815 100644 --- a/core/src/main/java/google/registry/model/bulkquery/DomainBaseLite.java +++ b/core/src/main/java/google/registry/model/bulkquery/DomainLite.java @@ -14,7 +14,7 @@ package google.registry.model.bulkquery; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainContent; import google.registry.persistence.VKey; import google.registry.persistence.WithStringVKey; @@ -23,17 +23,17 @@ import javax.persistence.AccessType; import javax.persistence.Entity; /** - * A 'light' version of {@link DomainBase} with only base table ("Domain") attributes, which allows - * fast bulk loading. They are used in in-memory assembly of {@code DomainBase} instances along with + * A 'light' version of {@link Domain} with only base table ("Domain") attributes, which allows fast + * bulk loading. They are used in in-memory assembly of {@code Domain} instances along with * bulk-loaded child entities ({@code GracePeriod} etc). The in-memory assembly achieves much higher - * performance than loading {@code DomainBase} directly. + * performance than loading {@code Domain} directly. * *

Please refer to {@link BulkQueryEntities} for more information. */ @Entity(name = "Domain") @WithStringVKey @Access(AccessType.FIELD) -public class DomainBaseLite extends DomainContent { +public class DomainLite extends DomainContent { @Override @javax.persistence.Id @@ -42,7 +42,7 @@ public class DomainBaseLite extends DomainContent { return super.getRepoId(); } - public static VKey createVKey(String repoId) { - return VKey.createSql(DomainBaseLite.class, repoId); + public static VKey createVKey(String repoId) { + return VKey.createSql(DomainLite.class, repoId); } } diff --git a/core/src/main/java/google/registry/model/domain/DomainBase.java b/core/src/main/java/google/registry/model/domain/Domain.java similarity index 90% rename from core/src/main/java/google/registry/model/domain/DomainBase.java rename to core/src/main/java/google/registry/model/domain/Domain.java index 331089d3a..655581681 100644 --- a/core/src/main/java/google/registry/model/domain/DomainBase.java +++ b/core/src/main/java/google/registry/model/domain/Domain.java @@ -43,15 +43,11 @@ import org.joda.time.DateTime; /** * A persistable domain resource including mutable and non-mutable fields. * - *

For historical reasons, the name of this entity is "DomainBase". Ideally it would be - * "DomainResource" for linguistic parallelism with the other {@link EppResource} entity classes, - * but that would necessitate a complex data migration which isn't worth it. - * * @see RFC 5731 */ @ReportedOn @com.googlecode.objectify.annotation.Entity -@Entity(name = "Domain") +@Entity @Table( name = "Domain", indexes = { @@ -73,7 +69,7 @@ import org.joda.time.DateTime; @WithStringVKey @ExternalMessagingName("domain") @Access(AccessType.FIELD) -public class DomainBase extends DomainContent implements ForeignKeyedEppResource { +public class Domain extends DomainContent implements ForeignKeyedEppResource { @Override @javax.persistence.Id @@ -157,17 +153,17 @@ public class DomainBase extends DomainContent implements ForeignKeyedEppResource } @Override - public VKey createVKey() { - return VKey.create(DomainBase.class, getRepoId(), Key.create(this)); + public VKey createVKey() { + return VKey.create(Domain.class, getRepoId(), Key.create(this)); } @Override - public DomainBase cloneProjectedAtTime(final DateTime now) { + public Domain cloneProjectedAtTime(final DateTime now) { return cloneDomainProjectedAtTime(this, now); } - public static VKey createVKey(Key key) { - return VKey.create(DomainBase.class, key.getName(), key); + public static VKey createVKey(Key key) { + return VKey.create(Domain.class, key.getName(), key); } /** An override of {@link EppResource#asBuilder} with tighter typing. */ @@ -176,12 +172,12 @@ public class DomainBase extends DomainContent implements ForeignKeyedEppResource return new Builder(clone(this)); } - /** A builder for constructing {@link DomainBase}, since it is immutable. */ - public static class Builder extends DomainContent.Builder { + /** A builder for constructing {@link Domain}, since it is immutable. */ + public static class Builder extends DomainContent.Builder { public Builder() {} - Builder(DomainBase instance) { + Builder(Domain instance) { super(instance); } diff --git a/core/src/main/java/google/registry/model/domain/DomainCommand.java b/core/src/main/java/google/registry/model/domain/DomainCommand.java index 50ffe88e6..08d24acd8 100644 --- a/core/src/main/java/google/registry/model/domain/DomainCommand.java +++ b/core/src/main/java/google/registry/model/domain/DomainCommand.java @@ -54,7 +54,7 @@ import javax.xml.bind.annotation.XmlValue; import org.joda.time.DateTime; import org.joda.time.LocalDate; -/** A collection of {@link DomainBase} commands. */ +/** A collection of {@link Domain} commands. */ public class DomainCommand { /** The default validity period (if not specified) is 1 year for all operations. */ @@ -72,7 +72,7 @@ public class DomainCommand { /** The fields on "chgType" from RFC5731. */ @XmlTransient - public static class DomainCreateOrChange extends ImmutableObject + public static class DomainCreateOrChange extends ImmutableObject implements ResourceCreateOrChange { /** The contactId of the registrant who registered this domain. */ @@ -100,7 +100,7 @@ public class DomainCommand { } /** - * A create command for a {@link DomainBase}, mapping "createType" from RFC5731. */ @XmlRootElement @@ -113,7 +113,7 @@ public class DomainCommand { "foreignKeyedDesignatedContacts", "authInfo" }) - public static class Create extends DomainCreateOrChange + public static class Create extends DomainCreateOrChange implements CreateOrUpdate { /** Fully qualified domain name, which serves as a unique identifier for this domain. */ @@ -196,11 +196,11 @@ public class DomainCommand { } } - /** A delete command for a {@link DomainBase}. */ + /** A delete command for a {@link Domain}. */ @XmlRootElement public static class Delete extends AbstractSingleResourceCommand {} - /** An info request for a {@link DomainBase}. */ + /** An info request for a {@link Domain}. */ @XmlRootElement public static class Info extends ImmutableObject implements SingleResourceCommand { @@ -259,11 +259,11 @@ public class DomainCommand { } } - /** A check request for {@link DomainBase}. */ + /** A check request for {@link Domain}. */ @XmlRootElement public static class Check extends ResourceCheck {} - /** A renew command for a {@link DomainBase}. */ + /** A renew command for a {@link Domain}. */ @XmlRootElement public static class Renew extends AbstractSingleResourceCommand { @XmlElement(name = "curExpDate") @@ -281,7 +281,7 @@ public class DomainCommand { } } - /** A transfer operation for a {@link DomainBase}. */ + /** A transfer operation for a {@link Domain}. */ @XmlRootElement public static class Transfer extends AbstractSingleResourceCommand { /** The period to extend this domain's registration upon completion of the transfer. */ @@ -300,11 +300,10 @@ public class DomainCommand { } } - /** An update to a {@link DomainBase}. */ + /** An update to a {@link Domain}. */ @XmlRootElement @XmlType(propOrder = {"targetId", "innerAdd", "innerRemove", "innerChange"}) - public static class Update - extends ResourceUpdate + public static class Update extends ResourceUpdate implements CreateOrUpdate { @XmlElement(name = "chg") @@ -383,7 +382,7 @@ public class DomainCommand { /** The inner change type on a domain update command. */ @XmlType(propOrder = {"registrantContactId", "authInfo"}) - public static class Change extends DomainCreateOrChange { + public static class Change extends DomainCreateOrChange { /** Creates a copy of this {@link Change} with hard links to hosts and contacts. */ Change cloneAndLinkReferences(DateTime now) throws InvalidReferencesException { Change clone = clone(this); diff --git a/core/src/main/java/google/registry/model/domain/DomainContent.java b/core/src/main/java/google/registry/model/domain/DomainContent.java index 8b5aaaf51..40fee1f23 100644 --- a/core/src/main/java/google/registry/model/domain/DomainContent.java +++ b/core/src/main/java/google/registry/model/domain/DomainContent.java @@ -91,11 +91,6 @@ import org.joda.time.Interval; * foreign-keyed fields can refer to the proper parent entity's ID, whether we're storing this in * the DB itself or as part of another entity. * - *

For historical reasons, the name of this class is "DomainContent". Ideally it would be - * "DomainBase" for parallelism with the other {@link EppResource} entity classes, but because that - * name is already taken by {@link DomainBase} (also for historical reasons), we can't use it. Once - * we are no longer on Datastore, we can rename the classes. - * * @see RFC 5731 */ @MappedSuperclass @@ -294,7 +289,7 @@ public class DomainContent extends EppResource return Optional.ofNullable(dnsRefreshRequestTime); } - public static VKey restoreOfyFrom(Key domainKey, VKey key, Long historyId) { + public static VKey restoreOfyFrom(Key domainKey, VKey key, Long historyId) { if (historyId == null) { // This is a legacy key (or a null key, in which case this works too) return VKey.restoreOfyFrom(key, EntityGroupRoot.class, "per-tld"); @@ -707,10 +702,10 @@ public class DomainContent extends EppResource } @Override - public VKey createVKey() { + public VKey createVKey() { throw new UnsupportedOperationException( "DomainContent is not an actual persisted entity you can create a key to;" - + " use DomainBase instead"); + + " use Domain instead"); } /** Predicate to determine if a given {@link DesignatedContact} is the registrant. */ @@ -723,7 +718,7 @@ public class DomainContent extends EppResource return new Builder<>(clone(this)); } - /** A builder for constructing {@link DomainBase}, since it is immutable. */ + /** A builder for constructing {@link Domain}, since it is immutable. */ public static class Builder> extends EppResource.Builder implements BuilderWithTransferData { @@ -740,7 +735,7 @@ public class DomainContent extends EppResource if (DomainTransferData.EMPTY.equals(getInstance().transferData)) { setTransferData(null); } - // A DomainBase has status INACTIVE if there are no nameservers. + // A Domain has status INACTIVE if there are no nameservers. if (getInstance().getNameservers().isEmpty()) { addStatusValue(StatusValue.INACTIVE); } else { // There are nameservers, so make sure INACTIVE isn't there. diff --git a/core/src/main/java/google/registry/model/domain/DomainHistory.java b/core/src/main/java/google/registry/model/domain/DomainHistory.java index 5b1b1c3b9..5aae9deca 100644 --- a/core/src/main/java/google/registry/model/domain/DomainHistory.java +++ b/core/src/main/java/google/registry/model/domain/DomainHistory.java @@ -80,7 +80,7 @@ import org.hibernate.Hibernate; @IdClass(DomainHistoryId.class) public class DomainHistory extends HistoryEntry { - // Store DomainContent instead of DomainBase so we don't pick up its @Id + // Store DomainContent instead of Domain so we don't pick up its @Id // Nullable for the sake of pre-Registry-3.0 history objects @DoNotCompare @Nullable DomainContent domainContent; @@ -95,7 +95,7 @@ public class DomainHistory extends HistoryEntry { /** This method is private because it is only used by Hibernate. */ @SuppressWarnings("unused") private void setDomainRepoId(String domainRepoId) { - parent = Key.create(DomainBase.class, domainRepoId); + parent = Key.create(Domain.class, domainRepoId); } // We could have reused domainContent.nsHosts here, but Hibernate throws a weird exception after @@ -241,9 +241,9 @@ public class DomainHistory extends HistoryEntry { return Optional.ofNullable(domainContent); } - /** The key to the {@link DomainBase} this is based off of. */ - public VKey getParentVKey() { - return VKey.create(DomainBase.class, getDomainRepoId()); + /** The key to the {@link Domain} this is based off of. */ + public VKey getParentVKey() { + return VKey.create(Domain.class, getDomainRepoId()); } public Set getGracePeriodHistories() { @@ -260,7 +260,7 @@ public class DomainHistory extends HistoryEntry { @Override public Optional getResourceAtPointInTime() { return getDomainContent() - .map(domainContent -> new DomainBase.Builder().copyFrom(domainContent).build()); + .map(domainContent -> new Domain.Builder().copyFrom(domainContent).build()); } @PostLoad @@ -377,20 +377,20 @@ public class DomainHistory extends HistoryEntry { if (domainContent == null) { return this; } - // TODO(b/203609982): if actual type of domainContent is DomainBase, convert to DomainContent - // Note: a DomainHistory fetched by JPA has DomainContent in this field. Allowing DomainBase + // TODO(b/203609982): if actual type of domainContent is Domain, convert to DomainContent + // Note: a DomainHistory fetched by JPA has DomainContent in this field. Allowing Domain // in the setter makes equality checks messy. getInstance().domainContent = domainContent; - if (domainContent instanceof DomainBase) { + if (domainContent instanceof Domain) { super.setParent(domainContent); } else { - super.setParent(Key.create(DomainBase.class, domainContent.getRepoId())); + super.setParent(Key.create(Domain.class, domainContent.getRepoId())); } return this; } public Builder setDomainRepoId(String domainRepoId) { - getInstance().parent = Key.create(DomainBase.class, domainRepoId); + getInstance().parent = Key.create(Domain.class, domainRepoId); return this; } diff --git a/core/src/main/java/google/registry/model/domain/GracePeriod.java b/core/src/main/java/google/registry/model/domain/GracePeriod.java index 94dc6adb7..877e4e388 100644 --- a/core/src/main/java/google/registry/model/domain/GracePeriod.java +++ b/core/src/main/java/google/registry/model/domain/GracePeriod.java @@ -37,8 +37,8 @@ import org.joda.time.DateTime; /** * A domain grace period with an expiration time. * - *

When a grace period expires, it is lazily removed from the {@link DomainBase} the next time - * the resource is loaded from Datastore. + *

When a grace period expires, it is lazily removed from the {@link Domain} the next time the + * resource is loaded from Datastore. */ @Embed @Entity diff --git a/core/src/main/java/google/registry/model/eppcommon/StatusValue.java b/core/src/main/java/google/registry/model/eppcommon/StatusValue.java index 0991fc902..904700145 100644 --- a/core/src/main/java/google/registry/model/eppcommon/StatusValue.java +++ b/core/src/main/java/google/registry/model/eppcommon/StatusValue.java @@ -22,7 +22,7 @@ import com.google.common.collect.ImmutableSet; import google.registry.model.EppResource; import google.registry.model.contact.ContactBase; import google.registry.model.contact.ContactResource; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainContent; import google.registry.model.host.HostBase; import google.registry.model.host.HostResource; @@ -133,11 +133,11 @@ public enum StatusValue implements EppEnum { ContactBase.class, ContactResource.class, DomainContent.class, - DomainBase.class, + Domain.class, HostBase.class, HostResource.class), NONE, - DOMAINS(DomainContent.class, DomainBase.class); + DOMAINS(DomainContent.class, Domain.class); private final ImmutableSet> classes; diff --git a/core/src/main/java/google/registry/model/host/HostBase.java b/core/src/main/java/google/registry/model/host/HostBase.java index f1826c4b5..f2ba52c7b 100644 --- a/core/src/main/java/google/registry/model/host/HostBase.java +++ b/core/src/main/java/google/registry/model/host/HostBase.java @@ -26,7 +26,7 @@ import com.googlecode.objectify.annotation.IgnoreSave; import com.googlecode.objectify.annotation.Index; import com.googlecode.objectify.condition.IfNull; import google.registry.model.EppResource; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.transfer.TransferData; import google.registry.persistence.VKey; import java.net.InetAddress; @@ -76,7 +76,7 @@ public class HostBase extends EppResource { @Index @IgnoreSave(IfNull.class) @DoNotHydrate - VKey superordinateDomain; + VKey superordinateDomain; /** * The time that this resource was last transferred. @@ -98,7 +98,7 @@ public class HostBase extends EppResource { return fullyQualifiedHostName; } - public VKey getSuperordinateDomain() { + public VKey getSuperordinateDomain() { return superordinateDomain; } @@ -155,7 +155,7 @@ public class HostBase extends EppResource { * {@link #superordinateDomain} field. Passing it as a parameter allows the caller to control * the degree of consistency used to load it. */ - public DateTime computeLastTransferTime(@Nullable DomainBase superordinateDomain) { + public DateTime computeLastTransferTime(@Nullable Domain superordinateDomain) { if (!isSubordinate()) { checkArgument(superordinateDomain == null); return getLastTransferTime(); @@ -222,7 +222,7 @@ public class HostBase extends EppResource { ImmutableSet.copyOf(difference(getInstance().getInetAddresses(), inetAddresses))); } - public B setSuperordinateDomain(VKey superordinateDomain) { + public B setSuperordinateDomain(VKey superordinateDomain) { getInstance().superordinateDomain = superordinateDomain; return thisCastToDerived(); } diff --git a/core/src/main/java/google/registry/model/index/ForeignKeyIndex.java b/core/src/main/java/google/registry/model/index/ForeignKeyIndex.java index 2ac3b6907..208db9a5b 100644 --- a/core/src/main/java/google/registry/model/index/ForeignKeyIndex.java +++ b/core/src/main/java/google/registry/model/index/ForeignKeyIndex.java @@ -48,7 +48,7 @@ import google.registry.model.EppResource; import google.registry.model.annotations.DeleteAfterMigration; import google.registry.model.annotations.ReportedOn; import google.registry.model.contact.ContactResource; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.host.HostResource; import google.registry.persistence.VKey; import google.registry.persistence.transaction.CriteriaQueryBuilder; @@ -75,10 +75,10 @@ public abstract class ForeignKeyIndex extends BackupGroup @Entity public static class ForeignKeyContactIndex extends ForeignKeyIndex {} - /** The {@link ForeignKeyIndex} type for {@link DomainBase} entities. */ + /** The {@link ForeignKeyIndex} type for {@link Domain} entities. */ @ReportedOn @Entity - public static class ForeignKeyDomainIndex extends ForeignKeyIndex {} + public static class ForeignKeyDomainIndex extends ForeignKeyIndex {} /** The {@link ForeignKeyIndex} type for {@link HostResource} entities. */ @ReportedOn @@ -90,14 +90,14 @@ public abstract class ForeignKeyIndex extends BackupGroup RESOURCE_CLASS_TO_FKI_CLASS = ImmutableBiMap.of( ContactResource.class, ForeignKeyContactIndex.class, - DomainBase.class, ForeignKeyDomainIndex.class, + Domain.class, ForeignKeyDomainIndex.class, HostResource.class, ForeignKeyHostIndex.class); private static final ImmutableMap, String> RESOURCE_CLASS_TO_FKI_PROPERTY = ImmutableMap.of( ContactResource.class, "contactId", - DomainBase.class, "fullyQualifiedDomainName", + Domain.class, "fullyQualifiedDomainName", HostResource.class, "fullyQualifiedHostName"); @Id String foreignKey; diff --git a/core/src/main/java/google/registry/model/package-info.java b/core/src/main/java/google/registry/model/package-info.java index cd95b4721..597ef539e 100644 --- a/core/src/main/java/google/registry/model/package-info.java +++ b/core/src/main/java/google/registry/model/package-info.java @@ -33,7 +33,7 @@ import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; * via Objectify. * *

All first class entities are represented as a resource class - {@link - * google.registry.model.domain.DomainBase}, {@link google.registry.model.host.HostResource}, {@link + * google.registry.model.domain.Domain}, {@link google.registry.model.host.HostResource}, {@link * google.registry.model.contact.ContactResource}, and {@link * google.registry.model.registrar.Registrar}. Resource objects are written in a single shared * entity group per TLD. All commands that operate on those entities are grouped in a "Command" diff --git a/core/src/main/java/google/registry/model/poll/PollMessage.java b/core/src/main/java/google/registry/model/poll/PollMessage.java index 5430838b4..44922d3ae 100644 --- a/core/src/main/java/google/registry/model/poll/PollMessage.java +++ b/core/src/main/java/google/registry/model/poll/PollMessage.java @@ -35,7 +35,7 @@ import google.registry.model.annotations.ReportedOn; import google.registry.model.contact.ContactHistory; import google.registry.model.contact.ContactHistory.ContactHistoryId; import google.registry.model.contact.ContactResource; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainHistory; import google.registry.model.domain.DomainHistory.DomainHistoryId; import google.registry.model.domain.DomainRenewData; @@ -103,7 +103,7 @@ public abstract class PollMessage extends ImmutableObject /** Indicates the type of entity the poll message is for. */ public enum Type { - DOMAIN(1L, DomainBase.class), + DOMAIN(1L, Domain.class), CONTACT(2L, ContactResource.class), HOST(3L, HostResource.class); diff --git a/core/src/main/java/google/registry/model/reporting/HistoryEntry.java b/core/src/main/java/google/registry/model/reporting/HistoryEntry.java index 54f87f9ea..3aeb0753c 100644 --- a/core/src/main/java/google/registry/model/reporting/HistoryEntry.java +++ b/core/src/main/java/google/registry/model/reporting/HistoryEntry.java @@ -38,7 +38,7 @@ import google.registry.model.contact.ContactBase; import google.registry.model.contact.ContactHistory; import google.registry.model.contact.ContactHistory.ContactHistoryId; import google.registry.model.contact.ContactResource; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainContent; import google.registry.model.domain.DomainHistory; import google.registry.model.domain.DomainHistory.DomainHistoryId; @@ -386,7 +386,7 @@ public class HistoryEntry extends ImmutableObject implements Buildable, UnsafeSe String parentKind = getParent().getKind(); final HistoryEntry resultEntity; // can't use a switch statement since we're calling getKind() - if (parentKind.equals(getKind(DomainBase.class))) { + if (parentKind.equals(getKind(Domain.class))) { resultEntity = new DomainHistory.Builder().copyFrom(this).setDomainRepoId(parent.getName()).build(); } else if (parentKind.equals(getKind(HostResource.class))) { @@ -408,7 +408,7 @@ public class HistoryEntry extends ImmutableObject implements Buildable, UnsafeSe long id = key.getId(); Key parent = key.getParent(); String parentKind = parent.getKind(); - if (parentKind.equals(getKind(DomainBase.class))) { + if (parentKind.equals(getKind(Domain.class))) { return VKey.create( DomainHistory.class, new DomainHistoryId(repoId, id), diff --git a/core/src/main/java/google/registry/model/reporting/HistoryEntryDao.java b/core/src/main/java/google/registry/model/reporting/HistoryEntryDao.java index 1fcdebffc..dc80f21ac 100644 --- a/core/src/main/java/google/registry/model/reporting/HistoryEntryDao.java +++ b/core/src/main/java/google/registry/model/reporting/HistoryEntryDao.java @@ -27,7 +27,7 @@ import com.google.common.collect.Streams; import google.registry.model.EppResource; import google.registry.model.contact.ContactHistory; import google.registry.model.contact.ContactResource; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainHistory; import google.registry.model.host.HostHistory; import google.registry.model.host.HostResource; @@ -53,7 +53,7 @@ public class HistoryEntryDao { ImmutableMap.of( ContactResource.class, ContactHistory.class, - DomainBase.class, + Domain.class, DomainHistory.class, HostResource.class, HostHistory.class); diff --git a/core/src/main/java/google/registry/persistence/DomainHistoryVKey.java b/core/src/main/java/google/registry/persistence/DomainHistoryVKey.java index 00dd17bfa..e0a42b2aa 100644 --- a/core/src/main/java/google/registry/persistence/DomainHistoryVKey.java +++ b/core/src/main/java/google/registry/persistence/DomainHistoryVKey.java @@ -17,16 +17,16 @@ package google.registry.persistence; import static google.registry.util.PreconditionsUtils.checkArgumentNotNull; import com.googlecode.objectify.Key; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainHistory; import google.registry.model.domain.DomainHistory.DomainHistoryId; import google.registry.model.reporting.HistoryEntry; import java.io.Serializable; import javax.persistence.Embeddable; -/** {@link VKey} for {@link HistoryEntry} which parent is {@link DomainBase}. */ +/** {@link VKey} for {@link HistoryEntry} which parent is {@link Domain}. */ @Embeddable -public class DomainHistoryVKey extends EppHistoryVKey { +public class DomainHistoryVKey extends EppHistoryVKey { // Hibernate requires a default constructor private DomainHistoryVKey() {} @@ -52,6 +52,6 @@ public class DomainHistoryVKey extends EppHistoryVKey return VKey.create( DomainHistory.class, createSqlKey(), - Key.create(Key.create(DomainBase.class, repoId), DomainHistory.class, historyRevisionId)); + Key.create(Key.create(Domain.class, repoId), DomainHistory.class, historyRevisionId)); } } diff --git a/core/src/main/java/google/registry/persistence/EppHistoryVKey.java b/core/src/main/java/google/registry/persistence/EppHistoryVKey.java index 3b1df7ed6..8adeea2be 100644 --- a/core/src/main/java/google/registry/persistence/EppHistoryVKey.java +++ b/core/src/main/java/google/registry/persistence/EppHistoryVKey.java @@ -78,7 +78,7 @@ public abstract class EppHistoryVKey extends Immutable * Creates the kind path for the given ofyKey}. * *

The kind path is a string including all kind names(delimited by slash) of a hierarchical - * {@link Key}, e.g., the kind path for BillingEvent.OneTime is "DomainBase/HistoryEntry/OneTime". + * {@link Key}, e.g., the kind path for BillingEvent.OneTime is "Domain/HistoryEntry/OneTime". */ @Nullable public static String createKindPath(@Nullable Key ofyKey) { diff --git a/core/src/main/java/google/registry/persistence/VKey.java b/core/src/main/java/google/registry/persistence/VKey.java index fccf6a93b..9983036da 100644 --- a/core/src/main/java/google/registry/persistence/VKey.java +++ b/core/src/main/java/google/registry/persistence/VKey.java @@ -177,10 +177,10 @@ public class VKey extends ImmutableObject implements Serializable { * kind of the ancestor key and the value is either a String or a Long. * *

For example, to restore the objectify key for - * DomainBase("COM-1234")/HistoryEntry(123)/PollEvent(567), one might use: + * Domain("COM-1234")/HistoryEntry(123)/PollEvent(567), one might use: * *

{@code
-   * pollEvent.restoreOfy(DomainBase.class, "COM-1234", HistoryEntry.class, 567)
+   * pollEvent.restoreOfy(Domain.class, "COM-1234", HistoryEntry.class, 567)
    * }
* *

The final key id or name is obtained from the SQL key. It is assumed that this value must be diff --git a/core/src/main/java/google/registry/rdap/RdapDomainAction.java b/core/src/main/java/google/registry/rdap/RdapDomainAction.java index cbcf697b6..bb5772761 100644 --- a/core/src/main/java/google/registry/rdap/RdapDomainAction.java +++ b/core/src/main/java/google/registry/rdap/RdapDomainAction.java @@ -21,7 +21,7 @@ import static google.registry.request.Action.Method.HEAD; import static google.registry.util.DateTimeUtils.START_OF_TIME; import google.registry.flows.EppException; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.rdap.RdapJsonFormatter.OutputDataType; import google.registry.rdap.RdapMetrics.EndpointType; import google.registry.rdap.RdapObjectClasses.RdapDomain; @@ -59,12 +59,12 @@ public class RdapDomainAction extends RdapActionBase { pathSearchString, getHumanReadableObjectTypeName(), e.getMessage())); } // The query string is not used; the RDAP syntax is /rdap/domain/mydomain.com. - Optional domainBase = + Optional domain = loadByForeignKey( - DomainBase.class, + Domain.class, pathSearchString, shouldIncludeDeleted() ? START_OF_TIME : rdapJsonFormatter.getRequestTime()); - if (!domainBase.isPresent() || !isAuthorized(domainBase.get())) { + if (!domain.isPresent() || !isAuthorized(domain.get())) { // RFC7480 5.3 - if the server wishes to respond that it doesn't have data satisfying the // query, it MUST reply with 404 response code. // @@ -72,6 +72,6 @@ public class RdapDomainAction extends RdapActionBase { // exists but we don't want to show it to you", because we DON'T wish to say that. throw new NotFoundException(pathSearchString + " not found"); } - return rdapJsonFormatter.createRdapDomain(domainBase.get(), OutputDataType.FULL); + return rdapJsonFormatter.createRdapDomain(domain.get(), OutputDataType.FULL); } } diff --git a/core/src/main/java/google/registry/rdap/RdapDomainSearchAction.java b/core/src/main/java/google/registry/rdap/RdapDomainSearchAction.java index 953f2ccb0..a199b9039 100644 --- a/core/src/main/java/google/registry/rdap/RdapDomainSearchAction.java +++ b/core/src/main/java/google/registry/rdap/RdapDomainSearchAction.java @@ -36,7 +36,7 @@ import com.google.common.flogger.FluentLogger; import com.google.common.net.InetAddresses; import com.google.common.primitives.Booleans; import com.googlecode.objectify.cmd.Query; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.host.HostResource; import google.registry.persistence.VKey; import google.registry.persistence.transaction.CriteriaQueryBuilder; @@ -187,10 +187,10 @@ public class RdapDomainSearchAction extends RdapSearchActionBase { /** Searches for domains by domain name without a wildcard or interest in deleted entries. */ private DomainSearchResponse searchByDomainNameWithoutWildcard( final RdapSearchPattern partialStringQuery) { - Optional domainBase = - loadByForeignKey(DomainBase.class, partialStringQuery.getInitialString(), getRequestTime()); + Optional domain = + loadByForeignKey(Domain.class, partialStringQuery.getInitialString(), getRequestTime()); return makeSearchResults( - shouldBeVisible(domainBase) ? ImmutableList.of(domainBase.get()) : ImmutableList.of()); + shouldBeVisible(domain) ? ImmutableList.of(domain.get()) : ImmutableList.of()); } /** Searches for domains by domain name with an initial string, wildcard and possible suffix. */ @@ -206,12 +206,12 @@ public class RdapDomainSearchAction extends RdapSearchActionBase { // domains directly, rather than the foreign keys, because then we have an index on TLD if we // need it. int querySizeLimit = RESULT_SET_SIZE_SCALING_FACTOR * rdapResultSetMaxSize; - RdapResultSet resultSet; + RdapResultSet resultSet; if (tm().isOfy()) { - Query query = + Query query = auditedOfy() .load() - .type(DomainBase.class) + .type(Domain.class) .filter("fullyQualifiedDomainName <", partialStringQuery.getNextInitialString()) .filter("fullyQualifiedDomainName >=", partialStringQuery.getInitialString()); if (cursorString.isPresent()) { @@ -230,8 +230,8 @@ public class RdapDomainSearchAction extends RdapSearchActionBase { () -> { CriteriaBuilder criteriaBuilder = replicaJpaTm().getEntityManager().getCriteriaBuilder(); - CriteriaQueryBuilder queryBuilder = - CriteriaQueryBuilder.create(replicaJpaTm(), DomainBase.class) + CriteriaQueryBuilder queryBuilder = + CriteriaQueryBuilder.create(replicaJpaTm(), Domain.class) .where( "fullyQualifiedDomainName", criteriaBuilder::like, @@ -262,9 +262,9 @@ public class RdapDomainSearchAction extends RdapSearchActionBase { // searchByDomainNameWithInitialString, unable to perform an inequality query on deletion time. // Don't use queryItems, because it doesn't handle pending deletes. int querySizeLimit = RESULT_SET_SIZE_SCALING_FACTOR * rdapResultSetMaxSize; - RdapResultSet resultSet; + RdapResultSet resultSet; if (tm().isOfy()) { - Query query = auditedOfy().load().type(DomainBase.class).filter("tld", tld); + Query query = auditedOfy().load().type(Domain.class).filter("tld", tld); if (cursorString.isPresent()) { query = query.filter("fullyQualifiedDomainName >", cursorString.get()); } @@ -275,9 +275,9 @@ public class RdapDomainSearchAction extends RdapSearchActionBase { replicaJpaTm() .transact( () -> { - CriteriaQueryBuilder builder = + CriteriaQueryBuilder builder = queryItemsSql( - DomainBase.class, + Domain.class, "tld", tld, Optional.of("fullyQualifiedDomainName"), @@ -414,9 +414,9 @@ public class RdapDomainSearchAction extends RdapSearchActionBase { // The suffix must be a domain that we manage. That way, we can look up the domain and search // through the subordinate hosts. This is more efficient, and lets us permit wildcard searches // with no initial string. - DomainBase domainBase = + Domain domain = loadByForeignKey( - DomainBase.class, + Domain.class, partialStringQuery.getSuffix(), shouldIncludeDeleted() ? START_OF_TIME : getRequestTime()) .orElseThrow( @@ -426,7 +426,7 @@ public class RdapDomainSearchAction extends RdapSearchActionBase { + "must be a domain defined in the system")); Optional desiredRegistrar = getDesiredRegistrar(); ImmutableList.Builder> builder = new ImmutableList.Builder<>(); - for (String fqhn : ImmutableSortedSet.copyOf(domainBase.getSubordinateHosts())) { + for (String fqhn : ImmutableSortedSet.copyOf(domain.getSubordinateHosts())) { // We can't just check that the host name starts with the initial query string, because // then the query ns.exam*.example.com would match against nameserver ns.example.com. if (partialStringQuery.matches(fqhn)) { @@ -542,19 +542,19 @@ public class RdapDomainSearchAction extends RdapSearchActionBase { // We must break the query up into chunks, because the in operator is limited to 30 subqueries. // Since it is possible for the same domain to show up more than once in our result list (if // we do a wildcard nameserver search that returns multiple nameservers used by the same - // domain), we must create a set of resulting {@link DomainBase} objects. Use a sorted set, + // domain), we must create a set of resulting {@link Domain} objects. Use a sorted set, // and fetch all domains, to make sure that we can return the first domains in alphabetical // order. - ImmutableSortedSet.Builder domainSetBuilder = - ImmutableSortedSet.orderedBy(Comparator.comparing(DomainBase::getDomainName)); + ImmutableSortedSet.Builder domainSetBuilder = + ImmutableSortedSet.orderedBy(Comparator.comparing(Domain::getDomainName)); int numHostKeysSearched = 0; for (List> chunk : Iterables.partition(hostKeys, 30)) { numHostKeysSearched += chunk.size(); if (tm().isOfy()) { - Query query = + Query query = auditedOfy() .load() - .type(DomainBase.class) + .type(Domain.class) .filter( "nsHosts in", chunk.stream().map(VKey::getOfyKey).collect(toImmutableSet())); if (!shouldIncludeDeleted()) { @@ -564,7 +564,7 @@ public class RdapDomainSearchAction extends RdapSearchActionBase { } else if (cursorString.isPresent()) { query = query.filter("fullyQualifiedDomainName >", cursorString.get()); } - Stream stream = Streams.stream(query).filter(this::isAuthorized); + Stream stream = Streams.stream(query).filter(this::isAuthorized); if (cursorString.isPresent()) { stream = stream.filter(domain -> (domain.getDomainName().compareTo(cursorString.get()) > 0)); @@ -575,8 +575,8 @@ public class RdapDomainSearchAction extends RdapSearchActionBase { .transact( () -> { for (VKey hostKey : hostKeys) { - CriteriaQueryBuilder queryBuilder = - CriteriaQueryBuilder.create(replicaJpaTm(), DomainBase.class) + CriteriaQueryBuilder queryBuilder = + CriteriaQueryBuilder.create(replicaJpaTm(), Domain.class) .whereFieldContains("nsHosts", hostKey) .orderByAsc("fullyQualifiedDomainName"); CriteriaBuilder criteriaBuilder = @@ -606,7 +606,7 @@ public class RdapDomainSearchAction extends RdapSearchActionBase { }); } } - List domains = domainSetBuilder.build().asList(); + List domains = domainSetBuilder.build().asList(); metricInformationBuilder.setNumHostsRetrieved(numHostKeysSearched); // If everything that we found will fit in the result, check whether there might have been // more results that got dropped because the first stage limit on number of nameservers. If @@ -620,13 +620,13 @@ public class RdapDomainSearchAction extends RdapSearchActionBase { } /** Output JSON for a list of domains, with no incompleteness warnings. */ - private DomainSearchResponse makeSearchResults(List domains) { + private DomainSearchResponse makeSearchResults(List domains) { return makeSearchResults( domains, IncompletenessWarningType.COMPLETE, Optional.of((long) domains.size())); } /** Output JSON from data in an {@link RdapResultSet} object. */ - private DomainSearchResponse makeSearchResults(RdapResultSet resultSet) { + private DomainSearchResponse makeSearchResults(RdapResultSet resultSet) { return makeSearchResults( resultSet.resources(), resultSet.incompletenessWarningType(), @@ -641,7 +641,7 @@ public class RdapDomainSearchAction extends RdapSearchActionBase { * maximum number of nameservers in the first stage query. */ private DomainSearchResponse makeSearchResults( - List domains, + List domains, IncompletenessWarningType incompletenessWarningType, Optional numDomainsRetrieved) { numDomainsRetrieved.ifPresent(metricInformationBuilder::setNumDomainsRetrieved); @@ -650,7 +650,7 @@ public class RdapDomainSearchAction extends RdapSearchActionBase { DomainSearchResponse.Builder builder = DomainSearchResponse.builder().setIncompletenessWarningType(incompletenessWarningType); Optional newCursor = Optional.empty(); - for (DomainBase domain : Iterables.limit(domains, rdapResultSetMaxSize)) { + for (Domain domain : Iterables.limit(domains, rdapResultSetMaxSize)) { newCursor = Optional.of(domain.getDomainName()); builder .domainSearchResultsBuilder() diff --git a/core/src/main/java/google/registry/rdap/RdapJsonFormatter.java b/core/src/main/java/google/registry/rdap/RdapJsonFormatter.java index 98c0d83d6..5ae6acac3 100644 --- a/core/src/main/java/google/registry/rdap/RdapJsonFormatter.java +++ b/core/src/main/java/google/registry/rdap/RdapJsonFormatter.java @@ -45,7 +45,7 @@ import google.registry.model.contact.ContactResource; import google.registry.model.contact.PostalInfo; import google.registry.model.domain.DesignatedContact; import google.registry.model.domain.DesignatedContact.Type; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.eppcommon.Address; import google.registry.model.eppcommon.StatusValue; import google.registry.model.host.HostResource; @@ -267,7 +267,7 @@ public class RdapJsonFormatter { } /** - * Creates a JSON object for a {@link DomainBase}. + * Creates a JSON object for a {@link Domain}. * *

NOTE that domain searches aren't in the spec yet - they're in the RFC 9082 that describes * the query format, but they aren't in the RDAP Technical Implementation Guide 15feb19, meaning @@ -276,20 +276,20 @@ public class RdapJsonFormatter { *

We're implementing domain searches anyway, BUT we won't have the response for searches * conform to the RDAP Response Profile. * - * @param domainBase the domain resource object from which the JSON object should be created + * @param domain the domain resource object from which the JSON object should be created * @param outputDataType whether to generate FULL or SUMMARY data. Domains are never INTERNAL. */ - RdapDomain createRdapDomain(DomainBase domainBase, OutputDataType outputDataType) { + RdapDomain createRdapDomain(Domain domain, OutputDataType outputDataType) { RdapDomain.Builder builder = RdapDomain.builder(); - builder.linksBuilder().add(makeSelfLink("domain", domainBase.getDomainName())); + builder.linksBuilder().add(makeSelfLink("domain", domain.getDomainName())); if (outputDataType != OutputDataType.FULL) { builder.remarksBuilder().add(RdapIcannStandardInformation.SUMMARY_DATA_REMARK); } // RDAP Response Profile 15feb19 section 2.1 discusses the domain name. - builder.setLdhName(domainBase.getDomainName()); + builder.setLdhName(domain.getDomainName()); // RDAP Response Profile 15feb19 section 2.2: // The domain handle MUST be the ROID - builder.setHandle(domainBase.getRepoId()); + builder.setHandle(domain.getRepoId()); // If this is a summary (search result) - we'll return now. Since there's no requirement for // domain searches at all, having the name, handle, and self link is enough. if (outputDataType == OutputDataType.SUMMARY) { @@ -304,12 +304,12 @@ public class RdapJsonFormatter { Event.builder() .setEventAction(EventAction.REGISTRATION) .setEventActor( - Optional.ofNullable(domainBase.getCreationRegistrarId()).orElse("(none)")) - .setEventDate(domainBase.getCreationTime()) + Optional.ofNullable(domain.getCreationRegistrarId()).orElse("(none)")) + .setEventDate(domain.getCreationTime()) .build(), Event.builder() .setEventAction(EventAction.EXPIRATION) - .setEventDate(domainBase.getRegistrationExpirationTime()) + .setEventDate(domain.getRegistrationExpirationTime()) .build(), Event.builder() .setEventAction(EventAction.LAST_UPDATE_OF_RDAP_DATABASE) @@ -317,18 +317,18 @@ public class RdapJsonFormatter { .build()); // RDAP Response Profile 15feb19 section 2.3.2 discusses optional events. We add some of those // here. We also add a few others we find interesting. - builder.eventsBuilder().addAll(makeOptionalEvents(domainBase)); + builder.eventsBuilder().addAll(makeOptionalEvents(domain)); // RDAP Response Profile 15feb19 section 2.4.1: // The domain object in the RDAP response MUST contain an entity with the Registrar role. // // See {@link createRdapRegistrarEntity} for details of section 2.4 conformance Registrar registrar = - Registrar.loadRequiredRegistrarCached(domainBase.getCurrentSponsorRegistrarId()); + Registrar.loadRequiredRegistrarCached(domain.getCurrentSponsorRegistrarId()); builder.entitiesBuilder().add(createRdapRegistrarEntity(registrar, OutputDataType.INTERNAL)); // RDAP Technical Implementation Guide 3.2: must have link to the registrar's RDAP URL for this // domain, with rel=related. for (String registrarRdapBase : registrar.getRdapBaseUrls()) { - String href = makeServerRelativeUrl(registrarRdapBase, "domain", domainBase.getDomainName()); + String href = makeServerRelativeUrl(registrarRdapBase, "domain", domain.getDomainName()); builder .linksBuilder() .add( @@ -342,14 +342,14 @@ public class RdapJsonFormatter { // makeStatusValueList should in theory always contain one of either "active" or "inactive". ImmutableSet status = makeStatusValueList( - domainBase.getStatusValues(), + domain.getStatusValues(), false, // isRedacted - domainBase.getDeletionTime().isBefore(getRequestTime())); + domain.getDeletionTime().isBefore(getRequestTime())); builder.statusBuilder().addAll(status); if (status.isEmpty()) { logger.atWarning().log( "Domain %s (ROID %s) doesn't have any status.", - domainBase.getDomainName(), domainBase.getRepoId()); + domain.getDomainName(), domain.getRepoId()); } // RDAP Response Profile 2.6.3, must have a notice about statuses. That is in {@link // RdapIcannStandardInformation#domainBoilerplateNotices} @@ -357,11 +357,10 @@ public class RdapJsonFormatter { // Kick off the database loads of the nameservers that we will need, so it can load // asynchronously while we load and process the contacts. ImmutableSet loadedHosts = - tm().transact( - () -> ImmutableSet.copyOf(tm().loadByKeys(domainBase.getNameservers()).values())); + tm().transact(() -> ImmutableSet.copyOf(tm().loadByKeys(domain.getNameservers()).values())); // Load the registrant and other contacts and add them to the data. ImmutableMap, ContactResource> loadedContacts = - tm().transact(() -> tm().loadByKeysIfPresent(domainBase.getReferencedContacts())); + tm().transact(() -> tm().loadByKeysIfPresent(domain.getReferencedContacts())); // RDAP Response Profile 2.7.3, A domain MUST have the REGISTRANT, ADMIN, TECH roles and MAY // have others. We also add the BILLING. // @@ -371,8 +370,8 @@ public class RdapJsonFormatter { // the GDPR redaction is handled in createRdapContactEntity ImmutableSetMultimap, Type> contactsToRoles = Streams.concat( - domainBase.getContacts().stream(), - Stream.of(DesignatedContact.create(Type.REGISTRANT, domainBase.getRegistrant()))) + domain.getContacts().stream(), + Stream.of(DesignatedContact.create(Type.REGISTRANT, domain.getRegistrant()))) .sorted(DESIGNATED_CONTACT_ORDERING) .collect( toImmutableSetMultimap( @@ -404,7 +403,7 @@ public class RdapJsonFormatter { // // TODO(b/133310221): get the zoneSigned value from the config files. SecureDns.Builder secureDnsBuilder = SecureDns.builder().setZoneSigned(true); - domainBase.getDsData().forEach(secureDnsBuilder::addDsData); + domain.getDsData().forEach(secureDnsBuilder::addDsData); builder.setSecureDns(secureDnsBuilder.build()); return builder.build(); diff --git a/core/src/main/java/google/registry/rdap/RdapNameserverSearchAction.java b/core/src/main/java/google/registry/rdap/RdapNameserverSearchAction.java index abd1bab29..9a0bc8588 100644 --- a/core/src/main/java/google/registry/rdap/RdapNameserverSearchAction.java +++ b/core/src/main/java/google/registry/rdap/RdapNameserverSearchAction.java @@ -27,7 +27,7 @@ import com.google.common.collect.Iterables; import com.google.common.net.InetAddresses; import com.google.common.primitives.Booleans; import com.googlecode.objectify.cmd.Query; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.host.HostResource; import google.registry.persistence.transaction.CriteriaQueryBuilder; import google.registry.rdap.RdapJsonFormatter.OutputDataType; @@ -176,9 +176,9 @@ public class RdapNameserverSearchAction extends RdapSearchActionBase { /** Searches for nameservers by name using the superordinate domain as a suffix. */ private NameserverSearchResponse searchByNameUsingSuperordinateDomain( RdapSearchPattern partialStringQuery) { - Optional domainBase = - loadByForeignKey(DomainBase.class, partialStringQuery.getSuffix(), getRequestTime()); - if (!domainBase.isPresent()) { + Optional domain = + loadByForeignKey(Domain.class, partialStringQuery.getSuffix(), getRequestTime()); + if (!domain.isPresent()) { // Don't allow wildcards with suffixes which are not domains we manage. That would risk a // table scan in many easily foreseeable cases. The user might ask for ns*.zombo.com, // forcing us to query for all hosts beginning with ns, then filter for those ending in @@ -188,7 +188,7 @@ public class RdapNameserverSearchAction extends RdapSearchActionBase { "A suffix after a wildcard in a nameserver lookup must be an in-bailiwick domain"); } List hostList = new ArrayList<>(); - for (String fqhn : ImmutableSortedSet.copyOf(domainBase.get().getSubordinateHosts())) { + for (String fqhn : ImmutableSortedSet.copyOf(domain.get().getSubordinateHosts())) { if (cursorString.isPresent() && (fqhn.compareTo(cursorString.get()) <= 0)) { continue; } @@ -208,7 +208,7 @@ public class RdapNameserverSearchAction extends RdapSearchActionBase { return makeSearchResults( hostList, IncompletenessWarningType.COMPLETE, - domainBase.get().getSubordinateHosts().size(), + domain.get().getSubordinateHosts().size(), CursorType.NAME); } diff --git a/core/src/main/java/google/registry/rde/DomainBaseToXjcConverter.java b/core/src/main/java/google/registry/rde/DomainToXjcConverter.java similarity index 96% rename from core/src/main/java/google/registry/rde/DomainBaseToXjcConverter.java rename to core/src/main/java/google/registry/rde/DomainToXjcConverter.java index b6f095d1c..5394f85e4 100644 --- a/core/src/main/java/google/registry/rde/DomainBaseToXjcConverter.java +++ b/core/src/main/java/google/registry/rde/DomainToXjcConverter.java @@ -23,7 +23,7 @@ import com.google.common.collect.ImmutableSet; import com.google.common.flogger.FluentLogger; import google.registry.model.contact.ContactResource; import google.registry.model.domain.DesignatedContact; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.rgp.GracePeriodStatus; import google.registry.model.domain.secdns.DelegationSignerData; import google.registry.model.eppcommon.StatusValue; @@ -46,18 +46,18 @@ import google.registry.xjc.rgp.XjcRgpStatusValueType; import google.registry.xjc.secdns.XjcSecdnsDsDataType; import google.registry.xjc.secdns.XjcSecdnsDsOrKeyType; -/** Utility class that turns {@link DomainBase} as {@link XjcRdeDomainElement}. */ -final class DomainBaseToXjcConverter { +/** Utility class that turns {@link Domain} as {@link XjcRdeDomainElement}. */ +final class DomainToXjcConverter { private static final FluentLogger logger = FluentLogger.forEnclosingClass(); - /** Converts {@link DomainBase} to {@link XjcRdeDomainElement}. */ - static XjcRdeDomainElement convert(DomainBase domain, RdeMode mode) { + /** Converts {@link Domain} to {@link XjcRdeDomainElement}. */ + static XjcRdeDomainElement convert(Domain domain, RdeMode mode) { return new XjcRdeDomainElement(convertDomain(domain, mode)); } - /** Converts {@link DomainBase} to {@link XjcRdeDomain}. */ - static XjcRdeDomain convertDomain(DomainBase model, RdeMode mode) { + /** Converts {@link Domain} to {@link XjcRdeDomain}. */ + static XjcRdeDomain convertDomain(Domain model, RdeMode mode) { XjcRdeDomain bean = new XjcRdeDomain(); // o A element that contains the fully qualified name of the @@ -252,7 +252,7 @@ final class DomainBaseToXjcConverter { return bean; } - private static boolean hasGainingAndLosingRegistrars(DomainBase model) { + private static boolean hasGainingAndLosingRegistrars(Domain model) { return !Strings.isNullOrEmpty(model.getTransferData().getGainingRegistrarId()) && !Strings.isNullOrEmpty(model.getTransferData().getLosingRegistrarId()); } @@ -315,5 +315,5 @@ final class DomainBaseToXjcConverter { return bean; } - private DomainBaseToXjcConverter() {} + private DomainToXjcConverter() {} } diff --git a/core/src/main/java/google/registry/rde/HostResourceToXjcConverter.java b/core/src/main/java/google/registry/rde/HostResourceToXjcConverter.java index 364528b33..4d6aaa419 100644 --- a/core/src/main/java/google/registry/rde/HostResourceToXjcConverter.java +++ b/core/src/main/java/google/registry/rde/HostResourceToXjcConverter.java @@ -17,7 +17,7 @@ package google.registry.rde; import static com.google.common.base.Preconditions.checkArgument; import com.google.common.net.InetAddresses; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.eppcommon.StatusValue; import google.registry.model.host.HostResource; import google.registry.xjc.host.XjcHostAddrType; @@ -34,7 +34,7 @@ import org.joda.time.DateTime; final class HostResourceToXjcConverter { /** Converts a subordinate {@link HostResource} to {@link XjcRdeHostElement}. */ - static XjcRdeHostElement convertSubordinate(HostResource host, DomainBase superordinateDomain) { + static XjcRdeHostElement convertSubordinate(HostResource host, Domain superordinateDomain) { checkArgument(superordinateDomain.createVKey().equals(host.getSuperordinateDomain())); return new XjcRdeHostElement(convertSubordinateHost(host, superordinateDomain)); } @@ -46,7 +46,7 @@ final class HostResourceToXjcConverter { } /** Converts {@link HostResource} to {@link XjcRdeHost}. */ - static XjcRdeHost convertSubordinateHost(HostResource model, DomainBase superordinateDomain) { + static XjcRdeHost convertSubordinateHost(HostResource model, Domain superordinateDomain) { XjcRdeHost bean = convertHostCommon( model, diff --git a/core/src/main/java/google/registry/rde/RdeFragmenter.java b/core/src/main/java/google/registry/rde/RdeFragmenter.java index 660037cc3..dfae9927f 100644 --- a/core/src/main/java/google/registry/rde/RdeFragmenter.java +++ b/core/src/main/java/google/registry/rde/RdeFragmenter.java @@ -21,7 +21,7 @@ import com.google.auto.value.AutoValue; import com.google.common.collect.ImmutableMap; import google.registry.model.EppResource; import google.registry.model.contact.ContactResource; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.host.HostResource; import google.registry.model.rde.RdeMode; import java.util.HashMap; @@ -62,8 +62,8 @@ public class RdeFragmenter { return result; } resourcesFound++; - if (resource instanceof DomainBase) { - result = Optional.of(marshaller.marshalDomain((DomainBase) resource, mode)); + if (resource instanceof Domain) { + result = Optional.of(marshaller.marshalDomain((Domain) resource, mode)); cache.put(WatermarkModePair.create(watermark, mode), result); return result; } else if (resource instanceof ContactResource) { diff --git a/core/src/main/java/google/registry/rde/RdeMarshaller.java b/core/src/main/java/google/registry/rde/RdeMarshaller.java index 7a92cf772..0030f5a06 100644 --- a/core/src/main/java/google/registry/rde/RdeMarshaller.java +++ b/core/src/main/java/google/registry/rde/RdeMarshaller.java @@ -21,7 +21,7 @@ import com.google.common.flogger.FluentLogger; import com.googlecode.objectify.Key; import google.registry.model.ImmutableObject; import google.registry.model.contact.ContactResource; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.host.HostResource; import google.registry.model.rde.RdeMode; import google.registry.model.registrar.Registrar; @@ -123,15 +123,14 @@ public final class RdeMarshaller implements Serializable { ContactResourceToXjcConverter.convert(contact)); } - /** Turns {@link DomainBase} object into an XML fragment. */ - public DepositFragment marshalDomain(DomainBase domain, RdeMode mode) { - return marshalResource(RdeResourceType.DOMAIN, domain, - DomainBaseToXjcConverter.convert(domain, mode)); + /** Turns {@link Domain} object into an XML fragment. */ + public DepositFragment marshalDomain(Domain domain, RdeMode mode) { + return marshalResource( + RdeResourceType.DOMAIN, domain, DomainToXjcConverter.convert(domain, mode)); } /** Turns {@link HostResource} object into an XML fragment. */ - public DepositFragment marshalSubordinateHost( - HostResource host, DomainBase superordinateDomain) { + public DepositFragment marshalSubordinateHost(HostResource host, Domain superordinateDomain) { return marshalResource(RdeResourceType.HOST, host, HostResourceToXjcConverter.convertSubordinate(host, superordinateDomain)); } diff --git a/core/src/main/java/google/registry/rde/RdeStagingAction.java b/core/src/main/java/google/registry/rde/RdeStagingAction.java index b776ec42e..0bf36dffd 100644 --- a/core/src/main/java/google/registry/rde/RdeStagingAction.java +++ b/core/src/main/java/google/registry/rde/RdeStagingAction.java @@ -46,7 +46,7 @@ import google.registry.keyring.api.KeyModule.Key; import google.registry.model.common.Cursor; import google.registry.model.common.Cursor.CursorType; import google.registry.model.contact.ContactResource; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.host.HostResource; import google.registry.model.index.EppResourceIndex; import google.registry.model.rde.RdeMode; @@ -83,7 +83,7 @@ import org.joda.time.Duration; * account for things like pending transfer. * *

Only {@link ContactResource}s and {@link HostResource}s that are referenced by an included - * {@link DomainBase} will be included in the corresponding pending deposit. + * {@link Domain} will be included in the corresponding pending deposit. * *

{@link Registrar} entities, both active and inactive, are included in all deposits. They are * not rewinded point-in-time. diff --git a/core/src/main/java/google/registry/reporting/icann/TransactionsReportingQueryBuilder.java b/core/src/main/java/google/registry/reporting/icann/TransactionsReportingQueryBuilder.java index 8ddc729d8..4a449dbec 100644 --- a/core/src/main/java/google/registry/reporting/icann/TransactionsReportingQueryBuilder.java +++ b/core/src/main/java/google/registry/reporting/icann/TransactionsReportingQueryBuilder.java @@ -14,8 +14,6 @@ package google.registry.reporting.icann; -import static google.registry.persistence.transaction.TransactionManagerFactory.tm; -import static google.registry.reporting.icann.IcannReportingModule.DATASTORE_EXPORT_DATA_SET; import static google.registry.reporting.icann.IcannReportingModule.ICANN_REPORTING_DATA_SET; import static google.registry.reporting.icann.QueryBuilderUtils.getQueryFromFile; import static google.registry.reporting.icann.QueryBuilderUtils.getTableName; @@ -72,180 +70,72 @@ public final class TransactionsReportingQueryBuilder implements QueryBuilder { DateTime latestReportTime = earliestReportTime.plusMonths(1).minusMillis(1); ImmutableMap.Builder queriesBuilder = ImmutableMap.builder(); - String registrarIanaIdQuery; - if (tm().isOfy()) { - registrarIanaIdQuery = - SqlTemplate.create(getQueryFromFile("registrar_iana_id.sql")) - .put("PROJECT_ID", projectId) - .put("DATASTORE_EXPORT_DATA_SET", DATASTORE_EXPORT_DATA_SET) - .put("REGISTRAR_TABLE", "Registrar") - .build(); - } else { - registrarIanaIdQuery = - SqlTemplate.create(getQueryFromFile("cloud_sql_registrar_iana_id.sql")) - .put("PROJECT_ID", projectId) - .build(); - } + String registrarIanaIdQuery = + SqlTemplate.create(getQueryFromFile("cloud_sql_registrar_iana_id.sql")) + .put("PROJECT_ID", projectId) + .build(); queriesBuilder.put(getTableName(REGISTRAR_IANA_ID, yearMonth), registrarIanaIdQuery); - String totalDomainsQuery; - if (tm().isOfy()) { - totalDomainsQuery = - SqlTemplate.create(getQueryFromFile("total_domains.sql")) - .put("PROJECT_ID", projectId) - .put("DATASTORE_EXPORT_DATA_SET", DATASTORE_EXPORT_DATA_SET) - .put("DOMAINBASE_TABLE", "DomainBase") - .put("REGISTRAR_TABLE", "Registrar") - .build(); - } else { - totalDomainsQuery = - SqlTemplate.create(getQueryFromFile("cloud_sql_total_domains.sql")) - .put("PROJECT_ID", projectId) - .build(); - } + String totalDomainsQuery = + SqlTemplate.create(getQueryFromFile("cloud_sql_total_domains.sql")) + .put("PROJECT_ID", projectId) + .build(); queriesBuilder.put(getTableName(TOTAL_DOMAINS, yearMonth), totalDomainsQuery); DateTimeFormatter timestampFormatter = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss.SSS"); - String totalNameserversQuery; - if (tm().isOfy()) { - totalNameserversQuery = - SqlTemplate.create(getQueryFromFile("total_nameservers.sql")) - .put("PROJECT_ID", projectId) - .put("DATASTORE_EXPORT_DATA_SET", DATASTORE_EXPORT_DATA_SET) - .put("HOSTRESOURCE_TABLE", "HostResource") - .put("DOMAINBASE_TABLE", "DomainBase") - .put("REGISTRAR_TABLE", "Registrar") - .put("LATEST_REPORT_TIME", timestampFormatter.print(latestReportTime)) - .build(); - } else { - totalNameserversQuery = - SqlTemplate.create(getQueryFromFile("cloud_sql_total_nameservers.sql")) - .put("PROJECT_ID", projectId) - .put("LATEST_REPORT_TIME", timestampFormatter.print(latestReportTime)) - .build(); - } + String totalNameserversQuery = + SqlTemplate.create(getQueryFromFile("cloud_sql_total_nameservers.sql")) + .put("PROJECT_ID", projectId) + .put("LATEST_REPORT_TIME", timestampFormatter.print(latestReportTime)) + .build(); queriesBuilder.put(getTableName(TOTAL_NAMESERVERS, yearMonth), totalNameserversQuery); - String transactionCountsQuery; - if (tm().isOfy()) { - transactionCountsQuery = - SqlTemplate.create(getQueryFromFile("transaction_counts.sql")) - .put("PROJECT_ID", projectId) - .put("DATASTORE_EXPORT_DATA_SET", DATASTORE_EXPORT_DATA_SET) - .put("REGISTRAR_TABLE", "Registrar") - .put("HISTORYENTRY_TABLE", "HistoryEntry") - .put("EARLIEST_REPORT_TIME", timestampFormatter.print(earliestReportTime)) - .put("LATEST_REPORT_TIME", timestampFormatter.print(latestReportTime)) - .put("CLIENT_ID", "clientId") - .put("OTHER_CLIENT_ID", "otherClientId") - .put("TRANSFER_SUCCESS_FIELD", "TRANSFER_GAINING_SUCCESSFUL") - .put("TRANSFER_NACKED_FIELD", "TRANSFER_GAINING_NACKED") - .put("DEFAULT_FIELD", "field") - .build(); - } else { - transactionCountsQuery = - SqlTemplate.create(getQueryFromFile("cloud_sql_transaction_counts.sql")) - .put("PROJECT_ID", projectId) - .put("EARLIEST_REPORT_TIME", timestampFormatter.print(earliestReportTime)) - .put("LATEST_REPORT_TIME", timestampFormatter.print(latestReportTime)) - .build(); - } + String transactionCountsQuery = + SqlTemplate.create(getQueryFromFile("cloud_sql_transaction_counts.sql")) + .put("PROJECT_ID", projectId) + .put("EARLIEST_REPORT_TIME", timestampFormatter.print(earliestReportTime)) + .put("LATEST_REPORT_TIME", timestampFormatter.print(latestReportTime)) + .build(); queriesBuilder.put(getTableName(TRANSACTION_COUNTS, yearMonth), transactionCountsQuery); - String transactionTransferLosingQuery; - if (tm().isOfy()) { - transactionTransferLosingQuery = - SqlTemplate.create(getQueryFromFile("transaction_counts.sql")) - .put("PROJECT_ID", projectId) - .put("DATASTORE_EXPORT_DATA_SET", DATASTORE_EXPORT_DATA_SET) - .put("REGISTRAR_TABLE", "Registrar") - .put("HISTORYENTRY_TABLE", "HistoryEntry") - .put("EARLIEST_REPORT_TIME", timestampFormatter.print(earliestReportTime)) - .put("LATEST_REPORT_TIME", timestampFormatter.print(latestReportTime)) - // Roles are reversed for losing queries - .put("CLIENT_ID", "otherClientId") - .put("OTHER_CLIENT_ID", "clientId") - .put("TRANSFER_SUCCESS_FIELD", "TRANSFER_LOSING_SUCCESSFUL") - .put("TRANSFER_NACKED_FIELD", "TRANSFER_LOSING_NACKED") - .put("DEFAULT_FIELD", "NULL") - .build(); - } else { - transactionTransferLosingQuery = - SqlTemplate.create(getQueryFromFile("cloud_sql_transaction_transfer_losing.sql")) - .put("PROJECT_ID", projectId) - .put("EARLIEST_REPORT_TIME", timestampFormatter.print(earliestReportTime)) - .put("LATEST_REPORT_TIME", timestampFormatter.print(latestReportTime)) - .build(); - } + String transactionTransferLosingQuery = + SqlTemplate.create(getQueryFromFile("cloud_sql_transaction_transfer_losing.sql")) + .put("PROJECT_ID", projectId) + .put("EARLIEST_REPORT_TIME", timestampFormatter.print(earliestReportTime)) + .put("LATEST_REPORT_TIME", timestampFormatter.print(latestReportTime)) + .build(); queriesBuilder.put( getTableName(TRANSACTION_TRANSFER_LOSING, yearMonth), transactionTransferLosingQuery); // App Engine log table suffixes use YYYYMMDD format DateTimeFormatter logTableFormatter = DateTimeFormat.forPattern("yyyyMMdd"); - String attemptedAddsQuery; - if (tm().isOfy()) { - attemptedAddsQuery = - SqlTemplate.create(getQueryFromFile("attempted_adds.sql")) - .put("PROJECT_ID", projectId) - .put("DATASTORE_EXPORT_DATA_SET", DATASTORE_EXPORT_DATA_SET) - .put("REGISTRAR_TABLE", "Registrar") - .put("APPENGINE_LOGS_DATA_SET", "appengine_logs") - .put("REQUEST_TABLE", "appengine_googleapis_com_request_log_") - .put("FIRST_DAY_OF_MONTH", logTableFormatter.print(earliestReportTime)) - .put("LAST_DAY_OF_MONTH", logTableFormatter.print(latestReportTime)) - // All metadata logs for reporting come from google.registry.flows.FlowReporter. - .put( - "METADATA_LOG_PREFIX", - "google.registry.flows.FlowReporter recordToLogs: FLOW-LOG-SIGNATURE-METADATA") - .build(); - } else { - attemptedAddsQuery = - SqlTemplate.create(getQueryFromFile("cloud_sql_attempted_adds.sql")) - .put("PROJECT_ID", projectId) - .put("APPENGINE_LOGS_DATA_SET", "appengine_logs") - .put("REQUEST_TABLE", "appengine_googleapis_com_request_log_") - .put("FIRST_DAY_OF_MONTH", logTableFormatter.print(earliestReportTime)) - .put("LAST_DAY_OF_MONTH", logTableFormatter.print(latestReportTime)) - // All metadata logs for reporting come from google.registry.flows.FlowReporter. - .put( - "METADATA_LOG_PREFIX", - "google.registry.flows.FlowReporter recordToLogs: FLOW-LOG-SIGNATURE-METADATA") - .build(); - } + String attemptedAddsQuery = + SqlTemplate.create(getQueryFromFile("cloud_sql_attempted_adds.sql")) + .put("PROJECT_ID", projectId) + .put("APPENGINE_LOGS_DATA_SET", "appengine_logs") + .put("REQUEST_TABLE", "appengine_googleapis_com_request_log_") + .put("FIRST_DAY_OF_MONTH", logTableFormatter.print(earliestReportTime)) + .put("LAST_DAY_OF_MONTH", logTableFormatter.print(latestReportTime)) + // All metadata logs for reporting come from google.registry.flows.FlowReporter. + .put( + "METADATA_LOG_PREFIX", + "google.registry.flows.FlowReporter recordToLogs: FLOW-LOG-SIGNATURE-METADATA") + .build(); queriesBuilder.put(getTableName(ATTEMPTED_ADDS, yearMonth), attemptedAddsQuery); - String aggregateQuery; - if (tm().isOfy()) { - aggregateQuery = - SqlTemplate.create(getQueryFromFile("transactions_report_aggregation.sql")) - .put("PROJECT_ID", projectId) - .put("DATASTORE_EXPORT_DATA_SET", DATASTORE_EXPORT_DATA_SET) - .put("REGISTRY_TABLE", "Registry") - .put("ICANN_REPORTING_DATA_SET", icannReportingDataSet) - .put("REGISTRAR_IANA_ID_TABLE", getTableName(REGISTRAR_IANA_ID, yearMonth)) - .put("TOTAL_DOMAINS_TABLE", getTableName(TOTAL_DOMAINS, yearMonth)) - .put("TOTAL_NAMESERVERS_TABLE", getTableName(TOTAL_NAMESERVERS, yearMonth)) - .put("TRANSACTION_COUNTS_TABLE", getTableName(TRANSACTION_COUNTS, yearMonth)) - .put( - "TRANSACTION_TRANSFER_LOSING_TABLE", - getTableName(TRANSACTION_TRANSFER_LOSING, yearMonth)) - .put("ATTEMPTED_ADDS_TABLE", getTableName(ATTEMPTED_ADDS, yearMonth)) - .build(); - } else { - aggregateQuery = - SqlTemplate.create(getQueryFromFile("cloud_sql_transactions_report_aggregation.sql")) - .put("PROJECT_ID", projectId) - .put("ICANN_REPORTING_DATA_SET", icannReportingDataSet) - .put("REGISTRAR_IANA_ID_TABLE", getTableName(REGISTRAR_IANA_ID, yearMonth)) - .put("TOTAL_DOMAINS_TABLE", getTableName(TOTAL_DOMAINS, yearMonth)) - .put("TOTAL_NAMESERVERS_TABLE", getTableName(TOTAL_NAMESERVERS, yearMonth)) - .put("TRANSACTION_COUNTS_TABLE", getTableName(TRANSACTION_COUNTS, yearMonth)) - .put( - "TRANSACTION_TRANSFER_LOSING_TABLE", - getTableName(TRANSACTION_TRANSFER_LOSING, yearMonth)) - .put("ATTEMPTED_ADDS_TABLE", getTableName(ATTEMPTED_ADDS, yearMonth)) - .build(); - } + String aggregateQuery = + SqlTemplate.create(getQueryFromFile("cloud_sql_transactions_report_aggregation.sql")) + .put("PROJECT_ID", projectId) + .put("ICANN_REPORTING_DATA_SET", icannReportingDataSet) + .put("REGISTRAR_IANA_ID_TABLE", getTableName(REGISTRAR_IANA_ID, yearMonth)) + .put("TOTAL_DOMAINS_TABLE", getTableName(TOTAL_DOMAINS, yearMonth)) + .put("TOTAL_NAMESERVERS_TABLE", getTableName(TOTAL_NAMESERVERS, yearMonth)) + .put("TRANSACTION_COUNTS_TABLE", getTableName(TRANSACTION_COUNTS, yearMonth)) + .put( + "TRANSACTION_TRANSFER_LOSING_TABLE", + getTableName(TRANSACTION_TRANSFER_LOSING, yearMonth)) + .put("ATTEMPTED_ADDS_TABLE", getTableName(ATTEMPTED_ADDS, yearMonth)) + .build(); queriesBuilder.put(getTableName(TRANSACTIONS_REPORT_AGGREGATION, yearMonth), aggregateQuery); return queriesBuilder.build(); diff --git a/core/src/main/java/google/registry/reporting/icann/sql/attempted_adds.sql b/core/src/main/java/google/registry/reporting/icann/sql/attempted_adds.sql deleted file mode 100644 index ace385822..000000000 --- a/core/src/main/java/google/registry/reporting/icann/sql/attempted_adds.sql +++ /dev/null @@ -1,73 +0,0 @@ -#standardSQL - -- Copyright 2017 The Nomulus Authors. All Rights Reserved. - -- - -- Licensed under the Apache License, Version 2.0 (the "License"); - -- you may not use this file except in compliance with the License. - -- You may obtain a copy of the License at - -- - -- http://www.apache.org/licenses/LICENSE-2.0 - -- - -- Unless required by applicable law or agreed to in writing, software - -- distributed under the License is distributed on an "AS IS" BASIS, - -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - -- See the License for the specific language governing permissions and - -- limitations under the License. - - -- Determine the number of attempted adds each registrar made. - - -- Since the specification requests all 'attempted' adds, we regex the - -- monthly App Engine logs, searching for all create commands and associating - -- them with their corresponding registrars. - - -- Example log generated by FlowReporter in App Engine logs: - --google.registry.flows.FlowReporter - -- recordToLogs: FLOW-LOG-SIGNATURE-METADATA: - --{"serverTrid":"oNwL2J2eRya7bh7c9oHIzg==-2360a","clientId":"ipmirror" - -- ,"commandType":"hello", "resourceType":"","flowClassName":"HelloFlow" - -- ,"targetId":"","targetIds":[],"tld":"", - -- "tlds":[],"icannActivityReportField":""} - --- This outer select just converts the registrar's clientId to their name. -SELECT - tld, - registrar_table.registrarName AS registrar_name, - 'ATTEMPTED_ADDS' AS metricName, - count AS metricValue -FROM ( - SELECT - JSON_EXTRACT_SCALAR(json, '$.tld') AS tld, - JSON_EXTRACT_SCALAR(json, '$.clientId') AS clientId, - COUNT(json) AS count - FROM ( - -- Extract JSON metadata package from monthly logs - SELECT - REGEXP_EXTRACT(logMessages, r'FLOW-LOG-SIGNATURE-METADATA: (.*)\n?$') - AS json - FROM ( - SELECT - protoPayload.resource AS requestPath, - ARRAY( - SELECT logMessage - FROM UNNEST(protoPayload.line)) AS logMessage - FROM - `%PROJECT_ID%.%APPENGINE_LOGS_DATA_SET%.%REQUEST_TABLE%*` - WHERE _TABLE_SUFFIX - BETWEEN '%FIRST_DAY_OF_MONTH%' - AND '%LAST_DAY_OF_MONTH%') - JOIN UNNEST(logMessage) AS logMessages - -- Look for metadata logs from epp and registrar console requests - WHERE requestPath IN ('/_dr/epp', '/_dr/epptool', '/registrar-xhr') - AND STARTS_WITH(logMessages, "%METADATA_LOG_PREFIX%") - -- Look for domain creates - AND REGEXP_CONTAINS( - logMessages, r'"commandType":"create","resourceType":"domain"') - -- Filter prober data - AND NOT REGEXP_CONTAINS( - logMessages, r'"prober-[a-z]{2}-((any)|(canary))"') ) - GROUP BY tld, clientId ) AS logs_table -JOIN - `%PROJECT_ID%.%DATASTORE_EXPORT_DATA_SET%.%REGISTRAR_TABLE%` - AS registrar_table -ON logs_table.clientId = registrar_table.__key__.name -ORDER BY tld, registrar_name - diff --git a/core/src/main/java/google/registry/reporting/icann/sql/registrar_iana_id.sql b/core/src/main/java/google/registry/reporting/icann/sql/registrar_iana_id.sql deleted file mode 100644 index c6726eb1b..000000000 --- a/core/src/main/java/google/registry/reporting/icann/sql/registrar_iana_id.sql +++ /dev/null @@ -1,30 +0,0 @@ -#standardSQL - -- Copyright 2017 The Nomulus Authors. All Rights Reserved. - -- - -- Licensed under the Apache License, Version 2.0 (the "License"); - -- you may not use this file except in compliance with the License. - -- You may obtain a copy of the License at - -- - -- http://www.apache.org/licenses/LICENSE-2.0 - -- - -- Unless required by applicable law or agreed to in writing, software - -- distributed under the License is distributed on an "AS IS" BASIS, - -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - -- See the License for the specific language governing permissions and - -- limitations under the License. - - -- Gather a list of all tld-registrar pairs, with their IANA IDs. - - -- This establishes which registrars will appear in the reports. - -SELECT - allowed_tlds AS tld, - registrarName AS registrar_name, - ianaIdentifier AS iana_id -FROM - `%PROJECT_ID%.%DATASTORE_EXPORT_DATA_SET%.%REGISTRAR_TABLE%`, - UNNEST(allowedTlds) as allowed_tlds -WHERE (type = 'REAL' OR type = 'INTERNAL') --- Filter out prober data -AND NOT ENDS_WITH(allowed_tlds, ".test") -ORDER BY tld, registrarName diff --git a/core/src/main/java/google/registry/reporting/icann/sql/total_domains.sql b/core/src/main/java/google/registry/reporting/icann/sql/total_domains.sql deleted file mode 100644 index f08b60f29..000000000 --- a/core/src/main/java/google/registry/reporting/icann/sql/total_domains.sql +++ /dev/null @@ -1,37 +0,0 @@ -#standardSQL - -- Copyright 2017 The Nomulus Authors. All Rights Reserved. - -- - -- Licensed under the Apache License, Version 2.0 (the "License"); - -- you may not use this file except in compliance with the License. - -- You may obtain a copy of the License at - -- - -- http://www.apache.org/licenses/LICENSE-2.0 - -- - -- Unless required by applicable law or agreed to in writing, software - -- distributed under the License is distributed on an "AS IS" BASIS, - -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - -- See the License for the specific language governing permissions and - -- limitations under the License. - - -- Determine the number of domains each registrar sponsors per tld. - - -- This is just the number of fullyQualifiedDomainNames under each - -- tld-registrar pair. - -SELECT - tld, - registrarName as registrar_name, - 'TOTAL_DOMAINS' as metricName, - COUNT(fullyQualifiedDomainName) as metricValue -FROM - `%PROJECT_ID%.%DATASTORE_EXPORT_DATA_SET%.%DOMAINBASE_TABLE%` - AS domain_table -JOIN - `%PROJECT_ID%.%DATASTORE_EXPORT_DATA_SET%.%REGISTRAR_TABLE%` - AS registrar_table -ON - currentSponsorClientId = registrar_table.__key__.name -WHERE - registrar_table.type = 'REAL' OR registrar_table.type = 'INTERNAL' -GROUP BY tld, registrarName -ORDER BY tld, registrarName diff --git a/core/src/main/java/google/registry/reporting/icann/sql/total_nameservers.sql b/core/src/main/java/google/registry/reporting/icann/sql/total_nameservers.sql deleted file mode 100644 index bab51b056..000000000 --- a/core/src/main/java/google/registry/reporting/icann/sql/total_nameservers.sql +++ /dev/null @@ -1,55 +0,0 @@ -#standardSQL - -- Copyright 2017 The Nomulus Authors. All Rights Reserved. - -- - -- Licensed under the Apache License, Version 2.0 (the "License"); - -- you may not use this file except in compliance with the License. - -- You may obtain a copy of the License at - -- - -- http://www.apache.org/licenses/LICENSE-2.0 - -- - -- Unless required by applicable law or agreed to in writing, software - -- distributed under the License is distributed on an "AS IS" BASIS, - -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - -- See the License for the specific language governing permissions and - -- limitations under the License. - - -- Determine the number of referenced nameservers for a registrar's domains. - - -- We count the number of unique hosts under each tld-registrar combo by - -- collecting all domains' listed hosts that were still valid at the - -- end of the reporting month. - -SELECT - tld, - registrarName AS registrar_name, - 'TOTAL_NAMESERVERS' AS metricName, - COUNT(fullyQualifiedHostName) AS metricValue -FROM - `%PROJECT_ID%.%DATASTORE_EXPORT_DATA_SET%.%HOSTRESOURCE_TABLE%` AS host_table -JOIN ( - SELECT - __key__.name AS clientId, - registrarName - FROM - `%PROJECT_ID%.%DATASTORE_EXPORT_DATA_SET%.%REGISTRAR_TABLE%` - WHERE - type = 'REAL' - OR type = 'INTERNAL') AS registrar_table -ON - currentSponsorClientId = registrar_table.clientId -JOIN ( - SELECT - tld, - hosts.name AS referencedHostName - FROM - `%PROJECT_ID%.%DATASTORE_EXPORT_DATA_SET%.%DOMAINBASE_TABLE%`, - UNNEST(nsHosts) AS hosts - WHERE creationTime <= TIMESTAMP("%LATEST_REPORT_TIME%") - AND deletionTime > TIMESTAMP("%LATEST_REPORT_TIME%") ) AS domain_table -ON - host_table.__key__.name = domain_table.referencedHostName -WHERE creationTime <= TIMESTAMP("%LATEST_REPORT_TIME%") -AND deletionTime > TIMESTAMP("%LATEST_REPORT_TIME%") -GROUP BY tld, registrarName -ORDER BY tld, registrarName - diff --git a/core/src/main/java/google/registry/reporting/icann/sql/transaction_counts.sql b/core/src/main/java/google/registry/reporting/icann/sql/transaction_counts.sql deleted file mode 100644 index 35c976a34..000000000 --- a/core/src/main/java/google/registry/reporting/icann/sql/transaction_counts.sql +++ /dev/null @@ -1,85 +0,0 @@ -#standardSQL - -- Copyright 2017 The Nomulus Authors. All Rights Reserved. - -- - -- Licensed under the Apache License, Version 2.0 (the "License"); - -- you may not use this file except in compliance with the License. - -- You may obtain a copy of the License at - -- - -- http://www.apache.org/licenses/LICENSE-2.0 - -- - -- Unless required by applicable law or agreed to in writing, software - -- distributed under the License is distributed on an "AS IS" BASIS, - -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - -- See the License for the specific language governing permissions and - -- limitations under the License. - - -- Counts the number of mutating transactions each registrar made. - - -- We populate the fields through explicit logging of - -- DomainTransactionRecords, which contain all necessary information for - -- reporting (such as reporting time, report field, report amount, etc. - - -- A special note on transfers: we only record 'TRANSFER_SUCCESSFUL' or - -- 'TRANSFER_NACKED', and we can infer the gaining and losing parties - -- from the enclosing HistoryEntry's clientId and otherClientId - -- respectively. This query templates the client ID, field for transfer - -- success, field for transfer nacks and default field. This allows us to - -- create one query for TRANSFER_GAINING and the other report fields, - -- and one query for TRANSFER_LOSING fields from the same template. - --- This outer select just converts the registrar's clientId to their name. -SELECT - tld, - registrar_table.registrarName AS registrar_name, - metricName, - metricValue -FROM ( - SELECT - tld, - clientId, - CASE - WHEN field = 'TRANSFER_SUCCESSFUL' THEN '%TRANSFER_SUCCESS_FIELD%' - WHEN field = 'TRANSFER_NACKED' THEN '%TRANSFER_NACKED_FIELD%' - ELSE %DEFAULT_FIELD% - END AS metricName, - SUM(amount) AS metricValue - FROM ( - SELECT - CASE - -- Explicit transfer acks (approve) and nacks (reject) are done - -- by the opposing registrar. Thus, for these specific actions, - -- we swap the 'otherClientId' with the 'clientId' to properly - -- account for this reversal. - WHEN (entries.type = 'DOMAIN_TRANSFER_APPROVE' - OR entries.type = 'DOMAIN_TRANSFER_REJECT') - THEN entries.%OTHER_CLIENT_ID% - ELSE entries.%CLIENT_ID% - END AS clientId, - entries.domainTransactionRecords.tld[SAFE_OFFSET(index)] AS tld, - entries.domainTransactionRecords.reportingTime[SAFE_OFFSET(index)] - AS reportingTime, - entries.domainTransactionRecords.reportField[SAFE_OFFSET(index)] - AS field, - entries.domainTransactionRecords.reportAmount[SAFE_OFFSET(index)] - AS amount - FROM - `%PROJECT_ID%.%DATASTORE_EXPORT_DATA_SET%.%HISTORYENTRY_TABLE%` - AS entries, - -- This allows us to 'loop' through the arrays in parallel by index - UNNEST(GENERATE_ARRAY(0, ARRAY_LENGTH( - entries.domainTransactionRecords.tld) - 1)) AS index - -- Ignore null entries - WHERE entries.domainTransactionRecords IS NOT NULL ) - -- Only look at this month's data - WHERE reportingTime - BETWEEN TIMESTAMP('%EARLIEST_REPORT_TIME%') - AND TIMESTAMP('%LATEST_REPORT_TIME%') - GROUP BY - tld, - clientId, - field ) AS counts_table -JOIN - `%PROJECT_ID%.%DATASTORE_EXPORT_DATA_SET%.%REGISTRAR_TABLE%` - AS registrar_table -ON - counts_table.clientId = registrar_table.__key__.name diff --git a/core/src/main/java/google/registry/reporting/icann/sql/transactions_report_aggregation.sql b/core/src/main/java/google/registry/reporting/icann/sql/transactions_report_aggregation.sql deleted file mode 100644 index 9b4567e5d..000000000 --- a/core/src/main/java/google/registry/reporting/icann/sql/transactions_report_aggregation.sql +++ /dev/null @@ -1,100 +0,0 @@ -#standardSQL - -- Copyright 2017 The Nomulus Authors. All Rights Reserved. - -- - -- Licensed under the Apache License, Version 2.0 (the "License"); - -- you may not use this file except in compliance with the License. - -- You may obtain a copy of the License at - -- - -- http://www.apache.org/licenses/LICENSE-2.0 - -- - -- Unless required by applicable law or agreed to in writing, software - -- distributed under the License is distributed on an "AS IS" BASIS, - -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - -- See the License for the specific language governing permissions and - -- limitations under the License. - - -- Construct the transaction reports' rows from the intermediary data views. - - -- This query pulls from all intermediary tables to create the activity - -- report csv, via a table transpose and sum over all activity report fields. - -SELECT - registrars.tld as tld, - -- Surround registrar names with quotes to handle names containing a comma. - FORMAT("\"%s\"", registrars.registrar_name) as registrar_name, - registrars.iana_id as iana_id, - SUM(IF(metrics.metricName = 'TOTAL_DOMAINS', metrics.metricValue, 0)) AS total_domains, - SUM(IF(metrics.metricName = 'TOTAL_NAMESERVERS', metrics.metricValue, 0)) AS total_nameservers, - SUM(IF(metrics.metricName = 'NET_ADDS_1_YR', metrics.metricValue, 0)) AS net_adds_1_yr, - SUM(IF(metrics.metricName = 'NET_ADDS_2_YR', metrics.metricValue, 0)) AS net_adds_2_yr, - SUM(IF(metrics.metricName = 'NET_ADDS_3_YR', metrics.metricValue, 0)) AS net_adds_3_yr, - SUM(IF(metrics.metricName = 'NET_ADDS_4_YR', metrics.metricValue, 0)) AS net_adds_4_yr, - SUM(IF(metrics.metricName = 'NET_ADDS_5_YR', metrics.metricValue, 0)) AS net_adds_5_yr, - SUM(IF(metrics.metricName = 'NET_ADDS_6_YR', metrics.metricValue, 0)) AS net_adds_6_yr, - SUM(IF(metrics.metricName = 'NET_ADDS_7_YR', metrics.metricValue, 0)) AS net_adds_7_yr, - SUM(IF(metrics.metricName = 'NET_ADDS_8_YR', metrics.metricValue, 0)) AS net_adds_8_yr, - SUM(IF(metrics.metricName = 'NET_ADDS_9_YR', metrics.metricValue, 0)) AS net_adds_9_yr, - SUM(IF(metrics.metricName = 'NET_ADDS_10_Yr', metrics.metricValue, 0)) AS net_adds_10_yr, - SUM(IF(metrics.metricName = 'NET_RENEWS_1_YR', metrics.metricValue, 0)) AS net_renews_1_yr, - SUM(IF(metrics.metricName = 'NET_RENEWS_2_YR', metrics.metricValue, 0)) AS net_renews_2_yr, - SUM(IF(metrics.metricName = 'NET_RENEWS_3_YR', metrics.metricValue, 0)) AS net_renews_3_yr, - SUM(IF(metrics.metricName = 'NET_RENEWS_4_YR', metrics.metricValue, 0)) AS net_renews_4_yr, - SUM(IF(metrics.metricName = 'NET_RENEWS_5_YR', metrics.metricValue, 0)) AS net_renews_5_yr, - SUM(IF(metrics.metricName = 'NET_RENEWS_6_YR', metrics.metricValue, 0)) AS net_renews_6_yr, - SUM(IF(metrics.metricName = 'NET_RENEWS_7_YR', metrics.metricValue, 0)) AS net_renews_7_yr, - SUM(IF(metrics.metricName = 'NET_RENEWS_8_YR', metrics.metricValue, 0)) AS net_renews_8_yr, - SUM(IF(metrics.metricName = 'NET_RENEWS_9_YR', metrics.metricValue, 0)) AS net_renews_9_yr, - SUM(IF(metrics.metricName = 'NET_RENEWS_10_YR', metrics.metricValue, 0)) AS net_renews_10_yr, - SUM(IF(metrics.metricName = 'TRANSFER_GAINING_SUCCESSFUL', metrics.metricValue, 0)) AS transfer_gaining_successful, - SUM(IF(metrics.metricName = 'TRANSFER_GAINING_NACKED', metrics.metricValue, 0)) AS transfer_gaining_nacked, - SUM(IF(metrics.metricName = 'TRANSFER_LOSING_SUCCESSFUL', metrics.metricValue, 0)) AS transfer_losing_successful, - SUM(IF(metrics.metricName = 'TRANSFER_LOSING_NACKED', metrics.metricValue, 0)) AS transfer_losing_nacked, - -- We don't interact with transfer disputes - 0 AS transfer_disputed_won, - 0 AS transfer_disputed_lost, - 0 AS transfer_disputed_nodecision, - SUM(IF(metrics.metricName = 'DELETED_DOMAINS_GRACE', metrics.metricValue, 0)) AS deleted_domains_grace, - SUM(IF(metrics.metricName = 'DELETED_DOMAINS_NOGRACE', metrics.metricValue, 0)) AS deleted_domains_nograce, - SUM(IF(metrics.metricName = 'RESTORED_DOMAINS', metrics.metricValue, 0)) AS restored_domains, - -- We don't require restore reports - 0 AS restored_noreport, - -- We don't enforce AGP limits right now - 0 AS agp_exemption_requests, - 0 AS agp_exemptions_granted, - 0 AS agp_exempted_domains, - SUM(IF(metrics.metricName = 'ATTEMPTED_ADDS', metrics.metricValue, 0)) AS attempted_adds -FROM --- Only produce reports for real TLDs -(SELECT tldStr AS tld - FROM `%PROJECT_ID%.%DATASTORE_EXPORT_DATA_SET%.%REGISTRY_TABLE%` - WHERE tldType = 'REAL') AS registries -JOIN -(SELECT * - FROM `%PROJECT_ID%.%ICANN_REPORTING_DATA_SET%.%REGISTRAR_IANA_ID_TABLE%`) - AS registrars -ON registries.tld = registrars.tld --- We LEFT JOIN to produce reports even if the registrar made no transactions -LEFT OUTER JOIN ( - -- Gather all intermediary data views - SELECT * - FROM `%PROJECT_ID%.%ICANN_REPORTING_DATA_SET%.%TOTAL_DOMAINS_TABLE%` - UNION ALL - SELECT * - FROM `%PROJECT_ID%.%ICANN_REPORTING_DATA_SET%.%TOTAL_NAMESERVERS_TABLE%` - UNION ALL - SELECT * - FROM `%PROJECT_ID%.%ICANN_REPORTING_DATA_SET%.%TRANSACTION_COUNTS_TABLE%` - UNION ALL - SELECT * - FROM `%PROJECT_ID%.%ICANN_REPORTING_DATA_SET%.%TRANSACTION_TRANSFER_LOSING_TABLE%` - UNION ALL - SELECT * - FROM `%PROJECT_ID%.%ICANN_REPORTING_DATA_SET%.%ATTEMPTED_ADDS_TABLE%` ) AS metrics --- Join on tld and registrar name -ON registrars.tld = metrics.tld -AND registrars.registrar_name = metrics.registrar_name -GROUP BY -tld, registrar_name, iana_id -ORDER BY -tld, registrar_name - diff --git a/core/src/main/java/google/registry/reporting/spec11/Spec11EmailUtils.java b/core/src/main/java/google/registry/reporting/spec11/Spec11EmailUtils.java index 3e3249556..6a0a6b3cd 100644 --- a/core/src/main/java/google/registry/reporting/spec11/Spec11EmailUtils.java +++ b/core/src/main/java/google/registry/reporting/spec11/Spec11EmailUtils.java @@ -31,7 +31,7 @@ import com.google.template.soy.tofu.SoyTofu; import com.google.template.soy.tofu.SoyTofu.Renderer; import google.registry.beam.spec11.ThreatMatch; import google.registry.config.RegistryConfig.Config; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.registrar.Registrar; import google.registry.model.registrar.RegistrarPoc; import google.registry.reporting.spec11.soy.Spec11EmailSoyInfo; @@ -136,13 +136,13 @@ public class Spec11EmailUtils { .filter( threatMatch -> tm() - .createQueryComposer(DomainBase.class) + .createQueryComposer(Domain.class) .where( "fullyQualifiedDomainName", Comparator.EQ, threatMatch.fullyQualifiedDomainName()) .stream() - .anyMatch(DomainBase::shouldPublishToDns)) + .anyMatch(Domain::shouldPublishToDns)) .collect(toImmutableList()); }); return RegistrarThreatMatches.create(registrarThreatMatches.clientId(), filteredMatches); diff --git a/core/src/main/java/google/registry/tmch/LordnTaskUtils.java b/core/src/main/java/google/registry/tmch/LordnTaskUtils.java index 888f86e3e..f90a284d2 100644 --- a/core/src/main/java/google/registry/tmch/LordnTaskUtils.java +++ b/core/src/main/java/google/registry/tmch/LordnTaskUtils.java @@ -21,14 +21,14 @@ import static google.registry.persistence.transaction.TransactionManagerFactory. import com.google.appengine.api.taskqueue.TaskOptions; import com.google.appengine.api.taskqueue.TaskOptions.Method; import com.google.common.base.Joiner; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.registrar.Registrar; import java.util.Optional; import org.joda.time.DateTime; /** * Helper methods for creating tasks containing CSV line data in the lordn-sunrise and lordn-claims - * queues based on DomainBase changes. + * queues based on {@link Domain} changes. * *

Note that, per the * TMCH RFC, while the application-datetime data is optional (which we never send because there @@ -43,12 +43,10 @@ public final class LordnTaskUtils { public static final String COLUMNS_SUNRISE = "roid,domain-name,SMD-id,registrar-id," + "registration-datetime,application-datetime"; - /** - * Enqueues a task in the LORDN queue representing a line of CSV for LORDN export. - */ - public static void enqueueDomainBaseTask(DomainBase domain) { + /** Enqueues a task in the LORDN queue representing a line of CSV for LORDN export. */ + public static void enqueueDomainTask(Domain domain) { tm().assertInTransaction(); - // This method needs to use ofy transactionTime as the DomainBase's creationTime because + // This method needs to use ofy transactionTime as the Domain's creationTime because // CreationTime isn't yet populated when this method is called during the resource flow. String tld = domain.getTld(); if (domain.getLaunchNotice() == null) { @@ -65,7 +63,7 @@ public final class LordnTaskUtils { } /** Returns the corresponding CSV LORDN line for a sunrise domain. */ - public static String getCsvLineForSunriseDomain(DomainBase domain, DateTime transactionTime) { + public static String getCsvLineForSunriseDomain(Domain domain, DateTime transactionTime) { return Joiner.on(',') .join( domain.getRepoId(), @@ -76,7 +74,7 @@ public final class LordnTaskUtils { } /** Returns the corresponding CSV LORDN line for a claims domain. */ - public static String getCsvLineForClaimsDomain(DomainBase domain, DateTime transactionTime) { + public static String getCsvLineForClaimsDomain(Domain domain, DateTime transactionTime) { return Joiner.on(',') .join( domain.getRepoId(), diff --git a/core/src/main/java/google/registry/tools/CommandUtilities.java b/core/src/main/java/google/registry/tools/CommandUtilities.java index 4b84d041e..dc5c3be47 100644 --- a/core/src/main/java/google/registry/tools/CommandUtilities.java +++ b/core/src/main/java/google/registry/tools/CommandUtilities.java @@ -20,7 +20,7 @@ import com.google.common.base.Ascii; import com.google.common.base.Strings; import google.registry.model.EppResource; import google.registry.model.contact.ContactResource; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.host.HostResource; import google.registry.model.index.ForeignKeyIndex; import google.registry.persistence.VKey; @@ -33,7 +33,7 @@ class CommandUtilities { public enum ResourceType { CONTACT(ContactResource.class), HOST(HostResource.class), - DOMAIN(DomainBase.class); + DOMAIN(Domain.class); private final Class clazz; diff --git a/core/src/main/java/google/registry/tools/CountDomainsCommand.java b/core/src/main/java/google/registry/tools/CountDomainsCommand.java index 560c9b2a6..54273c7e7 100644 --- a/core/src/main/java/google/registry/tools/CountDomainsCommand.java +++ b/core/src/main/java/google/registry/tools/CountDomainsCommand.java @@ -20,7 +20,7 @@ import static google.registry.persistence.transaction.TransactionManagerFactory. import com.beust.jcommander.Parameter; import com.beust.jcommander.Parameters; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.util.Clock; import java.util.List; import javax.inject.Inject; @@ -48,7 +48,7 @@ final class CountDomainsCommand implements CommandWithRemoteApi { private long getCountForTld(String tld, DateTime now) { return tm().transact( () -> - tm().createQueryComposer(DomainBase.class) + tm().createQueryComposer(Domain.class) .where("tld", Comparator.EQ, tld) .where("deletionTime", Comparator.GT, now) .count()); diff --git a/core/src/main/java/google/registry/tools/DeleteTldCommand.java b/core/src/main/java/google/registry/tools/DeleteTldCommand.java index 5d180b957..8d979fd32 100644 --- a/core/src/main/java/google/registry/tools/DeleteTldCommand.java +++ b/core/src/main/java/google/registry/tools/DeleteTldCommand.java @@ -19,7 +19,7 @@ import static google.registry.persistence.transaction.TransactionManagerFactory. import com.beust.jcommander.Parameter; import com.beust.jcommander.Parameters; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.registrar.Registrar; import google.registry.model.tld.Registry; import google.registry.model.tld.Registry.TldType; @@ -79,7 +79,7 @@ final class DeleteTldCommand extends ConfirmingCommand implements CommandWithRem private boolean tldContainsDomains(String tld) { return tm().transact( () -> - tm().createQueryComposer(DomainBase.class) + tm().createQueryComposer(Domain.class) .where("tld", Comparator.EQ, tld) .first() .isPresent()); diff --git a/core/src/main/java/google/registry/tools/DomainLockUtils.java b/core/src/main/java/google/registry/tools/DomainLockUtils.java index dfb24abe9..99c8c1bd4 100644 --- a/core/src/main/java/google/registry/tools/DomainLockUtils.java +++ b/core/src/main/java/google/registry/tools/DomainLockUtils.java @@ -28,7 +28,7 @@ import google.registry.batch.RelockDomainAction; import google.registry.config.RegistryConfig.Config; import google.registry.model.billing.BillingEvent; import google.registry.model.billing.BillingEvent.Reason; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainHistory; import google.registry.model.domain.RegistryLock; import google.registry.model.reporting.HistoryEntry; @@ -252,11 +252,11 @@ public final class DomainLockUtils { private RegistryLock.Builder createLockBuilder( String domainName, String registrarId, @Nullable String registrarPocId, boolean isAdmin) { DateTime now = jpaTm().getTransactionTime(); - DomainBase domainBase = getDomain(domainName, registrarId, now); - verifyDomainNotLocked(domainBase, isAdmin); + Domain domain = getDomain(domainName, registrarId, now); + verifyDomainNotLocked(domain, isAdmin); // Multiple pending actions are not allowed for non-admins - RegistryLockDao.getMostRecentByRepoId(domainBase.getRepoId()) + RegistryLockDao.getMostRecentByRepoId(domain.getRepoId()) .ifPresent( previousLock -> checkArgument( @@ -268,7 +268,7 @@ public final class DomainLockUtils { return new RegistryLock.Builder() .setVerificationCode(stringGenerator.createString(VERIFICATION_CODE_LENGTH)) .setDomainName(domainName) - .setRepoId(domainBase.getRepoId()) + .setRepoId(domain.getRepoId()) .setRegistrarId(registrarId) .setRegistrarPocId(registrarPocId) .isSuperuser(isAdmin); @@ -277,11 +277,11 @@ public final class DomainLockUtils { private RegistryLock.Builder createUnlockBuilder( String domainName, String registrarId, boolean isAdmin, Optional relockDuration) { DateTime now = jpaTm().getTransactionTime(); - DomainBase domainBase = getDomain(domainName, registrarId, now); + Domain domain = getDomain(domainName, registrarId, now); Optional lockOptional = - RegistryLockDao.getMostRecentVerifiedLockByRepoId(domainBase.getRepoId()); + RegistryLockDao.getMostRecentVerifiedLockByRepoId(domain.getRepoId()); - verifyDomainLocked(domainBase, isAdmin); + verifyDomainLocked(domain, isAdmin); RegistryLock.Builder newLockBuilder; if (isAdmin) { @@ -293,7 +293,7 @@ public final class DomainLockUtils { .map(RegistryLock::asBuilder) .orElse( new RegistryLock.Builder() - .setRepoId(domainBase.getRepoId()) + .setRepoId(domain.getRepoId()) .setDomainName(domainName) .setLockCompletionTime(now) .setRegistrarId(registrarId)); @@ -325,24 +325,23 @@ public final class DomainLockUtils { .setRegistrarId(registrarId); } - private static void verifyDomainNotLocked(DomainBase domainBase, boolean isAdmin) { + private static void verifyDomainNotLocked(Domain domain, boolean isAdmin) { checkArgument( - isAdmin || !domainBase.getStatusValues().containsAll(REGISTRY_LOCK_STATUSES), + isAdmin || !domain.getStatusValues().containsAll(REGISTRY_LOCK_STATUSES), "Domain %s is already locked", - domainBase.getDomainName()); + domain.getDomainName()); } - private static void verifyDomainLocked(DomainBase domainBase, boolean isAdmin) { + private static void verifyDomainLocked(Domain domain, boolean isAdmin) { checkArgument( - isAdmin - || !Sets.intersection(domainBase.getStatusValues(), REGISTRY_LOCK_STATUSES).isEmpty(), + isAdmin || !Sets.intersection(domain.getStatusValues(), REGISTRY_LOCK_STATUSES).isEmpty(), "Domain %s is already unlocked", - domainBase.getDomainName()); + domain.getDomainName()); } - private DomainBase getDomain(String domainName, String registrarId, DateTime now) { - DomainBase domain = - loadByForeignKeyCached(DomainBase.class, domainName, now) + private Domain getDomain(String domainName, String registrarId, DateTime now) { + Domain domain = + loadByForeignKeyCached(Domain.class, domainName, now) .orElseThrow(() -> new IllegalArgumentException("Domain doesn't exist")); // The user must have specified either the correct registrar ID or the admin registrar ID checkArgument( @@ -363,10 +362,10 @@ public final class DomainLockUtils { } private void applyLockStatuses(RegistryLock lock, DateTime lockTime, boolean isAdmin) { - DomainBase domain = getDomain(lock.getDomainName(), lock.getRegistrarId(), lockTime); + Domain domain = getDomain(lock.getDomainName(), lock.getRegistrarId(), lockTime); verifyDomainNotLocked(domain, isAdmin); - DomainBase newDomain = + Domain newDomain = domain .asBuilder() .setStatusValues( @@ -376,10 +375,10 @@ public final class DomainLockUtils { } private void removeLockStatuses(RegistryLock lock, boolean isAdmin, DateTime unlockTime) { - DomainBase domain = getDomain(lock.getDomainName(), lock.getRegistrarId(), unlockTime); + Domain domain = getDomain(lock.getDomainName(), lock.getRegistrarId(), unlockTime); verifyDomainLocked(domain, isAdmin); - DomainBase newDomain = + Domain newDomain = domain .asBuilder() .setStatusValues( @@ -389,8 +388,7 @@ public final class DomainLockUtils { saveEntities(newDomain, lock, unlockTime, false); } - private static void saveEntities( - DomainBase domain, RegistryLock lock, DateTime now, boolean isLock) { + private static void saveEntities(Domain domain, RegistryLock lock, DateTime now, boolean isLock) { String reason = String.format( "%s of a domain through a RegistryLock operation", isLock ? "Lock" : "Unlock"); diff --git a/core/src/main/java/google/registry/tools/EnqueuePollMessageCommand.java b/core/src/main/java/google/registry/tools/EnqueuePollMessageCommand.java index 9c7f02404..9af829039 100644 --- a/core/src/main/java/google/registry/tools/EnqueuePollMessageCommand.java +++ b/core/src/main/java/google/registry/tools/EnqueuePollMessageCommand.java @@ -25,7 +25,7 @@ import com.beust.jcommander.Parameters; import com.google.common.collect.ImmutableList; import com.google.common.collect.Streams; import google.registry.config.RegistryConfig.Config; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainHistory; import google.registry.model.poll.PollMessage; import google.registry.model.registrar.Registrar; @@ -85,11 +85,11 @@ class EnqueuePollMessageCommand extends MutatingCommand { !sendToAll || isNullOrEmpty(clientIds), "Cannot specify both --all and --clients"); tm().transact( () -> { - Optional domainOpt = - loadByForeignKey(DomainBase.class, domainName, tm().getTransactionTime()); + Optional domainOpt = + loadByForeignKey(Domain.class, domainName, tm().getTransactionTime()); checkArgument( domainOpt.isPresent(), "Domain %s doesn't exist or isn't active", domainName); - DomainBase domain = domainOpt.get(); + Domain domain = domainOpt.get(); ImmutableList registrarIds; if (sendToAll) { registrarIds = diff --git a/core/src/main/java/google/registry/tools/GenerateDnsReportCommand.java b/core/src/main/java/google/registry/tools/GenerateDnsReportCommand.java index 63cfe4c97..9ea453536 100644 --- a/core/src/main/java/google/registry/tools/GenerateDnsReportCommand.java +++ b/core/src/main/java/google/registry/tools/GenerateDnsReportCommand.java @@ -25,7 +25,7 @@ import com.beust.jcommander.Parameter; import com.beust.jcommander.Parameters; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.host.HostResource; import google.registry.persistence.transaction.QueryComposer.Comparator; import google.registry.tools.params.PathParameter; @@ -73,13 +73,13 @@ final class GenerateDnsReportCommand implements CommandWithRemoteApi { String generate() { result.append("[\n"); - List domains = + List domains = tm().transact( () -> - tm().createQueryComposer(DomainBase.class) + tm().createQueryComposer(Domain.class) .where("tld", Comparator.EQ, tld) .list()); - for (DomainBase domain : domains) { + for (Domain domain : domains) { // Skip deleted domains and domains that don't get published to DNS. if (isBeforeOrAt(domain.getDeletionTime(), now) || !domain.shouldPublishToDns()) { continue; @@ -100,7 +100,7 @@ final class GenerateDnsReportCommand implements CommandWithRemoteApi { return result.append("\n]\n").toString(); } - private void write(DomainBase domain) { + private void write(Domain domain) { ImmutableList nameservers = ImmutableList.sortedCopyOf(domain.loadNameserverHostNames()); ImmutableList> dsData = diff --git a/core/src/main/java/google/registry/tools/GenerateLordnCommand.java b/core/src/main/java/google/registry/tools/GenerateLordnCommand.java index 200c9739d..8af7305ef 100644 --- a/core/src/main/java/google/registry/tools/GenerateLordnCommand.java +++ b/core/src/main/java/google/registry/tools/GenerateLordnCommand.java @@ -21,7 +21,7 @@ import static java.nio.charset.StandardCharsets.UTF_8; import com.beust.jcommander.Parameter; import com.beust.jcommander.Parameters; import com.google.common.collect.ImmutableList; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.tmch.LordnTaskUtils; import google.registry.tools.params.PathParameter; import google.registry.util.Clock; @@ -65,7 +65,7 @@ final class GenerateLordnCommand implements CommandWithRemoteApi { tm().transact( () -> tm() - .createQueryComposer(DomainBase.class) + .createQueryComposer(Domain.class) .where("tld", Comparator.EQ, tld) .orderBy("repoId") .stream() @@ -91,7 +91,7 @@ final class GenerateLordnCommand implements CommandWithRemoteApi { private static void processDomain( ImmutableList.Builder claimsCsv, ImmutableList.Builder sunriseCsv, - DomainBase domain) { + Domain domain) { String status = " "; if (domain.getLaunchNotice() == null && domain.getSmdId() != null) { sunriseCsv.add(LordnTaskUtils.getCsvLineForSunriseDomain(domain, domain.getCreationTime())); diff --git a/core/src/main/java/google/registry/tools/GetAllocationTokenCommand.java b/core/src/main/java/google/registry/tools/GetAllocationTokenCommand.java index 2404543a5..e28b3278a 100644 --- a/core/src/main/java/google/registry/tools/GetAllocationTokenCommand.java +++ b/core/src/main/java/google/registry/tools/GetAllocationTokenCommand.java @@ -23,7 +23,7 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; import com.googlecode.objectify.Key; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.token.AllocationToken; import google.registry.persistence.VKey; import java.util.Collection; @@ -55,7 +55,7 @@ final class GetAllocationTokenCommand implements CommandWithRemoteApi { .forEach((k, v) -> builder.put(k.getSqlKey().toString(), v))); } ImmutableMap loadedTokens = builder.build(); - ImmutableMap, DomainBase> domains = + ImmutableMap, Domain> domains = tm().transact(() -> loadRedeemedDomains(loadedTokens.values())); for (String token : mainParameters) { @@ -65,10 +65,10 @@ final class GetAllocationTokenCommand implements CommandWithRemoteApi { if (!loadedToken.getRedemptionHistoryEntry().isPresent()) { System.out.printf("Token %s was not redeemed.\n", token); } else { - Key domainOfyKey = + Key domainOfyKey = loadedToken.getRedemptionHistoryEntry().get().getOfyKey().getParent(); - DomainBase domain = - domains.get(VKey.create(DomainBase.class, domainOfyKey.getName(), domainOfyKey)); + Domain domain = + domains.get(VKey.create(Domain.class, domainOfyKey.getName(), domainOfyKey)); if (domain == null) { System.out.printf("ERROR: Token %s was redeemed but domain can't be loaded.\n", token); } else { @@ -85,22 +85,21 @@ final class GetAllocationTokenCommand implements CommandWithRemoteApi { } @SuppressWarnings("unchecked") - private static ImmutableMap, DomainBase> loadRedeemedDomains( + private static ImmutableMap, Domain> loadRedeemedDomains( Collection tokens) { - ImmutableList> domainKeys = + ImmutableList> domainKeys = tokens.stream() .map(AllocationToken::getRedemptionHistoryEntry) .filter(Optional::isPresent) .map(Optional::get) .map(key -> tm().loadByKey(key)) - .map(he -> (Key) he.getParent()) - .map(key -> VKey.create(DomainBase.class, key.getName(), key)) + .map(he -> (Key) he.getParent()) + .map(key -> VKey.create(Domain.class, key.getName(), key)) .collect(toImmutableList()); - ImmutableMap.Builder, DomainBase> domainsBuilder = - new ImmutableMap.Builder<>(); - for (List> keys : Lists.partition(domainKeys, BATCH_SIZE)) { + ImmutableMap.Builder, Domain> domainsBuilder = new ImmutableMap.Builder<>(); + for (List> keys : Lists.partition(domainKeys, BATCH_SIZE)) { tm().loadByKeys(ImmutableList.copyOf(keys)) - .forEach((k, v) -> domainsBuilder.put((VKey) k, v)); + .forEach((k, v) -> domainsBuilder.put((VKey) k, v)); } return domainsBuilder.build(); } diff --git a/core/src/main/java/google/registry/tools/GetDomainCommand.java b/core/src/main/java/google/registry/tools/GetDomainCommand.java index e442cc215..21827d708 100644 --- a/core/src/main/java/google/registry/tools/GetDomainCommand.java +++ b/core/src/main/java/google/registry/tools/GetDomainCommand.java @@ -18,7 +18,7 @@ import static google.registry.model.EppResourceUtils.loadByForeignKey; import com.beust.jcommander.Parameter; import com.beust.jcommander.Parameters; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.util.DomainNameUtils; import java.util.List; @@ -38,7 +38,7 @@ final class GetDomainCommand extends GetEppResourceCommand { printResource( "Domain", canonicalDomain, - loadByForeignKey(DomainBase.class, canonicalDomain, readTimestamp)); + loadByForeignKey(Domain.class, canonicalDomain, readTimestamp)); } } } diff --git a/core/src/main/java/google/registry/tools/RenewDomainCommand.java b/core/src/main/java/google/registry/tools/RenewDomainCommand.java index 233872189..7db608dfc 100644 --- a/core/src/main/java/google/registry/tools/RenewDomainCommand.java +++ b/core/src/main/java/google/registry/tools/RenewDomainCommand.java @@ -25,7 +25,7 @@ import com.beust.jcommander.Parameter; import com.beust.jcommander.Parameters; import com.google.common.base.Joiner; import com.google.template.soy.data.SoyMapData; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.tools.soy.DomainRenewSoyInfo; import google.registry.util.Clock; import java.util.List; @@ -77,11 +77,10 @@ final class RenewDomainCommand extends MutatingEppToolCommand { checkArgument(period < 10, "Cannot renew domains for 10 or more years"); DateTime now = clock.nowUtc(); for (String domainName : mainParameters) { - Optional domainOptional = - loadByForeignKey(DomainBase.class, domainName, now); + Optional domainOptional = loadByForeignKey(Domain.class, domainName, now); checkArgumentPresent(domainOptional, "Domain '%s' does not exist or is deleted", domainName); setSoyTemplate(DomainRenewSoyInfo.getInstance(), DomainRenewSoyInfo.RENEWDOMAIN); - DomainBase domain = domainOptional.get(); + Domain domain = domainOptional.get(); SoyMapData soyMapData = new SoyMapData( diff --git a/core/src/main/java/google/registry/tools/UniformRapidSuspensionCommand.java b/core/src/main/java/google/registry/tools/UniformRapidSuspensionCommand.java index a059b3ecb..d28f9686d 100644 --- a/core/src/main/java/google/registry/tools/UniformRapidSuspensionCommand.java +++ b/core/src/main/java/google/registry/tools/UniformRapidSuspensionCommand.java @@ -32,7 +32,7 @@ import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSortedSet; import com.google.template.soy.data.SoyListData; import com.google.template.soy.data.SoyMapData; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.secdns.DelegationSignerData; import google.registry.model.eppcommon.StatusValue; import google.registry.model.host.HostResource; @@ -126,9 +126,9 @@ final class UniformRapidSuspensionCommand extends MutatingEppToolCommand { ImmutableList newCanonicalHosts = newHosts.stream().map(DomainNameUtils::canonicalizeHostname).collect(toImmutableList()); ImmutableSet newHostsSet = ImmutableSet.copyOf(newCanonicalHosts); - Optional domainOpt = loadByForeignKey(DomainBase.class, domainName, now); + Optional domainOpt = loadByForeignKey(Domain.class, domainName, now); checkArgumentPresent(domainOpt, "Domain '%s' does not exist or is deleted", domainName); - DomainBase domain = domainOpt.get(); + Domain domain = domainOpt.get(); Set missingHosts = difference(newHostsSet, checkResourcesExist(HostResource.class, newCanonicalHosts, now)); checkArgument(missingHosts.isEmpty(), "Hosts do not exist: %s", missingHosts); @@ -202,7 +202,7 @@ final class UniformRapidSuspensionCommand extends MutatingEppToolCommand { Boolean.toString(undo))); } - private ImmutableSortedSet getExistingNameservers(DomainBase domain) { + private ImmutableSortedSet getExistingNameservers(Domain domain) { ImmutableSortedSet.Builder nameservers = ImmutableSortedSet.naturalOrder(); for (HostResource host : tm().transact(() -> tm().loadByKeys(domain.getNameservers()).values())) { @@ -211,7 +211,7 @@ final class UniformRapidSuspensionCommand extends MutatingEppToolCommand { return nameservers.build(); } - private ImmutableSortedSet getExistingLocks(DomainBase domain) { + private ImmutableSortedSet getExistingLocks(Domain domain) { ImmutableSortedSet.Builder locks = ImmutableSortedSet.naturalOrder(); for (StatusValue lock : domain.getStatusValues()) { if (URS_LOCKS.contains(lock.getXmlName())) { @@ -221,7 +221,7 @@ final class UniformRapidSuspensionCommand extends MutatingEppToolCommand { return locks.build(); } - private boolean hasClientHold(DomainBase domain) { + private boolean hasClientHold(Domain domain) { for (StatusValue status : domain.getStatusValues()) { if (status == StatusValue.CLIENT_HOLD) { return true; @@ -230,7 +230,7 @@ final class UniformRapidSuspensionCommand extends MutatingEppToolCommand { return false; } - private ImmutableList> getExistingDsData(DomainBase domain) { + private ImmutableList> getExistingDsData(Domain domain) { ImmutableList.Builder> dsDataJsons = new ImmutableList.Builder(); HexBinaryAdapter hexBinaryAdapter = new HexBinaryAdapter(); for (DelegationSignerData dsData : domain.getDsData()) { diff --git a/core/src/main/java/google/registry/tools/UnrenewDomainCommand.java b/core/src/main/java/google/registry/tools/UnrenewDomainCommand.java index a56561e60..a71146fde 100644 --- a/core/src/main/java/google/registry/tools/UnrenewDomainCommand.java +++ b/core/src/main/java/google/registry/tools/UnrenewDomainCommand.java @@ -32,7 +32,7 @@ import com.google.common.collect.ImmutableMultimap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Sets; import google.registry.model.billing.BillingEvent; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainHistory; import google.registry.model.domain.Period; import google.registry.model.domain.Period.Unit; @@ -87,11 +87,11 @@ class UnrenewDomainCommand extends ConfirmingCommand implements CommandWithRemot new ImmutableMap.Builder<>(); for (String domainName : mainParameters) { - if (ForeignKeyIndex.load(DomainBase.class, domainName, START_OF_TIME) == null) { + if (ForeignKeyIndex.load(Domain.class, domainName, START_OF_TIME) == null) { domainsNonexistentBuilder.add(domainName); continue; } - Optional domain = loadByForeignKey(DomainBase.class, domainName, now); + Optional domain = loadByForeignKey(Domain.class, domainName, now); if (!domain.isPresent() || domain.get().getStatusValues().contains(StatusValue.PENDING_DELETE)) { domainsDeletingBuilder.add(domainName); @@ -139,7 +139,7 @@ class UnrenewDomainCommand extends ConfirmingCommand implements CommandWithRemot StringBuilder resultBuilder = new StringBuilder(); DateTime now = clock.nowUtc(); for (String domainName : mainParameters) { - DomainBase domain = loadByForeignKey(DomainBase.class, domainName, now).get(); + Domain domain = loadByForeignKey(Domain.class, domainName, now).get(); DateTime previousTime = domain.getRegistrationExpirationTime(); DateTime newTime = leapSafeSubtractYears(previousTime, period); resultBuilder.append( @@ -162,8 +162,7 @@ class UnrenewDomainCommand extends ConfirmingCommand implements CommandWithRemot private void unrenewDomain(String domainName) { tm().assertInTransaction(); DateTime now = tm().getTransactionTime(); - Optional domainOptional = - loadByForeignKey(DomainBase.class, domainName, now); + Optional domainOptional = loadByForeignKey(Domain.class, domainName, now); // Transactional sanity checks on the off chance that something changed between init() running // and here. checkState( @@ -171,7 +170,7 @@ class UnrenewDomainCommand extends ConfirmingCommand implements CommandWithRemot && !domainOptional.get().getStatusValues().contains(StatusValue.PENDING_DELETE), "Domain %s was deleted or is pending deletion", domainName); - DomainBase domain = domainOptional.get(); + Domain domain = domainOptional.get(); checkState( Sets.intersection(domain.getStatusValues(), DISALLOWED_STATUSES).isEmpty(), "Domain %s has prohibited status values", @@ -217,7 +216,7 @@ class UnrenewDomainCommand extends ConfirmingCommand implements CommandWithRemot .build(); // End the old autorenew billing event and poll message now. updateAutorenewRecurrenceEndTime(domain, now); - DomainBase newDomain = + Domain newDomain = domain .asBuilder() .setRegistrationExpirationTime(newExpirationTime) diff --git a/core/src/main/java/google/registry/tools/UpdateDomainCommand.java b/core/src/main/java/google/registry/tools/UpdateDomainCommand.java index 662fc7adf..36e831fd6 100644 --- a/core/src/main/java/google/registry/tools/UpdateDomainCommand.java +++ b/core/src/main/java/google/registry/tools/UpdateDomainCommand.java @@ -32,7 +32,7 @@ import com.google.common.collect.Sets; import com.google.common.flogger.FluentLogger; import com.google.template.soy.data.SoyMapData; import google.registry.model.domain.DesignatedContact; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.GracePeriodBase; import google.registry.model.eppcommon.StatusValue; import google.registry.tools.params.NameserversParameter; @@ -183,21 +183,21 @@ final class UpdateDomainCommand extends CreateOrUpdateDomainCommand { ImmutableSet.Builder autorenewGracePeriodWarningDomains = new ImmutableSet.Builder<>(); DateTime now = clock.nowUtc(); - for (String domain : domains) { - Optional domainOptional = loadByForeignKey(DomainBase.class, domain, now); - checkArgumentPresent(domainOptional, "Domain '%s' does not exist or is deleted", domain); - DomainBase domainBase = domainOptional.get(); + for (String domainName : domains) { + Optional domainOptional = loadByForeignKey(Domain.class, domainName, now); + checkArgumentPresent(domainOptional, "Domain '%s' does not exist or is deleted", domainName); + Domain domain = domainOptional.get(); checkArgument( - !domainBase.getStatusValues().contains(SERVER_UPDATE_PROHIBITED), + !domain.getStatusValues().contains(SERVER_UPDATE_PROHIBITED), "The domain '%s' has status SERVER_UPDATE_PROHIBITED. Verify that you are allowed " + "to make updates, and if so, use the domain_unlock command to enable updates.", - domain); + domainName); checkArgument( - !domainBase.getStatusValues().contains(PENDING_DELETE) || forceInPendingDelete, + !domain.getStatusValues().contains(PENDING_DELETE) || forceInPendingDelete, "The domain '%s' has status PENDING_DELETE. Verify that you really are intending to " + "update a domain in pending delete (this is uncommon), and if so, pass the " + "--force_in_pending_delete parameter to allow this update.", - domain); + domainName); // Use TreeSets so that the results are always in the same order (this makes testing easier). Set addAdminsThisDomain = new TreeSet<>(addAdmins); @@ -211,7 +211,7 @@ final class UpdateDomainCommand extends CreateOrUpdateDomainCommand { if (!nameservers.isEmpty() || !admins.isEmpty() || !techs.isEmpty() || !statuses.isEmpty()) { if (!nameservers.isEmpty()) { - ImmutableSortedSet existingNameservers = domainBase.loadNameserverHostNames(); + ImmutableSortedSet existingNameservers = domain.loadNameserverHostNames(); populateAddRemoveLists( ImmutableSet.copyOf(nameservers), existingNameservers, @@ -224,13 +224,13 @@ final class UpdateDomainCommand extends CreateOrUpdateDomainCommand { checkArgument( numNameservers <= 13, "The resulting nameservers count for domain %s would be more than 13", - domain); + domainName); } if (!admins.isEmpty() || !techs.isEmpty()) { ImmutableSet existingAdmins = - getContactsOfType(domainBase, DesignatedContact.Type.ADMIN); + getContactsOfType(domain, DesignatedContact.Type.ADMIN); ImmutableSet existingTechs = - getContactsOfType(domainBase, DesignatedContact.Type.TECH); + getContactsOfType(domain, DesignatedContact.Type.TECH); if (!admins.isEmpty()) { populateAddRemoveLists( @@ -249,7 +249,7 @@ final class UpdateDomainCommand extends CreateOrUpdateDomainCommand { } if (!statuses.isEmpty()) { Set currentStatusValues = new HashSet<>(); - for (StatusValue statusValue : domainBase.getStatusValues()) { + for (StatusValue statusValue : domain.getStatusValues()) { currentStatusValues.add(statusValue.getXmlName()); } populateAddRemoveLists( @@ -280,24 +280,24 @@ final class UpdateDomainCommand extends CreateOrUpdateDomainCommand { || clearDsRecords); if (!add && !remove && !change && !secDns && autorenews == null) { - logger.atInfo().log("No changes need to be made to domain '%s'.", domain); + logger.atInfo().log("No changes need to be made to domain '%s'.", domainName); continue; } // If autorenew is being turned off and this domain is already in the autorenew grace period, // then we want to warn the user that they might want to delete it instead. if (Boolean.FALSE.equals(autorenews)) { - if (domainBase.getGracePeriods().stream() + if (domain.getGracePeriods().stream() .map(GracePeriodBase::getType) .anyMatch(isEqual(AUTO_RENEW))) { - autorenewGracePeriodWarningDomains.add(domain); + autorenewGracePeriodWarningDomains.add(domainName); } } setSoyTemplate(DomainUpdateSoyInfo.getInstance(), DomainUpdateSoyInfo.DOMAINUPDATE); SoyMapData soyMapData = new SoyMapData( - "domain", domain, + "domain", domainName, "add", add, "addNameservers", addNameserversThisDomain, "addAdmins", addAdminsThisDomain, @@ -341,11 +341,10 @@ final class UpdateDomainCommand extends CreateOrUpdateDomainCommand { removeSet.addAll(Sets.difference(oldSet, targetSet)); } - ImmutableSet getContactsOfType( - DomainBase domainBase, final DesignatedContact.Type contactType) { + ImmutableSet getContactsOfType(Domain domain, final DesignatedContact.Type contactType) { return tm().transact( () -> - domainBase.getContacts().stream() + domain.getContacts().stream() .filter(contact -> contact.getType().equals(contactType)) .map(contact -> tm().loadByKey(contact.getContactKey()).getContactId()) .collect(toImmutableSet())); diff --git a/core/src/main/java/google/registry/tools/params/EppResourceTypeParameter.java b/core/src/main/java/google/registry/tools/params/EppResourceTypeParameter.java index a511f8489..4b009cd4e 100644 --- a/core/src/main/java/google/registry/tools/params/EppResourceTypeParameter.java +++ b/core/src/main/java/google/registry/tools/params/EppResourceTypeParameter.java @@ -16,13 +16,13 @@ package google.registry.tools.params; import google.registry.model.EppResource; import google.registry.model.contact.ContactResource; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.host.HostResource; /** Enum to make it easy for a command to accept a flag that specifies an EppResource subclass. */ public enum EppResourceTypeParameter { CONTACT(ContactResource.class), - DOMAIN(DomainBase.class), + DOMAIN(Domain.class), HOST(HostResource.class); private final Class type; diff --git a/core/src/main/java/google/registry/tools/server/GenerateZoneFilesAction.java b/core/src/main/java/google/registry/tools/server/GenerateZoneFilesAction.java index faf61684b..701f9778d 100644 --- a/core/src/main/java/google/registry/tools/server/GenerateZoneFilesAction.java +++ b/core/src/main/java/google/registry/tools/server/GenerateZoneFilesAction.java @@ -29,7 +29,7 @@ import com.google.common.collect.ImmutableSet; import com.google.common.flogger.FluentLogger; import google.registry.config.RegistryConfig.Config; import google.registry.gcs.GcsUtils; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.secdns.DelegationSignerData; import google.registry.model.host.HostResource; import google.registry.request.Action; @@ -168,7 +168,7 @@ public class GenerateZoneFilesAction implements Runnable, JsonActionRunner.JsonA .setCacheMode(CacheMode.IGNORE) .scroll(ScrollMode.FORWARD_ONLY); for (int i = 1; scrollableResults.next(); i = (i + 1) % BATCH_SIZE) { - DomainBase domain = (DomainBase) scrollableResults.get(0); + Domain domain = (Domain) scrollableResults.get(0); populateStanzasForDomain(domain, exportTime, result); if (i == 0) { jpaTm().getEntityManager().flush(); @@ -179,7 +179,7 @@ public class GenerateZoneFilesAction implements Runnable, JsonActionRunner.JsonA } private void populateStanzasForDomain( - DomainBase domain, DateTime exportTime, ImmutableList.Builder result) { + Domain domain, DateTime exportTime, ImmutableList.Builder result) { domain = loadAtPointInTime(domain, exportTime); // A null means the domain was deleted (or not created) at this time. if (domain == null || !domain.shouldPublishToDns()) { @@ -193,7 +193,7 @@ public class GenerateZoneFilesAction implements Runnable, JsonActionRunner.JsonA } private void populateStanzasForSubordinateHosts( - DomainBase domain, DateTime exportTime, ImmutableList.Builder result) { + Domain domain, DateTime exportTime, ImmutableList.Builder result) { ImmutableSet subordinateHosts = domain.getSubordinateHosts(); if (!subordinateHosts.isEmpty()) { for (HostResource unprojectedHost : tm().loadByKeys(domain.getNameservers()).values()) { @@ -229,7 +229,7 @@ public class GenerateZoneFilesAction implements Runnable, JsonActionRunner.JsonA * } * */ - private String domainStanza(DomainBase domain, DateTime exportTime) { + private String domainStanza(Domain domain, DateTime exportTime) { StringBuilder result = new StringBuilder(); String domainLabel = stripTld(domain.getDomainName(), domain.getTld()); for (HostResource nameserver : tm().loadByKeys(domain.getNameservers()).values()) { diff --git a/core/src/main/java/google/registry/tools/server/ListDomainsAction.java b/core/src/main/java/google/registry/tools/server/ListDomainsAction.java index 8936e2e4f..a6eecb3b7 100644 --- a/core/src/main/java/google/registry/tools/server/ListDomainsAction.java +++ b/core/src/main/java/google/registry/tools/server/ListDomainsAction.java @@ -31,7 +31,7 @@ import com.google.common.collect.ImmutableSet; import com.google.common.collect.Lists; import google.registry.model.EppResource; import google.registry.model.EppResourceUtils; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.request.Action; import google.registry.request.Parameter; import google.registry.request.auth.Auth; @@ -47,7 +47,7 @@ import org.joda.time.DateTime; path = ListDomainsAction.PATH, method = {GET, POST}, auth = Auth.AUTH_INTERNAL_OR_ADMIN) -public final class ListDomainsAction extends ListObjectsAction { +public final class ListDomainsAction extends ListObjectsAction { /** An App Engine limitation on how many subqueries can be used in a single query. */ @VisibleForTesting @NonFinalForTesting static int maxNumSubqueries = 30; @@ -73,22 +73,22 @@ public final class ListDomainsAction extends ListObjectsAction { } @Override - public ImmutableSet loadObjects() { + public ImmutableSet loadObjects() { checkArgument(!tlds.isEmpty(), "Must specify TLDs to query"); assertTldsExist(tlds); - ImmutableList domains = tm().isOfy() ? loadDomainsOfy() : loadDomainsSql(); + ImmutableList domains = tm().isOfy() ? loadDomainsOfy() : loadDomainsSql(); return ImmutableSet.copyOf(domains.reverse()); } - private ImmutableList loadDomainsOfy() { + private ImmutableList loadDomainsOfy() { DateTime now = clock.nowUtc(); - ImmutableList.Builder domainsBuilder = new ImmutableList.Builder<>(); + ImmutableList.Builder domainsBuilder = new ImmutableList.Builder<>(); // Combine the batches together by sorting all domains together with newest first, applying the // limit, and then reversing for display order. for (List tldsBatch : Lists.partition(tlds.asList(), maxNumSubqueries)) { auditedOfy() .load() - .type(DomainBase.class) + .type(Domain.class) .filter("tld in", tldsBatch) // Get the N most recently created domains (requires ordering in descending order). .order("-creationTime") @@ -107,7 +107,7 @@ public final class ListDomainsAction extends ListObjectsAction { .collect(toImmutableList()); } - private ImmutableList loadDomainsSql() { + private ImmutableList loadDomainsSql() { return jpaTm() .transact( () -> @@ -115,7 +115,7 @@ public final class ListDomainsAction extends ListObjectsAction { .query( "FROM Domain WHERE tld IN (:tlds) AND deletionTime > " + "current_timestamp() ORDER BY creationTime DESC", - DomainBase.class) + Domain.class) .setParameter("tlds", tlds) .setMaxResults(limit) .getResultStream() diff --git a/core/src/main/java/google/registry/whois/DomainLookupCommand.java b/core/src/main/java/google/registry/whois/DomainLookupCommand.java index 789d0dc41..8af598e80 100644 --- a/core/src/main/java/google/registry/whois/DomainLookupCommand.java +++ b/core/src/main/java/google/registry/whois/DomainLookupCommand.java @@ -18,7 +18,7 @@ import static google.registry.model.EppResourceUtils.loadByForeignKey; import static google.registry.model.EppResourceUtils.loadByForeignKeyCached; import com.google.common.net.InternetDomainName; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import java.util.Optional; import org.joda.time.DateTime; @@ -42,10 +42,10 @@ public class DomainLookupCommand extends DomainOrHostLookupCommand { @Override protected Optional getResponse(InternetDomainName domainName, DateTime now) { - Optional domainResource = + Optional domainResource = cached - ? loadByForeignKeyCached(DomainBase.class, domainName.toString(), now) - : loadByForeignKey(DomainBase.class, domainName.toString(), now); + ? loadByForeignKeyCached(Domain.class, domainName.toString(), now) + : loadByForeignKey(Domain.class, domainName.toString(), now); return domainResource.map( domain -> new DomainWhoisResponse(domain, fullOutput, whoisRedactedEmailText, now)); } diff --git a/core/src/main/java/google/registry/whois/DomainWhoisResponse.java b/core/src/main/java/google/registry/whois/DomainWhoisResponse.java index 63f566cc2..f1e4364d7 100644 --- a/core/src/main/java/google/registry/whois/DomainWhoisResponse.java +++ b/core/src/main/java/google/registry/whois/DomainWhoisResponse.java @@ -28,7 +28,7 @@ import google.registry.model.contact.ContactResource; import google.registry.model.contact.PostalInfo; import google.registry.model.domain.DesignatedContact; import google.registry.model.domain.DesignatedContact.Type; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.GracePeriod; import google.registry.model.eppcommon.StatusValue; import google.registry.model.registrar.Registrar; @@ -54,7 +54,7 @@ final class DomainWhoisResponse extends WhoisResponseImpl { "For more information on Whois status codes, please visit https://icann.org/epp\r\n"; /** Domain which was the target of this WHOIS command. */ - private final DomainBase domain; + private final Domain domain; /** Whether the full WHOIS output is to be displayed. */ private final boolean fullOutput; @@ -62,9 +62,9 @@ final class DomainWhoisResponse extends WhoisResponseImpl { /** When fullOutput is false, the text to display for the registrant's email fields. */ private final String whoisRedactedEmailText; - /** Creates new WHOIS domain response on the given domain. */ + /** Creates new WHOIS domain response on the given domain. */ DomainWhoisResponse( - DomainBase domain, boolean fullOutput, String whoisRedactedEmailText, DateTime timestamp) { + Domain domain, boolean fullOutput, String whoisRedactedEmailText, DateTime timestamp) { super(timestamp); this.domain = checkNotNull(domain, "domain"); this.fullOutput = fullOutput; diff --git a/core/src/main/resources/META-INF/persistence.xml b/core/src/main/resources/META-INF/persistence.xml index 9c50a9e10..5dcc9a372 100644 --- a/core/src/main/resources/META-INF/persistence.xml +++ b/core/src/main/resources/META-INF/persistence.xml @@ -45,7 +45,7 @@ google.registry.model.common.DatabaseMigrationStateSchedule google.registry.model.contact.ContactHistory google.registry.model.contact.ContactResource - google.registry.model.domain.DomainBase + google.registry.model.domain.Domain google.registry.model.domain.DomainHistory google.registry.model.domain.GracePeriod google.registry.model.domain.GracePeriod$GracePeriodHistory @@ -102,7 +102,7 @@ google.registry.model.billing.VKeyConverter_OneTime google.registry.model.billing.VKeyConverter_Recurring google.registry.model.contact.VKeyConverter_ContactResource - google.registry.model.domain.VKeyConverter_DomainBase + google.registry.model.domain.VKeyConverter_Domain google.registry.model.domain.token.VKeyConverter_AllocationToken google.registry.model.host.VKeyConverter_HostResource google.registry.model.poll.VKeyConverter_Autorenew diff --git a/core/src/test/java/google/registry/batch/DeleteExpiredDomainsActionTest.java b/core/src/test/java/google/registry/batch/DeleteExpiredDomainsActionTest.java index 2e0d0a6e9..06b249092 100644 --- a/core/src/test/java/google/registry/batch/DeleteExpiredDomainsActionTest.java +++ b/core/src/test/java/google/registry/batch/DeleteExpiredDomainsActionTest.java @@ -21,7 +21,6 @@ import static google.registry.model.reporting.HistoryEntry.Type.DOMAIN_CREATE; import static google.registry.persistence.transaction.TransactionManagerFactory.tm; import static google.registry.testing.DatabaseHelper.createTld; import static google.registry.testing.DatabaseHelper.loadByEntity; -import static google.registry.testing.DatabaseHelper.newDomainBase; import static google.registry.testing.DatabaseHelper.persistActiveDomain; import static google.registry.testing.DatabaseHelper.persistResource; import static google.registry.util.DateTimeUtils.END_OF_TIME; @@ -33,13 +32,14 @@ import google.registry.flows.EppTestComponent.FakesAndMocksModule; import google.registry.model.billing.BillingEvent; import google.registry.model.billing.BillingEvent.Flag; import google.registry.model.billing.BillingEvent.Reason; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainHistory; import google.registry.model.ofy.Ofy; import google.registry.model.poll.PollMessage; import google.registry.model.reporting.HistoryEntry; import google.registry.persistence.transaction.QueryComposer.Comparator; import google.registry.testing.AppEngineExtension; +import google.registry.testing.DatabaseHelper; import google.registry.testing.FakeClock; import google.registry.testing.FakeLockHandler; import google.registry.testing.FakeResponse; @@ -82,21 +82,21 @@ class DeleteExpiredDomainsActionTest { @Test void test_deletesOnlyExpiredDomain() { // A normal, active autorenewing domain that shouldn't be touched. - DomainBase activeDomain = persistActiveDomain("foo.tld"); + Domain activeDomain = persistActiveDomain("foo.tld"); // A non-autorenewing domain that is already pending delete and shouldn't be touched. - DomainBase alreadyDeletedDomain = + Domain alreadyDeletedDomain = persistResource( - newDomainBase("bar.tld") + DatabaseHelper.newDomain("bar.tld") .asBuilder() .setAutorenewEndTime(Optional.of(clock.nowUtc().minusDays(10))) .setDeletionTime(clock.nowUtc().plusDays(17)) .build()); // A non-autorenewing domain that hasn't reached its expiration time and shouldn't be touched. - DomainBase notYetExpiredDomain = + Domain notYetExpiredDomain = persistResource( - newDomainBase("baz.tld") + DatabaseHelper.newDomain("baz.tld") .asBuilder() .setAutorenewEndTime(Optional.of(clock.nowUtc().plusDays(15))) .build()); @@ -104,7 +104,7 @@ class DeleteExpiredDomainsActionTest { // A non-autorenewing domain that is past its expiration time and should be deleted. // (This is the only one that needs a full set of subsidiary resources, for the delete flow to // to operate on.) - DomainBase pendingExpirationDomain = persistNonAutorenewingDomain("fizz.tld"); + Domain pendingExpirationDomain = persistNonAutorenewingDomain("fizz.tld"); assertThat(loadByEntity(pendingExpirationDomain).getStatusValues()) .doesNotContain(PENDING_DELETE); @@ -114,21 +114,21 @@ class DeleteExpiredDomainsActionTest { clock.advanceOneMilli(); action.run(); - DomainBase reloadedActiveDomain = loadByEntity(activeDomain); + Domain reloadedActiveDomain = loadByEntity(activeDomain); assertThat(reloadedActiveDomain).isEqualTo(activeDomain); assertThat(reloadedActiveDomain.getStatusValues()).doesNotContain(PENDING_DELETE); assertThat(loadByEntity(alreadyDeletedDomain)).isEqualTo(alreadyDeletedDomain); assertThat(loadByEntity(notYetExpiredDomain)).isEqualTo(notYetExpiredDomain); - DomainBase reloadedExpiredDomain = loadByEntity(pendingExpirationDomain); + Domain reloadedExpiredDomain = loadByEntity(pendingExpirationDomain); assertThat(reloadedExpiredDomain.getStatusValues()).contains(PENDING_DELETE); assertThat(reloadedExpiredDomain.getDeletionTime()).isEqualTo(clock.nowUtc().plusDays(35)); } @Test void test_deletesThreeDomainsInOneRun() throws Exception { - DomainBase domain1 = persistNonAutorenewingDomain("ecck1.tld"); - DomainBase domain2 = persistNonAutorenewingDomain("veee2.tld"); - DomainBase domain3 = persistNonAutorenewingDomain("tarm3.tld"); + Domain domain1 = persistNonAutorenewingDomain("ecck1.tld"); + Domain domain2 = persistNonAutorenewingDomain("veee2.tld"); + Domain domain3 = persistNonAutorenewingDomain("tarm3.tld"); // action.run() executes an ancestor-less query which is subject to eventual consistency (it // uses an index that is updated asynchronously). For a deterministic test outcome, we busy @@ -139,10 +139,10 @@ class DeleteExpiredDomainsActionTest { tm().transact( () -> tm() - .createQueryComposer(DomainBase.class) + .createQueryComposer(Domain.class) .where("autorenewEndTime", Comparator.LTE, clock.nowUtc()) .stream() - .map(DomainBase::getDomainName) + .map(Domain::getDomainName) .collect(toImmutableSet())); if (matchingDomains.containsAll(ImmutableSet.of("ecck1.tld", "veee2.tld", "tarm3.tld"))) { break; @@ -164,8 +164,8 @@ class DeleteExpiredDomainsActionTest { assertThat(loadByEntity(domain3).getStatusValues()).contains(PENDING_DELETE); } - private DomainBase persistNonAutorenewingDomain(String domainName) { - DomainBase pendingExpirationDomain = persistActiveDomain(domainName); + private Domain persistNonAutorenewingDomain(String domainName) { + Domain pendingExpirationDomain = persistActiveDomain(domainName); DomainHistory createHistoryEntry = persistResource( new DomainHistory.Builder() diff --git a/core/src/test/java/google/registry/batch/DeleteProberDataActionTest.java b/core/src/test/java/google/registry/batch/DeleteProberDataActionTest.java index 3d266bac2..094d8d50f 100644 --- a/core/src/test/java/google/registry/batch/DeleteProberDataActionTest.java +++ b/core/src/test/java/google/registry/batch/DeleteProberDataActionTest.java @@ -22,7 +22,6 @@ import static google.registry.persistence.transaction.TransactionManagerFactory. import static google.registry.testing.DatabaseHelper.createTld; import static google.registry.testing.DatabaseHelper.loadByEntitiesIfPresent; import static google.registry.testing.DatabaseHelper.loadByEntity; -import static google.registry.testing.DatabaseHelper.newDomainBase; import static google.registry.testing.DatabaseHelper.persistActiveDomain; import static google.registry.testing.DatabaseHelper.persistActiveHost; import static google.registry.testing.DatabaseHelper.persistDeletedDomain; @@ -42,7 +41,7 @@ import google.registry.dns.DnsQueue; import google.registry.model.ImmutableObject; import google.registry.model.billing.BillingEvent; import google.registry.model.billing.BillingEvent.Reason; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainHistory; import google.registry.model.index.EppResourceIndex; import google.registry.model.index.ForeignKeyIndex; @@ -51,6 +50,7 @@ import google.registry.model.reporting.HistoryEntry; import google.registry.model.tld.Registry; import google.registry.model.tld.Registry.TldType; import google.registry.testing.AppEngineExtension; +import google.registry.testing.DatabaseHelper; import google.registry.testing.FakeClock; import google.registry.testing.SystemPropertyExtension; import java.util.Optional; @@ -173,7 +173,7 @@ class DeleteProberDataActionTest { @Test void testSuccess_doesntDeleteNicDomainForProbers() throws Exception { - DomainBase nic = persistActiveDomain("nic.ib-any.test"); + Domain nic = persistActiveDomain("nic.ib-any.test"); Set ibEntities = persistLotsOfDomains("ib-any.test"); action.run(); assertAllAbsent(ibEntities); @@ -192,32 +192,32 @@ class DeleteProberDataActionTest { @Test void testSuccess_activeDomain_isSoftDeleted() throws Exception { - DomainBase domain = + Domain domain = persistResource( - newDomainBase("blah.ib-any.test") + DatabaseHelper.newDomain("blah.ib-any.test") .asBuilder() .setCreationTimeForTest(DateTime.now(UTC).minusYears(1)) .build()); action.run(); DateTime timeAfterDeletion = DateTime.now(UTC); - assertThat(loadByForeignKey(DomainBase.class, "blah.ib-any.test", timeAfterDeletion)).isEmpty(); + assertThat(loadByForeignKey(Domain.class, "blah.ib-any.test", timeAfterDeletion)).isEmpty(); assertThat(loadByEntity(domain).getDeletionTime()).isLessThan(timeAfterDeletion); assertDnsTasksEnqueued("blah.ib-any.test"); } @Test void testSuccess_activeDomain_doubleMapSoftDeletes() throws Exception { - DomainBase domain = persistResource( - newDomainBase("blah.ib-any.test") - .asBuilder() - .setCreationTimeForTest(DateTime.now(UTC).minusYears(1)) - .build()); + Domain domain = + persistResource( + DatabaseHelper.newDomain("blah.ib-any.test") + .asBuilder() + .setCreationTimeForTest(DateTime.now(UTC).minusYears(1)) + .build()); action.run(); DateTime timeAfterDeletion = DateTime.now(UTC); resetAction(); action.run(); - assertThat(loadByForeignKey(DomainBase.class, "blah.ib-any.test", timeAfterDeletion)) - .isEmpty(); + assertThat(loadByForeignKey(Domain.class, "blah.ib-any.test", timeAfterDeletion)).isEmpty(); assertThat(loadByEntity(domain).getDeletionTime()).isLessThan(timeAfterDeletion); assertDnsTasksEnqueued("blah.ib-any.test"); } @@ -225,22 +225,21 @@ class DeleteProberDataActionTest { @Test void test_recentlyCreatedDomain_isntDeletedYet() throws Exception { persistResource( - newDomainBase("blah.ib-any.test") + DatabaseHelper.newDomain("blah.ib-any.test") .asBuilder() .setCreationTimeForTest(DateTime.now(UTC).minusSeconds(1)) .build()); action.run(); - Optional domain = - loadByForeignKey(DomainBase.class, "blah.ib-any.test", DateTime.now(UTC)); + Optional domain = loadByForeignKey(Domain.class, "blah.ib-any.test", DateTime.now(UTC)); assertThat(domain).isPresent(); assertThat(domain.get().getDeletionTime()).isEqualTo(END_OF_TIME); } @Test void testDryRun_doesntSoftDeleteData() throws Exception { - DomainBase domain = + Domain domain = persistResource( - newDomainBase("blah.ib-any.test") + DatabaseHelper.newDomain("blah.ib-any.test") .asBuilder() .setCreationTimeForTest(DateTime.now(UTC).minusYears(1)) .build()); @@ -252,11 +251,11 @@ class DeleteProberDataActionTest { @Test void test_domainWithSubordinateHosts_isSkipped() throws Exception { persistActiveHost("ns1.blah.ib-any.test"); - DomainBase nakedDomain = + Domain nakedDomain = persistDeletedDomain("todelete.ib-any.test", DateTime.now(UTC).minusYears(1)); - DomainBase domainWithSubord = + Domain domainWithSubord = persistDomainAsDeleted( - newDomainBase("blah.ib-any.test") + DatabaseHelper.newDomain("blah.ib-any.test") .asBuilder() .setSubordinateHosts(ImmutableSet.of("ns1.blah.ib-any.test")) .build(), @@ -270,7 +269,7 @@ class DeleteProberDataActionTest { @Test void testFailure_registryAdminClientId_isRequiredForSoftDeletion() { persistResource( - newDomainBase("blah.ib-any.test") + DatabaseHelper.newDomain("blah.ib-any.test") .asBuilder() .setCreationTimeForTest(DateTime.now(UTC).minusYears(1)) .build()); @@ -284,7 +283,7 @@ class DeleteProberDataActionTest { * along with the ForeignKeyIndex and EppResourceIndex. */ private static Set persistDomainAndDescendants(String fqdn) { - DomainBase domain = persistDeletedDomain(fqdn, DELETION_TIME); + Domain domain = persistDeletedDomain(fqdn, DELETION_TIME); DomainHistory historyEntry = persistSimpleResource( new DomainHistory.Builder() @@ -321,7 +320,7 @@ class DeleteProberDataActionTest { .add(pollMessage); if (tm().isOfy()) { builder - .add(ForeignKeyIndex.load(DomainBase.class, fqdn, START_OF_TIME)) + .add(ForeignKeyIndex.load(Domain.class, fqdn, START_OF_TIME)) .add(loadByEntity(EppResourceIndex.create(Key.create(domain)))); } return builder.build(); diff --git a/core/src/test/java/google/registry/batch/ExpandRecurringBillingEventsActionTest.java b/core/src/test/java/google/registry/batch/ExpandRecurringBillingEventsActionTest.java index 16b3ad84f..80932bcd2 100644 --- a/core/src/test/java/google/registry/batch/ExpandRecurringBillingEventsActionTest.java +++ b/core/src/test/java/google/registry/batch/ExpandRecurringBillingEventsActionTest.java @@ -26,7 +26,6 @@ import static google.registry.testing.DatabaseHelper.assertBillingEventsForResou import static google.registry.testing.DatabaseHelper.createTld; import static google.registry.testing.DatabaseHelper.getHistoryEntriesOfType; import static google.registry.testing.DatabaseHelper.getOnlyHistoryEntryOfType; -import static google.registry.testing.DatabaseHelper.newDomainBase; import static google.registry.testing.DatabaseHelper.persistDeletedDomain; import static google.registry.testing.DatabaseHelper.persistPremiumList; import static google.registry.testing.DatabaseHelper.persistResource; @@ -46,7 +45,7 @@ import google.registry.model.billing.BillingEvent.Flag; import google.registry.model.billing.BillingEvent.OneTime; import google.registry.model.billing.BillingEvent.Reason; import google.registry.model.common.Cursor; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainHistory; import google.registry.model.domain.Period; import google.registry.model.reporting.DomainTransactionRecord; @@ -54,6 +53,7 @@ import google.registry.model.reporting.DomainTransactionRecord.TransactionReport import google.registry.model.reporting.HistoryEntry; import google.registry.model.tld.Registry; import google.registry.testing.AppEngineExtension; +import google.registry.testing.DatabaseHelper; import google.registry.testing.FakeClock; import google.registry.testing.FakeResponse; import java.util.ArrayList; @@ -76,7 +76,7 @@ public class ExpandRecurringBillingEventsActionTest { private final FakeClock clock = new FakeClock(currentTestTime); private ExpandRecurringBillingEventsAction action; - private DomainBase domain; + private Domain domain; private DomainHistory historyEntry; private BillingEvent.Recurring recurring; @@ -91,7 +91,7 @@ public class ExpandRecurringBillingEventsActionTest { createTld("tld"); domain = persistResource( - newDomainBase("example.tld") + DatabaseHelper.newDomain("example.tld") .asBuilder() .setCreationTimeForTest(DateTime.parse("1999-01-05T00:00:00Z")) .build()); @@ -138,7 +138,7 @@ public class ExpandRecurringBillingEventsActionTest { } private void assertHistoryEntryMatches( - DomainBase domain, + Domain domain, HistoryEntry actual, String registrarId, DateTime billingTime, @@ -193,7 +193,7 @@ public class ExpandRecurringBillingEventsActionTest { @Test void testSuccess_expandSingleEvent_deletedDomain() throws Exception { DateTime deletionTime = DateTime.parse("2000-08-01T00:00:00Z"); - DomainBase deletedDomain = persistDeletedDomain("deleted.tld", deletionTime); + Domain deletedDomain = persistDeletedDomain("deleted.tld", deletionTime); historyEntry = persistResource( new DomainHistory.Builder() @@ -641,9 +641,9 @@ public class ExpandRecurringBillingEventsActionTest { @Test void testSuccess_expandMultipleEvents() throws Exception { persistResource(recurring); - DomainBase domain2 = + Domain domain2 = persistResource( - newDomainBase("example2.tld") + DatabaseHelper.newDomain("example2.tld") .asBuilder() .setCreationTimeForTest(DateTime.parse("1999-04-05T00:00:00Z")) .build()); @@ -666,9 +666,9 @@ public class ExpandRecurringBillingEventsActionTest { .setRecurrenceEndTime(END_OF_TIME) .setTargetId(domain2.getDomainName()) .build()); - DomainBase domain3 = + Domain domain3 = persistResource( - newDomainBase("example3.tld") + DatabaseHelper.newDomain("example3.tld") .asBuilder() .setCreationTimeForTest(DateTime.parse("1999-06-05T00:00:00Z")) .build()); diff --git a/core/src/test/java/google/registry/batch/RelockDomainActionTest.java b/core/src/test/java/google/registry/batch/RelockDomainActionTest.java index 1aaf7f35d..4d41cef4b 100644 --- a/core/src/test/java/google/registry/batch/RelockDomainActionTest.java +++ b/core/src/test/java/google/registry/batch/RelockDomainActionTest.java @@ -21,7 +21,6 @@ import static google.registry.model.eppcommon.StatusValue.PENDING_TRANSFER; import static google.registry.testing.DatabaseHelper.createTlds; import static google.registry.testing.DatabaseHelper.deleteTestDomain; import static google.registry.testing.DatabaseHelper.loadByEntity; -import static google.registry.testing.DatabaseHelper.newDomainBase; import static google.registry.testing.DatabaseHelper.persistActiveHost; import static google.registry.testing.DatabaseHelper.persistDomainAsDeleted; import static google.registry.testing.DatabaseHelper.persistResource; @@ -36,12 +35,13 @@ import static org.mockito.Mockito.verifyNoMoreInteractions; import com.google.cloud.tasks.v2.HttpMethod; import com.google.common.collect.ImmutableSet; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.RegistryLock; import google.registry.model.host.HostResource; import google.registry.testing.AppEngineExtension; import google.registry.testing.CloudTasksHelper; import google.registry.testing.CloudTasksHelper.TaskMatcher; +import google.registry.testing.DatabaseHelper; import google.registry.testing.DeterministicStringGenerator; import google.registry.testing.FakeClock; import google.registry.testing.FakeResponse; @@ -87,7 +87,7 @@ public class RelockDomainActionTest { .withUserService(UserInfo.create(POC_ID, "12345")) .build(); - private DomainBase domain; + private Domain domain; private RegistryLock oldLock; @Mock private SendEmailService sendEmailService; private RelockDomainAction action; @@ -96,7 +96,7 @@ public class RelockDomainActionTest { void beforeEach() throws Exception { createTlds("tld", "net"); HostResource host = persistActiveHost("ns1.example.net"); - domain = persistResource(newDomainBase(DOMAIN_NAME, host)); + domain = persistResource(DatabaseHelper.newDomain(DOMAIN_NAME, host)); oldLock = domainLockUtils.administrativelyApplyLock(DOMAIN_NAME, CLIENT_ID, POC_ID, false); assertThat(loadByEntity(domain).getStatusValues()) diff --git a/core/src/test/java/google/registry/batch/ResaveEntityActionTest.java b/core/src/test/java/google/registry/batch/ResaveEntityActionTest.java index e313e7c7b..e5605c10d 100644 --- a/core/src/test/java/google/registry/batch/ResaveEntityActionTest.java +++ b/core/src/test/java/google/registry/batch/ResaveEntityActionTest.java @@ -20,7 +20,7 @@ import static google.registry.batch.AsyncTaskEnqueuer.PARAM_RESOURCE_KEY; import static google.registry.batch.AsyncTaskEnqueuer.QUEUE_ASYNC_ACTIONS; import static google.registry.testing.DatabaseHelper.createTld; import static google.registry.testing.DatabaseHelper.loadByEntity; -import static google.registry.testing.DatabaseHelper.newDomainBase; +import static google.registry.testing.DatabaseHelper.newDomain; import static google.registry.testing.DatabaseHelper.persistActiveContact; import static google.registry.testing.DatabaseHelper.persistDomainWithDependentResources; import static google.registry.testing.DatabaseHelper.persistDomainWithPendingTransfer; @@ -31,7 +31,7 @@ import static org.mockito.Mockito.verify; import com.google.cloud.tasks.v2.HttpMethod; import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSortedSet; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.GracePeriod; import google.registry.model.domain.rgp.GracePeriodStatus; import google.registry.model.eppcommon.StatusValue; @@ -40,6 +40,7 @@ import google.registry.request.Response; import google.registry.testing.AppEngineExtension; import google.registry.testing.CloudTasksHelper; import google.registry.testing.CloudTasksHelper.TaskMatcher; +import google.registry.testing.DatabaseHelper; import google.registry.testing.FakeClock; import google.registry.testing.InjectExtension; import org.joda.time.DateTime; @@ -88,7 +89,7 @@ public class ResaveEntityActionTest { @MockitoSettings(strictness = Strictness.LENIENT) @Test void test_domainPendingTransfer_isResavedAndTransferCompleted() { - DomainBase domain = + Domain domain = persistDomainWithPendingTransfer( persistDomainWithDependentResources( "domain", @@ -106,15 +107,15 @@ public class ResaveEntityActionTest { domain.createVKey().getOfyKey().getString(), DateTime.parse("2016-02-06T10:00:01Z"), ImmutableSortedSet.of()); - DomainBase resavedDomain = loadByEntity(domain); + Domain resavedDomain = loadByEntity(domain); assertThat(resavedDomain.getCurrentSponsorRegistrarId()).isEqualTo("NewRegistrar"); verify(response).setPayload("Entity re-saved."); } @Test void test_domainPendingDeletion_isResavedAndReenqueued() { - DomainBase newDomain = newDomainBase("domain.tld"); - DomainBase domain = + Domain newDomain = DatabaseHelper.newDomain("domain.tld"); + Domain domain = persistResource( newDomain .asBuilder() @@ -136,7 +137,7 @@ public class ResaveEntityActionTest { domain.createVKey().getOfyKey().getString(), requestedTime, ImmutableSortedSet.of(requestedTime.plusDays(5))); - DomainBase resavedDomain = loadByEntity(domain); + Domain resavedDomain = loadByEntity(domain); assertThat(resavedDomain.getGracePeriods()).isEmpty(); cloudTasksHelper.assertTasksEnqueued( diff --git a/core/src/test/java/google/registry/beam/common/RegistryJpaReadTest.java b/core/src/test/java/google/registry/beam/common/RegistryJpaReadTest.java index 706def3b4..780f9d9f3 100644 --- a/core/src/test/java/google/registry/beam/common/RegistryJpaReadTest.java +++ b/core/src/test/java/google/registry/beam/common/RegistryJpaReadTest.java @@ -27,8 +27,8 @@ import google.registry.beam.TestPipelineExtension; import google.registry.beam.common.RegistryJpaIO.Read; import google.registry.model.contact.ContactBase; import google.registry.model.contact.ContactResource; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainAuthInfo; -import google.registry.model.domain.DomainBase; import google.registry.model.domain.GracePeriod; import google.registry.model.domain.launch.LaunchNotice; import google.registry.model.domain.rgp.GracePeriodStatus; @@ -116,9 +116,9 @@ public class RegistryJpaReadTest { ImmutableMap.of("type", Registrar.Type.REAL), false, (Object[] row) -> { - DomainBase domainBase = (DomainBase) row[0]; + Domain domain = (Domain) row[0]; String emailAddress = (String) row[1]; - return domainBase.getRepoId() + "-" + emailAddress; + return domain.getRepoId() + "-" + emailAddress; }); PCollection joinedStrings = testPipeline.apply(read); @@ -150,14 +150,14 @@ public class RegistryJpaReadTest { @Test void readWithStringTypedQuery() { setupForJoinQuery(); - Read read = + Read read = RegistryJpaIO.read( "select d from Domain d join Registrar r on" + " d.currentSponsorClientId = r.clientIdentifier where r.type = :type" + " and d.deletionTime > now()", ImmutableMap.of("type", Registrar.Type.REAL), - DomainBase.class, - DomainBase::getRepoId); + Domain.class, + Domain::getRepoId); PCollection repoIds = testPipeline.apply(read); PAssert.that(repoIds).containsInAnyOrder("4-COM"); @@ -179,8 +179,8 @@ public class RegistryJpaReadTest { .setTransferData(new ContactTransferData.Builder().build()) .setPersistedCurrentSponsorRegistrarId(registrar.getRegistrarId()) .build(); - DomainBase domain = - new DomainBase.Builder() + Domain domain = + new Domain.Builder() .setDomainName("example.com") .setRepoId("4-COM") .setCreationRegistrarId(registrar.getRegistrarId()) diff --git a/core/src/test/java/google/registry/beam/invoicing/InvoicingPipelineTest.java b/core/src/test/java/google/registry/beam/invoicing/InvoicingPipelineTest.java index 265bf222d..cc77576d7 100644 --- a/core/src/test/java/google/registry/beam/invoicing/InvoicingPipelineTest.java +++ b/core/src/test/java/google/registry/beam/invoicing/InvoicingPipelineTest.java @@ -41,7 +41,7 @@ import google.registry.model.billing.BillingEvent.Flag; import google.registry.model.billing.BillingEvent.OneTime; import google.registry.model.billing.BillingEvent.Reason; import google.registry.model.billing.BillingEvent.Recurring; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainHistory; import google.registry.model.registrar.Registrar; import google.registry.model.reporting.HistoryEntry; @@ -303,7 +303,7 @@ class InvoicingPipelineTest { .setInvoicingEnabled(true) .build(); persistResource(test); - DomainBase domain = persistActiveDomain("mycanadiandomain.test"); + Domain domain = persistActiveDomain("mycanadiandomain.test"); persistOneTimeBillingEvent(25, domain, registrar, Reason.RENEW, 3, Money.of(CAD, 20.5)); PCollection billingEvents = InvoicingPipeline.readFromCloudSql(options, pipeline); @@ -415,13 +415,13 @@ class InvoicingPipelineTest { .build(); persistResource(hello); - DomainBase domain1 = persistActiveDomain("mydomain.test"); - DomainBase domain2 = persistActiveDomain("mydomain2.test"); - DomainBase domain3 = persistActiveDomain("mydomain3.hello"); - DomainBase domain4 = persistActiveDomain("mydomain4.test"); - DomainBase domain5 = persistActiveDomain("mydomain5.test"); - DomainBase domain6 = persistActiveDomain("locked.test"); - DomainBase domain7 = persistActiveDomain("update-prohibited.test"); + Domain domain1 = persistActiveDomain("mydomain.test"); + Domain domain2 = persistActiveDomain("mydomain2.test"); + Domain domain3 = persistActiveDomain("mydomain3.hello"); + Domain domain4 = persistActiveDomain("mydomain4.test"); + Domain domain5 = persistActiveDomain("mydomain5.test"); + Domain domain6 = persistActiveDomain("locked.test"); + Domain domain7 = persistActiveDomain("update-prohibited.test"); persistOneTimeBillingEvent(1, domain1, registrar1, Reason.RENEW, 3, Money.of(USD, 20.5)); persistOneTimeBillingEvent(2, domain2, registrar1, Reason.RENEW, 3, Money.of(USD, 20.5)); @@ -453,7 +453,7 @@ class InvoicingPipelineTest { Registrar registrar4 = persistNewRegistrar("noBillRegistrar"); registrar4 = registrar4.asBuilder().setBillingAccountMap(null).build(); persistResource(registrar4); - DomainBase domain8 = persistActiveDomain("non-billable.test"); + Domain domain8 = persistActiveDomain("non-billable.test"); persistOneTimeBillingEvent(8, domain8, registrar4, Reason.RENEW, 3, Money.of(USD, 20.5)); // Add billing event for a non-real registrar @@ -466,16 +466,16 @@ class InvoicingPipelineTest { .setType(Registrar.Type.OTE) .build(); persistResource(registrar5); - DomainBase domain9 = persistActiveDomain("not-real.test"); + Domain domain9 = persistActiveDomain("not-real.test"); persistOneTimeBillingEvent(9, domain9, registrar5, Reason.RENEW, 3, Money.of(USD, 20.5)); // Add billing event for a non-invoicing TLD createTld("nobill"); - DomainBase domain10 = persistActiveDomain("test.nobill"); + Domain domain10 = persistActiveDomain("test.nobill"); persistOneTimeBillingEvent(10, domain10, registrar1, Reason.RENEW, 3, Money.of(USD, 20.5)); // Add billing event before October 2017 - DomainBase domain11 = persistActiveDomain("july.test"); + Domain domain11 = persistActiveDomain("july.test"); persistOneTimeBillingEvent( 11, domain11, @@ -487,7 +487,7 @@ class InvoicingPipelineTest { DateTime.parse("2017-07-02T00:00:00.0Z")); // Add a billing event with a corresponding cancellation - DomainBase domain12 = persistActiveDomain("cancel.test"); + Domain domain12 = persistActiveDomain("cancel.test"); OneTime oneTime = persistOneTimeBillingEvent(12, domain12, registrar1, Reason.RENEW, 3, Money.of(USD, 20.5)); DomainHistory domainHistory = persistDomainHistory(domain12, registrar1); @@ -507,7 +507,7 @@ class InvoicingPipelineTest { persistResource(cancellation); // Add billing event with a corresponding recurring billing event and cancellation - DomainBase domain13 = persistActiveDomain("cancel-recurring.test"); + Domain domain13 = persistActiveDomain("cancel-recurring.test"); DomainHistory domainHistoryRecurring = persistDomainHistory(domain13, registrar1); Recurring recurring = @@ -548,22 +548,22 @@ class InvoicingPipelineTest { persistResource(cancellationRecurring); } - private static DomainHistory persistDomainHistory(DomainBase domainBase, Registrar registrar) { + private static DomainHistory persistDomainHistory(Domain domain, Registrar registrar) { DomainHistory domainHistory = new DomainHistory.Builder() .setType(HistoryEntry.Type.DOMAIN_RENEW) .setModificationTime(DateTime.parse("2017-10-04T00:00:00.0Z")) - .setDomain(domainBase) + .setDomain(domain) .setRegistrarId(registrar.getRegistrarId()) .build(); return persistResource(domainHistory); } private static OneTime persistOneTimeBillingEvent( - int id, DomainBase domainBase, Registrar registrar, Reason reason, int years, Money money) { + int id, Domain domain, Registrar registrar, Reason reason, int years, Money money) { return persistOneTimeBillingEvent( id, - domainBase, + domain, registrar, reason, years, @@ -574,7 +574,7 @@ class InvoicingPipelineTest { private static OneTime persistOneTimeBillingEvent( int id, - DomainBase domainBase, + Domain domain, Registrar registrar, Reason reason, int years, @@ -590,10 +590,10 @@ class InvoicingPipelineTest { .setEventTime(eventTime) .setRegistrarId(registrar.getRegistrarId()) .setReason(reason) - .setTargetId(domainBase.getDomainName()) + .setTargetId(domain.getDomainName()) .setCost(money) .setFlags(Arrays.stream(flags).collect(toImmutableSet())) - .setDomainHistory(persistDomainHistory(domainBase, registrar)); + .setDomainHistory(persistDomainHistory(domain, registrar)); if (years > 0) { billingEventBuilder.setPeriodYears(years); diff --git a/core/src/test/java/google/registry/beam/rde/RdePipelineTest.java b/core/src/test/java/google/registry/beam/rde/RdePipelineTest.java index 0b5752941..8c7abd48a 100644 --- a/core/src/test/java/google/registry/beam/rde/RdePipelineTest.java +++ b/core/src/test/java/google/registry/beam/rde/RdePipelineTest.java @@ -31,7 +31,6 @@ import static google.registry.testing.AppEngineExtension.makeRegistrar1; import static google.registry.testing.AppEngineExtension.makeRegistrar2; import static google.registry.testing.DatabaseHelper.createTld; import static google.registry.testing.DatabaseHelper.insertSimpleResources; -import static google.registry.testing.DatabaseHelper.newDomainBase; import static google.registry.testing.DatabaseHelper.persistActiveContact; import static google.registry.testing.DatabaseHelper.persistActiveDomain; import static google.registry.testing.DatabaseHelper.persistActiveHost; @@ -58,7 +57,7 @@ import google.registry.model.contact.ContactBase; import google.registry.model.contact.ContactHistory; import google.registry.model.contact.ContactResource; import google.registry.model.domain.DesignatedContact; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainContent; import google.registry.model.domain.DomainHistory; import google.registry.model.domain.Period; @@ -84,6 +83,7 @@ import google.registry.rde.PendingDeposit; import google.registry.rde.RdeResourceType; import google.registry.testing.CloudTasksHelper; import google.registry.testing.CloudTasksHelper.TaskMatcher; +import google.registry.testing.DatabaseHelper; import google.registry.testing.DatastoreEntityExtension; import google.registry.testing.FakeClock; import google.registry.testing.FakeKeyringModule; @@ -274,9 +274,9 @@ public class RdePipelineTest { persistHostHistory(persistActiveHost("ns0.domain.tld")); HostResource host1 = persistActiveHost("ns1.external.tld"); persistHostHistory(host1); - DomainBase helloDomain = + Domain helloDomain = persistEppResource( - newDomainBase("hello.soy", contact1) + DatabaseHelper.newDomain("hello.soy", contact1) .asBuilder() .addNameserver(host1.createVKey()) .build()); @@ -284,17 +284,17 @@ public class RdePipelineTest { persistHostHistory(persistActiveHost("not-used-subordinate.hello.soy")); HostResource host2 = persistActiveHost("ns1.hello.soy"); persistHostHistory(host2); - DomainBase kittyDomain = + Domain kittyDomain = persistEppResource( - newDomainBase("kitty.fun", contact2) + DatabaseHelper.newDomain("kitty.fun", contact2) .asBuilder() .addNameservers(ImmutableSet.of(host1.createVKey(), host2.createVKey())) .build()); persistDomainHistory(kittyDomain); // Should not appear because the TLD is not included in a pending deposit. - persistDomainHistory(persistEppResource(newDomainBase("lol.cat", contact1))); + persistDomainHistory(persistEppResource(DatabaseHelper.newDomain("lol.cat", contact1))); // To be deleted. - DomainBase deletedDomain = persistActiveDomain("deleted.soy"); + Domain deletedDomain = persistActiveDomain("deleted.soy"); persistDomainHistory(deletedDomain); // Advance time @@ -335,7 +335,7 @@ public class RdePipelineTest { persistHostHistory(futureHost); persistDomainHistory( persistEppResource( - newDomainBase("future.soy", futureContact) + DatabaseHelper.newDomain("future.soy", futureContact) .asBuilder() .setNameservers(futureHost.createVKey()) .build())); diff --git a/core/src/test/java/google/registry/beam/resave/ResaveAllEppResourcesPipelineTest.java b/core/src/test/java/google/registry/beam/resave/ResaveAllEppResourcesPipelineTest.java index 9714c1909..6226c3a90 100644 --- a/core/src/test/java/google/registry/beam/resave/ResaveAllEppResourcesPipelineTest.java +++ b/core/src/test/java/google/registry/beam/resave/ResaveAllEppResourcesPipelineTest.java @@ -33,7 +33,7 @@ import static org.mockito.Mockito.verify; import google.registry.beam.TestPipelineExtension; import google.registry.model.EppResource; import google.registry.model.contact.ContactResource; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.GracePeriod; import google.registry.model.eppcommon.StatusValue; import google.registry.persistence.transaction.JpaTestExtensions; @@ -106,7 +106,7 @@ public class ResaveAllEppResourcesPipelineTest { void testPipeline_fulfilledDomainTransfer() { options.setFast(true); DateTime now = fakeClock.nowUtc(); - DomainBase domain = + Domain domain = persistDomainWithPendingTransfer( persistDomainWithDependentResources( "domain", @@ -122,7 +122,7 @@ public class ResaveAllEppResourcesPipelineTest { assertThat(domain.getUpdateTimestamp().getTimestamp()).isEqualTo(now); fakeClock.advanceOneMilli(); runPipeline(); - DomainBase postPipeline = loadByEntity(domain); + Domain postPipeline = loadByEntity(domain); assertThat(postPipeline.getStatusValues()).doesNotContain(StatusValue.PENDING_TRANSFER); assertThat(postPipeline.getUpdateTimestamp().getTimestamp()).isEqualTo(fakeClock.nowUtc()); } @@ -130,13 +130,13 @@ public class ResaveAllEppResourcesPipelineTest { @Test void testPipeline_autorenewedDomain() { DateTime now = fakeClock.nowUtc(); - DomainBase domain = + Domain domain = persistDomainWithDependentResources( "domain", "tld", persistActiveContact("jd1234"), now, now, now.plusYears(1)); assertThat(domain.getRegistrationExpirationTime()).isEqualTo(now.plusYears(1)); fakeClock.advanceBy(Duration.standardDays(500)); runPipeline(); - DomainBase postPipeline = loadByEntity(domain); + Domain postPipeline = loadByEntity(domain); assertThat(postPipeline.getRegistrationExpirationTime()).isEqualTo(now.plusYears(2)); } @@ -160,7 +160,7 @@ public class ResaveAllEppResourcesPipelineTest { // Spy the transaction manager so we can be sure we're only saving the renewed domain JpaTransactionManager spy = spy(jpaTm()); TransactionManagerFactory.setJpaTm(() -> spy); - ArgumentCaptor domainPutCaptor = ArgumentCaptor.forClass(DomainBase.class); + ArgumentCaptor domainPutCaptor = ArgumentCaptor.forClass(Domain.class); runPipeline(); // We should only be attempting to put the one changed domain into the DB verify(spy).put(domainPutCaptor.capture()); @@ -172,9 +172,9 @@ public class ResaveAllEppResourcesPipelineTest { options.setFast(false); DateTime now = fakeClock.nowUtc(); ContactResource contact = persistActiveContact("jd1234"); - DomainBase renewed = + Domain renewed = persistDomainWithDependentResources("renewed", "tld", contact, now, now, now.plusYears(1)); - DomainBase nonRenewed = + Domain nonRenewed = persistDomainWithDependentResources( "nonrenewed", "tld", contact, now, now, now.plusYears(20)); // Spy the transaction manager so we can be sure we're attempting to save everything diff --git a/core/src/test/java/google/registry/beam/spec11/Spec11PipelineTest.java b/core/src/test/java/google/registry/beam/spec11/Spec11PipelineTest.java index 7b3c14d65..f96ccb694 100644 --- a/core/src/test/java/google/registry/beam/spec11/Spec11PipelineTest.java +++ b/core/src/test/java/google/registry/beam/spec11/Spec11PipelineTest.java @@ -38,8 +38,8 @@ import google.registry.beam.TestPipelineExtension; import google.registry.beam.spec11.SafeBrowsingTransforms.EvaluateSafeBrowsingFn; import google.registry.beam.spec11.SafeBrowsingTransformsTest.HttpResponder; import google.registry.model.contact.ContactResource; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainAuthInfo; -import google.registry.model.domain.DomainBase; import google.registry.model.eppcommon.AuthInfo.PasswordAuth; import google.registry.model.registrar.Registrar; import google.registry.model.reporting.Spec11ThreatMatch; @@ -296,9 +296,9 @@ class Spec11PipelineTest { }); } - private DomainBase createDomain( + private Domain createDomain( String domainName, String repoId, Registrar registrar, ContactResource contact) { - return new DomainBase.Builder() + return new Domain.Builder() .setDomainName(domainName) .setRepoId(repoId) .setCreationRegistrarId(registrar.getRegistrarId()) diff --git a/core/src/test/java/google/registry/dns/PublishDnsUpdatesActionTest.java b/core/src/test/java/google/registry/dns/PublishDnsUpdatesActionTest.java index 1573ac518..536149c3b 100644 --- a/core/src/test/java/google/registry/dns/PublishDnsUpdatesActionTest.java +++ b/core/src/test/java/google/registry/dns/PublishDnsUpdatesActionTest.java @@ -44,7 +44,7 @@ import google.registry.dns.DnsMetrics.ActionStatus; import google.registry.dns.DnsMetrics.CommitStatus; import google.registry.dns.DnsMetrics.PublishStatus; import google.registry.dns.writer.DnsWriter; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.ofy.Ofy; import google.registry.model.tld.Registry; import google.registry.request.HttpException.ServiceUnavailableException; @@ -90,10 +90,10 @@ public class PublishDnsUpdatesActionTest { .asBuilder() .setDnsWriters(ImmutableSet.of("correctWriter")) .build()); - DomainBase domain1 = persistActiveDomain("example.xn--q9jyb4c"); + Domain domain1 = persistActiveDomain("example.xn--q9jyb4c"); persistActiveSubordinateHost("ns1.example.xn--q9jyb4c", domain1); persistActiveSubordinateHost("ns2.example.xn--q9jyb4c", domain1); - DomainBase domain2 = persistActiveDomain("example2.xn--q9jyb4c"); + Domain domain2 = persistActiveDomain("example2.xn--q9jyb4c"); persistActiveSubordinateHost("ns1.example.xn--q9jyb4c", domain2); clock.advanceOneMilli(); } diff --git a/core/src/test/java/google/registry/dns/RefreshDnsActionTest.java b/core/src/test/java/google/registry/dns/RefreshDnsActionTest.java index 622711e64..9c1cefffd 100644 --- a/core/src/test/java/google/registry/dns/RefreshDnsActionTest.java +++ b/core/src/test/java/google/registry/dns/RefreshDnsActionTest.java @@ -25,7 +25,7 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; import google.registry.dns.DnsConstants.TargetType; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.request.HttpException.BadRequestException; import google.registry.request.HttpException.NotFoundException; import google.registry.testing.AppEngineExtension; @@ -55,7 +55,7 @@ public class RefreshDnsActionTest { @Test void testSuccess_host() { - DomainBase domain = persistActiveDomain("example.xn--q9jyb4c"); + Domain domain = persistActiveDomain("example.xn--q9jyb4c"); persistActiveSubordinateHost("ns1.example.xn--q9jyb4c", domain); run(TargetType.HOST, "ns1.example.xn--q9jyb4c"); verify(dnsQueue).addHostRefreshTask("ns1.example.xn--q9jyb4c"); diff --git a/core/src/test/java/google/registry/dns/writer/clouddns/CloudDnsWriterTest.java b/core/src/test/java/google/registry/dns/writer/clouddns/CloudDnsWriterTest.java index e1eb565e7..c2514dbea 100644 --- a/core/src/test/java/google/registry/dns/writer/clouddns/CloudDnsWriterTest.java +++ b/core/src/test/java/google/registry/dns/writer/clouddns/CloudDnsWriterTest.java @@ -18,7 +18,6 @@ import static com.google.common.collect.ImmutableList.toImmutableList; import static com.google.common.io.BaseEncoding.base16; import static com.google.common.truth.Truth.assertThat; import static google.registry.testing.DatabaseHelper.createTld; -import static google.registry.testing.DatabaseHelper.newDomainBase; import static google.registry.testing.DatabaseHelper.newHostResource; import static google.registry.testing.DatabaseHelper.persistResource; import static org.mockito.ArgumentMatchers.anyString; @@ -39,12 +38,13 @@ import com.google.common.collect.Sets; import com.google.common.net.InetAddresses; import com.google.common.util.concurrent.RateLimiter; import google.registry.dns.writer.clouddns.CloudDnsWriter.ZoneStateException; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.secdns.DelegationSignerData; import google.registry.model.eppcommon.StatusValue; import google.registry.model.host.HostResource; import google.registry.persistence.VKey; import google.registry.testing.AppEngineExtension; +import google.registry.testing.DatabaseHelper; import google.registry.util.Retrier; import google.registry.util.SystemClock; import google.registry.util.SystemSleeper; @@ -282,7 +282,7 @@ public class CloudDnsWriterTest { } /** Returns a domain to be persisted in Datastore. */ - private static DomainBase fakeDomain( + private static Domain fakeDomain( String domainName, ImmutableSet nameservers, int numDsRecords) { ImmutableSet.Builder dsDataBuilder = new ImmutableSet.Builder<>(); @@ -295,7 +295,7 @@ public class CloudDnsWriterTest { hostResourceRefBuilder.add(nameserver.createVKey()); } - return newDomainBase(domainName) + return DatabaseHelper.newDomain(domainName) .asBuilder() .setNameservers(hostResourceRefBuilder.build()) .setDsData(dsDataBuilder.build()) diff --git a/core/src/test/java/google/registry/dns/writer/dnsupdate/DnsUpdateWriterTest.java b/core/src/test/java/google/registry/dns/writer/dnsupdate/DnsUpdateWriterTest.java index 2962d3879..2ae4c0ade 100644 --- a/core/src/test/java/google/registry/dns/writer/dnsupdate/DnsUpdateWriterTest.java +++ b/core/src/test/java/google/registry/dns/writer/dnsupdate/DnsUpdateWriterTest.java @@ -18,7 +18,6 @@ import static com.google.common.io.BaseEncoding.base16; import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertWithMessage; import static google.registry.testing.DatabaseHelper.createTld; -import static google.registry.testing.DatabaseHelper.newDomainBase; import static google.registry.testing.DatabaseHelper.newHostResource; import static google.registry.testing.DatabaseHelper.persistActiveDomain; import static google.registry.testing.DatabaseHelper.persistActiveHost; @@ -36,12 +35,13 @@ import com.google.common.base.VerifyException; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; import com.google.common.net.InetAddresses; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.secdns.DelegationSignerData; import google.registry.model.eppcommon.StatusValue; import google.registry.model.host.HostResource; import google.registry.model.ofy.Ofy; import google.registry.testing.AppEngineExtension; +import google.registry.testing.DatabaseHelper; import google.registry.testing.FakeClock; import google.registry.testing.InjectExtension; import java.util.ArrayList; @@ -100,7 +100,7 @@ public class DnsUpdateWriterTest { void testPublishDomainCreate_publishesNameServers() throws Exception { HostResource host1 = persistActiveHost("ns1.example.tld"); HostResource host2 = persistActiveHost("ns2.example.tld"); - DomainBase domain = + Domain domain = persistActiveDomain("example.tld") .asBuilder() .setNameservers(ImmutableSet.of(host1.createVKey(), host2.createVKey())) @@ -122,7 +122,7 @@ public class DnsUpdateWriterTest { @Test void testPublishAtomic_noCommit() { HostResource host1 = persistActiveHost("ns.example1.tld"); - DomainBase domain1 = + Domain domain1 = persistActiveDomain("example1.tld") .asBuilder() .setNameservers(ImmutableSet.of(host1.createVKey())) @@ -130,7 +130,7 @@ public class DnsUpdateWriterTest { persistResource(domain1); HostResource host2 = persistActiveHost("ns.example2.tld"); - DomainBase domain2 = + Domain domain2 = persistActiveDomain("example2.tld") .asBuilder() .setNameservers(ImmutableSet.of(host2.createVKey())) @@ -146,7 +146,7 @@ public class DnsUpdateWriterTest { @Test void testPublishAtomic_oneUpdate() throws Exception { HostResource host1 = persistActiveHost("ns.example1.tld"); - DomainBase domain1 = + Domain domain1 = persistActiveDomain("example1.tld") .asBuilder() .setNameservers(ImmutableSet.of(host1.createVKey())) @@ -154,7 +154,7 @@ public class DnsUpdateWriterTest { persistResource(domain1); HostResource host2 = persistActiveHost("ns.example2.tld"); - DomainBase domain2 = + Domain domain2 = persistActiveDomain("example2.tld") .asBuilder() .setNameservers(ImmutableSet.of(host2.createVKey())) @@ -177,7 +177,7 @@ public class DnsUpdateWriterTest { @Test void testPublishDomainCreate_publishesDelegationSigner() throws Exception { - DomainBase domain = + Domain domain = persistActiveDomain("example.tld") .asBuilder() .setNameservers(ImmutableSet.of(persistActiveHost("ns1.example.tld").createVKey())) @@ -201,7 +201,7 @@ public class DnsUpdateWriterTest { @Test void testPublishDomainWhenNotActive_removesDnsRecords() throws Exception { - DomainBase domain = + Domain domain = persistActiveDomain("example.tld") .asBuilder() .addStatusValue(StatusValue.SERVER_HOLD) @@ -246,7 +246,7 @@ public class DnsUpdateWriterTest { InetAddresses.forString("fd0e:a5c8:6dfb:6a5e:0:0:0:1"))) .build()); persistResource( - newDomainBase("example.tld") + DatabaseHelper.newDomain("example.tld") .asBuilder() .addSubordinateHost("ns1.example.tld") .addNameserver(host.createVKey()) @@ -318,7 +318,7 @@ public class DnsUpdateWriterTest { .build()); persistResource( - newDomainBase("example.tld") + DatabaseHelper.newDomain("example.tld") .asBuilder() .addSubordinateHost("ns1.example.tld") .addNameservers( @@ -354,7 +354,7 @@ public class DnsUpdateWriterTest { .build()); persistResource( - newDomainBase("example.tld") + DatabaseHelper.newDomain("example.tld") .asBuilder() .addSubordinateHost("ns1.example.tld") .addSubordinateHost("foo.example.tld") @@ -380,7 +380,7 @@ public class DnsUpdateWriterTest { @SuppressWarnings("AssertThrowsMultipleStatements") @Test void testPublishDomainFails_whenDnsUpdateReturnsError() throws Exception { - DomainBase domain = + Domain domain = persistActiveDomain("example.tld") .asBuilder() .setNameservers(ImmutableSet.of(persistActiveHost("ns1.example.tld").createVKey())) diff --git a/core/src/test/java/google/registry/flows/EppLifecycleDomainTest.java b/core/src/test/java/google/registry/flows/EppLifecycleDomainTest.java index 3c296b847..f088a36da 100644 --- a/core/src/test/java/google/registry/flows/EppLifecycleDomainTest.java +++ b/core/src/test/java/google/registry/flows/EppLifecycleDomainTest.java @@ -27,7 +27,7 @@ import static google.registry.testing.DatabaseHelper.createTlds; import static google.registry.testing.DatabaseHelper.getOnlyHistoryEntryOfType; import static google.registry.testing.DatabaseHelper.loadByEntity; import static google.registry.testing.DatabaseHelper.persistResource; -import static google.registry.testing.DomainBaseSubject.assertAboutDomains; +import static google.registry.testing.DomainSubject.assertAboutDomains; import static google.registry.testing.EppMetricSubject.assertThat; import static google.registry.util.DateTimeUtils.START_OF_TIME; import static org.joda.money.CurrencyUnit.USD; @@ -41,7 +41,7 @@ import com.google.re2j.Pattern; import google.registry.model.billing.BillingEvent; import google.registry.model.billing.BillingEvent.OneTime; import google.registry.model.billing.BillingEvent.Reason; -import google.registry.model.domain.DomainBase; +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; @@ -334,9 +334,8 @@ class EppLifecycleDomainTest extends EppTestCase { // This is the time of the renew. "UPDATE", "2000-06-03T00:00:00Z")); - DomainBase domain = - loadByForeignKey(DomainBase.class, "example.tld", DateTime.parse("2000-06-03T04:00:00Z")) - .get(); + Domain domain = + loadByForeignKey(Domain.class, "example.tld", DateTime.parse("2000-06-03T04:00:00Z")).get(); DateTime deleteTime = DateTime.parse("2000-06-04T00:00:00Z"); // Delete domain example.tld during both grace periods. @@ -376,7 +375,7 @@ class EppLifecycleDomainTest extends EppTestCase { // entire cost of registration was refunded. We have to do this through the DB instead of EPP // because domains deleted during the add grace period vanish immediately as far as the world // outside our system is concerned. - DomainBase deletedDomain = loadByEntity(domain); + Domain deletedDomain = loadByEntity(domain); assertAboutDomains().that(deletedDomain).hasRegistrationExpirationTime(createTime); assertThatLogoutSucceeds(); @@ -399,8 +398,7 @@ class EppLifecycleDomainTest extends EppTestCase { "CRDATE", "2000-06-01T00:02:00.0Z", "EXDATE", "2002-06-01T00:02:00.0Z")); - DomainBase domain = - loadByForeignKey(DomainBase.class, "example.tld", createTime.plusHours(1)).get(); + Domain domain = loadByForeignKey(Domain.class, "example.tld", createTime.plusHours(1)).get(); // Delete domain example.tld within the add grace period. DateTime deleteTime = createTime.plusDays(1); @@ -432,7 +430,7 @@ class EppLifecycleDomainTest extends EppTestCase { // entire cost of registration was refunded. We have to do this through the DB instead of EPP // because domains deleted during the add grace period vanish immediately as far as the world // outside our system is concerned. - DomainBase deletedDomain = loadByEntity(domain); + Domain deletedDomain = loadByEntity(domain); assertAboutDomains().that(deletedDomain).hasRegistrationExpirationTime(createTime); assertThatLogoutSucceeds(); @@ -482,10 +480,8 @@ class EppLifecycleDomainTest extends EppTestCase { ImmutableMap.of( "CODE", "2303", "MSG", "The domain with given ID (example.tld) doesn't exist.")); - DomainBase domain = - loadByForeignKey( - DomainBase.class, "example.tld", DateTime.parse("2000-08-01T00:02:00Z")) - .get(); + Domain domain = + loadByForeignKey(Domain.class, "example.tld", DateTime.parse("2000-08-01T00:02:00Z")).get(); // Verify that the autorenew was ended and that the one-time billing event is not canceled. assertBillingEventsForResource( domain, @@ -495,7 +491,7 @@ class EppLifecycleDomainTest extends EppTestCase { assertThatLogoutSucceeds(); // Make sure that in the future, the domain expiration is unchanged after deletion - DomainBase clonedDomain = domain.cloneProjectedAtTime(deleteTime.plusYears(5)); + Domain clonedDomain = domain.cloneProjectedAtTime(deleteTime.plusYears(5)); Truth.assertThat(clonedDomain.getRegistrationExpirationTime()) .isEqualTo(createTime.plusYears(2)); } @@ -522,10 +518,8 @@ class EppLifecycleDomainTest extends EppTestCase { .atTime(createTime) .hasResponse("domain_create_response_eap_fee.xml"); - DomainBase domain = - loadByForeignKey( - DomainBase.class, "example.tld", DateTime.parse("2000-06-01T00:03:00Z")) - .get(); + Domain domain = + loadByForeignKey(Domain.class, "example.tld", DateTime.parse("2000-06-01T00:03:00Z")).get(); // Delete domain example.tld within the add grade period. DateTime deleteTime = createTime.plusDays(1); diff --git a/core/src/test/java/google/registry/flows/EppLifecycleHostTest.java b/core/src/test/java/google/registry/flows/EppLifecycleHostTest.java index 40d22084e..8c48f402a 100644 --- a/core/src/test/java/google/registry/flows/EppLifecycleHostTest.java +++ b/core/src/test/java/google/registry/flows/EppLifecycleHostTest.java @@ -23,7 +23,7 @@ import static google.registry.testing.EppMetricSubject.assertThat; import static google.registry.testing.HostResourceSubject.assertAboutHosts; import com.google.common.collect.ImmutableMap; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.host.HostResource; import google.registry.testing.AppEngineExtension; import org.joda.time.DateTime; @@ -212,8 +212,8 @@ class EppLifecycleHostTest extends EppTestCase { HostResource exampleBarFooTldHost = loadByForeignKey(HostResource.class, "ns1.example.bar.foo.tld", timeAfterCreates).get(); - DomainBase exampleBarFooTldDomain = - loadByForeignKey(DomainBase.class, "example.bar.foo.tld", timeAfterCreates).get(); + Domain exampleBarFooTldDomain = + loadByForeignKey(Domain.class, "example.bar.foo.tld", timeAfterCreates).get(); assertAboutHosts() .that(exampleBarFooTldHost) .hasSuperordinateDomain(exampleBarFooTldDomain.createVKey()); @@ -222,8 +222,8 @@ class EppLifecycleHostTest extends EppTestCase { HostResource exampleFooTldHost = loadByForeignKey(HostResource.class, "ns1.example.foo.tld", timeAfterCreates).get(); - DomainBase exampleFooTldDomain = - loadByForeignKey(DomainBase.class, "example.foo.tld", timeAfterCreates).get(); + Domain exampleFooTldDomain = + loadByForeignKey(Domain.class, "example.foo.tld", timeAfterCreates).get(); assertAboutHosts() .that(exampleFooTldHost) .hasSuperordinateDomain(exampleFooTldDomain.createVKey()); @@ -231,8 +231,7 @@ class EppLifecycleHostTest extends EppTestCase { HostResource exampleTldHost = loadByForeignKey(HostResource.class, "ns1.example.tld", timeAfterCreates).get(); - DomainBase exampleTldDomain = - loadByForeignKey(DomainBase.class, "example.tld", timeAfterCreates).get(); + Domain exampleTldDomain = loadByForeignKey(Domain.class, "example.tld", timeAfterCreates).get(); assertAboutHosts().that(exampleTldHost).hasSuperordinateDomain(exampleTldDomain.createVKey()); assertThat(exampleTldDomain.getSubordinateHosts()).containsExactly("ns1.example.tld"); diff --git a/core/src/test/java/google/registry/flows/EppPointInTimeTest.java b/core/src/test/java/google/registry/flows/EppPointInTimeTest.java index 33ecaaa57..f9d273585 100644 --- a/core/src/test/java/google/registry/flows/EppPointInTimeTest.java +++ b/core/src/test/java/google/registry/flows/EppPointInTimeTest.java @@ -30,7 +30,7 @@ import static org.joda.time.Duration.standardDays; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Iterables; import google.registry.flows.EppTestComponent.FakesAndMocksModule; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.ofy.Ofy; import google.registry.monitoring.whitebox.EppMetric; import google.registry.testing.AppEngineExtension; @@ -100,7 +100,7 @@ class EppPointInTimeTest { eppLoader = new EppLoader(this, "domain_create.xml", ImmutableMap.of("DOMAIN", "example.tld")); runFlow(); tm().clearSessionCache(); - DomainBase domainAfterCreate = Iterables.getOnlyElement(loadAllOf(DomainBase.class)); + Domain domainAfterCreate = Iterables.getOnlyElement(loadAllOf(Domain.class)); assertThat(domainAfterCreate.getDomainName()).isEqualTo("example.tld"); clock.advanceBy(standardDays(2)); @@ -109,7 +109,7 @@ class EppPointInTimeTest { runFlow(); tm().clearSessionCache(); - DomainBase domainAfterFirstUpdate = loadByEntity(domainAfterCreate); + Domain domainAfterFirstUpdate = loadByEntity(domainAfterCreate); assertThat(domainAfterCreate).isNotEqualTo(domainAfterFirstUpdate); clock.advanceOneMilli(); // same day as first update @@ -117,7 +117,7 @@ class EppPointInTimeTest { eppLoader = new EppLoader(this, "domain_update_dsdata_rem.xml"); runFlow(); tm().clearSessionCache(); - DomainBase domainAfterSecondUpdate = loadByEntity(domainAfterCreate); + Domain domainAfterSecondUpdate = loadByEntity(domainAfterCreate); clock.advanceBy(standardDays(2)); DateTime timeAtDelete = clock.nowUtc(); // before 'add' grace period ends @@ -128,7 +128,7 @@ class EppPointInTimeTest { assertThat(domainAfterFirstUpdate).isNotEqualTo(domainAfterSecondUpdate); // Point-in-time can only rewind an object from the current version, not roll forward. - DomainBase latest = loadByEntity(domainAfterCreate); + Domain latest = loadByEntity(domainAfterCreate); // Creation time has millisecond granularity due to isActive() check. tm().clearSessionCache(); diff --git a/core/src/test/java/google/registry/flows/EppTestCase.java b/core/src/test/java/google/registry/flows/EppTestCase.java index 55b23746d..3cd72b6fd 100644 --- a/core/src/test/java/google/registry/flows/EppTestCase.java +++ b/core/src/test/java/google/registry/flows/EppTestCase.java @@ -33,7 +33,7 @@ import google.registry.model.billing.BillingEvent; import google.registry.model.billing.BillingEvent.Flag; import google.registry.model.billing.BillingEvent.OneTime; import google.registry.model.billing.BillingEvent.Reason; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainHistory; import google.registry.model.eppcommon.EppXmlTransformer; import google.registry.model.ofy.Ofy; @@ -317,7 +317,7 @@ public class EppTestCase { /** Makes a one-time billing event corresponding to the given domain's creation. */ protected static BillingEvent.OneTime makeOneTimeCreateBillingEvent( - DomainBase domain, DateTime createTime) { + Domain domain, DateTime createTime) { return new BillingEvent.OneTime.Builder() .setReason(Reason.CREATE) .setTargetId(domain.getDomainName()) @@ -332,7 +332,7 @@ public class EppTestCase { } /** Makes a one-time billing event corresponding to the given domain's renewal. */ - static BillingEvent.OneTime makeOneTimeRenewBillingEvent(DomainBase domain, DateTime renewTime) { + static BillingEvent.OneTime makeOneTimeRenewBillingEvent(Domain domain, DateTime renewTime) { return new BillingEvent.OneTime.Builder() .setReason(Reason.RENEW) .setTargetId(domain.getDomainName()) @@ -347,7 +347,7 @@ public class EppTestCase { /** Makes a recurring billing event corresponding to the given domain's creation. */ static BillingEvent.Recurring makeRecurringCreateBillingEvent( - DomainBase domain, DateTime eventTime, DateTime endTime) { + Domain domain, DateTime eventTime, DateTime endTime) { return makeRecurringBillingEvent( domain, getOnlyHistoryEntryOfType(domain, Type.DOMAIN_CREATE, DomainHistory.class), @@ -357,7 +357,7 @@ public class EppTestCase { /** Makes a recurring billing event corresponding to the given domain's renewal. */ static BillingEvent.Recurring makeRecurringRenewBillingEvent( - DomainBase domain, DateTime eventTime, DateTime endTime) { + Domain domain, DateTime eventTime, DateTime endTime) { return makeRecurringBillingEvent( domain, getOnlyHistoryEntryOfType(domain, Type.DOMAIN_RENEW, DomainHistory.class), @@ -367,7 +367,7 @@ public class EppTestCase { /** Makes a recurring billing event corresponding to the given history entry. */ protected static BillingEvent.Recurring makeRecurringBillingEvent( - DomainBase domain, DomainHistory historyEntry, DateTime eventTime, DateTime endTime) { + Domain domain, DomainHistory historyEntry, DateTime eventTime, DateTime endTime) { return new BillingEvent.Recurring.Builder() .setReason(Reason.RENEW) .setFlags(ImmutableSet.of(Flag.AUTO_RENEW)) @@ -381,7 +381,7 @@ public class EppTestCase { /** Makes a cancellation billing event cancelling out the given domain create billing event. */ static BillingEvent.Cancellation makeCancellationBillingEventForCreate( - DomainBase domain, OneTime billingEventToCancel, DateTime createTime, DateTime deleteTime) { + Domain domain, OneTime billingEventToCancel, DateTime createTime, DateTime deleteTime) { return new BillingEvent.Cancellation.Builder() .setTargetId(domain.getDomainName()) .setRegistrarId(domain.getCurrentSponsorRegistrarId()) @@ -396,7 +396,7 @@ public class EppTestCase { /** Makes a cancellation billing event cancelling out the given domain renew billing event. */ static BillingEvent.Cancellation makeCancellationBillingEventForRenew( - DomainBase domain, OneTime billingEventToCancel, DateTime renewTime, DateTime deleteTime) { + Domain domain, OneTime billingEventToCancel, DateTime renewTime, DateTime deleteTime) { return new BillingEvent.Cancellation.Builder() .setTargetId(domain.getDomainName()) .setRegistrarId(domain.getCurrentSponsorRegistrarId()) diff --git a/core/src/test/java/google/registry/flows/contact/ContactDeleteFlowTest.java b/core/src/test/java/google/registry/flows/contact/ContactDeleteFlowTest.java index 858a7edef..f120e6168 100644 --- a/core/src/test/java/google/registry/flows/contact/ContactDeleteFlowTest.java +++ b/core/src/test/java/google/registry/flows/contact/ContactDeleteFlowTest.java @@ -22,7 +22,6 @@ import static google.registry.testing.DatabaseHelper.assertNoBillingEvents; import static google.registry.testing.DatabaseHelper.createTld; import static google.registry.testing.DatabaseHelper.getPollMessages; import static google.registry.testing.DatabaseHelper.newContactResource; -import static google.registry.testing.DatabaseHelper.newDomainBase; import static google.registry.testing.DatabaseHelper.persistActiveContact; import static google.registry.testing.DatabaseHelper.persistContactWithPendingTransfer; import static google.registry.testing.DatabaseHelper.persistDeletedContact; @@ -51,6 +50,7 @@ import google.registry.model.tld.Registry; import google.registry.model.transfer.TransferData; import google.registry.model.transfer.TransferResponse; import google.registry.model.transfer.TransferStatus; +import google.registry.testing.DatabaseHelper; import org.joda.time.DateTime; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -205,7 +205,8 @@ class ContactDeleteFlowTest extends ResourceFlowTestCase { +class DomainCheckFlowTest extends ResourceCheckFlowTestCase { @Order(value = Order.DEFAULT - 3) @RegisterExtension @@ -199,7 +199,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase historyEntryKey = Key.create(Key.create(domain), HistoryEntry.class, 1L); persistResource( new AllocationToken.Builder() @@ -779,7 +779,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase { +public class DomainClaimsCheckFlowTest extends ResourceFlowTestCase { DomainClaimsCheckFlowTest() { setEppInput("domain_check_claims.xml"); diff --git a/core/src/test/java/google/registry/flows/domain/DomainCreateFlowTest.java b/core/src/test/java/google/registry/flows/domain/DomainCreateFlowTest.java index c2a4dde72..ed4f944dd 100644 --- a/core/src/test/java/google/registry/flows/domain/DomainCreateFlowTest.java +++ b/core/src/test/java/google/registry/flows/domain/DomainCreateFlowTest.java @@ -43,14 +43,13 @@ import static google.registry.testing.DatabaseHelper.deleteTld; import static google.registry.testing.DatabaseHelper.getHistoryEntries; import static google.registry.testing.DatabaseHelper.loadRegistrar; import static google.registry.testing.DatabaseHelper.newContactResource; -import static google.registry.testing.DatabaseHelper.newDomainBase; import static google.registry.testing.DatabaseHelper.newHostResource; import static google.registry.testing.DatabaseHelper.persistActiveContact; import static google.registry.testing.DatabaseHelper.persistActiveDomain; import static google.registry.testing.DatabaseHelper.persistActiveHost; import static google.registry.testing.DatabaseHelper.persistReservedList; import static google.registry.testing.DatabaseHelper.persistResource; -import static google.registry.testing.DomainBaseSubject.assertAboutDomains; +import static google.registry.testing.DomainSubject.assertAboutDomains; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; import static google.registry.testing.TaskQueueHelper.assertDnsTasksEnqueued; import static google.registry.testing.TaskQueueHelper.assertNoDnsTasksEnqueued; @@ -151,7 +150,7 @@ import google.registry.model.billing.BillingEvent; import google.registry.model.billing.BillingEvent.Flag; import google.registry.model.billing.BillingEvent.Reason; import google.registry.model.billing.BillingEvent.RenewalPriceBehavior; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainHistory; import google.registry.model.domain.GracePeriod; import google.registry.model.domain.fee.BaseFee.FeeType; @@ -174,6 +173,7 @@ import google.registry.model.tld.Registry.TldState; import google.registry.model.tld.Registry.TldType; import google.registry.monitoring.whitebox.EppMetric; import google.registry.persistence.VKey; +import google.registry.testing.DatabaseHelper; import google.registry.testing.TaskQueueHelper.TaskMatcher; import java.math.BigDecimal; import java.util.Map; @@ -186,7 +186,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; /** Unit tests for {@link DomainCreateFlow}. */ -class DomainCreateFlowTest extends ResourceFlowTestCase { +class DomainCreateFlowTest extends ResourceFlowTestCase { private static final String CLAIMS_KEY = "2013041500/2/6/9/rJ1NrDO92vDsAzf7EQzgjX4R0000000001"; @@ -251,7 +251,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase expectedBillingFlags, @Nullable AllocationToken allocationToken) throws Exception { - DomainBase domain = reloadResourceByForeignKey(); + Domain domain = reloadResourceByForeignKey(); boolean isAnchorTenant = expectedBillingFlags.contains(ANCHOR_TENANT); // Set up the creation cost. @@ -525,7 +525,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase historyEntryKey = Key.create(Key.create(domain), HistoryEntry.class, 505L); persistResource( new AllocationToken.Builder() @@ -852,7 +852,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase { +class DomainDeleteFlowTest extends ResourceFlowTestCase { - private DomainBase domain; + private Domain domain; private DomainHistory earlierHistoryEntry; private static final DateTime TIME_BEFORE_FLOW = DateTime.parse("2000-06-06T22:00:00.0Z"); @@ -159,7 +159,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase { +class DomainFlowUtilsTest extends ResourceFlowTestCase { @BeforeEach void setup() { diff --git a/core/src/test/java/google/registry/flows/domain/DomainInfoFlowTest.java b/core/src/test/java/google/registry/flows/domain/DomainInfoFlowTest.java index fbf752ea5..4ffc192d4 100644 --- a/core/src/test/java/google/registry/flows/domain/DomainInfoFlowTest.java +++ b/core/src/test/java/google/registry/flows/domain/DomainInfoFlowTest.java @@ -22,7 +22,6 @@ import static google.registry.model.billing.BillingEvent.RenewalPriceBehavior.SP import static google.registry.model.tld.Registry.TldState.QUIET_PERIOD; import static google.registry.testing.DatabaseHelper.assertNoBillingEvents; import static google.registry.testing.DatabaseHelper.createTld; -import static google.registry.testing.DatabaseHelper.newDomainBase; import static google.registry.testing.DatabaseHelper.persistActiveContact; import static google.registry.testing.DatabaseHelper.persistActiveHost; import static google.registry.testing.DatabaseHelper.persistBillingRecurrenceForDomain; @@ -57,8 +56,8 @@ import google.registry.model.contact.ContactAuthInfo; import google.registry.model.contact.ContactResource; import google.registry.model.domain.DesignatedContact; import google.registry.model.domain.DesignatedContact.Type; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainAuthInfo; -import google.registry.model.domain.DomainBase; import google.registry.model.domain.DomainHistory; import google.registry.model.domain.GracePeriod; import google.registry.model.domain.rgp.GracePeriodStatus; @@ -70,6 +69,7 @@ import google.registry.model.reporting.HistoryEntry; import google.registry.model.tld.Registry; import google.registry.persistence.VKey; import google.registry.testing.AppEngineExtension; +import google.registry.testing.DatabaseHelper; import google.registry.testing.SetClockExtension; import javax.annotation.Nullable; import org.joda.money.Money; @@ -80,7 +80,7 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; /** Unit tests for {@link DomainInfoFlow}. */ -class DomainInfoFlowTest extends ResourceFlowTestCase { +class DomainInfoFlowTest extends ResourceFlowTestCase { @Order(value = Order.DEFAULT - 3) @RegisterExtension @@ -104,7 +104,7 @@ class DomainInfoFlowTest extends ResourceFlowTestCase renewalPrice) { domain = persistResource( - newDomainBase(domainName) + DatabaseHelper.newDomain(domainName) .asBuilder() .setCreationTimeForTest(DateTime.parse("1999-01-05T00:00:00Z")) .build()); diff --git a/core/src/test/java/google/registry/flows/domain/DomainRenewFlowTest.java b/core/src/test/java/google/registry/flows/domain/DomainRenewFlowTest.java index 863999e96..3e0c7440c 100644 --- a/core/src/test/java/google/registry/flows/domain/DomainRenewFlowTest.java +++ b/core/src/test/java/google/registry/flows/domain/DomainRenewFlowTest.java @@ -29,13 +29,13 @@ import static google.registry.testing.DatabaseHelper.createTld; import static google.registry.testing.DatabaseHelper.getOnlyHistoryEntryOfType; import static google.registry.testing.DatabaseHelper.loadByKey; import static google.registry.testing.DatabaseHelper.loadRegistrar; -import static google.registry.testing.DatabaseHelper.newDomainBase; +import static google.registry.testing.DatabaseHelper.newDomain; import static google.registry.testing.DatabaseHelper.persistActiveDomain; import static google.registry.testing.DatabaseHelper.persistDeletedDomain; import static google.registry.testing.DatabaseHelper.persistPremiumList; import static google.registry.testing.DatabaseHelper.persistResource; import static google.registry.testing.DatabaseHelper.persistResources; -import static google.registry.testing.DomainBaseSubject.assertAboutDomains; +import static google.registry.testing.DomainSubject.assertAboutDomains; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; import static google.registry.testing.HistoryEntrySubject.assertAboutHistoryEntries; import static google.registry.testing.TestDataHelper.updateSubstitutions; @@ -79,7 +79,7 @@ import google.registry.model.billing.BillingEvent; import google.registry.model.billing.BillingEvent.Flag; import google.registry.model.billing.BillingEvent.Reason; import google.registry.model.billing.BillingEvent.RenewalPriceBehavior; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainHistory; import google.registry.model.domain.GracePeriod; import google.registry.model.domain.rgp.GracePeriodStatus; @@ -107,7 +107,7 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; /** Unit tests for {@link DomainRenewFlow}. */ -class DomainRenewFlowTest extends ResourceFlowTestCase { +class DomainRenewFlowTest extends ResourceFlowTestCase { private static final ImmutableMap FEE_BASE_MAP = ImmutableMap.of( @@ -151,7 +151,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase { try { @@ -183,7 +183,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase historyEntryKey = Key.create(Key.create(domain), HistoryEntry.class, 505L); persistResource( new AllocationToken.Builder() @@ -858,7 +858,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase { +class DomainRestoreRequestFlowTest extends ResourceFlowTestCase { private static final ImmutableMap FEE_06_MAP = ImmutableMap.of("FEE_VERSION", "0.6", "FEE_NS", "fee", "CURRENCY", "USD"); @@ -110,7 +109,7 @@ class DomainRestoreRequestFlowTest } void persistPendingDeleteDomain(DateTime expirationTime) throws Exception { - DomainBase domain = persistResource(newDomainBase(getUniqueIdFromCommand())); + Domain domain = persistResource(DatabaseHelper.newDomain(getUniqueIdFromCommand())); HistoryEntry historyEntry = persistResource( new DomainHistory.Builder() @@ -167,7 +166,7 @@ class DomainRestoreRequestFlowTest // Double check that we see a poll message in the future for when the delete happens. assertThat(getPollMessages("TheRegistrar", clock.nowUtc().plusMonths(1))).hasSize(1); runFlowAssertResponse(loadFile("generic_success_response.xml")); - DomainBase domain = reloadResourceByForeignKey(); + Domain domain = reloadResourceByForeignKey(); DomainHistory historyEntryDomainRestore = getOnlyHistoryEntryOfType(domain, HistoryEntry.Type.DOMAIN_RESTORE, DomainHistory.class); assertLastHistoryContainsResource(domain); @@ -236,7 +235,7 @@ class DomainRestoreRequestFlowTest // Double check that we see a poll message in the future for when the delete happens. assertThat(getPollMessages("TheRegistrar", clock.nowUtc().plusMonths(1))).hasSize(1); runFlowAssertResponse(loadFile("generic_success_response.xml")); - DomainBase domain = reloadResourceByForeignKey(); + Domain domain = reloadResourceByForeignKey(); DomainHistory historyEntryDomainRestore = getOnlyHistoryEntryOfType(domain, HistoryEntry.Type.DOMAIN_RESTORE, DomainHistory.class); assertLastHistoryContainsResource(domain); @@ -617,7 +616,7 @@ class DomainRestoreRequestFlowTest @Test void testFailure_notInRedemptionPeriod() throws Exception { persistResource( - newDomainBase(getUniqueIdFromCommand()) + DatabaseHelper.newDomain(getUniqueIdFromCommand()) .asBuilder() .setDeletionTime(clock.nowUtc().plusDays(4)) .setStatusValues(ImmutableSet.of(StatusValue.PENDING_DELETE)) @@ -773,7 +772,7 @@ class DomainRestoreRequestFlowTest void testIcannTransactionReportField_getsStored() throws Exception { persistPendingDeleteDomain(); runFlow(); - DomainBase domain = reloadResourceByForeignKey(); + Domain domain = reloadResourceByForeignKey(); HistoryEntry historyEntryDomainRestore = getOnlyHistoryEntryOfType(domain, HistoryEntry.Type.DOMAIN_RESTORE); assertThat(historyEntryDomainRestore.getDomainTransactionRecords()) diff --git a/core/src/test/java/google/registry/flows/domain/DomainTransferApproveFlowTest.java b/core/src/test/java/google/registry/flows/domain/DomainTransferApproveFlowTest.java index 30e17dc5b..f5254e0ea 100644 --- a/core/src/test/java/google/registry/flows/domain/DomainTransferApproveFlowTest.java +++ b/core/src/test/java/google/registry/flows/domain/DomainTransferApproveFlowTest.java @@ -30,7 +30,7 @@ import static google.registry.testing.DatabaseHelper.getPollMessages; import static google.registry.testing.DatabaseHelper.loadByKey; import static google.registry.testing.DatabaseHelper.loadRegistrar; import static google.registry.testing.DatabaseHelper.persistResource; -import static google.registry.testing.DomainBaseSubject.assertAboutDomains; +import static google.registry.testing.DomainSubject.assertAboutDomains; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; import static google.registry.testing.HistoryEntrySubject.assertAboutHistoryEntries; import static google.registry.util.DateTimeUtils.START_OF_TIME; @@ -54,8 +54,8 @@ import google.registry.model.billing.BillingEvent.OneTime; import google.registry.model.billing.BillingEvent.Reason; import google.registry.model.billing.BillingEvent.Recurring; import google.registry.model.contact.ContactAuthInfo; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainAuthInfo; -import google.registry.model.domain.DomainBase; import google.registry.model.domain.DomainHistory; import google.registry.model.domain.GracePeriod; import google.registry.model.domain.Period; @@ -83,7 +83,7 @@ import org.junit.jupiter.api.Test; /** Unit tests for {@link DomainTransferApproveFlow}. */ class DomainTransferApproveFlowTest - extends DomainTransferFlowTestCase { + extends DomainTransferFlowTestCase { @BeforeEach void beforeEach() { @@ -110,7 +110,7 @@ class DomainTransferApproveFlowTest clock.advanceOneMilli(); } - private void assertTransferApproved(DomainBase domain, DomainTransferData oldTransferData) { + private void assertTransferApproved(Domain domain, DomainTransferData oldTransferData) { assertAboutDomains() .that(domain) .hasCurrentSponsorRegistrarId("NewRegistrar") @@ -643,7 +643,7 @@ class DomainTransferApproveFlowTest @Test void testSuccess_superuserExtension_transferPeriodZero_autorenewGraceActive() throws Exception { - DomainBase domain = reloadResourceByForeignKey(); + Domain domain = reloadResourceByForeignKey(); VKey existingAutorenewEvent = domain.getAutorenewBillingEvent(); // Set domain to have auto-renewed just before the transfer request, so that it will have an // active autorenew grace period spanning the entire transfer window. diff --git a/core/src/test/java/google/registry/flows/domain/DomainTransferCancelFlowTest.java b/core/src/test/java/google/registry/flows/domain/DomainTransferCancelFlowTest.java index 2417f0d16..3ed6da9b5 100644 --- a/core/src/test/java/google/registry/flows/domain/DomainTransferCancelFlowTest.java +++ b/core/src/test/java/google/registry/flows/domain/DomainTransferCancelFlowTest.java @@ -28,7 +28,7 @@ import static google.registry.testing.DatabaseHelper.getOnlyHistoryEntryOfType; import static google.registry.testing.DatabaseHelper.getPollMessages; import static google.registry.testing.DatabaseHelper.loadRegistrar; import static google.registry.testing.DatabaseHelper.persistResource; -import static google.registry.testing.DomainBaseSubject.assertAboutDomains; +import static google.registry.testing.DomainSubject.assertAboutDomains; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; import static google.registry.testing.HistoryEntrySubject.assertAboutHistoryEntries; import static google.registry.util.DateTimeUtils.END_OF_TIME; @@ -44,8 +44,8 @@ import google.registry.flows.domain.DomainFlowUtils.NotAuthorizedForTldException import google.registry.flows.exceptions.NotPendingTransferException; import google.registry.flows.exceptions.NotTransferInitiatorException; import google.registry.model.contact.ContactAuthInfo; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainAuthInfo; -import google.registry.model.domain.DomainBase; import google.registry.model.domain.DomainHistory; import google.registry.model.domain.GracePeriod; import google.registry.model.eppcommon.AuthInfo.PasswordAuth; @@ -63,7 +63,7 @@ import org.junit.jupiter.api.Test; /** Unit tests for {@link DomainTransferCancelFlow}. */ class DomainTransferCancelFlowTest - extends DomainTransferFlowTestCase { + extends DomainTransferFlowTestCase { @BeforeEach void beforeEach() { diff --git a/core/src/test/java/google/registry/flows/domain/DomainTransferFlowTestCase.java b/core/src/test/java/google/registry/flows/domain/DomainTransferFlowTestCase.java index d114dfe18..67a3f8825 100644 --- a/core/src/test/java/google/registry/flows/domain/DomainTransferFlowTestCase.java +++ b/core/src/test/java/google/registry/flows/domain/DomainTransferFlowTestCase.java @@ -24,7 +24,7 @@ import static google.registry.testing.DatabaseHelper.persistActiveContact; import static google.registry.testing.DatabaseHelper.persistDomainWithDependentResources; import static google.registry.testing.DatabaseHelper.persistDomainWithPendingTransfer; import static google.registry.testing.DatabaseHelper.persistResource; -import static google.registry.testing.DomainBaseSubject.assertAboutDomains; +import static google.registry.testing.DomainSubject.assertAboutDomains; import static google.registry.util.DateTimeUtils.END_OF_TIME; import com.google.common.base.Ascii; @@ -36,7 +36,7 @@ import google.registry.model.billing.BillingEvent; import google.registry.model.billing.BillingEvent.Flag; import google.registry.model.billing.BillingEvent.Reason; import google.registry.model.contact.ContactResource; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainHistory; import google.registry.model.eppcommon.StatusValue; import google.registry.model.host.HostResource; @@ -72,7 +72,7 @@ abstract class DomainTransferFlowTestCase REGISTRATION_EXPIRATION_TIME.plusYears(EXTENDED_REGISTRATION_YEARS); protected ContactResource contact; - protected DomainBase domain; + protected Domain domain; HostResource subordinateHost; private DomainHistory historyEntryDomainCreate; @@ -89,7 +89,7 @@ abstract class DomainTransferFlowTestCase AppEngineExtension.makeRegistrar1().asBuilder().setRegistrarId("ClientZ").build()); } - static DomainBase persistWithPendingTransfer(DomainBase domain) { + static Domain persistWithPendingTransfer(Domain domain) { return persistDomainWithPendingTransfer( domain, TRANSFER_REQUEST_TIME, @@ -162,8 +162,7 @@ abstract class DomainTransferFlowTestCase .build(); } - void assertTransferFailed( - DomainBase domain, TransferStatus status, TransferData oldTransferData) { + void assertTransferFailed(Domain domain, TransferStatus status, TransferData oldTransferData) { assertAboutDomains() .that(domain) .doesNotHaveStatusValue(StatusValue.PENDING_TRANSFER) diff --git a/core/src/test/java/google/registry/flows/domain/DomainTransferQueryFlowTest.java b/core/src/test/java/google/registry/flows/domain/DomainTransferQueryFlowTest.java index b22044c89..d215d9c13 100644 --- a/core/src/test/java/google/registry/flows/domain/DomainTransferQueryFlowTest.java +++ b/core/src/test/java/google/registry/flows/domain/DomainTransferQueryFlowTest.java @@ -19,7 +19,7 @@ import static google.registry.testing.DatabaseHelper.assertBillingEvents; import static google.registry.testing.DatabaseHelper.deleteTestDomain; import static google.registry.testing.DatabaseHelper.getPollMessages; import static google.registry.testing.DatabaseHelper.persistResource; -import static google.registry.testing.DomainBaseSubject.assertAboutDomains; +import static google.registry.testing.DomainSubject.assertAboutDomains; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; import static org.junit.jupiter.api.Assertions.assertThrows; @@ -30,8 +30,8 @@ import google.registry.flows.ResourceFlowUtils.ResourceDoesNotExistException; import google.registry.flows.exceptions.NoTransferHistoryToQueryException; import google.registry.flows.exceptions.NotAuthorizedToViewTransferException; import google.registry.model.contact.ContactAuthInfo; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainAuthInfo; -import google.registry.model.domain.DomainBase; import google.registry.model.eppcommon.AuthInfo.PasswordAuth; import google.registry.model.reporting.HistoryEntry; import google.registry.model.transfer.TransferStatus; @@ -40,7 +40,7 @@ import org.junit.jupiter.api.Test; /** Unit tests for {@link DomainTransferQueryFlow}. */ class DomainTransferQueryFlowTest - extends DomainTransferFlowTestCase { + extends DomainTransferFlowTestCase { @BeforeEach void beforeEach() { diff --git a/core/src/test/java/google/registry/flows/domain/DomainTransferRejectFlowTest.java b/core/src/test/java/google/registry/flows/domain/DomainTransferRejectFlowTest.java index d7dd9509d..0f1bd6994 100644 --- a/core/src/test/java/google/registry/flows/domain/DomainTransferRejectFlowTest.java +++ b/core/src/test/java/google/registry/flows/domain/DomainTransferRejectFlowTest.java @@ -29,7 +29,7 @@ import static google.registry.testing.DatabaseHelper.getPollMessages; import static google.registry.testing.DatabaseHelper.loadRegistrar; import static google.registry.testing.DatabaseHelper.persistDomainAsDeleted; import static google.registry.testing.DatabaseHelper.persistResource; -import static google.registry.testing.DomainBaseSubject.assertAboutDomains; +import static google.registry.testing.DomainSubject.assertAboutDomains; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; import static google.registry.testing.HistoryEntrySubject.assertAboutHistoryEntries; import static google.registry.util.DateTimeUtils.END_OF_TIME; @@ -44,8 +44,8 @@ import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException; import google.registry.flows.domain.DomainFlowUtils.NotAuthorizedForTldException; import google.registry.flows.exceptions.NotPendingTransferException; import google.registry.model.contact.ContactAuthInfo; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainAuthInfo; -import google.registry.model.domain.DomainBase; import google.registry.model.domain.DomainHistory; import google.registry.model.domain.GracePeriod; import google.registry.model.eppcommon.AuthInfo.PasswordAuth; @@ -65,7 +65,7 @@ import org.junit.jupiter.api.Test; /** Unit tests for {@link DomainTransferRejectFlow}. */ class DomainTransferRejectFlowTest - extends DomainTransferFlowTestCase { + extends DomainTransferFlowTestCase { @BeforeEach void beforeEach() { diff --git a/core/src/test/java/google/registry/flows/domain/DomainTransferRequestFlowTest.java b/core/src/test/java/google/registry/flows/domain/DomainTransferRequestFlowTest.java index 75e84aff3..a7613b2ff 100644 --- a/core/src/test/java/google/registry/flows/domain/DomainTransferRequestFlowTest.java +++ b/core/src/test/java/google/registry/flows/domain/DomainTransferRequestFlowTest.java @@ -38,7 +38,7 @@ import static google.registry.testing.DatabaseHelper.loadByKeys; import static google.registry.testing.DatabaseHelper.loadRegistrar; import static google.registry.testing.DatabaseHelper.persistActiveContact; import static google.registry.testing.DatabaseHelper.persistResource; -import static google.registry.testing.DomainBaseSubject.assertAboutDomains; +import static google.registry.testing.DomainSubject.assertAboutDomains; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; import static google.registry.testing.HistoryEntrySubject.assertAboutHistoryEntries; import static google.registry.testing.HostResourceSubject.assertAboutHosts; @@ -84,8 +84,8 @@ import google.registry.flows.exceptions.TransferPeriodZeroAndFeeTransferExtensio import google.registry.model.billing.BillingEvent; import google.registry.model.billing.BillingEvent.Reason; import google.registry.model.contact.ContactAuthInfo; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainAuthInfo; -import google.registry.model.domain.DomainBase; import google.registry.model.domain.DomainHistory; import google.registry.model.domain.GracePeriod; import google.registry.model.domain.Period; @@ -117,7 +117,7 @@ import org.junit.jupiter.api.Test; /** Unit tests for {@link DomainTransferRequestFlow}. */ class DomainTransferRequestFlowTest - extends DomainTransferFlowTestCase { + extends DomainTransferFlowTestCase { private static final ImmutableMap BASE_FEE_MAP = new ImmutableMap.Builder() @@ -161,7 +161,7 @@ class DomainTransferRequestFlowTest } private void assertTransferRequested( - DomainBase domain, + Domain domain, DateTime automaticTransferTime, Period expectedPeriod, DateTime expectedExpirationTime) @@ -201,8 +201,7 @@ class DomainTransferRequestFlowTest } private void assertTransferApproved( - DomainBase domain, DateTime automaticTransferTime, Period expectedPeriod) - throws Exception { + Domain domain, DateTime automaticTransferTime, Period expectedPeriod) throws Exception { assertAboutDomains() .that(domain) .hasCurrentSponsorRegistrarId("NewRegistrar") @@ -320,7 +319,7 @@ class DomainTransferRequestFlowTest assertThat(domain.getGracePeriods()).containsExactlyElementsIn(originalGracePeriods); // If we fast forward AUTOMATIC_TRANSFER_DAYS, the transfer should have cleared out all other // grace periods, but expect a transfer grace period (if there was a transfer billing event). - DomainBase domainAfterAutomaticTransfer = domain.cloneProjectedAtTime(implicitTransferTime); + Domain domainAfterAutomaticTransfer = domain.cloneProjectedAtTime(implicitTransferTime); if (expectTransferBillingEvent) { assertGracePeriods( domainAfterAutomaticTransfer.getGracePeriods(), @@ -424,7 +423,7 @@ class DomainTransferRequestFlowTest DateTime expectedExpirationTime, DateTime implicitTransferTime, Period expectedPeriod) throws Exception { Registry registry = Registry.get(domain.getTld()); - DomainBase domainAfterAutomaticTransfer = domain.cloneProjectedAtTime(implicitTransferTime); + Domain domainAfterAutomaticTransfer = domain.cloneProjectedAtTime(implicitTransferTime); assertTransferApproved(domainAfterAutomaticTransfer, implicitTransferTime, expectedPeriod); assertAboutDomains() .that(domainAfterAutomaticTransfer) @@ -436,7 +435,7 @@ class DomainTransferRequestFlowTest assertThat(loadByKey(domainAfterAutomaticTransfer.getAutorenewBillingEvent()).getEventTime()) .isEqualTo(expectedExpirationTime); // And after the expected grace time, the grace period should be gone. - DomainBase afterGracePeriod = + Domain afterGracePeriod = domain.cloneProjectedAtTime( clock .nowUtc() @@ -575,7 +574,7 @@ class DomainTransferRequestFlowTest if (expectedAutomaticTransferLength.equals(Duration.ZERO)) { // The transfer is going to happen immediately. To observe the domain in the pending transfer // state, grab it directly from the database. - domain = Iterables.getOnlyElement(tm().transact(() -> tm().loadAllOf(DomainBase.class))); + domain = Iterables.getOnlyElement(tm().transact(() -> tm().loadAllOf(Domain.class))); assertThat(domain.getDomainName()).isEqualTo("example.tld"); } else { // Transfer should have been requested. diff --git a/core/src/test/java/google/registry/flows/domain/DomainUpdateFlowTest.java b/core/src/test/java/google/registry/flows/domain/DomainUpdateFlowTest.java index 1b5e1e0e0..754eb3f80 100644 --- a/core/src/test/java/google/registry/flows/domain/DomainUpdateFlowTest.java +++ b/core/src/test/java/google/registry/flows/domain/DomainUpdateFlowTest.java @@ -37,14 +37,13 @@ import static google.registry.testing.DatabaseHelper.getOnlyHistoryEntryOfType; import static google.registry.testing.DatabaseHelper.getPollMessages; import static google.registry.testing.DatabaseHelper.loadByKey; import static google.registry.testing.DatabaseHelper.loadRegistrar; -import static google.registry.testing.DatabaseHelper.newDomainBase; import static google.registry.testing.DatabaseHelper.persistActiveContact; import static google.registry.testing.DatabaseHelper.persistActiveDomain; import static google.registry.testing.DatabaseHelper.persistActiveHost; import static google.registry.testing.DatabaseHelper.persistActiveSubordinateHost; import static google.registry.testing.DatabaseHelper.persistDeletedDomain; import static google.registry.testing.DatabaseHelper.persistResource; -import static google.registry.testing.DomainBaseSubject.assertAboutDomains; +import static google.registry.testing.DomainSubject.assertAboutDomains; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; import static google.registry.testing.HistoryEntrySubject.assertAboutHistoryEntries; import static google.registry.testing.TaskQueueHelper.assertDnsTasksEnqueued; @@ -95,7 +94,7 @@ import google.registry.model.billing.BillingEvent.Reason; import google.registry.model.contact.ContactResource; import google.registry.model.domain.DesignatedContact; import google.registry.model.domain.DesignatedContact.Type; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainHistory; import google.registry.model.domain.secdns.DelegationSignerData; import google.registry.model.eppcommon.StatusValue; @@ -105,6 +104,7 @@ import google.registry.model.poll.PendingActionNotificationResponse.DomainPendin import google.registry.model.poll.PollMessage; import google.registry.model.tld.Registry; import google.registry.persistence.VKey; +import google.registry.testing.DatabaseHelper; import java.util.Optional; import org.joda.money.Money; import org.joda.time.DateTime; @@ -112,7 +112,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; /** Unit tests for {@link DomainUpdateFlow}. */ -class DomainUpdateFlowTest extends ResourceFlowTestCase { +class DomainUpdateFlowTest extends ResourceFlowTestCase { private static final DelegationSignerData SOME_DSDATA = DelegationSignerData.create( @@ -147,12 +147,12 @@ class DomainUpdateFlowTest extends ResourceFlowTestCase sh8013Key = sh8013.createVKey(); persistResource( - newDomainBase(getUniqueIdFromCommand()) + DatabaseHelper.newDomain(getUniqueIdFromCommand()) .asBuilder() .setRegistrant(sh8013Key) .setContacts( @@ -486,11 +486,14 @@ class DomainUpdateFlowTest extends ResourceFlowTestCase flowUtils.verifyAllocationTokenIfPresent( - newDomainBase("blah.tld"), + DatabaseHelper.newDomain("blah.tld"), Registry.get("tld"), "TheRegistrar", DateTime.now(UTC), @@ -185,7 +185,7 @@ class AllocationTokenFlowUtilsTest { IllegalStateException.class, () -> failingFlowUtils.verifyAllocationTokenIfPresent( - newDomainBase("blah.tld"), + DatabaseHelper.newDomain("blah.tld"), Registry.get("tld"), "TheRegistrar", DateTime.now(UTC), @@ -305,7 +305,7 @@ class AllocationTokenFlowUtilsTest { @Test void test_checkDomainsWithToken_showsFailureMessageForRedeemedToken() { - DomainBase domain = persistActiveDomain("example.tld"); + Domain domain = persistActiveDomain("example.tld"); Key historyEntryKey = Key.create(Key.create(domain), HistoryEntry.class, 1051L); persistResource( new AllocationToken.Builder() @@ -396,7 +396,7 @@ class AllocationTokenFlowUtilsTest { clazz, () -> flowUtils.verifyAllocationTokenIfPresent( - newDomainBase("blah.tld"), + DatabaseHelper.newDomain("blah.tld"), Registry.get("tld"), "TheRegistrar", DateTime.now(UTC), @@ -438,11 +438,7 @@ class AllocationTokenFlowUtilsTest { @Override public AllocationToken validateToken( - DomainBase domain, - AllocationToken token, - Registry registry, - String registrarId, - DateTime now) { + Domain domain, AllocationToken token, Registry registry, String registrarId, DateTime now) { throw new IllegalStateException("failed for tests"); } diff --git a/core/src/test/java/google/registry/flows/host/HostCreateFlowTest.java b/core/src/test/java/google/registry/flows/host/HostCreateFlowTest.java index 36dd5cd3d..274b7e8a8 100644 --- a/core/src/test/java/google/registry/flows/host/HostCreateFlowTest.java +++ b/core/src/test/java/google/registry/flows/host/HostCreateFlowTest.java @@ -19,7 +19,6 @@ import static google.registry.model.EppResourceUtils.loadByForeignKey; import static google.registry.testing.DatabaseHelper.assertNoBillingEvents; import static google.registry.testing.DatabaseHelper.createTld; import static google.registry.testing.DatabaseHelper.createTlds; -import static google.registry.testing.DatabaseHelper.newDomainBase; import static google.registry.testing.DatabaseHelper.newHostResource; import static google.registry.testing.DatabaseHelper.persistActiveDomain; import static google.registry.testing.DatabaseHelper.persistActiveHost; @@ -50,10 +49,11 @@ import google.registry.flows.host.HostFlowUtils.HostNameTooShallowException; import google.registry.flows.host.HostFlowUtils.InvalidHostNameException; import google.registry.flows.host.HostFlowUtils.SuperordinateDomainDoesNotExistException; import google.registry.flows.host.HostFlowUtils.SuperordinateDomainInPendingDeleteException; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.eppcommon.StatusValue; import google.registry.model.host.HostResource; import google.registry.model.reporting.HistoryEntry; +import google.registry.testing.DatabaseHelper; import org.joda.time.DateTime; import org.junit.jupiter.api.Test; @@ -125,8 +125,8 @@ class HostCreateFlowTest extends ResourceFlowTestCase void testSuccess_linked() throws Exception { persistHostResource(); persistResource( - newDomainBase("example.foobar") + DatabaseHelper.newDomain("example.foobar") .asBuilder() .addNameserver(persistHostResource().createVKey()) .build()); @@ -113,9 +113,9 @@ class HostInfoFlowTest extends ResourceFlowTestCase private void runTest_superordinateDomain( DateTime domainTransferTime, @Nullable DateTime lastSuperordinateChange) throws Exception { persistNewRegistrar("superclientid"); - DomainBase domain = + Domain domain = persistResource( - newDomainBase("parent.foobar") + DatabaseHelper.newDomain("parent.foobar") .asBuilder() .setRepoId("BEEF-FOOBAR") .setLastTransferTime(domainTransferTime) diff --git a/core/src/test/java/google/registry/flows/host/HostUpdateFlowTest.java b/core/src/test/java/google/registry/flows/host/HostUpdateFlowTest.java index 3ab01b47a..e39c9ca7f 100644 --- a/core/src/test/java/google/registry/flows/host/HostUpdateFlowTest.java +++ b/core/src/test/java/google/registry/flows/host/HostUpdateFlowTest.java @@ -23,7 +23,6 @@ import static google.registry.testing.DatabaseHelper.assertNoBillingEvents; import static google.registry.testing.DatabaseHelper.createTld; import static google.registry.testing.DatabaseHelper.getOnlyHistoryEntryOfType; import static google.registry.testing.DatabaseHelper.loadByEntity; -import static google.registry.testing.DatabaseHelper.newDomainBase; import static google.registry.testing.DatabaseHelper.newHostResource; import static google.registry.testing.DatabaseHelper.persistActiveDomain; import static google.registry.testing.DatabaseHelper.persistActiveHost; @@ -31,7 +30,7 @@ import static google.registry.testing.DatabaseHelper.persistActiveSubordinateHos import static google.registry.testing.DatabaseHelper.persistDeletedHost; import static google.registry.testing.DatabaseHelper.persistNewRegistrar; import static google.registry.testing.DatabaseHelper.persistResource; -import static google.registry.testing.DomainBaseSubject.assertAboutDomains; +import static google.registry.testing.DomainSubject.assertAboutDomains; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; import static google.registry.testing.GenericEppResourceSubject.assertAboutEppResources; import static google.registry.testing.HistoryEntrySubject.assertAboutHistoryEntries; @@ -70,7 +69,7 @@ import google.registry.flows.host.HostUpdateFlow.CannotRemoveSubordinateHostLast import google.registry.flows.host.HostUpdateFlow.CannotRenameExternalHostException; import google.registry.flows.host.HostUpdateFlow.HostAlreadyExistsException; import google.registry.flows.host.HostUpdateFlow.RenameHostToExternalRemoveIpException; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.eppcommon.StatusValue; import google.registry.model.host.HostResource; import google.registry.model.index.ForeignKeyIndex; @@ -78,6 +77,7 @@ import google.registry.model.reporting.HistoryEntry; import google.registry.model.tld.Registry; import google.registry.model.transfer.DomainTransferData; import google.registry.model.transfer.TransferStatus; +import google.registry.testing.DatabaseHelper; import google.registry.testing.TaskQueueHelper.TaskMatcher; import javax.annotation.Nullable; import org.joda.time.DateTime; @@ -110,11 +110,11 @@ class HostUpdateFlowTest extends ResourceFlowTestCaseThe transfer is from "TheRegistrar" to "NewRegistrar". */ - private DomainBase createDomainWithServerApprovedTransfer(String domainName) { + private Domain createDomainWithServerApprovedTransfer(String domainName) { DateTime now = clock.nowUtc(); DateTime requestTime = now.minusDays(1).minus(Registry.DEFAULT_AUTOMATIC_TRANSFER_LENGTH); DateTime transferExpirationTime = now.minusDays(1); - return newDomainBase(domainName) + return DatabaseHelper.newDomain(domainName) .asBuilder() .setPersistedCurrentSponsorRegistrarId("TheRegistrar") .addStatusValue(StatusValue.PENDING_TRANSFER) @@ -197,7 +197,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase192.0.2.22", "1080:0:0:0:8:800:200C:417A"); createTld("tld"); - DomainBase example = persistActiveDomain("example.tld"); - DomainBase foo = + Domain example = persistActiveDomain("example.tld"); + Domain foo = persistResource( - newDomainBase("foo.tld") + DatabaseHelper.newDomain("foo.tld") .asBuilder() .setSubordinateHosts(ImmutableSet.of(oldHostName())) .build()); @@ -340,13 +340,13 @@ class HostUpdateFlowTest extends ResourceFlowTestCase1080:0:0:0:8:800:200C:417A"); createTld("foo"); createTld("tld"); - DomainBase fooDomain = + Domain fooDomain = persistResource( - newDomainBase("example.foo") + DatabaseHelper.newDomain("example.foo") .asBuilder() .setSubordinateHosts(ImmutableSet.of(oldHostName())) .build()); - DomainBase tldDomain = persistActiveDomain("example.tld"); + Domain tldDomain = persistActiveDomain("example.tld"); persistActiveSubordinateHost(oldHostName(), fooDomain); assertThat(fooDomain.getSubordinateHosts()).containsExactly("ns1.example.foo"); assertThat(tldDomain.getSubordinateHosts()).isEmpty(); @@ -361,9 +361,9 @@ class HostUpdateFlowTest extends ResourceFlowTestCase192.0.2.22", null); createTld("tld"); - DomainBase domain = persistActiveDomain("example.tld"); + Domain domain = persistActiveDomain("example.tld"); persistActiveHost(oldHostName()); assertThat(domain.getSubordinateHosts()).isEmpty(); assertThrows(CannotRenameExternalHostException.class, this::runFlow); @@ -428,7 +428,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase192.0.2.22", null); createTld("tld"); - DomainBase domain = persistActiveDomain("example.tld"); + Domain domain = persistActiveDomain("example.tld"); persistActiveHost(oldHostName()); assertThat(domain.getSubordinateHosts()).isEmpty(); HostResource renamedHost = doSuccessfulTestAsSuperuser(); @@ -504,13 +504,16 @@ class HostUpdateFlowTest extends ResourceFlowTestCase1080:0:0:0:8:800:200C:417A"); createTld("tld"); DateTime lastTransferTime = clock.nowUtc().minusDays(5); - DomainBase foo = + Domain foo = persistResource( - newDomainBase("foo.tld").asBuilder().setLastTransferTime(lastTransferTime).build()); + DatabaseHelper.newDomain("foo.tld") + .asBuilder() + .setLastTransferTime(lastTransferTime) + .build()); // Set the new domain to have a last transfer time that is different than the last transfer // time on the host in question. persistResource( - newDomainBase("example.tld") + DatabaseHelper.newDomain("example.tld") .asBuilder() .setLastTransferTime(clock.nowUtc().minusDays(10)) .build()); @@ -539,16 +542,16 @@ class HostUpdateFlowTest extends ResourceFlowTestCase192.0.2.22", "1080:0:0:0:8:800:200C:417A"); createTld("tld"); - DomainBase domain = + Domain domain = persistResource( - newDomainBase("foo.tld") + DatabaseHelper.newDomain("foo.tld") .asBuilder() .setLastTransferTime(clock.nowUtc().minusDays(5)) .build()); // Set the new domain to have a last transfer time that is different than the last transfer // time on the host in question. persistResource( - newDomainBase("example.tld") + DatabaseHelper.newDomain("example.tld") .asBuilder() .setLastTransferTime(clock.nowUtc().minusDays(10)) .build()); @@ -579,14 +582,15 @@ class HostUpdateFlowTest extends ResourceFlowTestCase192.0.2.22", "1080:0:0:0:8:800:200C:417A"); createTld("tld"); - DomainBase foo = + Domain foo = persistResource( - newDomainBase("foo.tld") + DatabaseHelper.newDomain("foo.tld") .asBuilder() .setLastTransferTime(clock.nowUtc().minusDays(5)) .build()); // Set the new domain to have a null last transfer time. - persistResource(newDomainBase("example.tld").asBuilder().setLastTransferTime(null).build()); + persistResource( + DatabaseHelper.newDomain("example.tld").asBuilder().setLastTransferTime(null).build()); DateTime lastTransferTime = clock.nowUtc().minusDays(20); persistResource( @@ -615,10 +619,12 @@ class HostUpdateFlowTest extends ResourceFlowTestCase192.0.2.22", "1080:0:0:0:8:800:200C:417A"); createTld("tld"); - DomainBase foo = - persistResource(newDomainBase("foo.tld").asBuilder().setLastTransferTime(null).build()); + Domain foo = + persistResource( + DatabaseHelper.newDomain("foo.tld").asBuilder().setLastTransferTime(null).build()); // Set the new domain to have a null last transfer time. - persistResource(newDomainBase("example.tld").asBuilder().setLastTransferTime(null).build()); + persistResource( + DatabaseHelper.newDomain("example.tld").asBuilder().setLastTransferTime(null).build()); DateTime lastTransferTime = clock.nowUtc().minusDays(20); persistResource( @@ -646,14 +652,15 @@ class HostUpdateFlowTest extends ResourceFlowTestCase192.0.2.22", "1080:0:0:0:8:800:200C:417A"); createTld("tld"); - DomainBase foo = + Domain foo = persistResource( - newDomainBase("foo.tld") + DatabaseHelper.newDomain("foo.tld") .asBuilder() .setLastTransferTime(clock.nowUtc().minusDays(5)) .build()); // Set the new domain to have a null last transfer time. - persistResource(newDomainBase("example.tld").asBuilder().setLastTransferTime(null).build()); + persistResource( + DatabaseHelper.newDomain("example.tld").asBuilder().setLastTransferTime(null).build()); persistResource( newHostResource(oldHostName()) .asBuilder() @@ -679,7 +686,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase1080:0:0:0:8:800:200C:417A"); createTld("foo"); - DomainBase domain = persistActiveDomain("example.foo"); + Domain domain = persistActiveDomain("example.foo"); persistResource( newHostResource(oldHostName()) .asBuilder() @@ -717,7 +724,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase1080:0:0:0:8:800:200C:417A"); createTld("foo"); - DomainBase domain = persistActiveDomain("example.foo"); + Domain domain = persistActiveDomain("example.foo"); DateTime lastTransferTime = clock.nowUtc().minusDays(12); persistResource( newHostResource(oldHostName()) @@ -753,7 +760,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase1080:0:0:0:8:800:200C:417A"); createTld("foo"); - DomainBase domain = persistActiveDomain("example.foo"); + Domain domain = persistActiveDomain("example.foo"); persistResource( newHostResource(oldHostName()) .asBuilder() @@ -784,7 +791,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase192.0.2.22", null); createTld("tld"); persistResource( - newDomainBase("example.tld") + DatabaseHelper.newDomain("example.tld") .asBuilder() .setLastTransferTime(domainTransferTime) .build()); @@ -835,9 +842,9 @@ class HostUpdateFlowTest extends ResourceFlowTestCase192.0.2.22", "1080:0:0:0:8:800:200C:417A"); createTld("tld"); - DomainBase domain = + Domain domain = persistResource( - newDomainBase("example.tld") + DatabaseHelper.newDomain("example.tld") .asBuilder() .setSubordinateHosts(ImmutableSet.of(oldHostName())) .setDeletionTime(clock.nowUtc().plusDays(35)) @@ -1104,9 +1111,9 @@ class HostUpdateFlowTest extends ResourceFlowTestCase { /** This is the message id being sent in the ACK request. */ private static final long MESSAGE_ID = 3; - private DomainBase domain; + private Domain domain; private ContactResource contact; @BeforeEach @@ -58,7 +58,7 @@ class PollAckFlowTest extends FlowTestCase { setRegistrarIdForFlow("NewRegistrar"); createTld("example"); contact = persistActiveContact("jd1234"); - domain = persistResource(newDomainBase("test.example", contact)); + domain = persistResource(DatabaseHelper.newDomain("test.example", contact)); } private void persistOneTimePollMessage(long messageId) { diff --git a/core/src/test/java/google/registry/flows/poll/PollRequestFlowTest.java b/core/src/test/java/google/registry/flows/poll/PollRequestFlowTest.java index 5210baee8..ab3bd7d7c 100644 --- a/core/src/test/java/google/registry/flows/poll/PollRequestFlowTest.java +++ b/core/src/test/java/google/registry/flows/poll/PollRequestFlowTest.java @@ -16,7 +16,6 @@ package google.registry.flows.poll; import static google.registry.testing.DatabaseHelper.createHistoryEntryForEppResource; import static google.registry.testing.DatabaseHelper.createTld; -import static google.registry.testing.DatabaseHelper.newDomainBase; import static google.registry.testing.DatabaseHelper.persistActiveContact; import static google.registry.testing.DatabaseHelper.persistActiveHost; import static google.registry.testing.DatabaseHelper.persistNewRegistrar; @@ -30,7 +29,7 @@ import google.registry.flows.FlowTestCase; import google.registry.flows.poll.PollRequestFlow.UnexpectedMessageIdException; import google.registry.model.contact.ContactHistory; import google.registry.model.contact.ContactResource; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.eppcommon.Trid; import google.registry.model.host.HostHistory; import google.registry.model.host.HostResource; @@ -40,6 +39,7 @@ import google.registry.model.reporting.HistoryEntry; import google.registry.model.transfer.TransferResponse.ContactTransferResponse; import google.registry.model.transfer.TransferResponse.DomainTransferResponse; import google.registry.model.transfer.TransferStatus; +import google.registry.testing.DatabaseHelper; import google.registry.testing.SetClockExtension; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Order; @@ -53,7 +53,7 @@ class PollRequestFlowTest extends FlowTestCase { @RegisterExtension final SetClockExtension setClockExtension = new SetClockExtension(clock, "2011-01-02T01:01:01Z"); - private DomainBase domain; + private Domain domain; private ContactResource contact; private HostResource host; @@ -64,7 +64,7 @@ class PollRequestFlowTest extends FlowTestCase { createTld("example"); persistNewRegistrar("BadRegistrar"); contact = persistActiveContact("jd1234"); - domain = persistResource(newDomainBase("test.example", contact)); + domain = persistResource(DatabaseHelper.newDomain("test.example", contact)); host = persistActiveHost("ns1.test.example"); } diff --git a/core/src/test/java/google/registry/model/billing/BillingEventTest.java b/core/src/test/java/google/registry/model/billing/BillingEventTest.java index 0c87ede2d..945b47973 100644 --- a/core/src/test/java/google/registry/model/billing/BillingEventTest.java +++ b/core/src/test/java/google/registry/model/billing/BillingEventTest.java @@ -34,7 +34,7 @@ import google.registry.model.EntityTestCase; import google.registry.model.billing.BillingEvent.Flag; import google.registry.model.billing.BillingEvent.Reason; import google.registry.model.billing.BillingEvent.RenewalPriceBehavior; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainHistory; import google.registry.model.domain.GracePeriod; import google.registry.model.domain.rgp.GracePeriodStatus; @@ -59,7 +59,7 @@ public class BillingEventTest extends EntityTestCase { private DomainHistory domainHistory; private DomainHistory domainHistory2; - private DomainBase domain; + private Domain domain; private BillingEvent.OneTime oneTime; private BillingEvent.OneTime oneTimeSynthetic; private BillingEvent.Recurring recurring; diff --git a/core/src/test/java/google/registry/model/bulkquery/BulkQueryHelper.java b/core/src/test/java/google/registry/model/bulkquery/BulkQueryHelper.java index ce8e42b77..c73bac4d4 100644 --- a/core/src/test/java/google/registry/model/bulkquery/BulkQueryHelper.java +++ b/core/src/test/java/google/registry/model/bulkquery/BulkQueryHelper.java @@ -15,9 +15,11 @@ package google.registry.model.bulkquery; import static com.google.common.collect.ImmutableSet.toImmutableSet; +import static google.registry.model.bulkquery.BulkQueryEntities.assembleDomain; +import static google.registry.model.bulkquery.BulkQueryEntities.assembleDomainHistory; import static google.registry.persistence.transaction.TransactionManagerFactory.jpaTm; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainHistory; import google.registry.model.domain.DomainHistory.DomainHistoryId; import google.registry.model.domain.GracePeriod; @@ -28,17 +30,17 @@ import google.registry.model.reporting.DomainTransactionRecord; import google.registry.persistence.VKey; /** - * Helpers for bulk-loading {@link google.registry.model.domain.DomainBase} and {@link - * google.registry.model.domain.DomainHistory} entities in tests. + * Helpers for bulk-loading {@link Domain} and {@link google.registry.model.domain.DomainHistory} + * entities in tests. */ public class BulkQueryHelper { - static DomainBase loadAndAssembleDomainBase(String domainRepoId) { + static Domain loadAndAssembleDomain(String domainRepoId) { return jpaTm() .transact( () -> - BulkQueryEntities.assembleDomainBase( - jpaTm().loadByKey(DomainBaseLite.createVKey(domainRepoId)), + assembleDomain( + jpaTm().loadByKey(DomainLite.createVKey(domainRepoId)), jpaTm() .loadAllOfStream(GracePeriod.class) .filter(gracePeriod -> gracePeriod.getDomainRepoId().equals(domainRepoId)) @@ -58,7 +60,7 @@ public class BulkQueryHelper { return jpaTm() .transact( () -> - BulkQueryEntities.assembleDomainHistory( + assembleDomainHistory( jpaTm().loadByKey(VKey.createSql(DomainHistoryLite.class, domainHistoryId)), jpaTm() .loadAllOfStream(DomainDsDataHistory.class) diff --git a/core/src/test/java/google/registry/model/bulkquery/DomainBaseLiteTest.java b/core/src/test/java/google/registry/model/bulkquery/DomainLiteTest.java similarity index 73% rename from core/src/test/java/google/registry/model/bulkquery/DomainBaseLiteTest.java rename to core/src/test/java/google/registry/model/bulkquery/DomainLiteTest.java index 2c6bf9cbb..a8a5c5569 100644 --- a/core/src/test/java/google/registry/model/bulkquery/DomainBaseLiteTest.java +++ b/core/src/test/java/google/registry/model/bulkquery/DomainLiteTest.java @@ -15,13 +15,14 @@ package google.registry.model.bulkquery; import static com.google.common.truth.Truth.assertThat; +import static google.registry.model.bulkquery.BulkQueryHelper.loadAndAssembleDomain; import static google.registry.persistence.transaction.TransactionManagerFactory.jpaTm; import static org.joda.time.DateTimeZone.UTC; import com.google.common.collect.Sets; import com.google.common.collect.Sets.SetView; import com.google.common.truth.Truth8; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.testing.AppEngineExtension; import google.registry.testing.FakeClock; import java.util.Set; @@ -33,8 +34,8 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; -/** Unit tests for reading {@link DomainBaseLite}. */ -class DomainBaseLiteTest { +/** Unit tests for reading {@link DomainLite}. */ +class DomainLiteTest { protected FakeClock fakeClock = new FakeClock(DateTime.now(UTC)); @@ -65,53 +66,46 @@ class DomainBaseLiteTest { } @Test - void domainBaseLiteAttributes_versusDomainBase() { - Set domainBaseAttributes = + void domainLiteAttributes_versusDomain() { + Set domainAttributes = jpaTm() .transact( () -> - jpaTm() - .getEntityManager() - .getMetamodel() - .entity(DomainBase.class) - .getAttributes()) + jpaTm().getEntityManager().getMetamodel().entity(Domain.class).getAttributes()) .stream() .map(Attribute::getName) .collect(Collectors.toSet()); setupHelper.setupBulkQueryJpaTm(appEngine); - Set domainBaseLiteAttributes = + Set domainLiteAttributes = jpaTm() .transact( () -> jpaTm() .getEntityManager() .getMetamodel() - .entity(DomainBaseLite.class) + .entity(DomainLite.class) .getAttributes()) .stream() .map(Attribute::getName) .collect(Collectors.toSet()); - assertThat(domainBaseAttributes).containsAtLeastElementsIn(domainBaseLiteAttributes); + assertThat(domainAttributes).containsAtLeastElementsIn(domainLiteAttributes); - SetView excludedFromDomainBase = - Sets.difference(domainBaseAttributes, domainBaseLiteAttributes); - assertThat(excludedFromDomainBase) + SetView excludedFromDomain = Sets.difference(domainAttributes, domainLiteAttributes); + assertThat(excludedFromDomain) .containsExactly("internalDelegationSignerData", "internalGracePeriods", "nsHosts"); } @Test - void readDomainBaseLite_simple() { + void readDomainLite_simple() { setupHelper.setupBulkQueryJpaTm(appEngine); - assertThat(BulkQueryHelper.loadAndAssembleDomainBase(TestSetupHelper.DOMAIN_REPO_ID)) - .isEqualTo(setupHelper.domain); + assertThat(loadAndAssembleDomain(TestSetupHelper.DOMAIN_REPO_ID)).isEqualTo(setupHelper.domain); } @Test - void readDomainBaseLite_full() { + void readDomainLite_full() { setupHelper.applyChangeToDomainAndHistory(); setupHelper.setupBulkQueryJpaTm(appEngine); - assertThat(BulkQueryHelper.loadAndAssembleDomainBase(TestSetupHelper.DOMAIN_REPO_ID)) - .isEqualTo(setupHelper.domain); + assertThat(loadAndAssembleDomain(TestSetupHelper.DOMAIN_REPO_ID)).isEqualTo(setupHelper.domain); } } diff --git a/core/src/test/java/google/registry/model/bulkquery/TestSetupHelper.java b/core/src/test/java/google/registry/model/bulkquery/TestSetupHelper.java index 687cddc37..d7685baea 100644 --- a/core/src/test/java/google/registry/model/bulkquery/TestSetupHelper.java +++ b/core/src/test/java/google/registry/model/bulkquery/TestSetupHelper.java @@ -24,8 +24,8 @@ import com.google.common.base.Ascii; import com.google.common.collect.ImmutableSet; import google.registry.model.contact.ContactResource; import google.registry.model.domain.DesignatedContact; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainAuthInfo; -import google.registry.model.domain.DomainBase; import google.registry.model.domain.DomainHistory; import google.registry.model.domain.GracePeriod; import google.registry.model.domain.Period; @@ -73,7 +73,7 @@ public final class TestSetupHelper { public Registry registry; public Registrar registrar; public ContactResource contact; - public DomainBase domain; + public Domain domain; public DomainHistory domainHistory; public HostResource host; @@ -127,16 +127,15 @@ public final class TestSetupHelper { .build(); } - static DomainBase createSimpleDomain(ContactResource contact) { - return DatabaseHelper.newDomainBase(DOMAIN_NAME, DOMAIN_REPO_ID, contact) + static Domain createSimpleDomain(ContactResource contact) { + return DatabaseHelper.newDomain(DOMAIN_NAME, DOMAIN_REPO_ID, contact) .asBuilder() .setCreationRegistrarId(REGISTRAR_ID) .setPersistedCurrentSponsorRegistrarId(REGISTRAR_ID) .build(); } - static DomainBase createFullDomain( - ContactResource contact, HostResource host, FakeClock fakeClock) { + static Domain createFullDomain(ContactResource contact, HostResource host, FakeClock fakeClock) { return createSimpleDomain(contact) .asBuilder() .setDomainName(DOMAIN_NAME) @@ -188,7 +187,7 @@ public final class TestSetupHelper { .build(); } - static DomainHistory createHistoryWithoutContent(DomainBase domain, FakeClock fakeClock) { + static DomainHistory createHistoryWithoutContent(Domain domain, FakeClock fakeClock) { return new DomainHistory.Builder() .setType(HistoryEntry.Type.DOMAIN_CREATE) .setXmlBytes("".getBytes(UTF_8)) @@ -204,7 +203,7 @@ public final class TestSetupHelper { .build(); } - static DomainHistory createFullHistory(DomainBase domain, FakeClock fakeClock) { + static DomainHistory createFullHistory(Domain domain, FakeClock fakeClock) { return createHistoryWithoutContent(domain, fakeClock) .asBuilder() .setType(HistoryEntry.Type.DOMAIN_TRANSFER_APPROVE) diff --git a/core/src/test/java/google/registry/model/common/ClassPathManagerTest.java b/core/src/test/java/google/registry/model/common/ClassPathManagerTest.java index 126ee2cdb..abf0a5460 100644 --- a/core/src/test/java/google/registry/model/common/ClassPathManagerTest.java +++ b/core/src/test/java/google/registry/model/common/ClassPathManagerTest.java @@ -18,7 +18,7 @@ import static com.google.common.truth.Truth.assertThat; import static org.junit.jupiter.api.Assertions.assertThrows; import google.registry.model.contact.ContactResource; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainHistory; import google.registry.model.domain.token.AllocationToken; import google.registry.model.host.HostResource; @@ -61,7 +61,7 @@ public class ClassPathManagerTest { .isEqualTo(EppResourceIndexBucket.class); assertThat(ClassPathManager.getClass("EntityGroupRoot")).isEqualTo(EntityGroupRoot.class); assertThat(ClassPathManager.getClass("Lock")).isEqualTo(Lock.class); - assertThat(ClassPathManager.getClass("DomainBase")).isEqualTo(DomainBase.class); + assertThat(ClassPathManager.getClass("Domain")).isEqualTo(Domain.class); assertThat(ClassPathManager.getClass("HistoryEntry")).isEqualTo(HistoryEntry.class); assertThat(ClassPathManager.getClass("PollMessage")).isEqualTo(PollMessage.class); assertThat(ClassPathManager.getClass("ForeignKeyHostIndex")) @@ -115,7 +115,7 @@ public class ClassPathManagerTest { .isEqualTo("EppResourceIndexBucket"); assertThat(ClassPathManager.getClassName(EntityGroupRoot.class)).isEqualTo("EntityGroupRoot"); assertThat(ClassPathManager.getClassName(Lock.class)).isEqualTo("Lock"); - assertThat(ClassPathManager.getClassName(DomainBase.class)).isEqualTo("DomainBase"); + assertThat(ClassPathManager.getClassName(Domain.class)).isEqualTo("Domain"); assertThat(ClassPathManager.getClassName(HistoryEntry.class)).isEqualTo("HistoryEntry"); assertThat(ClassPathManager.getClassName(PollMessage.class)).isEqualTo("PollMessage"); assertThat(ClassPathManager.getClassName(ForeignKeyHostIndex.class)) diff --git a/core/src/test/java/google/registry/model/domain/DomainBaseSqlTest.java b/core/src/test/java/google/registry/model/domain/DomainSqlTest.java similarity index 91% rename from core/src/test/java/google/registry/model/domain/DomainBaseSqlTest.java rename to core/src/test/java/google/registry/model/domain/DomainSqlTest.java index a857040e4..173b19990 100644 --- a/core/src/test/java/google/registry/model/domain/DomainBaseSqlTest.java +++ b/core/src/test/java/google/registry/model/domain/DomainSqlTest.java @@ -64,8 +64,8 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; import org.testcontainers.shaded.com.google.common.collect.ImmutableList; -/** Verify that we can store/retrieve DomainBase objects from a SQL database. */ -public class DomainBaseSqlTest { +/** Verify that we can store/retrieve Domain objects from a SQL database. */ +public class DomainSqlTest { protected FakeClock fakeClock = new FakeClock(DateTime.now(UTC)); @@ -77,7 +77,7 @@ public class DomainBaseSqlTest { .withClock(fakeClock) .build(); - private DomainBase domain; + private Domain domain; private DomainHistory historyEntry; private VKey contactKey; private VKey contact2Key; @@ -98,7 +98,7 @@ public class DomainBaseSqlTest { host1VKey = createKey(HostResource.class, "host1"); domain = - new DomainBase.Builder() + new Domain.Builder() .setDomainName("example.com") .setRepoId("4-COM") .setCreationRegistrarId("registrar1") @@ -141,7 +141,7 @@ public class DomainBaseSqlTest { } @Test - void testDomainBasePersistence() { + void testDomainPersistence() { persistDomain(); assertEqualDomainExcept(loadByKey(domain.createVKey())); } @@ -164,7 +164,7 @@ public class DomainBaseSqlTest { jpaTm() .transact( () -> { - DomainBase persisted = jpaTm().loadByKey(domain.createVKey()); + Domain persisted = jpaTm().loadByKey(domain.createVKey()); jpaTm().put(persisted.asBuilder().build()); }); // Load the domain in its entirety. @@ -177,16 +177,15 @@ public class DomainBaseSqlTest { jpaTm() .transact( () -> { - DomainBase persisted = jpaTm().loadByKey(domain.createVKey()); - DomainBase modified = - persisted.asBuilder().setGracePeriods(ImmutableSet.of()).build(); + Domain persisted = jpaTm().loadByKey(domain.createVKey()); + Domain modified = persisted.asBuilder().setGracePeriods(ImmutableSet.of()).build(); jpaTm().put(modified); }); jpaTm() .transact( () -> { - DomainBase persisted = jpaTm().loadByKey(domain.createVKey()); + Domain persisted = jpaTm().loadByKey(domain.createVKey()); assertThat(persisted.getGracePeriods()).isEmpty(); }); } @@ -197,15 +196,15 @@ public class DomainBaseSqlTest { jpaTm() .transact( () -> { - DomainBase persisted = jpaTm().loadByKey(domain.createVKey()); - DomainBase modified = persisted.asBuilder().setGracePeriods(null).build(); + Domain persisted = jpaTm().loadByKey(domain.createVKey()); + Domain modified = persisted.asBuilder().setGracePeriods(null).build(); jpaTm().put(modified); }); jpaTm() .transact( () -> { - DomainBase persisted = jpaTm().loadByKey(domain.createVKey()); + Domain persisted = jpaTm().loadByKey(domain.createVKey()); assertThat(persisted.getGracePeriods()).isEmpty(); }); } @@ -216,8 +215,8 @@ public class DomainBaseSqlTest { jpaTm() .transact( () -> { - DomainBase persisted = jpaTm().loadByKey(domain.createVKey()); - DomainBase modified = + Domain persisted = jpaTm().loadByKey(domain.createVKey()); + Domain modified = persisted .asBuilder() .addGracePeriod( @@ -235,7 +234,7 @@ public class DomainBaseSqlTest { jpaTm() .transact( () -> { - DomainBase persisted = jpaTm().loadByKey(domain.createVKey()); + Domain persisted = jpaTm().loadByKey(domain.createVKey()); assertThat(persisted.getGracePeriods()) .containsExactly( GracePeriod.create( @@ -248,8 +247,8 @@ public class DomainBaseSqlTest { jpaTm() .transact( () -> { - DomainBase persisted = jpaTm().loadByKey(domain.createVKey()); - DomainBase.Builder builder = persisted.asBuilder(); + Domain persisted = jpaTm().loadByKey(domain.createVKey()); + Domain.Builder builder = persisted.asBuilder(); for (GracePeriod gracePeriod : persisted.getGracePeriods()) { if (gracePeriod.getType() == GracePeriodStatus.RENEW) { builder.removeGracePeriod(gracePeriod); @@ -261,7 +260,7 @@ public class DomainBaseSqlTest { jpaTm() .transact( () -> { - DomainBase persisted = jpaTm().loadByKey(domain.createVKey()); + Domain persisted = jpaTm().loadByKey(domain.createVKey()); assertEqualDomainExcept(persisted); }); } @@ -272,18 +271,17 @@ public class DomainBaseSqlTest { jpaTm() .transact( () -> { - DomainBase persisted = jpaTm().loadByKey(domain.createVKey()); - DomainBase modified = - persisted.asBuilder().setGracePeriods(ImmutableSet.of()).build(); + Domain persisted = jpaTm().loadByKey(domain.createVKey()); + Domain modified = persisted.asBuilder().setGracePeriods(ImmutableSet.of()).build(); jpaTm().put(modified); }); jpaTm() .transact( () -> { - DomainBase persisted = jpaTm().loadByKey(domain.createVKey()); + Domain persisted = jpaTm().loadByKey(domain.createVKey()); assertThat(persisted.getGracePeriods()).isEmpty(); - DomainBase modified = + Domain modified = persisted .asBuilder() .addGracePeriod( @@ -301,7 +299,7 @@ public class DomainBaseSqlTest { jpaTm() .transact( () -> { - DomainBase persisted = jpaTm().loadByKey(domain.createVKey()); + Domain persisted = jpaTm().loadByKey(domain.createVKey()); assertThat(persisted.getGracePeriods()) .containsExactly( GracePeriod.create( @@ -322,9 +320,9 @@ public class DomainBaseSqlTest { jpaTm() .transact( () -> { - DomainBase persisted = jpaTm().loadByKey(domain.createVKey()); + Domain persisted = jpaTm().loadByKey(domain.createVKey()); assertThat(persisted.getDsData()).containsExactlyElementsIn(domain.getDsData()); - DomainBase modified = persisted.asBuilder().setDsData(unionDsData).build(); + Domain modified = persisted.asBuilder().setDsData(unionDsData).build(); jpaTm().put(modified); }); @@ -332,7 +330,7 @@ public class DomainBaseSqlTest { jpaTm() .transact( () -> { - DomainBase persisted = jpaTm().loadByKey(domain.createVKey()); + Domain persisted = jpaTm().loadByKey(domain.createVKey()); assertThat(persisted.getDsData()).containsExactlyElementsIn(unionDsData); assertEqualDomainExcept(persisted, "dsData"); }); @@ -341,7 +339,7 @@ public class DomainBaseSqlTest { jpaTm() .transact( () -> { - DomainBase persisted = jpaTm().loadByKey(domain.createVKey()); + Domain persisted = jpaTm().loadByKey(domain.createVKey()); jpaTm().put(persisted.asBuilder().setDsData(domain.getDsData()).build()); }); @@ -349,7 +347,7 @@ public class DomainBaseSqlTest { jpaTm() .transact( () -> { - DomainBase persisted = jpaTm().loadByKey(domain.createVKey()); + Domain persisted = jpaTm().loadByKey(domain.createVKey()); assertEqualDomainExcept(persisted); }); } @@ -358,7 +356,7 @@ public class DomainBaseSqlTest { void testSerializable() { createTld("com"); insertInDb(contact, contact2, domain, host); - DomainBase persisted = jpaTm().transact(() -> jpaTm().loadByEntity(domain)); + Domain persisted = jpaTm().transact(() -> jpaTm().loadByEntity(domain)); assertThat(SerializeUtils.serializeDeserialize(persisted)).isEqualTo(persisted); } @@ -484,7 +482,7 @@ public class DomainBaseSqlTest { domain); // Store the existing BillingRecurrence VKey. This happens after the event has been persisted. - DomainBase persisted = loadByKey(domain.createVKey()); + Domain persisted = loadByKey(domain.createVKey()); // Verify that the domain data has been persisted. // dsData still isn't persisted. gracePeriods appears to have the same values but for some @@ -616,7 +614,7 @@ public class DomainBaseSqlTest { domain); // Store the existing BillingRecurrence VKey. This happens after the event has been persisted. - DomainBase persisted = loadByKey(domain.createVKey()); + Domain persisted = loadByKey(domain.createVKey()); // Verify that the domain data has been persisted. // dsData still isn't persisted. gracePeriods appears to have the same values but for some @@ -652,7 +650,7 @@ public class DomainBaseSqlTest { clazz, id, Key.create(Key.create(EntityGroupRoot.class, "per-tld"), clazz, id)); } - private void assertEqualDomainExcept(DomainBase thatDomain, String... excepts) { + private void assertEqualDomainExcept(Domain thatDomain, String... excepts) { ImmutableList moreExcepts = new ImmutableList.Builder() .addAll(Arrays.asList(excepts)) @@ -671,7 +669,7 @@ public class DomainBaseSqlTest { @Test void testUpdateTimeAfterNameserverUpdate() { persistDomain(); - DomainBase persisted = loadByKey(domain.createVKey()); + Domain persisted = loadByKey(domain.createVKey()); DateTime originalUpdateTime = persisted.getUpdateTimestamp().getTimestamp(); fakeClock.advanceOneMilli(); DateTime transactionTime = @@ -698,7 +696,7 @@ public class DomainBaseSqlTest { @Test void testUpdateTimeAfterDsDataUpdate() { persistDomain(); - DomainBase persisted = loadByKey(domain.createVKey()); + Domain persisted = loadByKey(domain.createVKey()); DateTime originalUpdateTime = persisted.getUpdateTimestamp().getTimestamp(); fakeClock.advanceOneMilli(); DateTime transactionTime = diff --git a/core/src/test/java/google/registry/model/domain/DomainBaseTest.java b/core/src/test/java/google/registry/model/domain/DomainTest.java similarity index 94% rename from core/src/test/java/google/registry/model/domain/DomainBaseTest.java rename to core/src/test/java/google/registry/model/domain/DomainTest.java index da58d32d9..a9f678694 100644 --- a/core/src/test/java/google/registry/model/domain/DomainBaseTest.java +++ b/core/src/test/java/google/registry/model/domain/DomainTest.java @@ -22,13 +22,12 @@ import static google.registry.model.EppResourceUtils.loadByForeignKey; import static google.registry.testing.DatabaseHelper.cloneAndSetAutoTimestamps; import static google.registry.testing.DatabaseHelper.createTld; import static google.registry.testing.DatabaseHelper.insertInDb; -import static google.registry.testing.DatabaseHelper.newDomainBase; import static google.registry.testing.DatabaseHelper.newHostResource; import static google.registry.testing.DatabaseHelper.persistActiveContact; import static google.registry.testing.DatabaseHelper.persistActiveDomain; import static google.registry.testing.DatabaseHelper.persistActiveHost; import static google.registry.testing.DatabaseHelper.persistResource; -import static google.registry.testing.DomainBaseSubject.assertAboutDomains; +import static google.registry.testing.DomainSubject.assertAboutDomains; import static google.registry.testing.SqlHelper.saveRegistrar; import static google.registry.util.DateTimeUtils.END_OF_TIME; import static google.registry.util.DateTimeUtils.START_OF_TIME; @@ -64,6 +63,7 @@ import google.registry.model.transfer.DomainTransferData; import google.registry.model.transfer.TransferStatus; import google.registry.persistence.VKey; import google.registry.testing.AppEngineExtension; +import google.registry.testing.DatabaseHelper; import google.registry.testing.FakeClock; import java.util.Optional; import org.joda.money.Money; @@ -72,9 +72,9 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; -/** Unit tests for {@link DomainBase}. */ +/** Unit tests for {@link Domain}. */ @SuppressWarnings("WeakerAccess") // Referred to by EppInputTest. -public class DomainBaseTest { +public class DomainTest { protected FakeClock fakeClock = new FakeClock(DateTime.now(UTC)); @@ -86,7 +86,7 @@ public class DomainBaseTest { .withClock(fakeClock) .build(); - private DomainBase domain; + private Domain domain; private VKey oneTimeBillKey; private VKey recurringBillKey; private DomainHistory domainHistory; @@ -171,7 +171,7 @@ public class DomainBaseTest { domain = persistResource( cloneAndSetAutoTimestamps( - new DomainBase.Builder() + new Domain.Builder() .setDomainName("example.com") .setRepoId("4-COM") .setCreationRegistrarId("TheRegistrar") @@ -230,9 +230,9 @@ public class DomainBaseTest { } @Test - void testDomainContentToDomainBase() { + void testDomainContentToDomain() { ImmutableObjectSubject.assertAboutImmutableObjects() - .that(new DomainBase.Builder().copyFrom(domain).build()) + .that(new Domain.Builder().copyFrom(domain).build()) .isEqualExceptFields(domain, "updateTimestamp", "revisions"); } @@ -241,28 +241,28 @@ public class DomainBaseTest { // Note that this only verifies that the value stored under the foreign key is the same as that // stored under the primary key ("domain" is the domain loaded from the datastore, not the // original domain object). - assertThat(loadByForeignKey(DomainBase.class, domain.getForeignKey(), fakeClock.nowUtc())) + assertThat(loadByForeignKey(Domain.class, domain.getForeignKey(), fakeClock.nowUtc())) .hasValue(domain); } @Test void testEmptyStringsBecomeNull() { assertThat( - newDomainBase("example.com") + DatabaseHelper.newDomain("example.com") .asBuilder() .setPersistedCurrentSponsorRegistrarId(null) .build() .getCurrentSponsorRegistrarId()) .isNull(); assertThat( - newDomainBase("example.com") + DatabaseHelper.newDomain("example.com") .asBuilder() .setPersistedCurrentSponsorRegistrarId("") .build() .getCurrentSponsorRegistrarId()) .isNull(); assertThat( - newDomainBase("example.com") + DatabaseHelper.newDomain("example.com") .asBuilder() .setPersistedCurrentSponsorRegistrarId(" ") .build() @@ -272,21 +272,21 @@ public class DomainBaseTest { void testEmptySetsAndArraysBecomeNull() { assertThat( - newDomainBase("example.com") + DatabaseHelper.newDomain("example.com") .asBuilder() .setNameservers(ImmutableSet.of()) .build() .nsHosts) .isNull(); assertThat( - newDomainBase("example.com") + DatabaseHelper.newDomain("example.com") .asBuilder() .setNameservers(ImmutableSet.of()) .build() .nsHosts) .isNull(); assertThat( - newDomainBase("example.com") + DatabaseHelper.newDomain("example.com") .asBuilder() .setNameservers(ImmutableSet.of(newHostResource("foo.example.tld").createVKey())) .build() @@ -294,7 +294,7 @@ public class DomainBaseTest { .isNotNull(); // This behavior should also hold true for ImmutableObjects nested in collections. assertThat( - newDomainBase("example.com") + DatabaseHelper.newDomain("example.com") .asBuilder() .setDsData(ImmutableSet.of(DelegationSignerData.create(1, 1, 1, (byte[]) null))) .build() @@ -304,7 +304,7 @@ public class DomainBaseTest { .getDigest()) .isNull(); assertThat( - newDomainBase("example.com") + DatabaseHelper.newDomain("example.com") .asBuilder() .setDsData(ImmutableSet.of(DelegationSignerData.create(1, 1, 1, new byte[] {}))) .build() @@ -314,7 +314,7 @@ public class DomainBaseTest { .getDigest()) .isNull(); assertThat( - newDomainBase("example.com") + DatabaseHelper.newDomain("example.com") .asBuilder() .setDsData(ImmutableSet.of(DelegationSignerData.create(1, 1, 1, new byte[] {1}))) .build() @@ -327,8 +327,9 @@ public class DomainBaseTest { @Test void testEmptyTransferDataBecomesNull() { - DomainBase withNull = newDomainBase("example.com").asBuilder().setTransferData(null).build(); - DomainBase withEmpty = withNull.asBuilder().setTransferData(DomainTransferData.EMPTY).build(); + Domain withNull = + DatabaseHelper.newDomain("example.com").asBuilder().setTransferData(null).build(); + Domain withEmpty = withNull.asBuilder().setTransferData(DomainTransferData.EMPTY).build(); assertThat(withNull).isEqualTo(withEmpty); assertThat(withEmpty.transferData).isNull(); } @@ -340,13 +341,14 @@ public class DomainBaseTest { StatusValue[] statuses = {StatusValue.OK}; // OK is implicit if there's no other statuses but there are nameservers. assertAboutDomains() - .that(newDomainBase("example.com").asBuilder().setNameservers(nameservers).build()) + .that( + DatabaseHelper.newDomain("example.com").asBuilder().setNameservers(nameservers).build()) .hasExactlyStatusValues(statuses); StatusValue[] statuses1 = {StatusValue.CLIENT_HOLD}; // If there are other status values, OK should be suppressed. (Domains can't be LINKED.) assertAboutDomains() .that( - newDomainBase("example.com") + DatabaseHelper.newDomain("example.com") .asBuilder() .setNameservers(nameservers) .setStatusValues(ImmutableSet.of(StatusValue.CLIENT_HOLD)) @@ -356,7 +358,7 @@ public class DomainBaseTest { // When OK is suppressed, it should be removed even if it was originally there. assertAboutDomains() .that( - newDomainBase("example.com") + DatabaseHelper.newDomain("example.com") .asBuilder() .setNameservers(nameservers) .setStatusValues(ImmutableSet.of(StatusValue.OK, StatusValue.CLIENT_HOLD)) @@ -365,13 +367,13 @@ public class DomainBaseTest { StatusValue[] statuses3 = {StatusValue.INACTIVE}; // If there are no nameservers, INACTIVE should be added, which suppresses OK. assertAboutDomains() - .that(newDomainBase("example.com").asBuilder().build()) + .that(DatabaseHelper.newDomain("example.com").asBuilder().build()) .hasExactlyStatusValues(statuses3); StatusValue[] statuses4 = {StatusValue.CLIENT_HOLD, StatusValue.INACTIVE}; // If there are no nameservers but there are status values, INACTIVE should still be added. assertAboutDomains() .that( - newDomainBase("example.com") + DatabaseHelper.newDomain("example.com") .asBuilder() .setStatusValues(ImmutableSet.of(StatusValue.CLIENT_HOLD)) .build()) @@ -380,7 +382,7 @@ public class DomainBaseTest { // If there are nameservers, INACTIVE should be removed even if it was originally there. assertAboutDomains() .that( - newDomainBase("example.com") + DatabaseHelper.newDomain("example.com") .asBuilder() .setNameservers(nameservers) .setStatusValues(ImmutableSet.of(StatusValue.INACTIVE, StatusValue.CLIENT_HOLD)) @@ -389,9 +391,7 @@ public class DomainBaseTest { } private void assertTransferred( - DomainBase domain, - DateTime newExpirationTime, - VKey newAutorenewEvent) { + Domain domain, DateTime newExpirationTime, VKey newAutorenewEvent) { assertThat(domain.getTransferData().getTransferStatus()) .isEqualTo(TransferStatus.SERVER_APPROVED); assertThat(domain.getCurrentSponsorRegistrarId()).isEqualTo("TheRegistrar"); @@ -453,7 +453,7 @@ public class DomainBaseTest { "TheRegistrar", oneTimeBillKey)) .build(); - DomainBase afterTransfer = domain.cloneProjectedAtTime(fakeClock.nowUtc().plusDays(1)); + Domain afterTransfer = domain.cloneProjectedAtTime(fakeClock.nowUtc().plusDays(1)); DateTime newExpirationTime = oldExpirationTime.plusYears(1); VKey serverApproveAutorenewEvent = domain.getTransferData().getServerApproveAutorenewEvent(); @@ -471,7 +471,7 @@ public class DomainBaseTest { transferBillingEvent.createVKey(), afterTransfer.getGracePeriods().iterator().next().getGracePeriodId())); // If we project after the grace period expires all should be the same except the grace period. - DomainBase afterGracePeriod = + Domain afterGracePeriod = domain.cloneProjectedAtTime( fakeClock .nowUtc() @@ -521,13 +521,13 @@ public class DomainBaseTest { DateTime transferSuccessDateTime = now.plusDays(5); setupPendingTransferDomain(autorenewDateTime, transferRequestDateTime, transferSuccessDateTime); - DomainBase beforeAutoRenew = domain.cloneProjectedAtTime(autorenewDateTime.minusDays(1)); + Domain beforeAutoRenew = domain.cloneProjectedAtTime(autorenewDateTime.minusDays(1)); assertThat(beforeAutoRenew.getLastEppUpdateTime()).isEqualTo(transferRequestDateTime); assertThat(beforeAutoRenew.getLastEppUpdateRegistrarId()).isEqualTo("TheRegistrar"); // If autorenew happens before transfer succeeds(before transfer grace period starts as well), // lastEppUpdateClientId should still be the current sponsor client id - DomainBase afterAutoRenew = domain.cloneProjectedAtTime(autorenewDateTime.plusDays(1)); + Domain afterAutoRenew = domain.cloneProjectedAtTime(autorenewDateTime.plusDays(1)); assertThat(afterAutoRenew.getLastEppUpdateTime()).isEqualTo(autorenewDateTime); assertThat(afterAutoRenew.getLastEppUpdateRegistrarId()).isEqualTo("NewRegistrar"); } @@ -540,12 +540,11 @@ public class DomainBaseTest { DateTime transferSuccessDateTime = now.plusDays(5); setupPendingTransferDomain(autorenewDateTime, transferRequestDateTime, transferSuccessDateTime); - DomainBase beforeAutoRenew = domain.cloneProjectedAtTime(autorenewDateTime.minusDays(1)); + Domain beforeAutoRenew = domain.cloneProjectedAtTime(autorenewDateTime.minusDays(1)); assertThat(beforeAutoRenew.getLastEppUpdateTime()).isEqualTo(transferRequestDateTime); assertThat(beforeAutoRenew.getLastEppUpdateRegistrarId()).isEqualTo("TheRegistrar"); - DomainBase afterTransferSuccess = - domain.cloneProjectedAtTime(transferSuccessDateTime.plusDays(1)); + Domain afterTransferSuccess = domain.cloneProjectedAtTime(transferSuccessDateTime.plusDays(1)); assertThat(afterTransferSuccess.getLastEppUpdateTime()).isEqualTo(transferSuccessDateTime); assertThat(afterTransferSuccess.getLastEppUpdateRegistrarId()).isEqualTo("TheRegistrar"); } @@ -568,11 +567,11 @@ public class DomainBaseTest { DateTime autorenewDateTime = now.plusDays(3); setupUnmodifiedDomain(autorenewDateTime); - DomainBase beforeAutoRenew = domain.cloneProjectedAtTime(autorenewDateTime.minusDays(1)); + Domain beforeAutoRenew = domain.cloneProjectedAtTime(autorenewDateTime.minusDays(1)); assertThat(beforeAutoRenew.getLastEppUpdateTime()).isEqualTo(null); assertThat(beforeAutoRenew.getLastEppUpdateRegistrarId()).isEqualTo(null); - DomainBase afterAutoRenew = domain.cloneProjectedAtTime(autorenewDateTime.plusDays(1)); + Domain afterAutoRenew = domain.cloneProjectedAtTime(autorenewDateTime.plusDays(1)); assertThat(afterAutoRenew.getLastEppUpdateTime()).isEqualTo(autorenewDateTime); assertThat(afterAutoRenew.getLastEppUpdateRegistrarId()).isEqualTo("NewRegistrar"); } @@ -650,7 +649,7 @@ public class DomainBaseTest { @Test void testRenewalsHappenAtExpiration() { - DomainBase renewed = domain.cloneProjectedAtTime(domain.getRegistrationExpirationTime()); + Domain renewed = domain.cloneProjectedAtTime(domain.getRegistrationExpirationTime()); assertThat(renewed.getRegistrationExpirationTime()) .isEqualTo(domain.getRegistrationExpirationTime().plusYears(1)); assertThat(renewed.getLastEppUpdateTime()).isEqualTo(domain.getRegistrationExpirationTime()); @@ -661,7 +660,7 @@ public class DomainBaseTest { @Test void testTldGetsSet() { createTld("tld"); - domain = newDomainBase("foo.tld"); + domain = DatabaseHelper.newDomain("foo.tld"); assertThat(domain.getTld()).isEqualTo("tld"); } @@ -672,7 +671,7 @@ public class DomainBaseTest { .asBuilder() .setRegistrationExpirationTime(DateTime.parse("2004-02-29T22:00:00.0Z")) .build(); - DomainBase renewed = + Domain renewed = domain.cloneProjectedAtTime(domain.getRegistrationExpirationTime().plusYears(4)); assertThat(renewed.getRegistrationExpirationTime().getDayOfMonth()).isEqualTo(28); } @@ -696,7 +695,7 @@ public class DomainBaseTest { .put(oldExpirationTime.plusYears(2).plusMillis(1), Money.of(USD, 5)) .build()) .build()); - DomainBase renewedThreeTimes = domain.cloneProjectedAtTime(oldExpirationTime.plusYears(2)); + Domain renewedThreeTimes = domain.cloneProjectedAtTime(oldExpirationTime.plusYears(2)); assertThat(renewedThreeTimes.getRegistrationExpirationTime()) .isEqualTo(oldExpirationTime.plusYears(3)); assertThat(renewedThreeTimes.getLastEppUpdateTime()).isEqualTo(oldExpirationTime.plusYears(2)); @@ -881,7 +880,7 @@ public class DomainBaseTest { .setTransferData(transferData) .setAutorenewBillingEvent(recurringBillKey) .build()); - DomainBase clone = domain.cloneProjectedAtTime(now); + Domain clone = domain.cloneProjectedAtTime(now); assertThat(clone.getRegistrationExpirationTime()) .isEqualTo(domain.getRegistrationExpirationTime().plusYears(1)); // Transferring removes the AUTORENEW grace period and adds a TRANSFER grace period diff --git a/core/src/test/java/google/registry/model/domain/token/AllocationTokenTest.java b/core/src/test/java/google/registry/model/domain/token/AllocationTokenTest.java index e73c7583c..8c6e1db00 100644 --- a/core/src/test/java/google/registry/model/domain/token/AllocationTokenTest.java +++ b/core/src/test/java/google/registry/model/domain/token/AllocationTokenTest.java @@ -35,7 +35,7 @@ import com.google.common.collect.ImmutableSortedMap; import com.googlecode.objectify.Key; import google.registry.model.EntityTestCase; import google.registry.model.billing.BillingEvent.RenewalPriceBehavior; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.token.AllocationToken.RegistrationBehavior; import google.registry.model.domain.token.AllocationToken.TokenStatus; import google.registry.model.domain.token.AllocationToken.TokenType; @@ -79,7 +79,7 @@ public class AllocationTokenTest extends EntityTestCase { .build()); assertThat(loadByEntity(unlimitedUseToken)).isEqualTo(unlimitedUseToken); - DomainBase domain = persistActiveDomain("example.foo"); + Domain domain = persistActiveDomain("example.foo"); Key historyEntryKey = Key.create(Key.create(domain), HistoryEntry.class, 1); AllocationToken singleUseToken = persistResource( @@ -116,7 +116,7 @@ public class AllocationTokenTest extends EntityTestCase { AllocationToken persisted = loadByEntity(unlimitedUseToken); assertThat(SerializeUtils.serializeDeserialize(persisted)).isEqualTo(persisted); - DomainBase domain = persistActiveDomain("example.foo"); + Domain domain = persistActiveDomain("example.foo"); Key historyEntryKey = Key.create(Key.create(domain), HistoryEntry.class, 1); AllocationToken singleUseToken = persistResource( @@ -264,7 +264,7 @@ public class AllocationTokenTest extends EntityTestCase { @Test void testBuild_redemptionHistoryEntryOnlyInSingleUse() { - DomainBase domain = persistActiveDomain("blahdomain.foo"); + Domain domain = persistActiveDomain("blahdomain.foo"); Key historyEntryKey = Key.create(Key.create(domain), HistoryEntry.class, 1); AllocationToken.Builder builder = new AllocationToken.Builder() diff --git a/core/src/test/java/google/registry/model/eppinput/EppInputTest.java b/core/src/test/java/google/registry/model/eppinput/EppInputTest.java index bfd4ba974..56dcb0968 100644 --- a/core/src/test/java/google/registry/model/eppinput/EppInputTest.java +++ b/core/src/test/java/google/registry/model/eppinput/EppInputTest.java @@ -21,7 +21,7 @@ import static google.registry.testing.TestDataHelper.loadBytes; import static org.junit.jupiter.api.Assertions.assertThrows; import google.registry.model.contact.ContactResourceTest; -import google.registry.model.domain.DomainBaseTest; +import google.registry.model.domain.DomainTest; import google.registry.model.eppinput.EppInput.InnerCommand; import google.registry.model.eppinput.EppInput.Login; import google.registry.xml.XmlException; @@ -44,7 +44,7 @@ class EppInputTest { @Test void testUnmarshalling_domainCheck() throws Exception { EppInput input = - unmarshal(EppInput.class, loadBytes(DomainBaseTest.class, "domain_check.xml").read()); + unmarshal(EppInput.class, loadBytes(DomainTest.class, "domain_check.xml").read()); assertThat(input.getCommandWrapper().getClTrid()).hasValue("ABC-12345"); assertThat(input.getCommandType()).isEqualTo("check"); assertThat(input.getResourceType()).hasValue("domain"); diff --git a/core/src/test/java/google/registry/model/history/DomainHistoryTest.java b/core/src/test/java/google/registry/model/history/DomainHistoryTest.java index 01f703b12..22bf096fc 100644 --- a/core/src/test/java/google/registry/model/history/DomainHistoryTest.java +++ b/core/src/test/java/google/registry/model/history/DomainHistoryTest.java @@ -20,7 +20,7 @@ import static google.registry.persistence.transaction.TransactionManagerFactory. import static google.registry.testing.DatabaseHelper.createTld; import static google.registry.testing.DatabaseHelper.insertInDb; import static google.registry.testing.DatabaseHelper.newContactResourceWithRoid; -import static google.registry.testing.DatabaseHelper.newDomainBase; +import static google.registry.testing.DatabaseHelper.newDomain; import static google.registry.testing.DatabaseHelper.newHostResourceWithRoid; import static google.registry.util.DateTimeUtils.END_OF_TIME; import static java.nio.charset.StandardCharsets.UTF_8; @@ -28,7 +28,7 @@ import static java.nio.charset.StandardCharsets.UTF_8; import com.google.common.collect.ImmutableSet; import google.registry.model.EntityTestCase; import google.registry.model.contact.ContactResource; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainContent; import google.registry.model.domain.DomainHistory; import google.registry.model.domain.GracePeriod; @@ -60,7 +60,7 @@ public class DomainHistoryTest extends EntityTestCase { @Test void testPersistence() { - DomainBase domain = addGracePeriodForSql(createDomainWithContactsAndHosts()); + Domain domain = addGracePeriodForSql(createDomainWithContactsAndHosts()); DomainHistory domainHistory = createDomainHistory(domain); insertInDb(domainHistory); @@ -75,7 +75,7 @@ public class DomainHistoryTest extends EntityTestCase { @Test void testSerializable() { - DomainBase domain = addGracePeriodForSql(createDomainWithContactsAndHosts()); + Domain domain = addGracePeriodForSql(createDomainWithContactsAndHosts()); DomainHistory domainHistory = createDomainHistory(domain); insertInDb(domainHistory); DomainHistory fromDatabase = @@ -85,7 +85,7 @@ public class DomainHistoryTest extends EntityTestCase { @Test void testLegacyPersistence_nullResource() { - DomainBase domain = addGracePeriodForSql(createDomainWithContactsAndHosts()); + Domain domain = addGracePeriodForSql(createDomainWithContactsAndHosts()); DomainHistory domainHistory = createDomainHistory(domain).asBuilder().setDomain(null).build(); insertInDb(domainHistory); @@ -100,7 +100,7 @@ public class DomainHistoryTest extends EntityTestCase { }); } - static DomainBase createDomainWithContactsAndHosts() { + static Domain createDomainWithContactsAndHosts() { createTld("tld"); HostResource host = newHostResourceWithRoid("ns1.example.com", "host1"); ContactResource contact = newContactResourceWithRoid("contactId", "contact1"); @@ -112,8 +112,8 @@ public class DomainHistoryTest extends EntityTestCase { jpaTm().insert(contact); }); - DomainBase domain = - newDomainBase("example.tld", "domainRepoId", contact) + Domain domain = + newDomain("example.tld", "domainRepoId", contact) .asBuilder() .setNameservers(host.createVKey()) .setDsData(ImmutableSet.of(DelegationSignerData.create(1, 2, 3, new byte[] {0, 1, 2}))) @@ -123,8 +123,8 @@ public class DomainHistoryTest extends EntityTestCase { return domain; } - private static DomainBase addGracePeriodForSql(DomainBase domainBase) { - return domainBase + private static Domain addGracePeriodForSql(Domain domain) { + return domain .asBuilder() .setGracePeriods( ImmutableSet.of( diff --git a/core/src/test/java/google/registry/model/host/HostResourceTest.java b/core/src/test/java/google/registry/model/host/HostResourceTest.java index 763ca27b3..e3199d38f 100644 --- a/core/src/test/java/google/registry/model/host/HostResourceTest.java +++ b/core/src/test/java/google/registry/model/host/HostResourceTest.java @@ -19,7 +19,6 @@ import static google.registry.model.ImmutableObjectSubject.immutableObjectCorres import static google.registry.persistence.transaction.TransactionManagerFactory.tm; import static google.registry.testing.DatabaseHelper.cloneAndSetAutoTimestamps; import static google.registry.testing.DatabaseHelper.createTld; -import static google.registry.testing.DatabaseHelper.newDomainBase; import static google.registry.testing.DatabaseHelper.persistNewRegistrars; import static google.registry.testing.DatabaseHelper.persistResource; import static google.registry.testing.HostResourceSubject.assertAboutHosts; @@ -30,11 +29,12 @@ import com.google.common.collect.ImmutableSet; import com.google.common.net.InetAddresses; import google.registry.model.EntityTestCase; import google.registry.model.ImmutableObjectSubject; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.eppcommon.StatusValue; import google.registry.model.eppcommon.Trid; import google.registry.model.transfer.DomainTransferData; import google.registry.model.transfer.TransferStatus; +import google.registry.testing.DatabaseHelper; import google.registry.util.SerializeUtils; import org.joda.time.DateTime; import org.junit.jupiter.api.BeforeEach; @@ -47,7 +47,7 @@ class HostResourceTest extends EntityTestCase { private final DateTime day2 = day3.minusDays(1); private final DateTime day1 = day2.minusDays(1); - private DomainBase domain; + private Domain domain; private HostResource host; @BeforeEach @@ -57,7 +57,7 @@ class HostResourceTest extends EntityTestCase { // Set up a new persisted registrar entity. domain = persistResource( - newDomainBase("example.com") + DatabaseHelper.newDomain("example.com") .asBuilder() .setRepoId("1-COM") .setTransferData( diff --git a/core/src/test/java/google/registry/model/index/ForeignKeyIndexTest.java b/core/src/test/java/google/registry/model/index/ForeignKeyIndexTest.java index f0c3a8c19..df0329c85 100644 --- a/core/src/test/java/google/registry/model/index/ForeignKeyIndexTest.java +++ b/core/src/test/java/google/registry/model/index/ForeignKeyIndexTest.java @@ -17,15 +17,15 @@ package google.registry.model.index; import static com.google.common.truth.Truth.assertThat; import static google.registry.persistence.transaction.TransactionManagerFactory.tm; import static google.registry.testing.DatabaseHelper.createTld; -import static google.registry.testing.DatabaseHelper.newDomainBase; import static google.registry.testing.DatabaseHelper.persistActiveHost; import static google.registry.testing.DatabaseHelper.persistResource; import com.google.common.collect.ImmutableList; import google.registry.model.EntityTestCase; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.host.HostResource; import google.registry.model.index.ForeignKeyIndex.ForeignKeyHostIndex; +import google.registry.testing.DatabaseHelper; import google.registry.testing.TestCacheExtension; import java.time.Duration; import org.junit.jupiter.api.BeforeEach; @@ -46,8 +46,8 @@ class ForeignKeyIndexTest extends EntityTestCase { @Test void testModifyForeignKeyIndex_notThrowExceptionInSql() { - DomainBase domainBase = newDomainBase("test.com"); - ForeignKeyIndex fki = ForeignKeyIndex.create(domainBase, fakeClock.nowUtc()); + Domain domain = DatabaseHelper.newDomain("test.com"); + ForeignKeyIndex fki = ForeignKeyIndex.create(domain, fakeClock.nowUtc()); tm().transact(() -> tm().insert(fki)); tm().transact(() -> tm().put(fki)); tm().transact(() -> tm().delete(fki)); diff --git a/core/src/test/java/google/registry/model/poll/PollMessageTest.java b/core/src/test/java/google/registry/model/poll/PollMessageTest.java index 6c33482d8..ca2bc25c5 100644 --- a/core/src/test/java/google/registry/model/poll/PollMessageTest.java +++ b/core/src/test/java/google/registry/model/poll/PollMessageTest.java @@ -19,7 +19,6 @@ import static google.registry.persistence.transaction.TransactionManagerFactory. import static google.registry.testing.DatabaseHelper.createTld; import static google.registry.testing.DatabaseHelper.insertInDb; import static google.registry.testing.DatabaseHelper.loadByKey; -import static google.registry.testing.DatabaseHelper.newDomainBase; import static google.registry.testing.DatabaseHelper.persistActiveContact; import static google.registry.testing.DatabaseHelper.persistResource; import static java.nio.charset.StandardCharsets.UTF_8; @@ -27,13 +26,14 @@ import static java.nio.charset.StandardCharsets.UTF_8; import com.google.common.collect.ImmutableList; import google.registry.model.EntityTestCase; import google.registry.model.contact.ContactResource; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainHistory; import google.registry.model.domain.Period; import google.registry.model.eppcommon.Trid; import google.registry.model.poll.PendingActionNotificationResponse.HostPendingActionNotificationResponse; import google.registry.model.reporting.HistoryEntry; import google.registry.persistence.VKey; +import google.registry.testing.DatabaseHelper; import google.registry.util.SerializeUtils; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -41,7 +41,7 @@ import org.junit.jupiter.api.Test; /** Unit tests for {@link PollMessage}. */ public class PollMessageTest extends EntityTestCase { - private DomainBase domain; + private Domain domain; private HistoryEntry historyEntry; private PollMessage.OneTime oneTime; private PollMessage.Autorenew autoRenew; @@ -54,7 +54,7 @@ public class PollMessageTest extends EntityTestCase { void setUp() { createTld("foobar"); ContactResource contact = persistActiveContact("contact1234"); - domain = persistResource(newDomainBase("foo.foobar", contact)); + domain = persistResource(DatabaseHelper.newDomain("foo.foobar", contact)); historyEntry = persistResource( new DomainHistory.Builder() diff --git a/core/src/test/java/google/registry/model/reporting/HistoryEntryDaoTest.java b/core/src/test/java/google/registry/model/reporting/HistoryEntryDaoTest.java index 51171faa1..4802171fb 100644 --- a/core/src/test/java/google/registry/model/reporting/HistoryEntryDaoTest.java +++ b/core/src/test/java/google/registry/model/reporting/HistoryEntryDaoTest.java @@ -18,7 +18,7 @@ import static com.google.common.truth.Truth.assertThat; import static google.registry.model.ImmutableObjectSubject.immutableObjectCorrespondence; import static google.registry.persistence.transaction.TransactionManagerFactory.tm; import static google.registry.testing.DatabaseHelper.createTld; -import static google.registry.testing.DatabaseHelper.newDomainBase; +import static google.registry.testing.DatabaseHelper.newDomain; import static google.registry.testing.DatabaseHelper.persistActiveDomain; import static google.registry.testing.DatabaseHelper.persistResource; import static google.registry.util.DateTimeUtils.END_OF_TIME; @@ -27,18 +27,19 @@ import static java.nio.charset.StandardCharsets.UTF_8; import com.google.common.collect.ImmutableSet; import google.registry.model.EntityTestCase; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainHistory; import google.registry.model.domain.Period; import google.registry.model.eppcommon.Trid; import google.registry.model.reporting.DomainTransactionRecord.TransactionReportField; +import google.registry.testing.DatabaseHelper; import org.joda.time.DateTime; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; class HistoryEntryDaoTest extends EntityTestCase { - private DomainBase domain; + private Domain domain; private HistoryEntry domainHistory; @BeforeEach @@ -120,7 +121,7 @@ class HistoryEntryDaoTest extends EntityTestCase { @Test void testLoadByResource_noEntriesForResource() { - DomainBase newDomain = persistResource(newDomainBase("new.foobar")); + Domain newDomain = persistResource(DatabaseHelper.newDomain("new.foobar")); assertThat(HistoryEntryDao.loadHistoryObjectsForResource(newDomain.createVKey())).isEmpty(); } } diff --git a/core/src/test/java/google/registry/model/reporting/HistoryEntryTest.java b/core/src/test/java/google/registry/model/reporting/HistoryEntryTest.java index 6e0a5078b..ca0b55fbe 100644 --- a/core/src/test/java/google/registry/model/reporting/HistoryEntryTest.java +++ b/core/src/test/java/google/registry/model/reporting/HistoryEntryTest.java @@ -26,7 +26,7 @@ import static org.junit.Assert.assertThrows; import com.google.common.collect.ImmutableSet; import google.registry.model.EntityTestCase; import google.registry.model.contact.ContactHistory; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainHistory; import google.registry.model.domain.Period; import google.registry.model.eppcommon.Trid; @@ -44,7 +44,7 @@ class HistoryEntryTest extends EntityTestCase { @BeforeEach void setUp() { createTld("foobar"); - DomainBase domain = persistActiveDomain("foo.foobar"); + Domain domain = persistActiveDomain("foo.foobar"); DomainTransactionRecord transactionRecord = new DomainTransactionRecord.Builder() .setTld("foobar") diff --git a/core/src/test/java/google/registry/model/reporting/Spec11ThreatMatchDaoTest.java b/core/src/test/java/google/registry/model/reporting/Spec11ThreatMatchDaoTest.java index 433948548..d87ec760d 100644 --- a/core/src/test/java/google/registry/model/reporting/Spec11ThreatMatchDaoTest.java +++ b/core/src/test/java/google/registry/model/reporting/Spec11ThreatMatchDaoTest.java @@ -18,7 +18,6 @@ import static com.google.common.truth.Truth.assertThat; import static google.registry.model.ImmutableObjectSubject.immutableObjectCorrespondence; import static google.registry.persistence.transaction.TransactionManagerFactory.jpaTm; import static google.registry.testing.DatabaseHelper.createTlds; -import static google.registry.testing.DatabaseHelper.newDomainBase; import static google.registry.testing.DatabaseHelper.persistActiveContact; import static google.registry.testing.DatabaseHelper.persistResource; @@ -26,8 +25,9 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; import google.registry.model.EntityTestCase; import google.registry.model.contact.ContactResource; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.reporting.Spec11ThreatMatch.ThreatType; +import google.registry.testing.DatabaseHelper; import org.joda.time.LocalDate; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -38,19 +38,19 @@ class Spec11ThreatMatchDaoTest extends EntityTestCase { private static final LocalDate TODAY = new LocalDate(2020, 8, 4); private static final LocalDate YESTERDAY = new LocalDate(2020, 8, 3); - private DomainBase todayComDomain; - private DomainBase todayOrgDomain; - private DomainBase yesterdayComDomain; - private DomainBase yesterdayOrgDomain; + private Domain todayComDomain; + private Domain todayOrgDomain; + private Domain yesterdayComDomain; + private Domain yesterdayOrgDomain; @BeforeEach void setUp() { createTlds("com", "org"); ContactResource contact = persistActiveContact("jd1234"); - todayComDomain = persistResource(newDomainBase("today.com", contact)); - todayOrgDomain = persistResource(newDomainBase("today.org", contact)); - yesterdayComDomain = persistResource(newDomainBase("yesterday.com", contact)); - yesterdayOrgDomain = persistResource(newDomainBase("yesterday.org", contact)); + todayComDomain = persistResource(DatabaseHelper.newDomain("today.com", contact)); + todayOrgDomain = persistResource(DatabaseHelper.newDomain("today.org", contact)); + yesterdayComDomain = persistResource(DatabaseHelper.newDomain("yesterday.com", contact)); + yesterdayOrgDomain = persistResource(DatabaseHelper.newDomain("yesterday.org", contact)); jpaTm() .transact( () -> { diff --git a/core/src/test/java/google/registry/model/reporting/Spec11ThreatMatchTest.java b/core/src/test/java/google/registry/model/reporting/Spec11ThreatMatchTest.java index 3f3e44067..966afd10d 100644 --- a/core/src/test/java/google/registry/model/reporting/Spec11ThreatMatchTest.java +++ b/core/src/test/java/google/registry/model/reporting/Spec11ThreatMatchTest.java @@ -27,7 +27,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows; import com.google.common.collect.ImmutableSet; import google.registry.model.EntityTestCase; import google.registry.model.contact.ContactResource; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.host.HostResource; import google.registry.model.transfer.ContactTransferData; import google.registry.persistence.VKey; @@ -44,7 +44,7 @@ public final class Spec11ThreatMatchTest extends EntityTestCase { private static final LocalDate DATE = LocalDate.parse("2020-06-10", ISODateTimeFormat.date()); private Spec11ThreatMatch threat; - private DomainBase domain; + private Domain domain; private HostResource host; private ContactResource registrantContact; @@ -62,7 +62,7 @@ public final class Spec11ThreatMatchTest extends EntityTestCase { // Create a domain for the purpose of testing a foreign key reference in the Threat table. domain = - new DomainBase() + new Domain() .asBuilder() .setCreationRegistrarId(REGISTRAR_ID) .setPersistedCurrentSponsorRegistrarId(REGISTRAR_ID) diff --git a/core/src/test/java/google/registry/model/transfer/TransferDataTest.java b/core/src/test/java/google/registry/model/transfer/TransferDataTest.java index 8b243b24f..df0608667 100644 --- a/core/src/test/java/google/registry/model/transfer/TransferDataTest.java +++ b/core/src/test/java/google/registry/model/transfer/TransferDataTest.java @@ -23,7 +23,7 @@ import google.registry.model.billing.BillingEvent; import google.registry.model.billing.BillingEvent.Cancellation; import google.registry.model.billing.BillingEvent.OneTime; import google.registry.model.billing.BillingEvent.Recurring; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.Period; import google.registry.model.eppcommon.Trid; import google.registry.model.poll.PollMessage; @@ -52,7 +52,7 @@ public class TransferDataTest { @BeforeEach void beforeEach() { Key historyEntryKey = - Key.create(Key.create(DomainBase.class, "4-TLD"), HistoryEntry.class, 1356L); + Key.create(Key.create(Domain.class, "4-TLD"), HistoryEntry.class, 1356L); transferBillingEventKey = OneTime.createVKey(12345L); otherServerApproveBillingEventKey = Cancellation.createVKey(2468L); recurringBillingEventKey = Recurring.createVKey(13579L); diff --git a/core/src/test/java/google/registry/model/translators/VKeyTranslatorFactoryTest.java b/core/src/test/java/google/registry/model/translators/VKeyTranslatorFactoryTest.java index 1571f7eb1..dbb9cc663 100644 --- a/core/src/test/java/google/registry/model/translators/VKeyTranslatorFactoryTest.java +++ b/core/src/test/java/google/registry/model/translators/VKeyTranslatorFactoryTest.java @@ -15,12 +15,12 @@ package google.registry.model.translators; import static com.google.common.truth.Truth.assertThat; -import static google.registry.testing.DatabaseHelper.newDomainBase; +import static google.registry.testing.DatabaseHelper.newDomain; import static google.registry.testing.DatabaseHelper.persistActiveContact; import com.googlecode.objectify.Key; import google.registry.model.common.ClassPathManager; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainHistory; import google.registry.model.domain.DomainHistory.DomainHistoryId; import google.registry.model.reporting.HistoryEntry; @@ -49,17 +49,17 @@ public class VKeyTranslatorFactoryTest { void testEntityWithFlatKey() { // Creating an objectify key instead of a datastore key as this should get a correctly formatted // key path. - DomainBase domain = newDomainBase("example.com", "ROID-1", persistActiveContact("contact-1")); - Key key = Key.create(domain); - VKey vkey = VKeyTranslatorFactory.createVKey(key); - assertThat(vkey.getKind()).isEqualTo(DomainBase.class); + Domain domain = newDomain("example.com", "ROID-1", persistActiveContact("contact-1")); + Key key = Key.create(domain); + VKey vkey = VKeyTranslatorFactory.createVKey(key); + assertThat(vkey.getKind()).isEqualTo(Domain.class); assertThat(vkey.getOfyKey()).isEqualTo(key); assertThat(vkey.getSqlKey()).isEqualTo("ROID-1"); } @Test void testEntityWithAncestor() { - Key domainKey = Key.create(DomainBase.class, "ROID-1"); + Key domainKey = Key.create(Domain.class, "ROID-1"); Key historyEntryKey = Key.create(domainKey, HistoryEntry.class, 10L); VKey vkey = VKeyTranslatorFactory.createVKey(historyEntryKey); diff --git a/core/src/test/java/google/registry/persistence/DomainHistoryVKeyTest.java b/core/src/test/java/google/registry/persistence/DomainHistoryVKeyTest.java index 9c5ef83e3..0d1c7b912 100644 --- a/core/src/test/java/google/registry/persistence/DomainHistoryVKeyTest.java +++ b/core/src/test/java/google/registry/persistence/DomainHistoryVKeyTest.java @@ -24,7 +24,7 @@ import com.googlecode.objectify.annotation.Id; import com.googlecode.objectify.annotation.Parent; import google.registry.model.ImmutableObject; import google.registry.model.common.EntityGroupRoot; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainHistory.DomainHistoryId; import google.registry.model.reporting.HistoryEntry; import google.registry.testing.AppEngineExtension; @@ -46,7 +46,7 @@ class DomainHistoryVKeyTest { @Test void testRestoreSymmetricVKey() { Key ofyKey = - Key.create(Key.create(DomainBase.class, "domainRepoId"), HistoryEntry.class, 10L); + Key.create(Key.create(Domain.class, "domainRepoId"), HistoryEntry.class, 10L); DomainHistoryVKey domainHistoryVKey = DomainHistoryVKey.create(ofyKey); TestEntity original = new TestEntity(domainHistoryVKey); tm().transact(() -> tm().insert(original)); @@ -62,7 +62,7 @@ class DomainHistoryVKeyTest { @Test void testCreateSymmetricVKeyFromOfyKey() { Key ofyKey = - Key.create(Key.create(DomainBase.class, "domainRepoId"), HistoryEntry.class, 10L); + Key.create(Key.create(Domain.class, "domainRepoId"), HistoryEntry.class, 10L); DomainHistoryVKey domainHistoryVKey = DomainHistoryVKey.create(ofyKey); assertThat(domainHistoryVKey.createSqlKey()) .isEqualTo(new DomainHistoryId("domainRepoId", 10L)); diff --git a/core/src/test/java/google/registry/persistence/VKeyTest.java b/core/src/test/java/google/registry/persistence/VKeyTest.java index 860194117..668df40da 100644 --- a/core/src/test/java/google/registry/persistence/VKeyTest.java +++ b/core/src/test/java/google/registry/persistence/VKeyTest.java @@ -15,7 +15,7 @@ package google.registry.persistence; import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth8.assertThat; -import static google.registry.testing.DatabaseHelper.newDomainBase; +import static google.registry.testing.DatabaseHelper.newDomain; import static google.registry.testing.DatabaseHelper.persistActiveContact; import static org.junit.jupiter.api.Assertions.assertThrows; @@ -23,7 +23,7 @@ import com.googlecode.objectify.Key; import com.googlecode.objectify.annotation.Entity; import google.registry.model.billing.BillingEvent.OneTime; import google.registry.model.common.ClassPathManager; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.host.HostResource; import google.registry.model.registrar.RegistrarPoc; import google.registry.testing.AppEngineExtension; @@ -127,10 +127,10 @@ class VKeyTest { // Creating an objectify key instead of a datastore key as this should get a correctly formatted // key path. We have to one of our actual model object classes for this, TestObject can not be // reconstructed by the VKeyTranslatorFactory. - DomainBase domain = newDomainBase("example.com", "ROID-1", persistActiveContact("contact-1")); - Key key = Key.create(domain); - VKey vkey = VKey.fromWebsafeKey(key.getString()); - assertThat(vkey.getKind()).isEqualTo(DomainBase.class); + Domain domain = newDomain("example.com", "ROID-1", persistActiveContact("contact-1")); + Key key = Key.create(domain); + VKey vkey = VKey.fromWebsafeKey(key.getString()); + assertThat(vkey.getKind()).isEqualTo(Domain.class); assertThat(vkey.getOfyKey()).isEqualTo(key); assertThat(vkey.getSqlKey()).isEqualTo("ROID-1"); } @@ -150,14 +150,12 @@ class VKeyTest { @Test void testStringify_vkeyFromWebsafeKey() { - DomainBase domain = newDomainBase("example.com", "ROID-1", persistActiveContact("contact-1")); - Key key = Key.create(domain); - VKey vkey = VKey.fromWebsafeKey(key.getString()); + Domain domain = newDomain("example.com", "ROID-1", persistActiveContact("contact-1")); + Key key = Key.create(domain); + VKey vkey = VKey.fromWebsafeKey(key.getString()); assertThat(vkey.stringify()) .isEqualTo( - "kind:DomainBase" - + "@sql:rO0ABXQABlJPSUQtMQ" - + "@ofy:agR0ZXN0chYLEgpEb21haW5CYXNlIgZST0lELTEM"); + "kind:Domain" + "@sql:rO0ABXQABlJPSUQtMQ" + "@ofy:agR0ZXN0chILEgZEb21haW4iBlJPSUQtMQw"); } @Test @@ -236,19 +234,18 @@ class VKeyTest { void testCreate_stringifyVkey_fromWebsafeKey() { assertThat( VKey.create( - "kind:DomainBase@sql:rO0ABXQABlJPSUQtMQ" + "kind:Domain@sql:rO0ABXQABlJPSUQtMQ" + "@ofy:agR0ZXN0chYLEgpEb21haW5CYXNlIgZST0lELTEM")) .isEqualTo( VKey.fromWebsafeKey( - Key.create( - newDomainBase("example.com", "ROID-1", persistActiveContact("contact-1"))) + Key.create(newDomain("example.com", "ROID-1", persistActiveContact("contact-1"))) .getString())); } @Test void testCreate_stringifedVKey_websafeKey() { - assertThat(VKey.create("agR0ZXN0chYLEgpEb21haW5CYXNlIgZST0lELTEM")) - .isEqualTo(VKey.fromWebsafeKey("agR0ZXN0chYLEgpEb21haW5CYXNlIgZST0lELTEM")); + assertThat(VKey.create("agR0ZXN0chkLEgZEb21haW4iDUdBU0RHSDQyMkQtSUQM")) + .isEqualTo(VKey.fromWebsafeKey("agR0ZXN0chkLEgZEb21haW4iDUdBU0RHSDQyMkQtSUQM")); } @Test @@ -286,7 +283,7 @@ class VKeyTest { @Test void testCreate_createFromExistingOfyKey_success() { String keyString = - Key.create(newDomainBase("example.com", "ROID-1", persistActiveContact("contact-1"))) + Key.create(newDomain("example.com", "ROID-1", persistActiveContact("contact-1"))) .getString(); assertThat(VKey.fromWebsafeKey(keyString)).isEqualTo(VKey.create(keyString)); } diff --git a/core/src/test/java/google/registry/rdap/RdapDomainActionTest.java b/core/src/test/java/google/registry/rdap/RdapDomainActionTest.java index d6b402853..ec3525440 100644 --- a/core/src/test/java/google/registry/rdap/RdapDomainActionTest.java +++ b/core/src/test/java/google/registry/rdap/RdapDomainActionTest.java @@ -21,7 +21,7 @@ import static google.registry.testing.DatabaseHelper.persistResource; import static google.registry.testing.DatabaseHelper.persistSimpleResources; import static google.registry.testing.FullFieldsTestEntityHelper.makeAndPersistContactResource; import static google.registry.testing.FullFieldsTestEntityHelper.makeAndPersistHostResource; -import static google.registry.testing.FullFieldsTestEntityHelper.makeDomainBase; +import static google.registry.testing.FullFieldsTestEntityHelper.makeDomain; import static google.registry.testing.FullFieldsTestEntityHelper.makeHistoryEntry; import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrar; import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrarContacts; @@ -29,7 +29,7 @@ import static org.mockito.Mockito.verify; import com.google.gson.JsonObject; import google.registry.model.contact.ContactResource; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.Period; import google.registry.model.host.HostResource; import google.registry.model.registrar.Registrar; @@ -90,7 +90,7 @@ class RdapDomainActionTest extends RdapActionBaseTestCase { HostResource host2 = makeAndPersistHostResource( "ns2.cat.lol", "bad:f00d:cafe:0:0:0:15:beef", clock.nowUtc().minusYears(2)); persistResource( - makeDomainBase( + makeDomain( "cat.lol", registrantLol, adminContactLol, @@ -106,9 +106,9 @@ class RdapDomainActionTest extends RdapActionBaseTestCase { // deleted domain in lol HostResource hostDodo2 = makeAndPersistHostResource( "ns2.dodo.lol", "bad:f00d:cafe:0:0:0:15:beef", clock.nowUtc().minusYears(2)); - DomainBase domainDeleted = + Domain domainDeleted = persistResource( - makeDomainBase( + makeDomain( "dodo.lol", makeAndPersistContactResource( "5372808-ERL", @@ -163,7 +163,7 @@ class RdapDomainActionTest extends RdapActionBaseTestCase { clock.nowUtc().minusYears(3), registrarIdn); persistResource( - makeDomainBase( + makeDomain( "cat.みんな", registrantIdn, adminContactIdn, @@ -203,7 +203,7 @@ class RdapDomainActionTest extends RdapActionBaseTestCase { clock.nowUtc().minusYears(3), registrar1Tld); persistResource( - makeDomainBase( + makeDomain( "cat.1.tld", registrant1Tld, adminContact1Tld, diff --git a/core/src/test/java/google/registry/rdap/RdapDomainSearchActionTest.java b/core/src/test/java/google/registry/rdap/RdapDomainSearchActionTest.java index c19eb738e..d56695be7 100644 --- a/core/src/test/java/google/registry/rdap/RdapDomainSearchActionTest.java +++ b/core/src/test/java/google/registry/rdap/RdapDomainSearchActionTest.java @@ -25,7 +25,7 @@ import static google.registry.testing.DatabaseHelper.persistResources; import static google.registry.testing.DatabaseHelper.persistSimpleResources; import static google.registry.testing.FullFieldsTestEntityHelper.makeAndPersistContactResource; import static google.registry.testing.FullFieldsTestEntityHelper.makeAndPersistHostResource; -import static google.registry.testing.FullFieldsTestEntityHelper.makeDomainBase; +import static google.registry.testing.FullFieldsTestEntityHelper.makeDomain; import static google.registry.testing.FullFieldsTestEntityHelper.makeHistoryEntry; import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrar; import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrarContacts; @@ -38,7 +38,7 @@ import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import google.registry.model.contact.ContactResource; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.Period; import google.registry.model.host.HostResource; import google.registry.model.registrar.Registrar; @@ -65,11 +65,11 @@ class RdapDomainSearchActionTest extends RdapSearchActionTestCase> hostKeys = hostKeysBuilder.build(); // Create all the domains at once, then persist them in parallel, for increased efficiency. - ImmutableList.Builder domainsBuilder = new ImmutableList.Builder<>(); + ImmutableList.Builder domainsBuilder = new ImmutableList.Builder<>(); for (int i = numActiveDomains * numTotalDomainsPerActiveDomain; i >= 1; i--) { String domainName = String.format("domain%d.lol", i); - DomainBase.Builder builder = - makeDomainBase(domainName, contact1, contact2, contact3, null, null, registrar) + Domain.Builder builder = + makeDomain(domainName, contact1, contact2, contact3, null, null, registrar) .asBuilder() .setNameservers(hostKeys) .setCreationTimeForTest(clock.nowUtc().minusYears(3)) diff --git a/core/src/test/java/google/registry/rdap/RdapEntityActionTest.java b/core/src/test/java/google/registry/rdap/RdapEntityActionTest.java index 7836319b2..10e018cf0 100644 --- a/core/src/test/java/google/registry/rdap/RdapEntityActionTest.java +++ b/core/src/test/java/google/registry/rdap/RdapEntityActionTest.java @@ -22,7 +22,7 @@ import static google.registry.testing.DatabaseHelper.persistResource; import static google.registry.testing.DatabaseHelper.persistSimpleResources; import static google.registry.testing.FullFieldsTestEntityHelper.makeAndPersistContactResource; import static google.registry.testing.FullFieldsTestEntityHelper.makeAndPersistDeletedContactResource; -import static google.registry.testing.FullFieldsTestEntityHelper.makeDomainBase; +import static google.registry.testing.FullFieldsTestEntityHelper.makeDomain; import static google.registry.testing.FullFieldsTestEntityHelper.makeHostResource; import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrar; import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrarContacts; @@ -89,13 +89,8 @@ class RdapEntityActionTest extends RdapActionBaseTestCase { persistResource(makeHostResource("ns1.cat.lol", "1.2.3.4")); HostResource host2 = persistResource(makeHostResource("ns2.cat.lol", "bad:f00d:cafe:0:0:0:15:beef")); - persistResource(makeDomainBase("cat.lol", - registrant, - adminContact, - techContact, - host1, - host2, - registrarLol)); + persistResource( + makeDomain("cat.lol", registrant, adminContact, techContact, host1, host2, registrarLol)); // xn--q9jyb4c createTld("xn--q9jyb4c"); Registrar registrarIdn = persistResource( diff --git a/core/src/test/java/google/registry/rdap/RdapJsonFormatterTest.java b/core/src/test/java/google/registry/rdap/RdapJsonFormatterTest.java index c381da876..a995db723 100644 --- a/core/src/test/java/google/registry/rdap/RdapJsonFormatterTest.java +++ b/core/src/test/java/google/registry/rdap/RdapJsonFormatterTest.java @@ -22,7 +22,7 @@ import static google.registry.testing.DatabaseHelper.persistResource; import static google.registry.testing.DatabaseHelper.persistSimpleResources; import static google.registry.testing.FullFieldsTestEntityHelper.makeAndPersistContactResource; import static google.registry.testing.FullFieldsTestEntityHelper.makeAndPersistHostResource; -import static google.registry.testing.FullFieldsTestEntityHelper.makeDomainBase; +import static google.registry.testing.FullFieldsTestEntityHelper.makeDomain; import static google.registry.testing.FullFieldsTestEntityHelper.makeHistoryEntry; import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrar; import static google.registry.testing.TestDataHelper.loadFile; @@ -35,7 +35,7 @@ import com.google.common.collect.Maps; import com.google.gson.Gson; import com.google.gson.JsonObject; import google.registry.model.contact.ContactResource; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.eppcommon.StatusValue; import google.registry.model.host.HostResource; import google.registry.model.ofy.Ofy; @@ -70,8 +70,8 @@ class RdapJsonFormatterTest { private RdapJsonFormatter rdapJsonFormatter; private Registrar registrar; - private DomainBase domainBaseFull; - private DomainBase domainBaseNoNameserversNoTransfers; + private Domain domainFull; + private Domain domainNoNameserversNoTransfers; private HostResource hostResourceIpv4; private HostResource hostResourceIpv6; private HostResource hostResourceBoth; @@ -158,7 +158,7 @@ class RdapJsonFormatterTest { .asBuilder() .setSuperordinateDomain( persistResource( - makeDomainBase( + makeDomain( "dog.みんな", contactResourceRegistrant, contactResourceAdmin, @@ -182,9 +182,9 @@ class RdapJsonFormatterTest { .build()) .createVKey()) .build()); - domainBaseFull = + domainFull = persistResource( - makeDomainBase( + makeDomain( "cat.みんな", contactResourceRegistrant, contactResourceAdmin, @@ -196,9 +196,9 @@ class RdapJsonFormatterTest { .setCreationTimeForTest(clock.nowUtc().minusMonths(4)) .setLastEppUpdateTime(clock.nowUtc().minusMonths(3)) .build()); - domainBaseNoNameserversNoTransfers = + domainNoNameserversNoTransfers = persistResource( - makeDomainBase( + makeDomain( "fish.みんな", contactResourceRegistrant, contactResourceRegistrant, @@ -213,7 +213,7 @@ class RdapJsonFormatterTest { // Create an unused domain that references hostResourceBoth and hostResourceNoAddresses so that // they will have "associated" (ie, StatusValue.LINKED) status. persistResource( - makeDomainBase( + makeDomain( "dog.みんな", contactResourceRegistrant, contactResourceAdmin, @@ -226,30 +226,30 @@ class RdapJsonFormatterTest { // We create 3 "transfer approved" entries, to make sure we only save the last one persistResource( makeHistoryEntry( - domainBaseFull, + domainFull, HistoryEntry.Type.DOMAIN_TRANSFER_APPROVE, null, null, clock.nowUtc().minusMonths(3))); persistResource( makeHistoryEntry( - domainBaseFull, + domainFull, HistoryEntry.Type.DOMAIN_TRANSFER_APPROVE, null, null, clock.nowUtc().minusMonths(1))); persistResource( makeHistoryEntry( - domainBaseFull, + domainFull, HistoryEntry.Type.DOMAIN_TRANSFER_APPROVE, null, null, clock.nowUtc().minusMonths(2))); - // We create a "transfer approved" entry for domainBaseNoNameserversNoTransfers that happened + // We create a "transfer approved" entry for domainNoNameserversNoTransfers that happened // before the domain was created, to make sure we don't show it persistResource( makeHistoryEntry( - domainBaseNoNameserversNoTransfers, + domainNoNameserversNoTransfers, HistoryEntry.Type.DOMAIN_TRANSFER_APPROVE, null, null, @@ -472,13 +472,13 @@ class RdapJsonFormatterTest { @Test void testDomain_full() { - assertThat(rdapJsonFormatter.createRdapDomain(domainBaseFull, OutputDataType.FULL).toJson()) + assertThat(rdapJsonFormatter.createRdapDomain(domainFull, OutputDataType.FULL).toJson()) .isEqualTo(loadJson("rdapjson_domain_full.json")); } @Test void testDomain_summary() { - assertThat(rdapJsonFormatter.createRdapDomain(domainBaseFull, OutputDataType.SUMMARY).toJson()) + assertThat(rdapJsonFormatter.createRdapDomain(domainFull, OutputDataType.SUMMARY).toJson()) .isEqualTo(loadJson("rdapjson_domain_summary.json")); } @@ -487,7 +487,7 @@ class RdapJsonFormatterTest { // Expected data are from "rdapjson_domain_summary.json" assertThat( Maps.transformValues( - rdapJsonFormatter.getLastHistoryEntryByType(domainBaseFull), + rdapJsonFormatter.getLastHistoryEntryByType(domainFull), HistoryEntry::getModificationTime)) .containsExactlyEntriesIn( ImmutableMap.of(TRANSFER, DateTime.parse("1999-12-01T00:00:00.000Z"))); @@ -496,7 +496,7 @@ class RdapJsonFormatterTest { @Test void testDomain_logged_out() { rdapJsonFormatter.rdapAuthorization = RdapAuthorization.PUBLIC_AUTHORIZATION; - assertThat(rdapJsonFormatter.createRdapDomain(domainBaseFull, OutputDataType.FULL).toJson()) + assertThat(rdapJsonFormatter.createRdapDomain(domainFull, OutputDataType.FULL).toJson()) .isEqualTo(loadJson("rdapjson_domain_logged_out.json")); } @@ -504,7 +504,7 @@ class RdapJsonFormatterTest { void testDomain_noNameserversNoTransfersMultipleRoleContact() { assertThat( rdapJsonFormatter - .createRdapDomain(domainBaseNoNameserversNoTransfers, OutputDataType.FULL) + .createRdapDomain(domainNoNameserversNoTransfers, OutputDataType.FULL) .toJson()) .isEqualTo(loadJson("rdapjson_domain_no_nameservers.json")); } diff --git a/core/src/test/java/google/registry/rdap/RdapNameserverSearchActionTest.java b/core/src/test/java/google/registry/rdap/RdapNameserverSearchActionTest.java index da1b244b6..fdcb9946a 100644 --- a/core/src/test/java/google/registry/rdap/RdapNameserverSearchActionTest.java +++ b/core/src/test/java/google/registry/rdap/RdapNameserverSearchActionTest.java @@ -25,7 +25,7 @@ import static google.registry.testing.DatabaseHelper.persistResources; import static google.registry.testing.DatabaseHelper.persistSimpleResources; import static google.registry.testing.FullFieldsTestEntityHelper.makeAndPersistHostResource; import static google.registry.testing.FullFieldsTestEntityHelper.makeContactResource; -import static google.registry.testing.FullFieldsTestEntityHelper.makeDomainBase; +import static google.registry.testing.FullFieldsTestEntityHelper.makeDomain; import static google.registry.testing.FullFieldsTestEntityHelper.makeHostResource; import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrar; import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrarContacts; @@ -36,7 +36,7 @@ import com.google.common.collect.ImmutableSet; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.host.HostResource; import google.registry.model.registrar.Registrar; import google.registry.rdap.RdapMetrics.EndpointType; @@ -56,7 +56,7 @@ class RdapNameserverSearchActionTest extends RdapSearchActionTestCaseThis tests the mapping between {@link DomainBase} and {@link XjcRdeDomain} as well as some + *

This tests the mapping between {@link Domain} and {@link XjcRdeDomain} as well as some * exceptional conditions. */ -public class DomainBaseToXjcConverterTest { +public class DomainToXjcConverterTest { @RegisterExtension public final AppEngineExtension appEngine = AppEngineExtension.builder().withCloudSql().build(); @@ -96,7 +96,7 @@ public class DomainBaseToXjcConverterTest { @Test void testConvertThick() { - XjcRdeDomain bean = DomainBaseToXjcConverter.convertDomain(makeDomainBase(clock), RdeMode.FULL); + XjcRdeDomain bean = DomainToXjcConverter.convertDomain(makeDomain(clock), RdeMode.FULL); assertThat(bean.getClID()).isEqualTo("TheRegistrar"); @@ -177,7 +177,7 @@ public class DomainBaseToXjcConverterTest { @Test void testConvertThin() { - XjcRdeDomain bean = DomainBaseToXjcConverter.convertDomain(makeDomainBase(clock), RdeMode.THIN); + XjcRdeDomain bean = DomainToXjcConverter.convertDomain(makeDomain(clock), RdeMode.THIN); assertThat(bean.getRegistrant()).isNull(); assertThat(bean.getContacts()).isEmpty(); assertThat(bean.getSecDNS()).isNull(); @@ -185,13 +185,13 @@ public class DomainBaseToXjcConverterTest { @Test void testMarshalThick() throws Exception { - XjcRdeDomain bean = DomainBaseToXjcConverter.convertDomain(makeDomainBase(clock), RdeMode.FULL); + XjcRdeDomain bean = DomainToXjcConverter.convertDomain(makeDomain(clock), RdeMode.FULL); wrapDeposit(bean).marshal(new ByteArrayOutputStream(), UTF_8); } @Test void testMarshalThin() throws Exception { - XjcRdeDomain bean = DomainBaseToXjcConverter.convertDomain(makeDomainBase(clock), RdeMode.THIN); + XjcRdeDomain bean = DomainToXjcConverter.convertDomain(makeDomain(clock), RdeMode.THIN); wrapDeposit(bean).marshal(new ByteArrayOutputStream(), UTF_8); } @@ -212,10 +212,13 @@ public class DomainBaseToXjcConverterTest { return deposit; } - static DomainBase makeDomainBase(FakeClock clock) { - DomainBase domain = + static Domain makeDomain(FakeClock clock) { + Domain domain = persistResource( - newDomainBase("example.xn--q9jyb4c").asBuilder().setRepoId("2-Q9JYB4C").build()); + DatabaseHelper.newDomain("example.xn--q9jyb4c") + .asBuilder() + .setRepoId("2-Q9JYB4C") + .build()); DomainHistory domainHistory = persistResource( new DomainHistory.Builder() diff --git a/core/src/test/java/google/registry/rde/HostResourceToXjcConverterTest.java b/core/src/test/java/google/registry/rde/HostResourceToXjcConverterTest.java index f9ba26c4d..b0f6ce86b 100644 --- a/core/src/test/java/google/registry/rde/HostResourceToXjcConverterTest.java +++ b/core/src/test/java/google/registry/rde/HostResourceToXjcConverterTest.java @@ -16,17 +16,17 @@ package google.registry.rde; import static com.google.common.truth.Truth.assertThat; import static google.registry.testing.DatabaseHelper.createTld; -import static google.registry.testing.DatabaseHelper.newDomainBase; import static google.registry.xjc.XjcXmlTransformer.marshalStrict; import static java.nio.charset.StandardCharsets.UTF_8; import static org.junit.jupiter.api.Assertions.assertThrows; import com.google.common.collect.ImmutableSet; import com.google.common.net.InetAddresses; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.eppcommon.StatusValue; import google.registry.model.host.HostResource; import google.registry.testing.AppEngineExtension; +import google.registry.testing.DatabaseHelper; import google.registry.xjc.host.XjcHostStatusType; import google.registry.xjc.host.XjcHostStatusValueType; import google.registry.xjc.rdehost.XjcRdeHost; @@ -55,8 +55,8 @@ public class HostResourceToXjcConverterTest { @Test void testConvertSubordinateHost() { - DomainBase domain = - newDomainBase("love.foobar") + Domain domain = + DatabaseHelper.newDomain("love.foobar") .asBuilder() .setPersistedCurrentSponsorRegistrarId("LeisureDog") .setLastTransferTime(DateTime.parse("2010-01-01T00:00:00Z")) diff --git a/core/src/test/java/google/registry/rde/RdeFixtures.java b/core/src/test/java/google/registry/rde/RdeFixtures.java index 4d345ecd1..356ba5738 100644 --- a/core/src/test/java/google/registry/rde/RdeFixtures.java +++ b/core/src/test/java/google/registry/rde/RdeFixtures.java @@ -33,8 +33,8 @@ import google.registry.model.contact.ContactPhoneNumber; import google.registry.model.contact.ContactResource; import google.registry.model.contact.PostalInfo; import google.registry.model.domain.DesignatedContact; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainAuthInfo; -import google.registry.model.domain.DomainBase; import google.registry.model.domain.DomainHistory; import google.registry.model.domain.GracePeriod; import google.registry.model.domain.rgp.GracePeriodStatus; @@ -56,9 +56,9 @@ import org.joda.time.DateTime; /** Utility class for creating {@code EppResource} entities that'll successfully marshal. */ final class RdeFixtures { - static DomainBase makeDomainBase(FakeClock clock, String tld) { - DomainBase domain = - new DomainBase.Builder() + static Domain makeDomain(FakeClock clock, String tld) { + Domain domain = + new Domain.Builder() .setDomainName("example." + tld) .setRepoId(generateNewDomainRoid(tld)) .setRegistrant( diff --git a/core/src/test/java/google/registry/rde/RdeTestSuite.java b/core/src/test/java/google/registry/rde/RdeTestSuite.java index f0d0d7282..33dcfe70e 100644 --- a/core/src/test/java/google/registry/rde/RdeTestSuite.java +++ b/core/src/test/java/google/registry/rde/RdeTestSuite.java @@ -23,7 +23,7 @@ import org.junit.runner.RunWith; @RunWith(JUnitPlatform.class) @SuiteDisplayName("RDE tests suite") @SelectClasses({ - DomainBaseToXjcConverterTest.class, + DomainToXjcConverterTest.class, GhostrydeGpgIntegrationTest.class, GhostrydeTest.class, HostResourceToXjcConverterTest.class, diff --git a/core/src/test/java/google/registry/reporting/spec11/Spec11EmailUtilsTest.java b/core/src/test/java/google/registry/reporting/spec11/Spec11EmailUtilsTest.java index da9f9c934..0c5bdba12 100644 --- a/core/src/test/java/google/registry/reporting/spec11/Spec11EmailUtilsTest.java +++ b/core/src/test/java/google/registry/reporting/spec11/Spec11EmailUtilsTest.java @@ -22,7 +22,6 @@ import static google.registry.reporting.spec11.Spec11RegistrarThreatMatchesParse import static google.registry.reporting.spec11.Spec11RegistrarThreatMatchesParserTest.sampleThreatMatches; import static google.registry.testing.DatabaseHelper.createTld; import static google.registry.testing.DatabaseHelper.loadByEntity; -import static google.registry.testing.DatabaseHelper.newDomainBase; import static google.registry.testing.DatabaseHelper.persistActiveHost; import static google.registry.testing.DatabaseHelper.persistResource; import static org.junit.jupiter.api.Assertions.assertThrows; @@ -35,10 +34,11 @@ import static org.mockito.Mockito.when; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; import com.google.common.net.MediaType; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.host.HostResource; import google.registry.reporting.spec11.soy.Spec11EmailSoyInfo; import google.registry.testing.AppEngineExtension; +import google.registry.testing.DatabaseHelper; import google.registry.util.EmailMessage; import google.registry.util.SendEmailService; import java.util.LinkedHashSet; @@ -101,8 +101,8 @@ class Spec11EmailUtilsTest { private ArgumentCaptor contentCaptor; private final LocalDate date = new LocalDate(2018, 7, 15); - private DomainBase aDomain; - private DomainBase bDomain; + private Domain aDomain; + private Domain bDomain; @BeforeEach void beforeEach() throws Exception { @@ -408,9 +408,9 @@ class Spec11EmailUtilsTest { assertThat(message).isEqualTo(expectedContentBuilder.build()); } - private static DomainBase persistDomainWithHost(String domainName, HostResource host) { + private static Domain persistDomainWithHost(String domainName, HostResource host) { return persistResource( - newDomainBase(domainName) + DatabaseHelper.newDomain(domainName) .asBuilder() .setNameservers(ImmutableSet.of(host.createVKey())) .build()); diff --git a/core/src/test/java/google/registry/schema/integration/SqlIntegrationTestSuite.java b/core/src/test/java/google/registry/schema/integration/SqlIntegrationTestSuite.java index e0c9942dd..707fbb6be 100644 --- a/core/src/test/java/google/registry/schema/integration/SqlIntegrationTestSuite.java +++ b/core/src/test/java/google/registry/schema/integration/SqlIntegrationTestSuite.java @@ -19,7 +19,7 @@ import static com.google.common.truth.Truth.assert_; import google.registry.model.billing.BillingEventTest; import google.registry.model.common.CursorTest; import google.registry.model.contact.ContactResourceTest; -import google.registry.model.domain.DomainBaseSqlTest; +import google.registry.model.domain.DomainSqlTest; import google.registry.model.domain.token.AllocationTokenTest; import google.registry.model.history.ContactHistoryTest; import google.registry.model.history.DomainHistoryTest; @@ -84,7 +84,7 @@ import org.junit.runner.RunWith; ContactHistoryTest.class, ContactResourceTest.class, CursorTest.class, - DomainBaseSqlTest.class, + DomainSqlTest.class, DomainHistoryTest.class, HostHistoryTest.class, LockTest.class, diff --git a/core/src/test/java/google/registry/server/Fixture.java b/core/src/test/java/google/registry/server/Fixture.java index bf0eeba8f..fadc16213 100644 --- a/core/src/test/java/google/registry/server/Fixture.java +++ b/core/src/test/java/google/registry/server/Fixture.java @@ -20,7 +20,6 @@ import static google.registry.model.domain.DesignatedContact.Type.TECH; import static google.registry.testing.DatabaseHelper.createTlds; import static google.registry.testing.DatabaseHelper.loadRegistrar; import static google.registry.testing.DatabaseHelper.newContactResource; -import static google.registry.testing.DatabaseHelper.newDomainBase; import static google.registry.testing.DatabaseHelper.persistActiveHost; import static google.registry.testing.DatabaseHelper.persistPremiumList; import static google.registry.testing.DatabaseHelper.persistResource; @@ -34,6 +33,7 @@ import google.registry.model.contact.ContactResource; import google.registry.model.contact.PostalInfo; import google.registry.model.domain.DesignatedContact; import google.registry.model.ofy.Ofy; +import google.registry.testing.DatabaseHelper; import google.registry.testing.FakeClock; import google.registry.testing.InjectExtension; import java.io.IOException; @@ -123,7 +123,7 @@ public enum Fixture { .build()); persistResource( - newDomainBase("love.xn--q9jyb4c", justine) + DatabaseHelper.newDomain("love.xn--q9jyb4c", justine) .asBuilder() .setContacts( ImmutableSet.of( @@ -137,7 +137,7 @@ public enum Fixture { .build()); persistResource( - newDomainBase("moogle.example", justine) + DatabaseHelper.newDomain("moogle.example", justine) .asBuilder() .setContacts( ImmutableSet.of( diff --git a/core/src/test/java/google/registry/testing/DatabaseHelper.java b/core/src/test/java/google/registry/testing/DatabaseHelper.java index 66b8679e2..5241e1d65 100644 --- a/core/src/test/java/google/registry/testing/DatabaseHelper.java +++ b/core/src/test/java/google/registry/testing/DatabaseHelper.java @@ -78,8 +78,8 @@ import google.registry.model.contact.ContactHistory; import google.registry.model.contact.ContactResource; import google.registry.model.domain.DesignatedContact; import google.registry.model.domain.DesignatedContact.Type; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainAuthInfo; -import google.registry.model.domain.DomainBase; import google.registry.model.domain.DomainContent; import google.registry.model.domain.DomainHistory; import google.registry.model.domain.GracePeriod; @@ -168,26 +168,24 @@ public class DatabaseHelper { .build(); } - public static DomainBase newDomainBase(String domainName) { + public static Domain newDomain(String domainName) { String repoId = generateNewDomainRoid(getTldFromDomainName(domainName)); - return newDomainBase(domainName, repoId, persistActiveContact("contact1234")); + return newDomain(domainName, repoId, persistActiveContact("contact1234")); } - public static DomainBase newDomainBase(String domainName, ContactResource contact) { - return newDomainBase( - domainName, generateNewDomainRoid(getTldFromDomainName(domainName)), contact); + public static Domain newDomain(String domainName, ContactResource contact) { + return newDomain(domainName, generateNewDomainRoid(getTldFromDomainName(domainName)), contact); } - public static DomainBase newDomainBase(String domainName, HostResource... hosts) { + public static Domain newDomain(String domainName, HostResource... hosts) { ImmutableSet> hostKeys = Arrays.stream(hosts).map(HostResource::createVKey).collect(toImmutableSet()); - return newDomainBase(domainName).asBuilder().setNameservers(hostKeys).build(); + return newDomain(domainName).asBuilder().setNameservers(hostKeys).build(); } - public static DomainBase newDomainBase( - String domainName, String repoId, ContactResource contact) { + public static Domain newDomain(String domainName, String repoId, ContactResource contact) { VKey contactKey = contact.createVKey(); - return new DomainBase.Builder() + return new Domain.Builder() .setRepoId(repoId) .setDomainName(domainName) .setCreationRegistrarId("TheRegistrar") @@ -276,7 +274,7 @@ public class DatabaseHelper { } public static HostResource persistActiveSubordinateHost( - String hostName, DomainBase superordinateDomain) { + String hostName, Domain superordinateDomain) { checkNotNull(superordinateDomain); return persistResource( newHostResource(hostName) @@ -293,19 +291,19 @@ public class DatabaseHelper { newHostResource(hostName).asBuilder().setDeletionTime(deletionTime).build()); } - public static DomainBase persistActiveDomain(String domainName) { - return persistResource(newDomainBase(domainName)); + public static Domain persistActiveDomain(String domainName) { + return persistResource(newDomain(domainName)); } - public static DomainBase persistActiveDomain(String domainName, DateTime creationTime) { + public static Domain persistActiveDomain(String domainName, DateTime creationTime) { return persistResource( - newDomainBase(domainName).asBuilder().setCreationTimeForTest(creationTime).build()); + newDomain(domainName).asBuilder().setCreationTimeForTest(creationTime).build()); } - public static DomainBase persistActiveDomain( + public static Domain persistActiveDomain( String domainName, DateTime creationTime, DateTime expirationTime) { return persistResource( - newDomainBase(domainName) + newDomain(domainName) .asBuilder() .setCreationTimeForTest(creationTime) .setRegistrationExpirationTime(expirationTime) @@ -313,31 +311,33 @@ public class DatabaseHelper { } /** Persists a domain resource with the given domain name deleted at the specified time. */ - public static DomainBase persistDeletedDomain(String domainName, DateTime deletionTime) { - return persistDomainAsDeleted(newDomainBase(domainName), deletionTime); + public static Domain persistDeletedDomain(String domainName, DateTime deletionTime) { + return persistDomainAsDeleted(newDomain(domainName), deletionTime); } /** * Returns a persisted domain that is the passed-in domain modified to be deleted at the specified * time. */ - public static DomainBase persistDomainAsDeleted(DomainBase domain, DateTime deletionTime) { + public static Domain persistDomainAsDeleted(Domain domain, DateTime deletionTime) { return persistResource(domain.asBuilder().setDeletionTime(deletionTime).build()); } /** Persists a domain and enqueues a LORDN task of the appropriate type for it. */ - public static DomainBase persistDomainAndEnqueueLordn(final DomainBase domain) { - final DomainBase persistedDomain = persistResource(domain); - // Calls {@link LordnTaskUtils#enqueueDomainBaseTask} wrapped in a transaction so that the - // transaction time is set correctly. - tm().transactNew(() -> LordnTaskUtils.enqueueDomainBaseTask(persistedDomain)); + public static Domain persistDomainAndEnqueueLordn(final Domain domain) { + final Domain persistedDomain = persistResource(domain); + /** + * Calls {@link LordnTaskUtils#enqueueDomainTask} wrapped in a transaction so that the + * transaction time is set correctly. + */ + tm().transactNew(() -> LordnTaskUtils.enqueueDomainTask(persistedDomain)); maybeAdvanceClock(); return persistedDomain; } /** Persists a {@link Recurring} and {@link HistoryEntry} for a domain that already exists. */ - public static DomainBase persistBillingRecurrenceForDomain( - DomainBase domain, RenewalPriceBehavior renewalPriceBehavior, @Nullable Money renewalPrice) { + public static Domain persistBillingRecurrenceForDomain( + Domain domain, RenewalPriceBehavior renewalPriceBehavior, @Nullable Money renewalPrice) { DomainHistory historyEntry = persistResource( new DomainHistory.Builder() @@ -465,7 +465,7 @@ public class DatabaseHelper { /** * Deletes "domain" and all history records, billing events, poll messages and subordinate hosts. */ - public static void deleteTestDomain(DomainBase domain, DateTime now) { + public static void deleteTestDomain(Domain domain, DateTime now) { Iterable billingEvents = getBillingEvents(domain); Iterable historyEntries = HistoryEntryDao.loadHistoryObjectsForResource(domain.createVKey()); @@ -547,7 +547,7 @@ public class DatabaseHelper { } public static BillingEvent.OneTime createBillingEventForTransfer( - DomainBase domain, DomainHistory historyEntry, DateTime costLookupTime, DateTime eventTime) { + Domain domain, DomainHistory historyEntry, DateTime costLookupTime, DateTime eventTime) { return new BillingEvent.OneTime.Builder() .setReason(Reason.TRANSFER) .setTargetId(domain.getDomainName()) @@ -609,7 +609,7 @@ public class DatabaseHelper { .build()); } - public static DomainBase persistDomainWithDependentResources( + public static Domain persistDomainWithDependentResources( String label, String tld, ContactResource contact, @@ -618,9 +618,9 @@ public class DatabaseHelper { DateTime expirationTime) { String domainName = String.format("%s.%s", label, tld); String repoId = generateNewDomainRoid(tld); - DomainBase domain = + Domain domain = persistResource( - new DomainBase.Builder() + new Domain.Builder() .setRepoId(repoId) .setDomainName(domainName) .setPersistedCurrentSponsorRegistrarId("TheRegistrar") @@ -675,8 +675,8 @@ public class DatabaseHelper { .build()); } - public static DomainBase persistDomainWithPendingTransfer( - DomainBase domain, + public static Domain persistDomainWithPendingTransfer( + Domain domain, DateTime requestTime, DateTime expirationTime, DateTime extendedRegistrationExpirationTime) { @@ -1165,7 +1165,7 @@ public class DatabaseHelper { return resource.getRepoId() != null ? HistoryEntry.Type.HOST_CREATE : HistoryEntry.Type.HOST_UPDATE; - } else if (resource instanceof DomainBase) { + } else if (resource instanceof Domain) { return resource.getRepoId() != null ? HistoryEntry.Type.DOMAIN_CREATE : HistoryEntry.Type.DOMAIN_UPDATE; diff --git a/core/src/test/java/google/registry/testing/DatastoreEntityExtension.java b/core/src/test/java/google/registry/testing/DatastoreEntityExtension.java index 292946e07..84192d6dc 100644 --- a/core/src/test/java/google/registry/testing/DatastoreEntityExtension.java +++ b/core/src/test/java/google/registry/testing/DatastoreEntityExtension.java @@ -16,6 +16,7 @@ package google.registry.testing; import google.registry.model.AppEngineEnvironment; import google.registry.model.annotations.DeleteAfterMigration; +import google.registry.model.domain.DomainSqlTest; import org.junit.jupiter.api.extension.AfterEachCallback; import org.junit.jupiter.api.extension.BeforeEachCallback; import org.junit.jupiter.api.extension.ExtensionContext; @@ -31,8 +32,8 @@ import org.junit.jupiter.api.extension.ExtensionContext; *

When used together with {@code JpaIntegrationWithCoverageExtension} or @{@code * TestPipelineExtension}, this extension must be registered first. For consistency's sake, it is * recommended that the field for this extension be annotated with - * {@code @org.junit.jupiter.api.Order(value = 1)}. Please refer to {@link - * google.registry.model.domain.DomainBaseSqlTest} for example, and to * JUnit 5 User Guide for details of extension ordering. * diff --git a/core/src/test/java/google/registry/testing/DomainBaseSubject.java b/core/src/test/java/google/registry/testing/DomainSubject.java similarity index 65% rename from core/src/test/java/google/registry/testing/DomainBaseSubject.java rename to core/src/test/java/google/registry/testing/DomainSubject.java index 0ce004183..ef51ea1f8 100644 --- a/core/src/test/java/google/registry/testing/DomainBaseSubject.java +++ b/core/src/test/java/google/registry/testing/DomainSubject.java @@ -22,7 +22,7 @@ import static google.registry.util.PreconditionsUtils.checkArgumentNotNull; import com.google.common.collect.ImmutableSet; import com.google.common.truth.FailureMetadata; import com.google.common.truth.SimpleSubjectBuilder; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.launch.LaunchNotice; import google.registry.model.domain.secdns.DelegationSignerData; import google.registry.model.eppcommon.AuthInfo; @@ -30,90 +30,89 @@ import google.registry.testing.TruthChainer.And; import java.util.Set; import org.joda.time.DateTime; -/** Truth subject for asserting things about {@link DomainBase} instances. */ -public final class DomainBaseSubject - extends AbstractEppResourceSubject { +/** Truth subject for asserting things about {@link Domain} instances. */ +public final class DomainSubject extends AbstractEppResourceSubject { - private final DomainBase actual; + private final Domain actual; - public DomainBaseSubject(FailureMetadata failureMetadata, DomainBase subject) { + public DomainSubject(FailureMetadata failureMetadata, Domain subject) { super(failureMetadata, checkNotNull(subject)); this.actual = subject; } - public And hasFullyQualifiedDomainName(String fullyQualifiedDomainName) { + public And hasFullyQualifiedDomainName(String fullyQualifiedDomainName) { return hasValue( fullyQualifiedDomainName, actual.getDomainName(), "has fullyQualifiedDomainName"); } - public And hasExactlyDsData(DelegationSignerData... dsData) { + public And hasExactlyDsData(DelegationSignerData... dsData) { return hasExactlyDsData(ImmutableSet.copyOf(dsData)); } - public And hasExactlyDsData(Set dsData) { + public And hasExactlyDsData(Set dsData) { return hasValue(dsData, actual.getDsData(), "has dsData"); } - public And hasNumDsData(int num) { + public And hasNumDsData(int num) { return hasValue(num, actual.getDsData().size(), "has num dsData"); } - public And hasLaunchNotice(LaunchNotice launchNotice) { + public And hasLaunchNotice(LaunchNotice launchNotice) { return hasValue(launchNotice, actual.getLaunchNotice(), "has launchNotice"); } - public And hasAuthInfoPwd(String pw) { + public And hasAuthInfoPwd(String pw) { AuthInfo authInfo = actual.getAuthInfo(); return hasValue(pw, authInfo == null ? null : authInfo.getPw().getValue(), "has auth info pw"); } - public And hasCurrentSponsorRegistrarId(String registrarId) { + public And hasCurrentSponsorRegistrarId(String registrarId) { return hasValue( registrarId, actual.getCurrentSponsorRegistrarId(), "has currentSponsorRegistrarId"); } - public And hasRegistrationExpirationTime(DateTime expiration) { + public And hasRegistrationExpirationTime(DateTime expiration) { return hasValue( expiration, actual.getRegistrationExpirationTime(), "getRegistrationExpirationTime()"); } - public And hasLastTransferTime(DateTime lastTransferTime) { + public And hasLastTransferTime(DateTime lastTransferTime) { return hasValue(lastTransferTime, actual.getLastTransferTime(), "getLastTransferTime()"); } - public And hasLastTransferTimeNotEqualTo(DateTime lastTransferTime) { + public And hasLastTransferTimeNotEqualTo(DateTime lastTransferTime) { return doesNotHaveValue( lastTransferTime, actual.getLastTransferTime(), "getLastTransferTime()"); } - public And hasDeletePollMessage() { + public And hasDeletePollMessage() { if (actual.getDeletePollMessage() == null) { failWithActual(simpleFact("expected to have a delete poll message")); } return andChainer(); } - public And hasNoDeletePollMessage() { + public And hasNoDeletePollMessage() { if (actual.getDeletePollMessage() != null) { failWithActual(simpleFact("expected to have no delete poll message")); } return andChainer(); } - public And hasSmdId(String smdId) { + public And hasSmdId(String smdId) { return hasValue(smdId, actual.getSmdId(), "getSmdId()"); } - public And hasAutorenewEndTime(DateTime autorenewEndTime) { + public And hasAutorenewEndTime(DateTime autorenewEndTime) { checkArgumentNotNull(autorenewEndTime, "Use hasNoAutorenewEndTime() instead"); return hasValue(autorenewEndTime, actual.getAutorenewEndTime(), "getAutorenewEndTime()"); } - public And hasNoAutorenewEndTime() { + public And hasNoAutorenewEndTime() { return hasNoValue(actual.getAutorenewEndTime(), "getAutorenewEndTime()"); } - public static SimpleSubjectBuilder assertAboutDomains() { - return assertAbout(DomainBaseSubject::new); + public static SimpleSubjectBuilder assertAboutDomains() { + return assertAbout(DomainSubject::new); } } diff --git a/core/src/test/java/google/registry/testing/FullFieldsTestEntityHelper.java b/core/src/test/java/google/registry/testing/FullFieldsTestEntityHelper.java index 97561b763..449fbde93 100644 --- a/core/src/test/java/google/registry/testing/FullFieldsTestEntityHelper.java +++ b/core/src/test/java/google/registry/testing/FullFieldsTestEntityHelper.java @@ -29,7 +29,7 @@ import google.registry.model.contact.ContactPhoneNumber; import google.registry.model.contact.ContactResource; import google.registry.model.contact.PostalInfo; import google.registry.model.domain.DesignatedContact; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.Period; import google.registry.model.domain.secdns.DelegationSignerData; import google.registry.model.eppcommon.StatusValue; @@ -330,7 +330,7 @@ public final class FullFieldsTestEntityHelper { return contactResource; } - public static DomainBase makeDomainBase( + public static Domain makeDomain( String domain, @Nullable ContactResource registrant, @Nullable ContactResource admin, @@ -338,8 +338,8 @@ public final class FullFieldsTestEntityHelper { @Nullable HostResource ns1, @Nullable HostResource ns2, Registrar registrar) { - DomainBase.Builder builder = - new DomainBase.Builder() + Domain.Builder builder = + new Domain.Builder() .setDomainName(Idn.toASCII(domain)) .setRepoId(generateNewDomainRoid(getTldFromDomainName(Idn.toASCII(domain)))) .setLastEppUpdateTime(DateTime.parse("2009-05-29T20:13:00Z")) diff --git a/core/src/test/java/google/registry/testing/HostResourceSubject.java b/core/src/test/java/google/registry/testing/HostResourceSubject.java index f11407cdd..e9413ee41 100644 --- a/core/src/test/java/google/registry/testing/HostResourceSubject.java +++ b/core/src/test/java/google/registry/testing/HostResourceSubject.java @@ -19,7 +19,7 @@ import static com.google.common.truth.Truth.assertAbout; import com.google.common.truth.FailureMetadata; import com.google.common.truth.SimpleSubjectBuilder; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.host.HostResource; import google.registry.persistence.VKey; import google.registry.testing.TruthChainer.And; @@ -57,7 +57,7 @@ public final class HostResourceSubject } public And hasSuperordinateDomain( - @Nullable VKey superordinateDomain) { + @Nullable VKey superordinateDomain) { return hasValue( superordinateDomain, actual.getSuperordinateDomain(), "has superordinateDomain"); } diff --git a/core/src/test/java/google/registry/tmch/LordnTaskUtilsTest.java b/core/src/test/java/google/registry/tmch/LordnTaskUtilsTest.java index 245cb05d3..facee1eb9 100644 --- a/core/src/test/java/google/registry/tmch/LordnTaskUtilsTest.java +++ b/core/src/test/java/google/registry/tmch/LordnTaskUtilsTest.java @@ -22,7 +22,7 @@ import static google.registry.testing.DatabaseHelper.persistDomainAndEnqueueLord import static google.registry.testing.TaskQueueHelper.assertTasksEnqueued; import static org.junit.jupiter.api.Assertions.assertThrows; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.launch.LaunchNotice; import google.registry.model.ofy.Ofy; import google.registry.model.registrar.Registrar.Type; @@ -53,8 +53,8 @@ public class LordnTaskUtilsTest { inject.setStaticField(Ofy.class, "clock", clock); } - private DomainBase.Builder newDomainBuilder() { - return new DomainBase.Builder() + private Domain.Builder newDomainBuilder() { + return new Domain.Builder() .setDomainName("fleece.example") .setPersistedCurrentSponsorRegistrarId("TheRegistrar") .setCreationRegistrarId("TheRegistrar") @@ -64,7 +64,7 @@ public class LordnTaskUtilsTest { } @Test - void test_enqueueDomainBaseTask_sunrise() { + void test_enqueueDomainTask_sunrise() { persistDomainAndEnqueueLordn(newDomainBuilder().setRepoId("A-EXAMPLE").build()); String expectedPayload = "A-EXAMPLE,fleece.example,smdzzzz,1,2010-05-01T10:11:12.000Z"; @@ -73,8 +73,8 @@ public class LordnTaskUtilsTest { } @Test - void test_enqueueDomainBaseTask_claims() { - DomainBase domain = + void test_enqueueDomainTask_claims() { + Domain domain = newDomainBuilder() .setRepoId("11-EXAMPLE") .setLaunchNotice( @@ -104,9 +104,9 @@ public class LordnTaskUtilsTest { } @Test - void test_enqueueDomainBaseTask_throwsNpeOnNullDomain() { + void test_enqueueDomainTask_throwsNpeOnNullDomain() { assertThrows( NullPointerException.class, - () -> tm().transactNew(() -> LordnTaskUtils.enqueueDomainBaseTask(null))); + () -> tm().transactNew(() -> LordnTaskUtils.enqueueDomainTask(null))); } } diff --git a/core/src/test/java/google/registry/tmch/NordnUploadActionTest.java b/core/src/test/java/google/registry/tmch/NordnUploadActionTest.java index 2db9ceec4..90b8e744c 100644 --- a/core/src/test/java/google/registry/tmch/NordnUploadActionTest.java +++ b/core/src/test/java/google/registry/tmch/NordnUploadActionTest.java @@ -21,7 +21,6 @@ import static com.google.common.net.MediaType.FORM_DATA; import static com.google.common.truth.Truth.assertThat; import static google.registry.testing.DatabaseHelper.createTld; import static google.registry.testing.DatabaseHelper.loadRegistrar; -import static google.registry.testing.DatabaseHelper.newDomainBase; import static google.registry.testing.DatabaseHelper.persistDomainAndEnqueueLordn; import static google.registry.testing.DatabaseHelper.persistResource; import static google.registry.testing.TaskQueueHelper.assertTasksEnqueued; @@ -47,11 +46,12 @@ import com.google.appengine.api.taskqueue.TransientFailureException; import com.google.apphosting.api.DeadlineExceededException; import com.google.common.base.VerifyException; import com.google.common.collect.ImmutableList; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.launch.LaunchNotice; import google.registry.model.ofy.Ofy; import google.registry.model.tld.Registry; import google.registry.testing.AppEngineExtension; +import google.registry.testing.DatabaseHelper; import google.registry.testing.FakeClock; import google.registry.testing.FakeSleeper; import google.registry.testing.FakeUrlConnectionService; @@ -289,7 +289,7 @@ class NordnUploadActionTest { } private void persistClaimsModeDomain() { - DomainBase domain = newDomainBase("claims-landrush1.tld"); + Domain domain = DatabaseHelper.newDomain("claims-landrush1.tld"); persistDomainAndEnqueueLordn( domain .asBuilder() @@ -301,7 +301,7 @@ class NordnUploadActionTest { private void persistSunriseModeDomain() { action.phase = "sunrise"; - DomainBase domain = newDomainBase("sunrise1.tld"); + Domain domain = DatabaseHelper.newDomain("sunrise1.tld"); persistDomainAndEnqueueLordn(domain.asBuilder().setSmdId("my-smdid").build()); } diff --git a/core/src/test/java/google/registry/tools/AckPollMessagesCommandTest.java b/core/src/test/java/google/registry/tools/AckPollMessagesCommandTest.java index 7608fff45..ba78e6f97 100644 --- a/core/src/test/java/google/registry/tools/AckPollMessagesCommandTest.java +++ b/core/src/test/java/google/registry/tools/AckPollMessagesCommandTest.java @@ -19,11 +19,10 @@ import static com.google.common.truth.Truth.assertThat; import static google.registry.testing.DatabaseHelper.createTld; import static google.registry.testing.DatabaseHelper.loadByKeys; import static google.registry.testing.DatabaseHelper.loadByKeysIfPresent; -import static google.registry.testing.DatabaseHelper.newDomainBase; import static google.registry.testing.DatabaseHelper.persistResource; import com.google.common.collect.ImmutableList; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainHistory; import google.registry.model.domain.DomainHistory.DomainHistoryId; import google.registry.model.ofy.Ofy; @@ -32,6 +31,7 @@ import google.registry.model.poll.PollMessage.Autorenew; import google.registry.model.poll.PollMessage.OneTime; import google.registry.model.reporting.HistoryEntry; import google.registry.persistence.VKey; +import google.registry.testing.DatabaseHelper; import google.registry.testing.FakeClock; import google.registry.testing.InjectExtension; import org.joda.time.DateTime; @@ -53,7 +53,8 @@ public class AckPollMessagesCommandTest extends CommandTestCase historyEntryKey = Key.create(Key.create(domain), HistoryEntry.class, 1051L); builder.setRedemptionHistoryEntry(HistoryEntry.createVKey(historyEntryKey)); } diff --git a/core/src/test/java/google/registry/tools/DomainLockUtilsTest.java b/core/src/test/java/google/registry/tools/DomainLockUtilsTest.java index fec327d29..d8df821fa 100644 --- a/core/src/test/java/google/registry/tools/DomainLockUtilsTest.java +++ b/core/src/test/java/google/registry/tools/DomainLockUtilsTest.java @@ -22,7 +22,6 @@ import static google.registry.testing.DatabaseHelper.createTlds; import static google.registry.testing.DatabaseHelper.getHistoryEntriesOfType; import static google.registry.testing.DatabaseHelper.getOnlyHistoryEntryOfType; import static google.registry.testing.DatabaseHelper.loadByEntity; -import static google.registry.testing.DatabaseHelper.newDomainBase; import static google.registry.testing.DatabaseHelper.persistActiveHost; import static google.registry.testing.DatabaseHelper.persistResource; import static google.registry.testing.SqlHelper.getRegistryLockByRevisionId; @@ -38,7 +37,7 @@ import com.google.common.collect.ImmutableList; import google.registry.batch.RelockDomainAction; import google.registry.model.billing.BillingEvent; import google.registry.model.billing.BillingEvent.Reason; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainHistory; import google.registry.model.domain.RegistryLock; import google.registry.model.host.HostResource; @@ -83,13 +82,13 @@ public final class DomainLockUtilsTest { .withUserService(UserInfo.create(POC_ID, "12345")) .build(); - private DomainBase domain; + private Domain domain; @BeforeEach void setup() { createTlds("tld", "net"); HostResource host = persistActiveHost("ns1.example.net"); - domain = persistResource(newDomainBase(DOMAIN_NAME, host)); + domain = persistResource(DatabaseHelper.newDomain(DOMAIN_NAME, host)); domainLockUtils = new DomainLockUtils( diff --git a/core/src/test/java/google/registry/tools/EnqueuePollMessageCommandTest.java b/core/src/test/java/google/registry/tools/EnqueuePollMessageCommandTest.java index dca295f56..a7b1aaa78 100644 --- a/core/src/test/java/google/registry/tools/EnqueuePollMessageCommandTest.java +++ b/core/src/test/java/google/registry/tools/EnqueuePollMessageCommandTest.java @@ -25,7 +25,7 @@ import static google.registry.testing.HistoryEntrySubject.assertAboutHistoryEntr import static org.junit.jupiter.api.Assertions.assertThrows; import com.beust.jcommander.ParameterException; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.ofy.Ofy; import google.registry.model.poll.PollMessage; import google.registry.model.reporting.HistoryEntry; @@ -39,7 +39,7 @@ class EnqueuePollMessageCommandTest extends CommandTestCase DS_DATA_OUTPUT = ImmutableList.of( ImmutableMap.of( @@ -139,7 +139,7 @@ class GenerateDnsReportCommandTest extends CommandTestCase { @Test void testExample() throws Exception { createTld("tld"); - persistResource(newDomainBase("sneezy.tld").asBuilder().setSmdId("smd1").build()); - persistResource(newDomainBase("wheezy.tld").asBuilder().setSmdId("smd2").build()); + persistResource(DatabaseHelper.newDomain("sneezy.tld").asBuilder().setSmdId("smd1").build()); + persistResource(DatabaseHelper.newDomain("wheezy.tld").asBuilder().setSmdId("smd2").build()); persistResource( - newDomainBase("fleecey.tld") + DatabaseHelper.newDomain("fleecey.tld") .asBuilder() .setLaunchNotice(LaunchNotice.create("smd3", "validator", START_OF_TIME, START_OF_TIME)) .setSmdId("smd3") diff --git a/core/src/test/java/google/registry/tools/GetAllocationTokenCommandTest.java b/core/src/test/java/google/registry/tools/GetAllocationTokenCommandTest.java index 515339c4a..e74c0aa8e 100644 --- a/core/src/test/java/google/registry/tools/GetAllocationTokenCommandTest.java +++ b/core/src/test/java/google/registry/tools/GetAllocationTokenCommandTest.java @@ -26,7 +26,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows; import com.beust.jcommander.ParameterException; import com.google.common.collect.ImmutableList; import com.googlecode.objectify.Key; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.token.AllocationToken; import google.registry.model.reporting.HistoryEntry; import org.joda.time.DateTime; @@ -76,8 +76,7 @@ class GetAllocationTokenCommandTest extends CommandTestCase { assertInStdout("Contact=VKey(sql:3-ROID"); assertInStdout( "Websafe key: " - + "kind:DomainBase" + + "kind:Domain" + "@sql:rO0ABXQABTItVExE" - + "@ofy:agR0ZXN0chULEgpEb21haW5CYXNlIgUyLVRMRAw"); + + "@ofy:agR0ZXN0chELEgZEb21haW4iBTItVExEDA"); } @Test @@ -54,9 +54,9 @@ class GetDomainCommandTest extends CommandTestCase { assertInStdout("sqlKey=3-ROID"); assertInStdout( "Websafe key: " - + "kind:DomainBase" + + "kind:Domain" + "@sql:rO0ABXQABTItVExE" - + "@ofy:agR0ZXN0chULEgpEb21haW5CYXNlIgUyLVRMRAw"); + + "@ofy:agR0ZXN0chELEgZEb21haW4iBTItVExEDA"); assertNotInStdout("LiveRef"); } @@ -78,20 +78,20 @@ class GetDomainCommandTest extends CommandTestCase { assertInStdout("fullyQualifiedDomainName=example2.tld"); assertInStdout( "Websafe key: " - + "kind:DomainBase" - + "@sql:rO0ABXQABTQtVExE" - + "@ofy:agR0ZXN0chULEgpEb21haW5CYXNlIgU0LVRMRAw"); + + "kind:Domain" + + "@sql:rO0ABXQABTItVExE" + + "@ofy:agR0ZXN0chELEgZEb21haW4iBTItVExEDA"); assertInStdout( "Websafe key: " - + "kind:DomainBase" + + "kind:Domain" + "@sql:rO0ABXQABTQtVExE" - + "@ofy:agR0ZXN0chULEgpEb21haW5CYXNlIgU0LVRMRAw"); + + "@ofy:agR0ZXN0chELEgZEb21haW4iBTQtVExEDA"); } @Test void testSuccess_domainDeletedInFuture() throws Exception { persistResource( - newDomainBase("example.tld") + DatabaseHelper.newDomain("example.tld") .asBuilder() .setDeletionTime(fakeClock.nowUtc().plusDays(1)) .build()); diff --git a/core/src/test/java/google/registry/tools/GetHistoryEntriesCommandTest.java b/core/src/test/java/google/registry/tools/GetHistoryEntriesCommandTest.java index 87c54488a..be66f4fbd 100644 --- a/core/src/test/java/google/registry/tools/GetHistoryEntriesCommandTest.java +++ b/core/src/test/java/google/registry/tools/GetHistoryEntriesCommandTest.java @@ -19,7 +19,7 @@ import static google.registry.testing.DatabaseHelper.persistActiveDomain; import static google.registry.testing.DatabaseHelper.persistResource; import static google.registry.testing.FullFieldsTestEntityHelper.makeHistoryEntry; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.Period; import google.registry.model.reporting.HistoryEntry; import google.registry.testing.FakeClock; @@ -32,7 +32,7 @@ class GetHistoryEntriesCommandTest extends CommandTestCase { @Test void testSuccess_locksDomain() throws Exception { - DomainBase domain = persistActiveDomain("example.tld"); + Domain domain = persistActiveDomain("example.tld"); runCommandForced("--client=TheRegistrar", "example.tld"); assertThat(reloadResource(domain).getStatusValues()) .containsAtLeastElementsIn(REGISTRY_LOCK_STATUSES); @@ -62,9 +62,9 @@ class LockDomainCommandTest extends CommandTestCase { @Test void testSuccess_partiallyUpdatesStatuses() throws Exception { - DomainBase domain = + Domain domain = persistResource( - newDomainBase("example.tld") + DatabaseHelper.newDomain("example.tld") .asBuilder() .addStatusValue(SERVER_TRANSFER_PROHIBITED) .build()); @@ -77,7 +77,7 @@ class LockDomainCommandTest extends CommandTestCase { void testSuccess_manyDomains() throws Exception { // Create 26 domains -- one more than the number of entity groups allowed in a transaction (in // case that was going to be the failure point). - List domains = new ArrayList<>(); + List domains = new ArrayList<>(); for (int n = 0; n < 26; n++) { String domain = String.format("domain%d.tld", n); domains.add(persistActiveDomain(domain)); @@ -85,9 +85,9 @@ class LockDomainCommandTest extends CommandTestCase { runCommandForced( ImmutableList.builder() .add("--client=TheRegistrar") - .addAll(domains.stream().map(DomainBase::getDomainName).collect(Collectors.toList())) + .addAll(domains.stream().map(Domain::getDomainName).collect(Collectors.toList())) .build()); - for (DomainBase domain : domains) { + for (Domain domain : domains) { assertThat(reloadResource(domain).getStatusValues()) .containsAtLeastElementsIn(REGISTRY_LOCK_STATUSES); } @@ -101,9 +101,9 @@ class LockDomainCommandTest extends CommandTestCase { @Test void testSuccess_alreadyLockedDomain_performsNoAction() throws Exception { - DomainBase domain = + Domain domain = persistResource( - newDomainBase("example.tld") + DatabaseHelper.newDomain("example.tld") .asBuilder() .addStatusValues(REGISTRY_LOCK_STATUSES) .build()); @@ -113,7 +113,7 @@ class LockDomainCommandTest extends CommandTestCase { @Test void testSuccess_defaultsToAdminRegistrar_ifUnspecified() throws Exception { - DomainBase domain = persistActiveDomain("example.tld"); + Domain domain = persistActiveDomain("example.tld"); runCommandForced("example.tld"); assertThat(getMostRecentRegistryLockByRepoId(domain.getRepoId()).get().getRegistrarId()) .isEqualTo("adminreg"); diff --git a/core/src/test/java/google/registry/tools/RenewDomainCommandTest.java b/core/src/test/java/google/registry/tools/RenewDomainCommandTest.java index 29de8082f..3ff123c64 100644 --- a/core/src/test/java/google/registry/tools/RenewDomainCommandTest.java +++ b/core/src/test/java/google/registry/tools/RenewDomainCommandTest.java @@ -15,7 +15,6 @@ package google.registry.tools; import static com.google.common.truth.Truth.assertThat; -import static google.registry.testing.DatabaseHelper.newDomainBase; import static google.registry.testing.DatabaseHelper.persistActiveDomain; import static google.registry.testing.DatabaseHelper.persistDeletedDomain; import static google.registry.testing.DatabaseHelper.persistNewRegistrar; @@ -24,8 +23,9 @@ import static org.junit.jupiter.api.Assertions.assertThrows; import com.beust.jcommander.ParameterException; import com.google.common.collect.ImmutableMap; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.registrar.Registrar; +import google.registry.testing.DatabaseHelper; import java.util.List; import org.joda.time.DateTime; import org.junit.jupiter.api.BeforeEach; @@ -60,8 +60,8 @@ public class RenewDomainCommandTest extends EppToolCommandTestCase persistThreeDomains() { - ImmutableList.Builder domains = new ImmutableList.Builder<>(); + private static List persistThreeDomains() { + ImmutableList.Builder domains = new ImmutableList.Builder<>(); domains.add( persistActiveDomain( "domain1.tld", @@ -75,7 +75,7 @@ public class RenewDomainCommandTest extends EppToolCommandTestCase defaultDsData; @BeforeEach @@ -55,7 +55,7 @@ class UniformRapidSuspensionCommandTest ns2 = persistActiveHost("ns2.example.com"); urs1 = persistActiveHost("urs1.example.com"); urs2 = persistActiveHost("urs2.example.com"); - defaultDomainBase = newDomainBase("evil.tld"); + defaultDomain = DatabaseHelper.newDomain("evil.tld"); defaultDsData = ImmutableSet.of( DelegationSignerData.create(1, 2, 3, new HexBinaryAdapter().unmarshal("dead")), @@ -63,18 +63,17 @@ class UniformRapidSuspensionCommandTest } private void persistDomainWithHosts( - DomainBase domainBase, ImmutableSet dsData, HostResource... hosts) { + Domain domain, ImmutableSet dsData, HostResource... hosts) { ImmutableSet.Builder> hostRefs = new ImmutableSet.Builder<>(); for (HostResource host : hosts) { hostRefs.add(host.createVKey()); } - persistResource( - domainBase.asBuilder().setNameservers(hostRefs.build()).setDsData(dsData).build()); + persistResource(domain.asBuilder().setNameservers(hostRefs.build()).setDsData(dsData).build()); } @Test void testCommand_addsLocksReplacesHostsAndDsDataPrintsUndo() throws Exception { - persistDomainWithHosts(defaultDomainBase, defaultDsData, ns1, ns2); + persistDomainWithHosts(defaultDomain, defaultDsData, ns1, ns2); runCommandForced( "--domain_name=evil.tld", "--hosts=urs1.example.com,urs2.example.com", @@ -95,7 +94,7 @@ class UniformRapidSuspensionCommandTest @Test void testCommand_respectsExistingHost() throws Exception { - persistDomainWithHosts(defaultDomainBase, defaultDsData, urs2, ns1); + persistDomainWithHosts(defaultDomain, defaultDsData, urs2, ns1); runCommandForced( "--domain_name=evil.tld", "--hosts=urs1.example.com,urs2.example.com", @@ -127,9 +126,10 @@ class UniformRapidSuspensionCommandTest @Test void testCommand_generatesUndoWithLocksToPreserve() throws Exception { persistResource( - newDomainBase("evil.tld").asBuilder() - .addStatusValue(StatusValue.SERVER_DELETE_PROHIBITED) - .build()); + DatabaseHelper.newDomain("evil.tld") + .asBuilder() + .addStatusValue(StatusValue.SERVER_DELETE_PROHIBITED) + .build()); runCommandForced("--domain_name=evil.tld", "--renew_one_year=false"); eppVerifier.verifySentAny().verifyNoMoreSent(); assertInStdout("uniform_rapid_suspension --undo"); @@ -140,7 +140,7 @@ class UniformRapidSuspensionCommandTest @Test void testCommand_removeClientHold() throws Exception { persistResource( - newDomainBase("evil.tld") + DatabaseHelper.newDomain("evil.tld") .asBuilder() .addStatusValue(StatusValue.CLIENT_HOLD) .addNameserver(ns1.createVKey()) @@ -164,7 +164,7 @@ class UniformRapidSuspensionCommandTest @Test void testUndo_removesLocksReplacesHostsAndDsData() throws Exception { - persistDomainWithHosts(defaultDomainBase, defaultDsData, urs1, urs2); + persistDomainWithHosts(defaultDomain, defaultDsData, urs1, urs2); runCommandForced( "--domain_name=evil.tld", "--undo", @@ -180,7 +180,7 @@ class UniformRapidSuspensionCommandTest @Test void testUndo_respectsLocksToPreserveFlag() throws Exception { - persistDomainWithHosts(defaultDomainBase, defaultDsData, urs1, urs2); + persistDomainWithHosts(defaultDomain, defaultDsData, urs1, urs2); runCommandForced( "--domain_name=evil.tld", "--undo", @@ -197,7 +197,7 @@ class UniformRapidSuspensionCommandTest @Test void testUndo_restoresClientHolds() throws Exception { - persistDomainWithHosts(defaultDomainBase, defaultDsData, urs1, urs2); + persistDomainWithHosts(defaultDomain, defaultDsData, urs1, urs2); runCommandForced( "--domain_name=evil.tld", "--undo", @@ -215,7 +215,7 @@ class UniformRapidSuspensionCommandTest @Test void testAutorenews_setToFalseByDefault() throws Exception { persistResource( - newDomainBase("evil.tld") + DatabaseHelper.newDomain("evil.tld") .asBuilder() .addStatusValue(StatusValue.SERVER_DELETE_PROHIBITED) .build()); @@ -227,7 +227,7 @@ class UniformRapidSuspensionCommandTest @Test void testAutorenews_setToTrueWhenUndo() throws Exception { persistResource( - newDomainBase("evil.tld") + DatabaseHelper.newDomain("evil.tld") .asBuilder() .addStatusValue(StatusValue.SERVER_DELETE_PROHIBITED) .build()); @@ -244,7 +244,7 @@ class UniformRapidSuspensionCommandTest @Test void testRenewOneYearWithoutUndo_verifyReasonWithoutUndo() throws Exception { persistDomainWithHosts( - newDomainBase("evil.tld") + DatabaseHelper.newDomain("evil.tld") .asBuilder() .setCreationTimeForTest(DateTime.parse("2021-10-01T05:01:11Z")) .setRegistrationExpirationTime(DateTime.parse("2022-10-01T05:01:11Z")) @@ -281,7 +281,7 @@ class UniformRapidSuspensionCommandTest @Test void testRenewOneYearWithUndo_verifyReasonWithUndo() throws Exception { persistDomainWithHosts( - newDomainBase("evil.tld") + DatabaseHelper.newDomain("evil.tld") .asBuilder() .setCreationTimeForTest(DateTime.parse("2021-10-01T05:01:11Z")) .setRegistrationExpirationTime(DateTime.parse("2022-10-01T05:01:11Z")) @@ -319,7 +319,7 @@ class UniformRapidSuspensionCommandTest @Test void testRenewOneYear_verifyBothRenewAndUpdateFlowsAreTriggered() throws Exception { persistDomainWithHosts( - newDomainBase("evil.tld") + DatabaseHelper.newDomain("evil.tld") .asBuilder() .setCreationTimeForTest(DateTime.parse("2021-10-01T05:01:11Z")) .setRegistrationExpirationTime(DateTime.parse("2022-10-01T05:01:11Z")) diff --git a/core/src/test/java/google/registry/tools/UnlockDomainCommandTest.java b/core/src/test/java/google/registry/tools/UnlockDomainCommandTest.java index e6c9d9eca..cce5b08da 100644 --- a/core/src/test/java/google/registry/tools/UnlockDomainCommandTest.java +++ b/core/src/test/java/google/registry/tools/UnlockDomainCommandTest.java @@ -18,7 +18,6 @@ import static com.google.common.truth.Truth.assertThat; import static google.registry.model.eppcommon.StatusValue.SERVER_DELETE_PROHIBITED; import static google.registry.model.eppcommon.StatusValue.SERVER_UPDATE_PROHIBITED; import static google.registry.testing.DatabaseHelper.createTld; -import static google.registry.testing.DatabaseHelper.newDomainBase; import static google.registry.testing.DatabaseHelper.persistActiveDomain; import static google.registry.testing.DatabaseHelper.persistNewRegistrar; import static google.registry.testing.DatabaseHelper.persistResource; @@ -28,10 +27,11 @@ import static org.junit.jupiter.api.Assertions.assertThrows; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.RegistryLock; import google.registry.model.registrar.Registrar.Type; import google.registry.testing.CloudTasksHelper; +import google.registry.testing.DatabaseHelper; import google.registry.testing.DeterministicStringGenerator; import google.registry.util.StringGenerator.Alphabets; import java.util.ArrayList; @@ -55,8 +55,8 @@ class UnlockDomainCommandTest extends CommandTestCase { new CloudTasksHelper(fakeClock).getTestCloudTasksUtils()); } - private DomainBase persistLockedDomain(String domainName, String registrarId) { - DomainBase domain = persistResource(newDomainBase(domainName)); + private Domain persistLockedDomain(String domainName, String registrarId) { + Domain domain = persistResource(DatabaseHelper.newDomain(domainName)); RegistryLock lock = command.domainLockUtils.saveNewRegistryLockRequest(domainName, registrarId, null, true); command.domainLockUtils.verifyAndApplyLock(lock.getVerificationCode(), true); @@ -65,14 +65,14 @@ class UnlockDomainCommandTest extends CommandTestCase { @Test void testSuccess_unlocksDomain() throws Exception { - DomainBase domain = persistLockedDomain("example.tld", "TheRegistrar"); + Domain domain = persistLockedDomain("example.tld", "TheRegistrar"); runCommandForced("--client=TheRegistrar", "example.tld"); assertThat(reloadResource(domain).getStatusValues()).containsNoneIn(REGISTRY_LOCK_STATUSES); } @Test void testSuccess_partiallyUpdatesStatuses() throws Exception { - DomainBase domain = persistLockedDomain("example.tld", "TheRegistrar"); + Domain domain = persistLockedDomain("example.tld", "TheRegistrar"); domain = persistResource( domain @@ -88,7 +88,7 @@ class UnlockDomainCommandTest extends CommandTestCase { void testSuccess_manyDomains() throws Exception { // Create 26 domains -- one more than the number of entity groups allowed in a transaction (in // case that was going to be the failure point). - List domains = new ArrayList<>(); + List domains = new ArrayList<>(); for (int n = 0; n < 26; n++) { String domain = String.format("domain%d.tld", n); domains.add(persistLockedDomain(domain, "TheRegistrar")); @@ -96,9 +96,9 @@ class UnlockDomainCommandTest extends CommandTestCase { runCommandForced( ImmutableList.builder() .add("--client=TheRegistrar") - .addAll(domains.stream().map(DomainBase::getDomainName).collect(Collectors.toList())) + .addAll(domains.stream().map(Domain::getDomainName).collect(Collectors.toList())) .build()); - for (DomainBase domain : domains) { + for (Domain domain : domains) { assertThat(reloadResource(domain).getStatusValues()).containsNoneIn(REGISTRY_LOCK_STATUSES); } } @@ -111,14 +111,14 @@ class UnlockDomainCommandTest extends CommandTestCase { @Test void testSuccess_alreadyUnlockedDomain_staysUnlocked() throws Exception { - DomainBase domain = persistActiveDomain("example.tld"); + Domain domain = persistActiveDomain("example.tld"); runCommandForced("--client=TheRegistrar", "example.tld"); assertThat(reloadResource(domain).getStatusValues()).containsNoneIn(REGISTRY_LOCK_STATUSES); } @Test void testSuccess_defaultsToAdminRegistrar_ifUnspecified() throws Exception { - DomainBase domain = persistLockedDomain("example.tld", "TheRegistrar"); + Domain domain = persistLockedDomain("example.tld", "TheRegistrar"); runCommandForced("example.tld"); assertThat(getMostRecentRegistryLockByRepoId(domain.getRepoId()).get().getRegistrarId()) .isEqualTo("adminreg"); diff --git a/core/src/test/java/google/registry/tools/UnrenewDomainCommandTest.java b/core/src/test/java/google/registry/tools/UnrenewDomainCommandTest.java index a60529d1d..3ae6870f5 100644 --- a/core/src/test/java/google/registry/tools/UnrenewDomainCommandTest.java +++ b/core/src/test/java/google/registry/tools/UnrenewDomainCommandTest.java @@ -25,7 +25,6 @@ import static google.registry.testing.DatabaseHelper.createTld; import static google.registry.testing.DatabaseHelper.getOnlyHistoryEntryOfType; import static google.registry.testing.DatabaseHelper.getPollMessages; import static google.registry.testing.DatabaseHelper.loadByKey; -import static google.registry.testing.DatabaseHelper.newDomainBase; import static google.registry.testing.DatabaseHelper.persistActiveContact; import static google.registry.testing.DatabaseHelper.persistActiveDomain; import static google.registry.testing.DatabaseHelper.persistDeletedDomain; @@ -39,11 +38,12 @@ import google.registry.model.billing.BillingEvent; import google.registry.model.billing.BillingEvent.Flag; import google.registry.model.billing.BillingEvent.Reason; import google.registry.model.contact.ContactResource; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainHistory; import google.registry.model.eppcommon.StatusValue; import google.registry.model.ofy.Ofy; import google.registry.model.poll.PollMessage; +import google.registry.testing.DatabaseHelper; import google.registry.testing.InjectExtension; import org.joda.time.DateTime; import org.junit.jupiter.api.BeforeEach; @@ -86,12 +86,12 @@ public class UnrenewDomainCommandTest extends CommandTestCase> nameservers = ImmutableSet.of(host1.createVKey(), host2.createVKey()); persistResource( - newDomainBase("example.tld").asBuilder().setNameservers(nameservers).build()); + DatabaseHelper.newDomain("example.tld").asBuilder().setNameservers(nameservers).build()); runCommandForced( "--client=NewRegistrar", "--nameservers=ns2.zdns.google,ns3.zdns.google", "example.tld"); eppVerifier.verifySent("domain_update_set_nameservers.xml"); @@ -250,7 +250,7 @@ class UpdateDomainCommandTest extends EppToolCommandTestCase techContactKey = techContact.createVKey(); persistResource( - newDomainBase("example.tld") + DatabaseHelper.newDomain("example.tld") .asBuilder() .setContacts( ImmutableSet.of( @@ -268,7 +268,7 @@ class UpdateDomainCommandTest extends EppToolCommandTestCase> nameservers = ImmutableSet.of(host.createVKey()); persistResource( - newDomainBase("example.tld") + DatabaseHelper.newDomain("example.tld") .asBuilder() .setStatusValues( ImmutableSet.of( @@ -377,7 +377,7 @@ class UpdateDomainCommandTest extends EppToolCommandTestCase techContactKey = techContact.createVKey(); persistResource( - newDomainBase("example.tld") + DatabaseHelper.newDomain("example.tld") .asBuilder() .setContacts( ImmutableSet.of( @@ -401,7 +401,7 @@ class UpdateDomainCommandTest extends EppToolCommandTestCase> nameservers = ImmutableSet.of(host.createVKey()); persistResource( - newDomainBase("example.tld") + DatabaseHelper.newDomain("example.tld") .asBuilder() .setStatusValues(ImmutableSet.of(SERVER_UPDATE_PROHIBITED)) .setNameservers(nameservers) @@ -426,7 +426,7 @@ class UpdateDomainCommandTest extends EppToolCommandTestCase> nameservers = ImmutableSet.of(host.createVKey()); persistResource( - newDomainBase("example.tld") + DatabaseHelper.newDomain("example.tld") .asBuilder() .setStatusValues(ImmutableSet.of(PENDING_DELETE)) .setNameservers(nameservers) diff --git a/core/src/test/java/google/registry/tools/server/GenerateZoneFilesActionTest.java b/core/src/test/java/google/registry/tools/server/GenerateZoneFilesActionTest.java index d6dffb76d..7750312b5 100644 --- a/core/src/test/java/google/registry/tools/server/GenerateZoneFilesActionTest.java +++ b/core/src/test/java/google/registry/tools/server/GenerateZoneFilesActionTest.java @@ -16,7 +16,6 @@ package google.registry.tools.server; import static com.google.common.truth.Truth.assertThat; import static google.registry.testing.DatabaseHelper.createTlds; -import static google.registry.testing.DatabaseHelper.newDomainBase; import static google.registry.testing.DatabaseHelper.newHostResource; import static google.registry.testing.DatabaseHelper.persistActiveContact; import static google.registry.testing.DatabaseHelper.persistActiveDomain; @@ -38,6 +37,7 @@ import google.registry.model.eppcommon.StatusValue; import google.registry.model.host.HostResource; import google.registry.persistence.VKey; import google.registry.testing.AppEngineExtension; +import google.registry.testing.DatabaseHelper; import google.registry.testing.FakeClock; import java.net.InetAddress; import java.util.Map; @@ -73,47 +73,58 @@ class GenerateZoneFilesActionTest { // This domain will have glue records, because it has a subordinate host which is its own // nameserver. None of the other domains should have glue records, because their nameservers are // subordinate to different domains. - persistResource(newDomainBase("bar.tld").asBuilder() - .addNameservers(nameservers) - .addSubordinateHost("ns.bar.tld") - .build()); - persistResource(newDomainBase("foo.tld").asBuilder() - .addSubordinateHost("ns.foo.tld") - .build()); - persistResource(newDomainBase("ns-and-ds.tld").asBuilder() - .addNameservers(nameservers) - .setDsData(ImmutableSet.of(DelegationSignerData.create(1, 2, 3, new byte[] {0, 1, 2}))) - .build()); - persistResource(newDomainBase("ns-only.tld").asBuilder() - .addNameservers(nameservers) - .build()); - persistResource(newDomainBase("ns-only-client-hold.tld").asBuilder() - .addNameservers(nameservers) - .setStatusValues(ImmutableSet.of(StatusValue.CLIENT_HOLD)) - .build()); - persistResource(newDomainBase("ns-only-pending-delete.tld").asBuilder() - .addNameservers(nameservers) - .setStatusValues(ImmutableSet.of(StatusValue.PENDING_DELETE)) - .build()); - persistResource(newDomainBase("ns-only-server-hold.tld").asBuilder() - .addNameservers(nameservers) - .setStatusValues(ImmutableSet.of(StatusValue.SERVER_HOLD)) - .build()); + persistResource( + DatabaseHelper.newDomain("bar.tld") + .asBuilder() + .addNameservers(nameservers) + .addSubordinateHost("ns.bar.tld") + .build()); + persistResource( + DatabaseHelper.newDomain("foo.tld").asBuilder().addSubordinateHost("ns.foo.tld").build()); + persistResource( + DatabaseHelper.newDomain("ns-and-ds.tld") + .asBuilder() + .addNameservers(nameservers) + .setDsData(ImmutableSet.of(DelegationSignerData.create(1, 2, 3, new byte[] {0, 1, 2}))) + .build()); + persistResource( + DatabaseHelper.newDomain("ns-only.tld").asBuilder().addNameservers(nameservers).build()); + persistResource( + DatabaseHelper.newDomain("ns-only-client-hold.tld") + .asBuilder() + .addNameservers(nameservers) + .setStatusValues(ImmutableSet.of(StatusValue.CLIENT_HOLD)) + .build()); + persistResource( + DatabaseHelper.newDomain("ns-only-pending-delete.tld") + .asBuilder() + .addNameservers(nameservers) + .setStatusValues(ImmutableSet.of(StatusValue.PENDING_DELETE)) + .build()); + persistResource( + DatabaseHelper.newDomain("ns-only-server-hold.tld") + .asBuilder() + .addNameservers(nameservers) + .setStatusValues(ImmutableSet.of(StatusValue.SERVER_HOLD)) + .build()); // These should be ignored; contacts aren't in DNS, hosts need to be from the same tld and have // IP addresses, and domains need to be from the same TLD and have hosts (even in the case where // domains contain DS data). - persistResource(newDomainBase("ds-only.tld").asBuilder() - .setDsData(ImmutableSet.of(DelegationSignerData.create(1, 2, 3, new byte[] {0, 1, 2}))) - .build()); + persistResource( + DatabaseHelper.newDomain("ds-only.tld") + .asBuilder() + .setDsData(ImmutableSet.of(DelegationSignerData.create(1, 2, 3, new byte[] {0, 1, 2}))) + .build()); persistActiveContact("ignored_contact"); persistActiveHost("ignored.host.tld"); // No ips. persistActiveDomain("ignored_domain.tld"); // No hosts or DS data. persistResource(newHostResource("ignored.foo.com").asBuilder().addInetAddresses(ips).build()); - persistResource(newDomainBase("ignored.com") - .asBuilder() - .addNameservers(nameservers) - .setDsData(ImmutableSet.of(DelegationSignerData.create(1, 2, 3, new byte[] {0, 1, 2}))) - .build()); + persistResource( + DatabaseHelper.newDomain("ignored.com") + .asBuilder() + .addNameservers(nameservers) + .setDsData(ImmutableSet.of(DelegationSignerData.create(1, 2, 3, new byte[] {0, 1, 2}))) + .build()); GenerateZoneFilesAction action = new GenerateZoneFilesAction(); action.bucket = "zonefiles-bucket"; diff --git a/core/src/test/java/google/registry/ui/server/registrar/RegistryLockPostActionTest.java b/core/src/test/java/google/registry/ui/server/registrar/RegistryLockPostActionTest.java index 7c7fdd743..f4e6284c1 100644 --- a/core/src/test/java/google/registry/ui/server/registrar/RegistryLockPostActionTest.java +++ b/core/src/test/java/google/registry/ui/server/registrar/RegistryLockPostActionTest.java @@ -19,7 +19,6 @@ import static com.google.common.truth.Truth.assertThat; import static google.registry.model.EppResourceUtils.loadByForeignKey; import static google.registry.testing.DatabaseHelper.createTld; import static google.registry.testing.DatabaseHelper.loadRegistrar; -import static google.registry.testing.DatabaseHelper.newDomainBase; import static google.registry.testing.DatabaseHelper.persistResource; import static google.registry.testing.SqlHelper.getMostRecentRegistryLockByRepoId; import static google.registry.testing.SqlHelper.getRegistryLockByVerificationCode; @@ -34,7 +33,7 @@ import com.google.appengine.api.users.User; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.RegistryLock; import google.registry.request.JsonActionRunner; import google.registry.request.JsonResponse; @@ -46,6 +45,7 @@ import google.registry.request.auth.AuthenticatedRegistrarAccessor.Role; import google.registry.request.auth.UserAuthInfo; import google.registry.testing.AppEngineExtension; import google.registry.testing.CloudTasksHelper; +import google.registry.testing.DatabaseHelper; import google.registry.testing.DeterministicStringGenerator; import google.registry.testing.FakeClock; import google.registry.tools.DomainLockUtils; @@ -90,7 +90,7 @@ final class RegistryLockPostActionTest { private User userWithLockPermission; private InternetAddress outgoingAddress; - private DomainBase domain; + private Domain domain; private RegistryLockPostAction action; @Mock SendEmailService emailService; @@ -102,7 +102,7 @@ final class RegistryLockPostActionTest { userWithLockPermission = userFromRegistrarPoc(AppEngineExtension.makeRegistrarContact3()); userWithoutPermission = userFromRegistrarPoc(AppEngineExtension.makeRegistrarContact2()); createTld("tld"); - domain = persistResource(newDomainBase("example.tld")); + domain = persistResource(DatabaseHelper.newDomain("example.tld")); outgoingAddress = new InternetAddress("domain-registry@example.com"); @@ -414,7 +414,7 @@ final class RegistryLockPostActionTest { } private RegistryLock createLock() { - DomainBase domain = loadByForeignKey(DomainBase.class, "example.tld", clock.nowUtc()).get(); + Domain domain = loadByForeignKey(Domain.class, "example.tld", clock.nowUtc()).get(); return new RegistryLock.Builder() .setDomainName("example.tld") .isSuperuser(false) diff --git a/core/src/test/java/google/registry/ui/server/registrar/RegistryLockVerifyActionTest.java b/core/src/test/java/google/registry/ui/server/registrar/RegistryLockVerifyActionTest.java index 2de494ddf..79de64d27 100644 --- a/core/src/test/java/google/registry/ui/server/registrar/RegistryLockVerifyActionTest.java +++ b/core/src/test/java/google/registry/ui/server/registrar/RegistryLockVerifyActionTest.java @@ -18,7 +18,6 @@ import static com.google.common.truth.Truth.assertThat; import static google.registry.testing.DatabaseHelper.createTlds; import static google.registry.testing.DatabaseHelper.getOnlyHistoryEntryOfType; import static google.registry.testing.DatabaseHelper.loadByEntity; -import static google.registry.testing.DatabaseHelper.newDomainBase; import static google.registry.testing.DatabaseHelper.persistActiveHost; import static google.registry.testing.DatabaseHelper.persistResource; import static google.registry.testing.SqlHelper.getRegistryLockByVerificationCode; @@ -35,7 +34,7 @@ import com.google.appengine.api.users.UserServiceFactory; import com.google.common.collect.ImmutableMap; import google.registry.model.billing.BillingEvent; import google.registry.model.billing.BillingEvent.Reason; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.DomainHistory; import google.registry.model.domain.RegistryLock; import google.registry.model.host.HostResource; @@ -82,7 +81,7 @@ final class RegistryLockVerifyActionTest { new DeterministicStringGenerator(Alphabets.BASE_58); private FakeResponse response; - private DomainBase domain; + private Domain domain; private AuthResult authResult; private RegistryLockVerifyAction action; private CloudTasksHelper cloudTasksHelper = new CloudTasksHelper(fakeClock); @@ -91,7 +90,7 @@ final class RegistryLockVerifyActionTest { void beforeEach() { createTlds("tld", "net"); HostResource host = persistActiveHost("ns1.example.net"); - domain = persistResource(newDomainBase("example.tld", host)); + domain = persistResource(DatabaseHelper.newDomain("example.tld", host)); when(request.getRequestURI()).thenReturn("https://registry.example/registry-lock-verification"); action = createAction(lockId, true); } @@ -303,7 +302,7 @@ final class RegistryLockVerifyActionTest { .build(); } - private DomainBase reloadDomain() { + private Domain reloadDomain() { return loadByEntity(domain); } diff --git a/core/src/test/java/google/registry/webdriver/RegistrarConsoleScreenshotTest.java b/core/src/test/java/google/registry/webdriver/RegistrarConsoleScreenshotTest.java index f3336ab2e..1c690cd42 100644 --- a/core/src/test/java/google/registry/webdriver/RegistrarConsoleScreenshotTest.java +++ b/core/src/test/java/google/registry/webdriver/RegistrarConsoleScreenshotTest.java @@ -21,7 +21,6 @@ import static google.registry.testing.AppEngineExtension.makeRegistrar2; import static google.registry.testing.AppEngineExtension.makeRegistrarContact2; import static google.registry.testing.DatabaseHelper.createTld; import static google.registry.testing.DatabaseHelper.loadRegistrar; -import static google.registry.testing.DatabaseHelper.newDomainBase; import static google.registry.testing.DatabaseHelper.persistActiveDomain; import static google.registry.testing.DatabaseHelper.persistResource; import static google.registry.testing.SqlHelper.saveRegistryLock; @@ -30,7 +29,7 @@ import static google.registry.util.DateTimeUtils.START_OF_TIME; import com.google.common.collect.ImmutableMap; import com.googlecode.objectify.ObjectifyFilter; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.RegistryLock; import google.registry.model.ofy.OfyFilter; import google.registry.model.registrar.Registrar.State; @@ -39,6 +38,7 @@ import google.registry.module.frontend.FrontendServlet; import google.registry.server.RegistryTestServer; import google.registry.testing.AppEngineExtension; import google.registry.testing.CertificateSamples; +import google.registry.testing.DatabaseHelper; import java.util.Optional; import java.util.UUID; import org.junit.jupiter.api.extension.RegisterExtension; @@ -398,7 +398,7 @@ class RegistrarConsoleScreenshotTest extends WebDriverTestCase { server.runInAppEngineEnvironment( () -> { createTld("tld"); - persistResource(newDomainBase("example.tld")); + persistResource(DatabaseHelper.newDomain("example.tld")); saveRegistryLock( new RegistryLock.Builder() .setRegistrarPocId("johndoe@theregistrar.com") @@ -461,19 +461,19 @@ class RegistrarConsoleScreenshotTest extends WebDriverTestCase { () -> { createTld("tld"); // expired unlock request - DomainBase expiredUnlockRequestDomain = persistActiveDomain("expiredunlock.tld"); + Domain expiredUnlockRequestDomain = persistActiveDomain("expiredunlock.tld"); saveRegistryLock( createRegistryLock(expiredUnlockRequestDomain) .asBuilder() .setLockCompletionTime(START_OF_TIME.minusDays(1)) .setUnlockRequestTime(START_OF_TIME.minusDays(1)) .build()); - DomainBase domain = persistActiveDomain("example.tld"); + Domain domain = persistActiveDomain("example.tld"); saveRegistryLock(createRegistryLock(domain).asBuilder().isSuperuser(true).build()); - DomainBase otherDomain = persistActiveDomain("otherexample.tld"); + Domain otherDomain = persistActiveDomain("otherexample.tld"); saveRegistryLock(createRegistryLock(otherDomain)); // include one pending-lock domain - DomainBase pendingDomain = persistActiveDomain("pending.tld"); + Domain pendingDomain = persistActiveDomain("pending.tld"); saveRegistryLock( new RegistryLock.Builder() .setVerificationCode(UUID.randomUUID().toString()) @@ -484,9 +484,9 @@ class RegistrarConsoleScreenshotTest extends WebDriverTestCase { .setRepoId(pendingDomain.getRepoId()) .build()); // and one pending-unlock domain - DomainBase pendingUnlockDomain = + Domain pendingUnlockDomain = persistResource( - newDomainBase("pendingunlock.tld") + DatabaseHelper.newDomain("pendingunlock.tld") .asBuilder() .setStatusValues(REGISTRY_LOCK_STATUSES) .build()); @@ -558,19 +558,19 @@ class RegistrarConsoleScreenshotTest extends WebDriverTestCase { private void createDomainAndSaveLock() { createTld("tld"); - DomainBase domainBase = persistActiveDomain("example.tld"); - saveRegistryLock(createRegistryLock(domainBase)); + Domain domain = persistActiveDomain("example.tld"); + saveRegistryLock(createRegistryLock(domain)); } - private RegistryLock createRegistryLock(DomainBase domainBase) { + private RegistryLock createRegistryLock(Domain domain) { return new RegistryLock.Builder() .setVerificationCode(UUID.randomUUID().toString()) .isSuperuser(false) .setRegistrarId("TheRegistrar") .setRegistrarPocId("Marla.Singer@crr.com") .setLockCompletionTime(START_OF_TIME) - .setDomainName(domainBase.getDomainName()) - .setRepoId(domainBase.getRepoId()) + .setDomainName(domain.getDomainName()) + .setRepoId(domain.getRepoId()) .build(); } } diff --git a/core/src/test/java/google/registry/whois/DomainWhoisResponseTest.java b/core/src/test/java/google/registry/whois/DomainWhoisResponseTest.java index dab01953a..5fc824ed8 100644 --- a/core/src/test/java/google/registry/whois/DomainWhoisResponseTest.java +++ b/core/src/test/java/google/registry/whois/DomainWhoisResponseTest.java @@ -28,7 +28,7 @@ import google.registry.model.contact.ContactPhoneNumber; import google.registry.model.contact.ContactResource; import google.registry.model.contact.PostalInfo; import google.registry.model.domain.DesignatedContact; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.domain.GracePeriod; import google.registry.model.domain.rgp.GracePeriodStatus; import google.registry.model.domain.secdns.DelegationSignerData; @@ -57,7 +57,7 @@ class DomainWhoisResponseTest { private ContactResource adminContact; private ContactResource registrant; private ContactResource techContact; - private DomainBase domainBase; + private Domain domain; private final FakeClock clock = new FakeClock(DateTime.parse("2009-05-29T20:15:00Z")); @@ -246,9 +246,9 @@ class DomainWhoisResponseTest { VKey techResourceKey = techContact.createVKey(); String repoId = "3-TLD"; - domainBase = + domain = persistResource( - new DomainBase.Builder() + new Domain.Builder() .setDomainName("example.tld") .setRepoId(repoId) .setCreationRegistrarId("NewRegistrar") @@ -281,7 +281,7 @@ class DomainWhoisResponseTest { @Test void getPlainTextOutputTest() { DomainWhoisResponse domainWhoisResponse = - new DomainWhoisResponse(domainBase, false, "Please contact registrar", clock.nowUtc()); + new DomainWhoisResponse(domain, false, "Please contact registrar", clock.nowUtc()); assertThat( domainWhoisResponse.getResponse( false, @@ -293,7 +293,7 @@ class DomainWhoisResponseTest { void getPlainTextOutputTest_registrarAbuseInfoMissing() { persistResource(abuseContact.asBuilder().setVisibleInDomainWhoisAsAbuse(false).build()); DomainWhoisResponse domainWhoisResponse = - new DomainWhoisResponse(domainBase, false, "Please contact registrar", clock.nowUtc()); + new DomainWhoisResponse(domain, false, "Please contact registrar", clock.nowUtc()); assertThat( domainWhoisResponse.getResponse(false, "Footer")) .isEqualTo( @@ -304,7 +304,7 @@ class DomainWhoisResponseTest { @Test void getPlainTextOutputTest_fullOutput() { DomainWhoisResponse domainWhoisResponse = - new DomainWhoisResponse(domainBase, true, "Please contact registrar", clock.nowUtc()); + new DomainWhoisResponse(domain, true, "Please contact registrar", clock.nowUtc()); assertThat( domainWhoisResponse.getResponse( false, @@ -316,7 +316,7 @@ class DomainWhoisResponseTest { void addImplicitOkStatusTest() { DomainWhoisResponse domainWhoisResponse = new DomainWhoisResponse( - domainBase.asBuilder().setStatusValues(null).build(), + domain.asBuilder().setStatusValues(null).build(), false, "Contact the registrar", clock.nowUtc()); diff --git a/core/src/test/java/google/registry/whois/NameserverWhoisResponseTest.java b/core/src/test/java/google/registry/whois/NameserverWhoisResponseTest.java index 57d286d9e..a26267585 100644 --- a/core/src/test/java/google/registry/whois/NameserverWhoisResponseTest.java +++ b/core/src/test/java/google/registry/whois/NameserverWhoisResponseTest.java @@ -17,7 +17,6 @@ package google.registry.whois; import static com.google.common.truth.Truth.assertThat; import static google.registry.testing.DatabaseHelper.createTld; import static google.registry.testing.DatabaseHelper.loadRegistrar; -import static google.registry.testing.DatabaseHelper.newDomainBase; import static google.registry.testing.DatabaseHelper.persistNewRegistrar; import static google.registry.testing.DatabaseHelper.persistResource; import static google.registry.whois.WhoisTestData.loadFile; @@ -25,10 +24,11 @@ import static google.registry.whois.WhoisTestData.loadFile; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; import com.google.common.net.InetAddresses; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.host.HostResource; import google.registry.model.registrar.Registrar; import google.registry.testing.AppEngineExtension; +import google.registry.testing.DatabaseHelper; import google.registry.testing.FakeClock; import google.registry.whois.WhoisResponse.WhoisResponseResults; import org.joda.time.DateTime; @@ -53,7 +53,7 @@ class NameserverWhoisResponseTest { persistNewRegistrar("example", "Hänsel & Gretel Registrar, Inc.", Registrar.Type.REAL, 8L); persistResource(loadRegistrar("example").asBuilder().setUrl("http://my.fake.url").build()); createTld("tld"); - DomainBase domain = persistResource(newDomainBase("zobo.tld")); + Domain domain = persistResource(DatabaseHelper.newDomain("zobo.tld")); hostResource1 = new HostResource.Builder() diff --git a/core/src/test/java/google/registry/whois/WhoisActionTest.java b/core/src/test/java/google/registry/whois/WhoisActionTest.java index 4220a5ef1..d1327382c 100644 --- a/core/src/test/java/google/registry/whois/WhoisActionTest.java +++ b/core/src/test/java/google/registry/whois/WhoisActionTest.java @@ -26,7 +26,7 @@ import static google.registry.testing.DatabaseHelper.persistActiveDomain; import static google.registry.testing.DatabaseHelper.persistResource; import static google.registry.testing.DatabaseHelper.persistSimpleResources; import static google.registry.testing.FullFieldsTestEntityHelper.makeContactResource; -import static google.registry.testing.FullFieldsTestEntityHelper.makeDomainBase; +import static google.registry.testing.FullFieldsTestEntityHelper.makeDomain; import static google.registry.testing.FullFieldsTestEntityHelper.makeHostResource; import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrar; import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrarContacts; @@ -45,7 +45,7 @@ import com.google.appengine.api.datastore.DatastoreTimeoutException; import com.google.common.collect.ImmutableSet; import com.google.common.net.InetAddresses; import google.registry.model.contact.ContactResource; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.eppcommon.Trid; import google.registry.model.host.HostResource; import google.registry.model.ofy.Ofy; @@ -119,8 +119,8 @@ public class WhoisActionTest { assertThat(response.getPayload()).isEqualTo(loadFile("whois_action_no_command.txt")); } - private DomainBase makeDomainBaseWithRegistrar(Registrar registrar) { - return makeDomainBase( + private Domain makeDomainWithRegistrar(Registrar registrar) { + return makeDomain( "cat.lol", persistResource(makeContactResource("5372808-ERL", "Goblin Market", "lol@cat.lol")), persistResource(makeContactResource("5372808-IRL", "Santa Claus", "BOFH@cat.lol")), @@ -134,7 +134,7 @@ public class WhoisActionTest { void testRun_domainQuery_works() { Registrar registrar = persistResource(makeRegistrar("evilregistrar", "Yes Virginia", ACTIVE)); - persistResource(makeDomainBaseWithRegistrar(registrar)); + persistResource(makeDomainWithRegistrar(registrar)); persistSimpleResources(makeRegistrarContacts(registrar)); newWhoisAction("domain cat.lol\r\n").run(); assertThat(response.getStatus()).isEqualTo(200); @@ -145,11 +145,10 @@ public class WhoisActionTest { void testRun_domainQuery_usesCache() { Registrar registrar = persistResource(makeRegistrar("evilregistrar", "Yes Virginia", ACTIVE)); - persistResource(makeDomainBaseWithRegistrar(registrar)); + persistResource(makeDomainWithRegistrar(registrar)); persistSimpleResources(makeRegistrarContacts(registrar)); // Populate the cache for both the domain and contact. - DomainBase domain = - loadByForeignKeyCached(DomainBase.class, "cat.lol", clock.nowUtc()).get(); + Domain domain = loadByForeignKeyCached(Domain.class, "cat.lol", clock.nowUtc()).get(); ContactResource contact = loadByForeignKeyCached(ContactResource.class, "5372808-ERL", clock.nowUtc()).get(); // Make a change to the domain and contact that won't be seen because the cache will be hit. @@ -173,7 +172,7 @@ public class WhoisActionTest { void testRun_domainAfterTransfer_hasUpdatedEppTimeAndClientId() { Registrar registrar = persistResource(makeRegistrar("TheRegistrar", "Yes Virginia", ACTIVE)); persistResource( - makeDomainBaseWithRegistrar(registrar) + makeDomainWithRegistrar(registrar) .asBuilder() .setTransferData( new DomainTransferData.Builder() @@ -198,14 +197,15 @@ public class WhoisActionTest { void testRun_idnDomain_works() { Registrar registrar = persistResource(makeRegistrar( "evilregistrar", "Yes Virginia", ACTIVE)); - persistResource(makeDomainBase( - "cat.みんな", - persistResource(makeContactResource("5372808-ERL", "(◕‿◕)", "lol@cat.みんな")), - persistResource(makeContactResource("5372808-IRL", "Santa Claus", "BOFH@cat.みんな")), - persistResource(makeContactResource("5372808-TRL", "The Raven", "bog@cat.みんな")), - persistResource(makeHostResource("ns1.cat.みんな", "1.2.3.4")), - persistResource(makeHostResource("ns2.cat.みんな", "bad:f00d:cafe::15:beef")), - registrar)); + persistResource( + makeDomain( + "cat.みんな", + persistResource(makeContactResource("5372808-ERL", "(◕‿◕)", "lol@cat.みんな")), + persistResource(makeContactResource("5372808-IRL", "Santa Claus", "BOFH@cat.みんな")), + persistResource(makeContactResource("5372808-TRL", "The Raven", "bog@cat.みんな")), + persistResource(makeHostResource("ns1.cat.みんな", "1.2.3.4")), + persistResource(makeHostResource("ns2.cat.みんな", "bad:f00d:cafe::15:beef")), + registrar)); persistSimpleResources(makeRegistrarContacts(registrar)); newWhoisAction("domain cat.みんな\r\n").run(); assertThat(response.getStatus()).isEqualTo(200); @@ -216,14 +216,15 @@ public class WhoisActionTest { void testRun_punycodeDomain_works() { Registrar registrar = persistResource(makeRegistrar( "evilregistrar", "Yes Virginia", ACTIVE)); - persistResource(makeDomainBase( - "cat.みんな", - persistResource(makeContactResource("5372808-ERL", "(◕‿◕)", "lol@cat.みんな")), - persistResource(makeContactResource("5372808-IRL", "Santa Claus", "BOFH@cat.みんな")), - persistResource(makeContactResource("5372808-TRL", "The Raven", "bog@cat.みんな")), - persistResource(makeHostResource("ns1.cat.みんな", "1.2.3.4")), - persistResource(makeHostResource("ns2.cat.みんな", "bad:f00d:cafe::15:beef")), - registrar)); + persistResource( + makeDomain( + "cat.みんな", + persistResource(makeContactResource("5372808-ERL", "(◕‿◕)", "lol@cat.みんな")), + persistResource(makeContactResource("5372808-IRL", "Santa Claus", "BOFH@cat.みんな")), + persistResource(makeContactResource("5372808-TRL", "The Raven", "bog@cat.みんな")), + persistResource(makeHostResource("ns1.cat.みんな", "1.2.3.4")), + persistResource(makeHostResource("ns2.cat.みんな", "bad:f00d:cafe::15:beef")), + registrar)); persistSimpleResources(makeRegistrarContacts(registrar)); newWhoisAction("domain cat.xn--q9jyb4c\r\n").run(); assertThat(response.getStatus()).isEqualTo(200); @@ -240,7 +241,7 @@ public class WhoisActionTest { @Test void testRun_domainNotFound_usesCache() { // Populate the cache with the nonexistence of this domain. - assertThat(loadByForeignKeyCached(DomainBase.class, "cat.lol", clock.nowUtc())).isEmpty(); + assertThat(loadByForeignKeyCached(Domain.class, "cat.lol", clock.nowUtc())).isEmpty(); // Add a new valid cat.lol domain that won't be found because the cache will be hit instead. persistActiveDomain("cat.lol"); newWhoisAction("domain cat.lol\r\n").run(); @@ -255,14 +256,15 @@ public class WhoisActionTest { persistResource(Registry.get("lol").asBuilder().setTldType(Registry.TldType.TEST).build()); Registrar registrar = persistResource(makeRegistrar( "evilregistrar", "Yes Virginia", ACTIVE)); - persistResource(makeDomainBase( - "cat.lol", - persistResource(makeContactResource("5372808-ERL", "Goblin Market", "lol@cat.lol")), - persistResource(makeContactResource("5372808-IRL", "Santa Claus", "BOFH@cat.lol")), - persistResource(makeContactResource("5372808-TRL", "The Raven", "bog@cat.lol")), - persistResource(makeHostResource("ns1.cat.lol", "1.2.3.4")), - persistResource(makeHostResource("ns2.cat.lol", "bad:f00d:cafe::15:beef")), - registrar)); + persistResource( + makeDomain( + "cat.lol", + persistResource(makeContactResource("5372808-ERL", "Goblin Market", "lol@cat.lol")), + persistResource(makeContactResource("5372808-IRL", "Santa Claus", "BOFH@cat.lol")), + persistResource(makeContactResource("5372808-TRL", "The Raven", "bog@cat.lol")), + persistResource(makeHostResource("ns1.cat.lol", "1.2.3.4")), + persistResource(makeHostResource("ns2.cat.lol", "bad:f00d:cafe::15:beef")), + registrar)); persistSimpleResources(makeRegistrarContacts(registrar)); newWhoisAction("domain cat.lol\r\n").run(); assertThat(response.getStatus()).isEqualTo(200); @@ -272,18 +274,19 @@ public class WhoisActionTest { @Test void testRun_domainFlaggedAsDeletedInDatastore_isConsideredNotFound() { Registrar registrar; - persistResource(makeDomainBase("cat.lol", - persistResource( - makeContactResource("5372808-ERL", "Peter Murphy", "lol@cat.lol")), - persistResource( - makeContactResource("5372808-IRL", "Santa Claus", "BOFH@cat.lol")), - persistResource( - makeContactResource("5372808-TRL", "The Raven", "bog@cat.lol")), - persistResource(makeHostResource("ns1.cat.lol", "1.2.3.4")), - persistResource(makeHostResource("ns2.cat.lol", "bad:f00d:cafe::15:beef")), - persistResource( - (registrar = makeRegistrar("example", "Example Registrar", ACTIVE)))) - .asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build()); + persistResource( + makeDomain( + "cat.lol", + persistResource(makeContactResource("5372808-ERL", "Peter Murphy", "lol@cat.lol")), + persistResource(makeContactResource("5372808-IRL", "Santa Claus", "BOFH@cat.lol")), + persistResource(makeContactResource("5372808-TRL", "The Raven", "bog@cat.lol")), + persistResource(makeHostResource("ns1.cat.lol", "1.2.3.4")), + persistResource(makeHostResource("ns2.cat.lol", "bad:f00d:cafe::15:beef")), + persistResource( + (registrar = makeRegistrar("example", "Example Registrar", ACTIVE)))) + .asBuilder() + .setDeletionTime(clock.nowUtc().minusDays(1)) + .build()); persistSimpleResources(makeRegistrarContacts(registrar)); newWhoisAction("domain cat.lol\r\n").run(); assertThat(response.getStatus()).isEqualTo(200); @@ -297,32 +300,40 @@ public class WhoisActionTest { @Test void testRun_domainDeletedThenRecreated_isFound() { Registrar registrar; - DomainBase domain1 = persistResource(makeDomainBase("cat.lol", + Domain domain1 = persistResource( - makeContactResource("5372808-ERL", "Peter Murphy", "lol@cat.lol")), - persistResource( - makeContactResource("5372808-IRL", "Santa Claus", "BOFH@cat.lol")), - persistResource( - makeContactResource("5372808-TRL", "The Raven", "bog@cat.lol")), - persistResource(makeHostResource("ns1.cat.lol", "1.2.3.4")), - persistResource(makeHostResource("ns2.cat.lol", "bad:f00d:cafe::15:beef")), - persistResource( - makeRegistrar("example", "Example Registrar", ACTIVE))).asBuilder() + makeDomain( + "cat.lol", + persistResource( + makeContactResource("5372808-ERL", "Peter Murphy", "lol@cat.lol")), + persistResource( + makeContactResource("5372808-IRL", "Santa Claus", "BOFH@cat.lol")), + persistResource(makeContactResource("5372808-TRL", "The Raven", "bog@cat.lol")), + persistResource(makeHostResource("ns1.cat.lol", "1.2.3.4")), + persistResource(makeHostResource("ns2.cat.lol", "bad:f00d:cafe::15:beef")), + persistResource(makeRegistrar("example", "Example Registrar", ACTIVE))) + .asBuilder() .setCreationTimeForTest(clock.nowUtc().minusDays(2)) - .setDeletionTime(clock.nowUtc().minusDays(1)).build()); - DomainBase domain2 = persistResource(makeDomainBase("cat.lol", + .setDeletionTime(clock.nowUtc().minusDays(1)) + .build()); + Domain domain2 = persistResource( - makeContactResource( - "5372809-ERL", "Mrs. Alice Crypto", "alice@example.lol")), - persistResource( - makeContactResource("5372809-IRL", "Mr. Bob Crypto", "bob@example.lol")), - persistResource( - makeContactResource("5372809-TRL", "Dr. Pablo", "pmy@example.lol")), - persistResource(makeHostResource("ns1.google.lol", "9.9.9.9")), - persistResource(makeHostResource("ns2.google.lol", "4311::f143")), - persistResource((registrar = makeRegistrar( - "example", "Example Registrar", ACTIVE)))).asBuilder() - .setCreationTimeForTest(clock.nowUtc()).build()); + makeDomain( + "cat.lol", + persistResource( + makeContactResource( + "5372809-ERL", "Mrs. Alice Crypto", "alice@example.lol")), + persistResource( + makeContactResource("5372809-IRL", "Mr. Bob Crypto", "bob@example.lol")), + persistResource( + makeContactResource("5372809-TRL", "Dr. Pablo", "pmy@example.lol")), + persistResource(makeHostResource("ns1.google.lol", "9.9.9.9")), + persistResource(makeHostResource("ns2.google.lol", "4311::f143")), + persistResource( + (registrar = makeRegistrar("example", "Example Registrar", ACTIVE)))) + .asBuilder() + .setCreationTimeForTest(clock.nowUtc()) + .build()); persistSimpleResources(makeRegistrarContacts(registrar)); assertThat(domain1.getRepoId()).isNotEqualTo(domain2.getRepoId()); newWhoisAction("domain cat.lol\r\n").run(); @@ -523,13 +534,15 @@ public class WhoisActionTest { void testRun_multilevelDomain_isNotConsideredAHostname() { Registrar registrar = persistResource(makeRegistrar("example", "Example Registrar", ACTIVE)); - persistResource(makeDomainBase("cat.1.test", - persistResource(makeContactResource("5372808-ERL", "(◕‿◕)", "lol@cat.1.test")), - persistResource(makeContactResource("5372808-IRL", "Santa Claus", "BOFH@cat.1.test")), - persistResource(makeContactResource("5372808-TRL", "The Raven", "bog@cat.1.test")), - persistResource(makeHostResource("ns1.cat.1.test", "1.2.3.4")), - persistResource(makeHostResource("ns2.cat.1.test", "bad:f00d:cafe::15:beef")), - registrar)); + persistResource( + makeDomain( + "cat.1.test", + persistResource(makeContactResource("5372808-ERL", "(◕‿◕)", "lol@cat.1.test")), + persistResource(makeContactResource("5372808-IRL", "Santa Claus", "BOFH@cat.1.test")), + persistResource(makeContactResource("5372808-TRL", "The Raven", "bog@cat.1.test")), + persistResource(makeHostResource("ns1.cat.1.test", "1.2.3.4")), + persistResource(makeHostResource("ns2.cat.1.test", "bad:f00d:cafe::15:beef")), + registrar)); persistSimpleResources(makeRegistrarContacts(registrar)); newWhoisAction("domain cat.1.test\r\n").run(); diff --git a/core/src/test/java/google/registry/whois/WhoisCommandFactoryTest.java b/core/src/test/java/google/registry/whois/WhoisCommandFactoryTest.java index f45971184..99c2577dd 100644 --- a/core/src/test/java/google/registry/whois/WhoisCommandFactoryTest.java +++ b/core/src/test/java/google/registry/whois/WhoisCommandFactoryTest.java @@ -16,7 +16,6 @@ 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.newDomainBase; import static google.registry.testing.DatabaseHelper.newHostResource; import static google.registry.testing.DatabaseHelper.newRegistry; import static google.registry.testing.DatabaseHelper.persistNewRegistrar; @@ -25,10 +24,11 @@ import static google.registry.testing.DatabaseHelper.persistResource; import com.google.common.collect.ImmutableSet; import com.google.common.net.InternetDomainName; import google.registry.config.RegistryConfig; -import google.registry.model.domain.DomainBase; +import google.registry.model.domain.Domain; import google.registry.model.host.HostResource; import google.registry.model.registrar.Registrar; import google.registry.testing.AppEngineExtension; +import google.registry.testing.DatabaseHelper; import google.registry.testing.FakeClock; import google.registry.testing.TestCacheExtension; import java.net.InetAddress; @@ -52,7 +52,7 @@ class WhoisCommandFactoryTest { WhoisCommandFactory noncachedFactory = WhoisCommandFactory.createNonCached(); WhoisCommandFactory cachedFactory = WhoisCommandFactory.createCached(); - DomainBase domain; + Domain domain; HostResource host; Registrar otherRegistrar; @@ -67,7 +67,7 @@ class WhoisCommandFactoryTest { .setInetAddresses(ImmutableSet.of(InetAddress.getByName("1.2.3.4"))) .build(); persistResource(host); - domain = newDomainBase("example.tld", host); + domain = DatabaseHelper.newDomain("example.tld", host); persistResource(domain); otherRegistrar = persistNewRegistrar("OtherRegistrar"); otherRegistrar = diff --git a/core/src/test/java/google/registry/whois/WhoisHttpActionTest.java b/core/src/test/java/google/registry/whois/WhoisHttpActionTest.java index 9e5f1680a..1aa300f74 100644 --- a/core/src/test/java/google/registry/whois/WhoisHttpActionTest.java +++ b/core/src/test/java/google/registry/whois/WhoisHttpActionTest.java @@ -21,7 +21,7 @@ import static google.registry.testing.DatabaseHelper.loadRegistrar; import static google.registry.testing.DatabaseHelper.persistResource; import static google.registry.testing.DatabaseHelper.persistSimpleResources; import static google.registry.testing.FullFieldsTestEntityHelper.makeContactResource; -import static google.registry.testing.FullFieldsTestEntityHelper.makeDomainBase; +import static google.registry.testing.FullFieldsTestEntityHelper.makeDomain; import static google.registry.testing.FullFieldsTestEntityHelper.makeHostResource; import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrar; import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrarContacts; @@ -122,14 +122,15 @@ class WhoisHttpActionTest { persistResource(Registry.get("lol").asBuilder().setTldType(Registry.TldType.TEST).build()); Registrar registrar = persistResource(makeRegistrar( "evilregistrar", "Yes Virginia", Registrar.State.ACTIVE)); - persistResource(makeDomainBase( - "cat.lol", - persistResource(makeContactResource("5372808-ERL", "Goblin Market", "lol@cat.lol")), - persistResource(makeContactResource("5372808-IRL", "Santa Claus", "BOFH@cat.lol")), - persistResource(makeContactResource("5372808-TRL", "The Raven", "bog@cat.lol")), - persistResource(makeHostResource("ns1.cat.lol", "1.2.3.4")), - persistResource(makeHostResource("ns2.cat.lol", "bad:f00d:cafe::15:beef")), - registrar)); + persistResource( + makeDomain( + "cat.lol", + persistResource(makeContactResource("5372808-ERL", "Goblin Market", "lol@cat.lol")), + persistResource(makeContactResource("5372808-IRL", "Santa Claus", "BOFH@cat.lol")), + persistResource(makeContactResource("5372808-TRL", "The Raven", "bog@cat.lol")), + persistResource(makeHostResource("ns1.cat.lol", "1.2.3.4")), + persistResource(makeHostResource("ns2.cat.lol", "bad:f00d:cafe::15:beef")), + registrar)); persistSimpleResources(makeRegistrarContacts(registrar)); newWhoisHttpAction("/domain/cat.lol").run(); assertThat(response.getStatus()).isEqualTo(404); @@ -141,14 +142,15 @@ class WhoisHttpActionTest { void testRun_domainQueryIdn_works() { Registrar registrar = persistResource(makeRegistrar( "evilregistrar", "Yes Virginia", Registrar.State.ACTIVE)); - persistResource(makeDomainBase( - "cat.みんな", - persistResource(makeContactResource("5372808-ERL", "(◕‿◕)", "lol@cat.みんな")), - persistResource(makeContactResource("5372808-IRL", "Santa Claus", "BOFH@cat.みんな")), - persistResource(makeContactResource("5372808-TRL", "The Raven", "bog@cat.みんな")), - persistResource(makeHostResource("ns1.cat.みんな", "1.2.3.4")), - persistResource(makeHostResource("ns2.cat.みんな", "bad:f00d:cafe::15:beef")), - registrar)); + persistResource( + makeDomain( + "cat.みんな", + persistResource(makeContactResource("5372808-ERL", "(◕‿◕)", "lol@cat.みんな")), + persistResource(makeContactResource("5372808-IRL", "Santa Claus", "BOFH@cat.みんな")), + persistResource(makeContactResource("5372808-TRL", "The Raven", "bog@cat.みんな")), + persistResource(makeHostResource("ns1.cat.みんな", "1.2.3.4")), + persistResource(makeHostResource("ns2.cat.みんな", "bad:f00d:cafe::15:beef")), + registrar)); persistSimpleResources(makeRegistrarContacts(registrar)); newWhoisHttpAction("/domain/cat.みんな").run(); assertThat(response.getStatus()).isEqualTo(200); @@ -167,27 +169,32 @@ class WhoisHttpActionTest { .setOrg("Galactic\r\nEmpire") .build()) .build()); - persistResource(makeDomainBase( - "cat.みんな", trl, - trl, - trl, - persistResource(makeHostResource("ns1.cat.みんな", "1.2.3.4")), - persistResource(makeHostResource("ns2.cat.みんな", "bad:f00d:cafe::15:beef")), - persistResource(makeRegistrar("example", "Example Registrar", Registrar.State.ACTIVE)))); + persistResource( + makeDomain( + "cat.みんな", + trl, + trl, + trl, + persistResource(makeHostResource("ns1.cat.みんな", "1.2.3.4")), + persistResource(makeHostResource("ns2.cat.みんな", "bad:f00d:cafe::15:beef")), + persistResource( + makeRegistrar("example", "Example Registrar", Registrar.State.ACTIVE)))); newWhoisHttpAction("/domain/cat.みんな").run(); assertThat(response.getPayload()).contains("Galactic Empire"); } @Test void testRun_domainOnly_works() { - persistResource(makeDomainBase( - "cat.みんな", - persistResource(makeContactResource("5372808-ERL", "(◕‿◕)", "lol@cat.みんな")), - persistResource(makeContactResource("5372808-IRL", "Operator", "BOFH@cat.みんな")), - persistResource(makeContactResource("5372808-TRL", "Eric Schmidt", "bog@cat.みんな")), - persistResource(makeHostResource("ns1.cat.みんな", "1.2.3.4")), - persistResource(makeHostResource("ns2.cat.みんな", "bad:f00d:cafe::15:beef")), - persistResource(makeRegistrar("example", "Example Registrar", Registrar.State.ACTIVE)))); + persistResource( + makeDomain( + "cat.みんな", + persistResource(makeContactResource("5372808-ERL", "(◕‿◕)", "lol@cat.みんな")), + persistResource(makeContactResource("5372808-IRL", "Operator", "BOFH@cat.みんな")), + persistResource(makeContactResource("5372808-TRL", "Eric Schmidt", "bog@cat.みんな")), + persistResource(makeHostResource("ns1.cat.みんな", "1.2.3.4")), + persistResource(makeHostResource("ns2.cat.みんな", "bad:f00d:cafe::15:beef")), + persistResource( + makeRegistrar("example", "Example Registrar", Registrar.State.ACTIVE)))); newWhoisHttpAction("cat.みんな").run(); assertThat(response.getStatus()).isEqualTo(200); assertThat(response.getPayload()).contains("Domain Name: cat.みんな\r\n"); @@ -204,14 +211,15 @@ class WhoisHttpActionTest { void testRun_domainQueryPunycode_works() { Registrar registrar = persistResource(makeRegistrar( "evilregistrar", "Yes Virginia", Registrar.State.ACTIVE)); - persistResource(makeDomainBase( - "cat.みんな", - persistResource(makeContactResource("5372808-ERL", "(◕‿◕)", "lol@cat.みんな")), - persistResource(makeContactResource("5372808-IRL", "Santa Claus", "BOFH@cat.みんな")), - persistResource(makeContactResource("5372808-TRL", "The Raven", "bog@cat.みんな")), - persistResource(makeHostResource("ns1.cat.みんな", "1.2.3.4")), - persistResource(makeHostResource("ns2.cat.みんな", "bad:f00d:cafe::15:beef")), - registrar)); + persistResource( + makeDomain( + "cat.みんな", + persistResource(makeContactResource("5372808-ERL", "(◕‿◕)", "lol@cat.みんな")), + persistResource(makeContactResource("5372808-IRL", "Santa Claus", "BOFH@cat.みんな")), + persistResource(makeContactResource("5372808-TRL", "The Raven", "bog@cat.みんな")), + persistResource(makeHostResource("ns1.cat.みんな", "1.2.3.4")), + persistResource(makeHostResource("ns2.cat.みんな", "bad:f00d:cafe::15:beef")), + registrar)); persistSimpleResources(makeRegistrarContacts(registrar)); newWhoisHttpAction("/domain/cat.xn--q9jyb4c").run(); assertThat(response.getPayload()).isEqualTo(loadFile("whois_action_idn_utf8.txt")); @@ -269,28 +277,32 @@ class WhoisHttpActionTest { @Test void testRun_uppercaseDomain_ignoresCasing() { - persistResource(makeDomainBase( - "cat.lol", - persistResource(makeContactResource("5372808-ERL", "Peter Murphy", "lol@cat.lol")), - persistResource(makeContactResource("5372808-IRL", "Operator", "BOFH@cat.lol")), - persistResource(makeContactResource("5372808-TRL", "Eric Schmidt", "bog@cat.lol")), - persistResource(makeHostResource("ns1.cat.lol", "1.2.3.4")), - persistResource(makeHostResource("ns2.cat.lol", "bad:f00d:cafe::15:beef")), - persistResource(makeRegistrar("example", "Example Registrar", Registrar.State.ACTIVE)))); + persistResource( + makeDomain( + "cat.lol", + persistResource(makeContactResource("5372808-ERL", "Peter Murphy", "lol@cat.lol")), + persistResource(makeContactResource("5372808-IRL", "Operator", "BOFH@cat.lol")), + persistResource(makeContactResource("5372808-TRL", "Eric Schmidt", "bog@cat.lol")), + persistResource(makeHostResource("ns1.cat.lol", "1.2.3.4")), + persistResource(makeHostResource("ns2.cat.lol", "bad:f00d:cafe::15:beef")), + persistResource( + makeRegistrar("example", "Example Registrar", Registrar.State.ACTIVE)))); newWhoisHttpAction("/domain/cat.LOL").run(); assertThat(response.getPayload()).contains("Domain Name: cat.lol\r\n"); } @Test void testRun_hairyPath_getsDecoded() { - persistResource(makeDomainBase( - "cat.lol", - persistResource(makeContactResource("5372808-ERL", "Peter Murphy", "lol@cat.lol")), - persistResource(makeContactResource("5372808-IRL", "Operator", "BOFH@cat.lol")), - persistResource(makeContactResource("5372808-TRL", "Eric Schmidt", "bog@cat.lol")), - persistResource(makeHostResource("ns1.cat.lol", "1.2.3.4")), - persistResource(makeHostResource("ns2.cat.lol", "bad:f00d:cafe::15:beef")), - persistResource(makeRegistrar("example", "Example Registrar", Registrar.State.ACTIVE)))); + persistResource( + makeDomain( + "cat.lol", + persistResource(makeContactResource("5372808-ERL", "Peter Murphy", "lol@cat.lol")), + persistResource(makeContactResource("5372808-IRL", "Operator", "BOFH@cat.lol")), + persistResource(makeContactResource("5372808-TRL", "Eric Schmidt", "bog@cat.lol")), + persistResource(makeHostResource("ns1.cat.lol", "1.2.3.4")), + persistResource(makeHostResource("ns2.cat.lol", "bad:f00d:cafe::15:beef")), + persistResource( + makeRegistrar("example", "Example Registrar", Registrar.State.ACTIVE)))); // python -c "print ''.join('%' + hex(ord(c))[2:] for c in 'cat.lol')" newWhoisHttpAction("/domain/%63%61%74%2e%6c%6f%6c").run(); assertThat(response.getPayload()).contains("Domain Name: cat.lol\r\n"); diff --git a/core/src/test/resources/google/registry/beam/invoicing/billing_events_test.sql b/core/src/test/resources/google/registry/beam/invoicing/billing_events_test.sql index 4d37e58e4..e20cff107 100644 --- a/core/src/test/resources/google/registry/beam/invoicing/billing_events_test.sql +++ b/core/src/test/resources/google/registry/beam/invoicing/billing_events_test.sql @@ -40,7 +40,6 @@ FROM ( SPLIT(cost, ' ')[OFFSET(1)] AS amount, -- Extract everything after the first dot in the domain as the TLD REGEXP_EXTRACT(targetId, r'[.](.+)') AS tld, - -- __key__.path looks like '"DomainBase", "", ...' REGEXP_REPLACE(SPLIT(__key__.path, ', ')[OFFSET(1)], '"', '') AS domainRepoId, COALESCE(cancellationMatchingBillingEvent.path, diff --git a/core/src/test/resources/google/registry/export/backup_kinds.txt b/core/src/test/resources/google/registry/export/backup_kinds.txt index a6383d3ad..bffcd77bb 100644 --- a/core/src/test/resources/google/registry/export/backup_kinds.txt +++ b/core/src/test/resources/google/registry/export/backup_kinds.txt @@ -1,7 +1,7 @@ AllocationToken Cancellation ContactResource -DomainBase +Domain EntityGroupRoot EppResourceIndex ForeignKeyContactIndex diff --git a/core/src/test/resources/google/registry/export/datastore/entity_filter.json b/core/src/test/resources/google/registry/export/datastore/entity_filter.json index bbc986ba0..26e836fee 100644 --- a/core/src/test/resources/google/registry/export/datastore/entity_filter.json +++ b/core/src/test/resources/google/registry/export/datastore/entity_filter.json @@ -2,6 +2,6 @@ "kinds": [ "Registry", "Registrar", - "DomainBase" + "Domain" ] } diff --git a/core/src/test/resources/google/registry/export/datastore/export_request_content.json b/core/src/test/resources/google/registry/export/datastore/export_request_content.json index 23bbee1bc..9c52b578d 100644 --- a/core/src/test/resources/google/registry/export/datastore/export_request_content.json +++ b/core/src/test/resources/google/registry/export/datastore/export_request_content.json @@ -1,6 +1,6 @@ { "entityFilter": { - "kinds": ["Registry", "Registrar", "DomainBase"] + "kinds": ["Registry", "Registrar", "Domain"] }, "outputUrlPrefix": "gs://mybucket/path" } diff --git a/core/src/test/resources/google/registry/export/datastore/metadata.json b/core/src/test/resources/google/registry/export/datastore/metadata.json index 082d6be92..719064f86 100644 --- a/core/src/test/resources/google/registry/export/datastore/metadata.json +++ b/core/src/test/resources/google/registry/export/datastore/metadata.json @@ -18,7 +18,7 @@ "kinds": [ "Registry", "Registrar", - "DomainBase" + "Domain" ] }, "outputUrlPrefix": "gs://domain-registry-alpha-datastore-export-test/2018-10-29T16:01:04_99364" diff --git a/core/src/test/resources/google/registry/export/datastore/operation.json b/core/src/test/resources/google/registry/export/datastore/operation.json index 0d3477253..9d0a3aeef 100644 --- a/core/src/test/resources/google/registry/export/datastore/operation.json +++ b/core/src/test/resources/google/registry/export/datastore/operation.json @@ -11,7 +11,7 @@ "kinds": [ "Registry", "Registrar", - "DomainBase" + "Domain" ] }, "outputUrlPrefix": "gs://domain-registry-alpha-datastore-export-test/2018-10-29T16:01:04_99364" diff --git a/core/src/test/resources/google/registry/export/datastore/operation_list.json b/core/src/test/resources/google/registry/export/datastore/operation_list.json index 7d464c083..14b708922 100644 --- a/core/src/test/resources/google/registry/export/datastore/operation_list.json +++ b/core/src/test/resources/google/registry/export/datastore/operation_list.json @@ -17,7 +17,7 @@ "kinds": [ "Registry", "Registrar", - "DomainBase" + "Domain" ] }, "outputUrlPrefix": "gs://domain-registry-alpha-datastore-export-test/2018-10-29T16:01:04_99364" @@ -45,7 +45,7 @@ "kinds": [ "Registry", "Registrar", - "DomainBase" + "Domain" ] }, "outputUrlPrefix": "gs://domain-registry-alpha-datastore-export-test/2018-10-29T16:01:04_99364" diff --git a/core/src/test/resources/google/registry/export/datastore/prettyprinted_operation.json b/core/src/test/resources/google/registry/export/datastore/prettyprinted_operation.json index 73f2f9c87..67967e7ba 100644 --- a/core/src/test/resources/google/registry/export/datastore/prettyprinted_operation.json +++ b/core/src/test/resources/google/registry/export/datastore/prettyprinted_operation.json @@ -7,7 +7,7 @@ "state" : "PROCESSING" }, "entityFilter" : { - "kinds" : [ "Registry", "Registrar", "DomainBase" ] + "kinds" : [ "Registry", "Registrar", "Domain" ] }, "outputUrlPrefix" : "gs://domain-registry-alpha-datastore-export-test/2018-10-29T16:01:04_99364", "@type" : "type.googleapis.com/google.datastore.admin.v1.ExportEntitiesMetadata" diff --git a/core/src/test/resources/google/registry/export/reporting_kinds.txt b/core/src/test/resources/google/registry/export/reporting_kinds.txt index 0da4a0557..c53895796 100644 --- a/core/src/test/resources/google/registry/export/reporting_kinds.txt +++ b/core/src/test/resources/google/registry/export/reporting_kinds.txt @@ -1,7 +1,7 @@ AllocationToken Cancellation ContactResource -DomainBase +Domain EppResourceIndex ForeignKeyContactIndex ForeignKeyDomainIndex diff --git a/core/src/test/resources/google/registry/model/schema.txt b/core/src/test/resources/google/registry/model/schema.txt index bdb70e207..61bdb5191 100644 --- a/core/src/test/resources/google/registry/model/schema.txt +++ b/core/src/test/resources/google/registry/model/schema.txt @@ -97,10 +97,7 @@ enum google.registry.model.contact.PostalInfo$Type { INTERNATIONALIZED; LOCALIZED; } -class google.registry.model.domain.DomainAuthInfo { - google.registry.model.eppcommon.AuthInfo$PasswordAuth pw; -} -class google.registry.model.domain.DomainBase { +class google.registry.model.domain.Domain { @Id java.lang.String repoId; google.registry.model.domain.DomainAuthInfo authInfo; google.registry.model.domain.launch.LaunchNotice launchNotice; @@ -129,6 +126,9 @@ class google.registry.model.domain.DomainBase { org.joda.time.DateTime lastTransferTime; org.joda.time.DateTime registrationExpirationTime; } +class google.registry.model.domain.DomainAuthInfo { + google.registry.model.eppcommon.AuthInfo$PasswordAuth pw; +} class google.registry.model.domain.DomainContent { @Id java.lang.String repoId; google.registry.model.domain.DomainAuthInfo authInfo; @@ -291,7 +291,7 @@ class google.registry.model.eppcommon.Trid { } class google.registry.model.host.HostBase { @Id java.lang.String repoId; - google.registry.persistence.VKey superordinateDomain; + google.registry.persistence.VKey superordinateDomain; java.lang.String creationClientId; java.lang.String currentSponsorClientId; java.lang.String fullyQualifiedHostName; @@ -321,7 +321,7 @@ class google.registry.model.host.HostHistory { } class google.registry.model.host.HostResource { @Id java.lang.String repoId; - google.registry.persistence.VKey superordinateDomain; + google.registry.persistence.VKey superordinateDomain; java.lang.String creationClientId; java.lang.String currentSponsorClientId; java.lang.String fullyQualifiedHostName; diff --git a/core/src/test/resources/google/registry/reporting/icann/attempted_adds_test.sql b/core/src/test/resources/google/registry/reporting/icann/attempted_adds_test.sql deleted file mode 100644 index 031b701c7..000000000 --- a/core/src/test/resources/google/registry/reporting/icann/attempted_adds_test.sql +++ /dev/null @@ -1,73 +0,0 @@ -#standardSQL - -- Copyright 2017 The Nomulus Authors. All Rights Reserved. - -- - -- Licensed under the Apache License, Version 2.0 (the "License"); - -- you may not use this file except in compliance with the License. - -- You may obtain a copy of the License at - -- - -- http://www.apache.org/licenses/LICENSE-2.0 - -- - -- Unless required by applicable law or agreed to in writing, software - -- distributed under the License is distributed on an "AS IS" BASIS, - -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - -- See the License for the specific language governing permissions and - -- limitations under the License. - - -- Determine the number of attempted adds each registrar made. - - -- Since the specification requests all 'attempted' adds, we regex the - -- monthly App Engine logs, searching for all create commands and associating - -- them with their corresponding registrars. - - -- Example log generated by FlowReporter in App Engine logs: - --google.registry.flows.FlowReporter - -- recordToLogs: FLOW-LOG-SIGNATURE-METADATA: - --{"serverTrid":"oNwL2J2eRya7bh7c9oHIzg==-2360a","clientId":"ipmirror" - -- ,"commandType":"hello", "resourceType":"","flowClassName":"HelloFlow" - -- ,"targetId":"","targetIds":[],"tld":"", - -- "tlds":[],"icannActivityReportField":""} - --- This outer select just converts the registrar's clientId to their name. -SELECT - tld, - registrar_table.registrarName AS registrar_name, - 'ATTEMPTED_ADDS' AS metricName, - count AS metricValue -FROM ( - SELECT - JSON_EXTRACT_SCALAR(json, '$.tld') AS tld, - JSON_EXTRACT_SCALAR(json, '$.clientId') AS clientId, - COUNT(json) AS count - FROM ( - -- Extract JSON metadata package from monthly logs - SELECT - REGEXP_EXTRACT(logMessages, r'FLOW-LOG-SIGNATURE-METADATA: (.*)\n?$') - AS json - FROM ( - SELECT - protoPayload.resource AS requestPath, - ARRAY( - SELECT logMessage - FROM UNNEST(protoPayload.line)) AS logMessage - FROM - `domain-registry-alpha.appengine_logs.appengine_googleapis_com_request_log_*` - WHERE _TABLE_SUFFIX - BETWEEN '20170901' - AND '20170930') - JOIN UNNEST(logMessage) AS logMessages - -- Look for metadata logs from epp and registrar console requests - WHERE requestPath IN ('/_dr/epp', '/_dr/epptool', '/registrar-xhr') - AND STARTS_WITH(logMessages, "google.registry.flows.FlowReporter recordToLogs: FLOW-LOG-SIGNATURE-METADATA") - -- Look for domain creates - AND REGEXP_CONTAINS( - logMessages, r'"commandType":"create","resourceType":"domain"') - -- Filter prober data - AND NOT REGEXP_CONTAINS( - logMessages, r'"prober-[a-z]{2}-((any)|(canary))"') ) - GROUP BY tld, clientId ) AS logs_table -JOIN - `domain-registry-alpha.latest_datastore_export.Registrar` - AS registrar_table -ON logs_table.clientId = registrar_table.__key__.name -ORDER BY tld, registrar_name - diff --git a/core/src/test/resources/google/registry/reporting/icann/registrar_iana_id_test.sql b/core/src/test/resources/google/registry/reporting/icann/registrar_iana_id_test.sql deleted file mode 100644 index 7b6db0947..000000000 --- a/core/src/test/resources/google/registry/reporting/icann/registrar_iana_id_test.sql +++ /dev/null @@ -1,30 +0,0 @@ -#standardSQL - -- Copyright 2017 The Nomulus Authors. All Rights Reserved. - -- - -- Licensed under the Apache License, Version 2.0 (the "License"); - -- you may not use this file except in compliance with the License. - -- You may obtain a copy of the License at - -- - -- http://www.apache.org/licenses/LICENSE-2.0 - -- - -- Unless required by applicable law or agreed to in writing, software - -- distributed under the License is distributed on an "AS IS" BASIS, - -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - -- See the License for the specific language governing permissions and - -- limitations under the License. - - -- Gather a list of all tld-registrar pairs, with their IANA IDs. - - -- This establishes which registrars will appear in the reports. - -SELECT - allowed_tlds AS tld, - registrarName AS registrar_name, - ianaIdentifier AS iana_id -FROM - `domain-registry-alpha.latest_datastore_export.Registrar`, - UNNEST(allowedTlds) as allowed_tlds -WHERE (type = 'REAL' OR type = 'INTERNAL') --- Filter out prober data -AND NOT ENDS_WITH(allowed_tlds, ".test") -ORDER BY tld, registrarName diff --git a/core/src/test/resources/google/registry/reporting/icann/total_domains_test.sql b/core/src/test/resources/google/registry/reporting/icann/total_domains_test.sql deleted file mode 100644 index 8c82118c6..000000000 --- a/core/src/test/resources/google/registry/reporting/icann/total_domains_test.sql +++ /dev/null @@ -1,37 +0,0 @@ -#standardSQL - -- Copyright 2017 The Nomulus Authors. All Rights Reserved. - -- - -- Licensed under the Apache License, Version 2.0 (the "License"); - -- you may not use this file except in compliance with the License. - -- You may obtain a copy of the License at - -- - -- http://www.apache.org/licenses/LICENSE-2.0 - -- - -- Unless required by applicable law or agreed to in writing, software - -- distributed under the License is distributed on an "AS IS" BASIS, - -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - -- See the License for the specific language governing permissions and - -- limitations under the License. - - -- Determine the number of domains each registrar sponsors per tld. - - -- This is just the number of fullyQualifiedDomainNames under each - -- tld-registrar pair. - -SELECT - tld, - registrarName as registrar_name, - 'TOTAL_DOMAINS' as metricName, - COUNT(fullyQualifiedDomainName) as metricValue -FROM - `domain-registry-alpha.latest_datastore_export.DomainBase` - AS domain_table -JOIN - `domain-registry-alpha.latest_datastore_export.Registrar` - AS registrar_table -ON - currentSponsorClientId = registrar_table.__key__.name -WHERE - registrar_table.type = 'REAL' OR registrar_table.type = 'INTERNAL' -GROUP BY tld, registrarName -ORDER BY tld, registrarName diff --git a/core/src/test/resources/google/registry/reporting/icann/total_nameservers_test.sql b/core/src/test/resources/google/registry/reporting/icann/total_nameservers_test.sql deleted file mode 100644 index a81ecbd56..000000000 --- a/core/src/test/resources/google/registry/reporting/icann/total_nameservers_test.sql +++ /dev/null @@ -1,55 +0,0 @@ -#standardSQL - -- Copyright 2017 The Nomulus Authors. All Rights Reserved. - -- - -- Licensed under the Apache License, Version 2.0 (the "License"); - -- you may not use this file except in compliance with the License. - -- You may obtain a copy of the License at - -- - -- http://www.apache.org/licenses/LICENSE-2.0 - -- - -- Unless required by applicable law or agreed to in writing, software - -- distributed under the License is distributed on an "AS IS" BASIS, - -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - -- See the License for the specific language governing permissions and - -- limitations under the License. - - -- Determine the number of referenced nameservers for a registrar's domains. - - -- We count the number of unique hosts under each tld-registrar combo by - -- collecting all domains' listed hosts that were still valid at the - -- end of the reporting month. - -SELECT - tld, - registrarName AS registrar_name, - 'TOTAL_NAMESERVERS' AS metricName, - COUNT(fullyQualifiedHostName) AS metricValue -FROM - `domain-registry-alpha.latest_datastore_export.HostResource` AS host_table -JOIN ( - SELECT - __key__.name AS clientId, - registrarName - FROM - `domain-registry-alpha.latest_datastore_export.Registrar` - WHERE - type = 'REAL' - OR type = 'INTERNAL') AS registrar_table -ON - currentSponsorClientId = registrar_table.clientId -JOIN ( - SELECT - tld, - hosts.name AS referencedHostName - FROM - `domain-registry-alpha.latest_datastore_export.DomainBase`, - UNNEST(nsHosts) AS hosts - WHERE creationTime <= TIMESTAMP("2017-09-30 23:59:59.999") - AND deletionTime > TIMESTAMP("2017-09-30 23:59:59.999") ) AS domain_table -ON - host_table.__key__.name = domain_table.referencedHostName -WHERE creationTime <= TIMESTAMP("2017-09-30 23:59:59.999") -AND deletionTime > TIMESTAMP("2017-09-30 23:59:59.999") -GROUP BY tld, registrarName -ORDER BY tld, registrarName - diff --git a/core/src/test/resources/google/registry/reporting/icann/transaction_counts_test.sql b/core/src/test/resources/google/registry/reporting/icann/transaction_counts_test.sql deleted file mode 100644 index f7becd54d..000000000 --- a/core/src/test/resources/google/registry/reporting/icann/transaction_counts_test.sql +++ /dev/null @@ -1,85 +0,0 @@ -#standardSQL - -- Copyright 2017 The Nomulus Authors. All Rights Reserved. - -- - -- Licensed under the Apache License, Version 2.0 (the "License"); - -- you may not use this file except in compliance with the License. - -- You may obtain a copy of the License at - -- - -- http://www.apache.org/licenses/LICENSE-2.0 - -- - -- Unless required by applicable law or agreed to in writing, software - -- distributed under the License is distributed on an "AS IS" BASIS, - -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - -- See the License for the specific language governing permissions and - -- limitations under the License. - - -- Counts the number of mutating transactions each registrar made. - - -- We populate the fields through explicit logging of - -- DomainTransactionRecords, which contain all necessary information for - -- reporting (such as reporting time, report field, report amount, etc. - - -- A special note on transfers: we only record 'TRANSFER_SUCCESSFUL' or - -- 'TRANSFER_NACKED', and we can infer the gaining and losing parties - -- from the enclosing HistoryEntry's clientId and otherClientId - -- respectively. This query templates the client ID, field for transfer - -- success, field for transfer nacks and default field. This allows us to - -- create one query for TRANSFER_GAINING and the other report fields, - -- and one query for TRANSFER_LOSING fields from the same template. - --- This outer select just converts the registrar's clientId to their name. -SELECT - tld, - registrar_table.registrarName AS registrar_name, - metricName, - metricValue -FROM ( - SELECT - tld, - clientId, - CASE - WHEN field = 'TRANSFER_SUCCESSFUL' THEN 'TRANSFER_GAINING_SUCCESSFUL' - WHEN field = 'TRANSFER_NACKED' THEN 'TRANSFER_GAINING_NACKED' - ELSE field - END AS metricName, - SUM(amount) AS metricValue - FROM ( - SELECT - CASE - -- Explicit transfer acks (approve) and nacks (reject) are done - -- by the opposing registrar. Thus, for these specific actions, - -- we swap the 'otherClientId' with the 'clientId' to properly - -- account for this reversal. - WHEN (entries.type = 'DOMAIN_TRANSFER_APPROVE' - OR entries.type = 'DOMAIN_TRANSFER_REJECT') - THEN entries.otherClientId - ELSE entries.clientId - END AS clientId, - entries.domainTransactionRecords.tld[SAFE_OFFSET(index)] AS tld, - entries.domainTransactionRecords.reportingTime[SAFE_OFFSET(index)] - AS reportingTime, - entries.domainTransactionRecords.reportField[SAFE_OFFSET(index)] - AS field, - entries.domainTransactionRecords.reportAmount[SAFE_OFFSET(index)] - AS amount - FROM - `domain-registry-alpha.latest_datastore_export.HistoryEntry` - AS entries, - -- This allows us to 'loop' through the arrays in parallel by index - UNNEST(GENERATE_ARRAY(0, ARRAY_LENGTH( - entries.domainTransactionRecords.tld) - 1)) AS index - -- Ignore null entries - WHERE entries.domainTransactionRecords IS NOT NULL ) - -- Only look at this month's data - WHERE reportingTime - BETWEEN TIMESTAMP('2017-09-01 00:00:00.000') - AND TIMESTAMP('2017-09-30 23:59:59.999') - GROUP BY - tld, - clientId, - field ) AS counts_table -JOIN - `domain-registry-alpha.latest_datastore_export.Registrar` - AS registrar_table -ON - counts_table.clientId = registrar_table.__key__.name diff --git a/core/src/test/resources/google/registry/reporting/icann/transactions_report_aggregation_test.sql b/core/src/test/resources/google/registry/reporting/icann/transactions_report_aggregation_test.sql deleted file mode 100644 index 523b3f702..000000000 --- a/core/src/test/resources/google/registry/reporting/icann/transactions_report_aggregation_test.sql +++ /dev/null @@ -1,100 +0,0 @@ -#standardSQL - -- Copyright 2017 The Nomulus Authors. All Rights Reserved. - -- - -- Licensed under the Apache License, Version 2.0 (the "License"); - -- you may not use this file except in compliance with the License. - -- You may obtain a copy of the License at - -- - -- http://www.apache.org/licenses/LICENSE-2.0 - -- - -- Unless required by applicable law or agreed to in writing, software - -- distributed under the License is distributed on an "AS IS" BASIS, - -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - -- See the License for the specific language governing permissions and - -- limitations under the License. - - -- Construct the transaction reports' rows from the intermediary data views. - - -- This query pulls from all intermediary tables to create the activity - -- report csv, via a table transpose and sum over all activity report fields. - -SELECT - registrars.tld as tld, - -- Surround registrar names with quotes to handle names containing a comma. - FORMAT("\"%s\"", registrars.registrar_name) as registrar_name, - registrars.iana_id as iana_id, - SUM(IF(metrics.metricName = 'TOTAL_DOMAINS', metrics.metricValue, 0)) AS total_domains, - SUM(IF(metrics.metricName = 'TOTAL_NAMESERVERS', metrics.metricValue, 0)) AS total_nameservers, - SUM(IF(metrics.metricName = 'NET_ADDS_1_YR', metrics.metricValue, 0)) AS net_adds_1_yr, - SUM(IF(metrics.metricName = 'NET_ADDS_2_YR', metrics.metricValue, 0)) AS net_adds_2_yr, - SUM(IF(metrics.metricName = 'NET_ADDS_3_YR', metrics.metricValue, 0)) AS net_adds_3_yr, - SUM(IF(metrics.metricName = 'NET_ADDS_4_YR', metrics.metricValue, 0)) AS net_adds_4_yr, - SUM(IF(metrics.metricName = 'NET_ADDS_5_YR', metrics.metricValue, 0)) AS net_adds_5_yr, - SUM(IF(metrics.metricName = 'NET_ADDS_6_YR', metrics.metricValue, 0)) AS net_adds_6_yr, - SUM(IF(metrics.metricName = 'NET_ADDS_7_YR', metrics.metricValue, 0)) AS net_adds_7_yr, - SUM(IF(metrics.metricName = 'NET_ADDS_8_YR', metrics.metricValue, 0)) AS net_adds_8_yr, - SUM(IF(metrics.metricName = 'NET_ADDS_9_YR', metrics.metricValue, 0)) AS net_adds_9_yr, - SUM(IF(metrics.metricName = 'NET_ADDS_10_Yr', metrics.metricValue, 0)) AS net_adds_10_yr, - SUM(IF(metrics.metricName = 'NET_RENEWS_1_YR', metrics.metricValue, 0)) AS net_renews_1_yr, - SUM(IF(metrics.metricName = 'NET_RENEWS_2_YR', metrics.metricValue, 0)) AS net_renews_2_yr, - SUM(IF(metrics.metricName = 'NET_RENEWS_3_YR', metrics.metricValue, 0)) AS net_renews_3_yr, - SUM(IF(metrics.metricName = 'NET_RENEWS_4_YR', metrics.metricValue, 0)) AS net_renews_4_yr, - SUM(IF(metrics.metricName = 'NET_RENEWS_5_YR', metrics.metricValue, 0)) AS net_renews_5_yr, - SUM(IF(metrics.metricName = 'NET_RENEWS_6_YR', metrics.metricValue, 0)) AS net_renews_6_yr, - SUM(IF(metrics.metricName = 'NET_RENEWS_7_YR', metrics.metricValue, 0)) AS net_renews_7_yr, - SUM(IF(metrics.metricName = 'NET_RENEWS_8_YR', metrics.metricValue, 0)) AS net_renews_8_yr, - SUM(IF(metrics.metricName = 'NET_RENEWS_9_YR', metrics.metricValue, 0)) AS net_renews_9_yr, - SUM(IF(metrics.metricName = 'NET_RENEWS_10_YR', metrics.metricValue, 0)) AS net_renews_10_yr, - SUM(IF(metrics.metricName = 'TRANSFER_GAINING_SUCCESSFUL', metrics.metricValue, 0)) AS transfer_gaining_successful, - SUM(IF(metrics.metricName = 'TRANSFER_GAINING_NACKED', metrics.metricValue, 0)) AS transfer_gaining_nacked, - SUM(IF(metrics.metricName = 'TRANSFER_LOSING_SUCCESSFUL', metrics.metricValue, 0)) AS transfer_losing_successful, - SUM(IF(metrics.metricName = 'TRANSFER_LOSING_NACKED', metrics.metricValue, 0)) AS transfer_losing_nacked, - -- We don't interact with transfer disputes - 0 AS transfer_disputed_won, - 0 AS transfer_disputed_lost, - 0 AS transfer_disputed_nodecision, - SUM(IF(metrics.metricName = 'DELETED_DOMAINS_GRACE', metrics.metricValue, 0)) AS deleted_domains_grace, - SUM(IF(metrics.metricName = 'DELETED_DOMAINS_NOGRACE', metrics.metricValue, 0)) AS deleted_domains_nograce, - SUM(IF(metrics.metricName = 'RESTORED_DOMAINS', metrics.metricValue, 0)) AS restored_domains, - -- We don't require restore reports - 0 AS restored_noreport, - -- We don't enforce AGP limits right now - 0 AS agp_exemption_requests, - 0 AS agp_exemptions_granted, - 0 AS agp_exempted_domains, - SUM(IF(metrics.metricName = 'ATTEMPTED_ADDS', metrics.metricValue, 0)) AS attempted_adds -FROM --- Only produce reports for real TLDs -(SELECT tldStr AS tld - FROM `domain-registry-alpha.latest_datastore_export.Registry` - WHERE tldType = 'REAL') AS registries -JOIN -(SELECT * - FROM `domain-registry-alpha.icann_reporting.registrar_iana_id_201709`) - AS registrars -ON registries.tld = registrars.tld --- We LEFT JOIN to produce reports even if the registrar made no transactions -LEFT OUTER JOIN ( - -- Gather all intermediary data views - SELECT * - FROM `domain-registry-alpha.icann_reporting.total_domains_201709` - UNION ALL - SELECT * - FROM `domain-registry-alpha.icann_reporting.total_nameservers_201709` - UNION ALL - SELECT * - FROM `domain-registry-alpha.icann_reporting.transaction_counts_201709` - UNION ALL - SELECT * - FROM `domain-registry-alpha.icann_reporting.transaction_transfer_losing_201709` - UNION ALL - SELECT * - FROM `domain-registry-alpha.icann_reporting.attempted_adds_201709` ) AS metrics --- Join on tld and registrar name -ON registrars.tld = metrics.tld -AND registrars.registrar_name = metrics.registrar_name -GROUP BY -tld, registrar_name, iana_id -ORDER BY -tld, registrar_name - diff --git a/docs/architecture.md b/docs/architecture.md index c55587225..3a6d55d6b 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -335,7 +335,7 @@ registry codebase: exported. * `DomainApplicationIndex` -- These hold domain applications received during the sunrise period. -* `DomainBase` -- These hold the ICANN domain information. +* `Domain` -- These hold the ICANN domain information. * `DomainRecord` -- These are used during the DNS update process. * `EntityGroupRoot` -- There is only one EntityGroupRoot entity, which serves as the Datastore parent of many other entities. diff --git a/docs/code-structure.md b/docs/code-structure.md index 41c08230e..450e86610 100644 --- a/docs/code-structure.md +++ b/docs/code-structure.md @@ -142,7 +142,7 @@ encapsulate related values together. The classes that extend `EppResource` (along with the RFCs that define them) are as follows: -* `DomainBase` ([RFC 5731](https://tools.ietf.org/html/rfc5731)), further +* `Domain` ([RFC 5731](https://tools.ietf.org/html/rfc5731)), further broken down into: * `DomainApplication`, an application for a domain submitted during (e.g.) sunrise or landrush diff --git a/docs/developing.md b/docs/developing.md index c13bc8fbe..ca3fe0620 100644 --- a/docs/developing.md +++ b/docs/developing.md @@ -80,7 +80,7 @@ as follows: 6. Delete the old fields, their indexes, and the `@OnSave` method. 7. Deploy the new version of the app. The schema migration is now complete. -The migration away from using a wrapper class around Keys on `DomainBase` +The migration away from using a wrapper class around Keys on `Domain` objects is instructive as an example: * [Step diff --git a/python/google/registry/scripts/testdata/datastore-indexes.xml b/python/google/registry/scripts/testdata/datastore-indexes.xml index fee7c0dfe..8396becda 100644 --- a/python/google/registry/scripts/testdata/datastore-indexes.xml +++ b/python/google/registry/scripts/testdata/datastore-indexes.xml @@ -5,19 +5,19 @@ - + - + - + @@ -32,17 +32,17 @@ - + - + - + @@ -66,11 +66,11 @@ - + - +