1
0
mirror of https://github.com/google/nomulus synced 2026-02-08 22:10:28 +00:00

Rename DomainContent -> DomainBase (#1729)

* Rename DomainContent -> DomainBase

This is a follow-up to PR #1725 which renamed DomainBase to Domain. Now, the
class naming hierarchy has the same structure as ContactBase/HostBase.
This commit is contained in:
Ben McIlwain
2022-08-02 17:21:17 -04:00
committed by GitHub
parent 35530616d6
commit f6d2a7ff91
20 changed files with 131 additions and 138 deletions

View File

@@ -58,7 +58,7 @@ import google.registry.model.contact.ContactHistory;
import google.registry.model.contact.ContactResource;
import google.registry.model.domain.DesignatedContact;
import google.registry.model.domain.Domain;
import google.registry.model.domain.DomainContent;
import google.registry.model.domain.DomainBase;
import google.registry.model.domain.DomainHistory;
import google.registry.model.domain.Period;
import google.registry.model.eppcommon.Trid;
@@ -187,7 +187,7 @@ public class RdePipelineTest {
.build());
}
private DomainHistory persistDomainHistory(DomainContent domain) {
private DomainHistory persistDomainHistory(DomainBase domain) {
DomainTransactionRecord transactionRecord =
new DomainTransactionRecord.Builder()
.setTld("soy")

View File

@@ -28,7 +28,7 @@ import com.google.common.testing.TestLogHandler;
import google.registry.model.EppResource;
import google.registry.model.contact.ContactBase;
import google.registry.model.contact.ContactHistory;
import google.registry.model.domain.DomainContent;
import google.registry.model.domain.DomainBase;
import google.registry.model.domain.DomainHistory;
import google.registry.model.eppcommon.Trid;
import google.registry.model.eppinput.EppInput.ResourceCommandWrapper;
@@ -155,10 +155,10 @@ public abstract class ResourceFlowTestCase<F extends Flow, R extends EppResource
assertAboutImmutableObjects()
.that(contactHistory.getContactBase().get())
.hasFieldsEqualTo(resource);
} else if (resource instanceof DomainContent) {
} else if (resource instanceof DomainBase) {
DomainHistory domainHistory = (DomainHistory) historyEntry;
assertAboutImmutableObjects()
.that(domainHistory.getDomainContent().get())
.that(domainHistory.getDomainBase().get())
.isEqualExceptFields(resource, "gracePeriods", "dsData", "nsHosts");
} else if (resource instanceof HostBase) {
HostHistory hostHistory = (HostHistory) historyEntry;

View File

@@ -489,16 +489,16 @@ public class DomainSqlTest {
// reason is showing up as different.
assertEqualDomainExcept(persisted, "creationTime", "dsData", "gracePeriods");
// Verify that the DomainContent object from the history record sets the fields correctly.
// Verify that the DomainBase object from the history record sets the fields correctly.
DomainHistory persistedHistoryEntry = loadByKey(historyEntry.createVKey());
assertThat(persistedHistoryEntry.getDomainContent().get().getAutorenewPollMessage())
assertThat(persistedHistoryEntry.getDomainBase().get().getAutorenewPollMessage())
.isEqualTo(domain.getAutorenewPollMessage());
assertThat(persistedHistoryEntry.getDomainContent().get().getAutorenewBillingEvent())
assertThat(persistedHistoryEntry.getDomainBase().get().getAutorenewBillingEvent())
.isEqualTo(domain.getAutorenewBillingEvent());
assertThat(persistedHistoryEntry.getDomainContent().get().getDeletePollMessage())
assertThat(persistedHistoryEntry.getDomainBase().get().getDeletePollMessage())
.isEqualTo(domain.getDeletePollMessage());
DomainTransferData persistedTransferData =
persistedHistoryEntry.getDomainContent().get().getTransferData();
persistedHistoryEntry.getDomainBase().get().getTransferData();
DomainTransferData originalTransferData = domain.getTransferData();
assertThat(persistedTransferData.getServerApproveBillingEvent())
.isEqualTo(originalTransferData.getServerApproveBillingEvent());
@@ -621,16 +621,16 @@ public class DomainSqlTest {
// reason is showing up as different.
assertEqualDomainExcept(persisted, "creationTime", "dsData", "gracePeriods");
// Verify that the DomainContent object from the history record sets the fields correctly.
// Verify that the DomainBase object from the history record sets the fields correctly.
DomainHistory persistedHistoryEntry = loadByKey(historyEntry.createVKey());
assertThat(persistedHistoryEntry.getDomainContent().get().getAutorenewPollMessage())
assertThat(persistedHistoryEntry.getDomainBase().get().getAutorenewPollMessage())
.isEqualTo(domain.getAutorenewPollMessage());
assertThat(persistedHistoryEntry.getDomainContent().get().getAutorenewBillingEvent())
assertThat(persistedHistoryEntry.getDomainBase().get().getAutorenewBillingEvent())
.isEqualTo(domain.getAutorenewBillingEvent());
assertThat(persistedHistoryEntry.getDomainContent().get().getDeletePollMessage())
assertThat(persistedHistoryEntry.getDomainBase().get().getDeletePollMessage())
.isEqualTo(domain.getDeletePollMessage());
DomainTransferData persistedTransferData =
persistedHistoryEntry.getDomainContent().get().getTransferData();
persistedHistoryEntry.getDomainBase().get().getTransferData();
DomainTransferData originalTransferData = domain.getTransferData();
assertThat(persistedTransferData.getServerApproveBillingEvent())
.isEqualTo(originalTransferData.getServerApproveBillingEvent());

View File

@@ -230,7 +230,7 @@ public class DomainTest {
}
@Test
void testDomainContentToDomain() {
void testDomainBaseToDomain() {
ImmutableObjectSubject.assertAboutImmutableObjects()
.that(new Domain.Builder().copyFrom(domain).build())
.isEqualExceptFields(domain, "updateTimestamp", "revisions");

View File

@@ -29,7 +29,7 @@ import com.google.common.collect.ImmutableSet;
import google.registry.model.EntityTestCase;
import google.registry.model.contact.ContactResource;
import google.registry.model.domain.Domain;
import google.registry.model.domain.DomainContent;
import google.registry.model.domain.DomainBase;
import google.registry.model.domain.DomainHistory;
import google.registry.model.domain.GracePeriod;
import google.registry.model.domain.Period;
@@ -134,13 +134,13 @@ public class DomainHistoryTest extends EntityTestCase {
}
static void assertDomainHistoriesEqual(DomainHistory one, DomainHistory two) {
assertAboutImmutableObjects().that(one).isEqualExceptFields(two, "domainContent");
assertAboutImmutableObjects().that(one).isEqualExceptFields(two, "domainBase");
assertAboutImmutableObjects()
.that(one.getDomainContent().get())
.isEqualExceptFields(two.getDomainContent().get(), "updateTimestamp");
.that(one.getDomainBase().get())
.isEqualExceptFields(two.getDomainBase().get(), "updateTimestamp");
}
private DomainHistory createDomainHistory(DomainContent domain) {
private DomainHistory createDomainHistory(DomainBase domain) {
DomainTransactionRecord transactionRecord =
new DomainTransactionRecord.Builder()
.setTld("tld")

View File

@@ -76,7 +76,7 @@ class HistoryEntryDaoTest extends EntityTestCase {
@Test
void testSimpleLoadAll() {
assertThat(HistoryEntryDao.loadAllHistoryObjects(START_OF_TIME, END_OF_TIME))
.comparingElementsUsing(immutableObjectCorrespondence("nsHosts", "domainContent"))
.comparingElementsUsing(immutableObjectCorrespondence("nsHosts", "domainBase"))
.containsExactly(domainHistory);
}
@@ -98,8 +98,7 @@ class HistoryEntryDaoTest extends EntityTestCase {
tm().transact(
() ->
assertThat(HistoryEntryDao.loadHistoryObjectsForResource(domain.createVKey()))
.comparingElementsUsing(
immutableObjectCorrespondence("nsHosts", "domainContent"))
.comparingElementsUsing(immutableObjectCorrespondence("nsHosts", "domainBase"))
.containsExactly(domainHistory));
}

View File

@@ -78,7 +78,7 @@ class HistoryEntryTest extends EntityTestCase {
DomainHistory fromDatabase = tm().loadByEntity(domainHistory);
assertAboutImmutableObjects()
.that(fromDatabase)
.isEqualExceptFields(domainHistory, "domainContent");
.isEqualExceptFields(domainHistory, "domainBase");
});
}

View File

@@ -80,7 +80,7 @@ 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.DomainContent;
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;
@@ -906,7 +906,7 @@ public class DatabaseHelper {
assertPollMessagesEqual(getPollMessages(), asList(expected));
}
public static void assertPollMessagesForResource(DomainContent domain, PollMessage... expected) {
public static void assertPollMessagesForResource(DomainBase domain, PollMessage... expected) {
assertPollMessagesEqual(getPollMessages(domain), asList(expected));
}
@@ -922,7 +922,7 @@ public class DatabaseHelper {
.collect(toImmutableList()));
}
public static ImmutableList<PollMessage> getPollMessages(DomainContent domain) {
public static ImmutableList<PollMessage> getPollMessages(DomainBase domain) {
return tm().transact(
() ->
tm().loadAllOf(PollMessage.class).stream()
@@ -973,10 +973,7 @@ public class DatabaseHelper {
}
public static PollMessage getOnlyPollMessage(
DomainContent domain,
String registrarId,
DateTime now,
Class<? extends PollMessage> subType) {
DomainBase domain, String registrarId, DateTime now, Class<? extends PollMessage> subType) {
return getPollMessages(domain, registrarId, now).stream()
.filter(subType::isInstance)
.map(subType::cast)

View File

@@ -129,7 +129,7 @@ class google.registry.model.domain.Domain {
class google.registry.model.domain.DomainAuthInfo {
google.registry.model.eppcommon.AuthInfo$PasswordAuth pw;
}
class google.registry.model.domain.DomainContent {
class google.registry.model.domain.DomainBase {
@Id java.lang.String repoId;
google.registry.model.domain.DomainAuthInfo authInfo;
google.registry.model.domain.launch.LaunchNotice launchNotice;
@@ -163,7 +163,7 @@ class google.registry.model.domain.DomainHistory {
@Parent com.googlecode.objectify.Key<? extends google.registry.model.EppResource> parent;
boolean bySuperuser;
byte[] xmlBytes;
google.registry.model.domain.DomainContent domainContent;
google.registry.model.domain.DomainBase domainBase;
google.registry.model.domain.Period period;
google.registry.model.eppcommon.Trid trid;
google.registry.model.reporting.HistoryEntry$Type type;