Skip to content

Commit 814ff3b

Browse files
committed
Remove various ContactHistory references
This keeps the ContactHistory class and tests, to avoid changing any database-related code in this PR.
1 parent 71c9407 commit 814ff3b

13 files changed

Lines changed: 26 additions & 528 deletions

core/src/main/java/google/registry/flows/FlowModule.java

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import dagger.Module;
2323
import dagger.Provides;
2424
import google.registry.flows.picker.FlowPicker;
25-
import google.registry.model.contact.ContactHistory;
2625
import google.registry.model.domain.DomainHistory;
2726
import google.registry.model.domain.metadata.MetadataExtension;
2827
import google.registry.model.eppcommon.AuthInfo;
@@ -267,23 +266,6 @@ B makeHistoryEntryBuilder(
267266
return builder;
268267
}
269268

270-
/**
271-
* Provides a partially filled in {@link ContactHistory.Builder}
272-
*
273-
* <p>This is not marked with {@link FlowScope} so that each retry gets a fresh one. Otherwise,
274-
* the fact that the builder is one-use would cause NPEs.
275-
*/
276-
@Provides
277-
static ContactHistory.Builder provideContactHistoryBuilder(
278-
Trid trid,
279-
@InputXml byte[] inputXmlBytes,
280-
@Superuser boolean isSuperuser,
281-
@RegistrarId String registrarId,
282-
EppInput eppInput) {
283-
return makeHistoryEntryBuilder(
284-
new ContactHistory.Builder(), trid, inputXmlBytes, isSuperuser, registrarId, eppInput);
285-
}
286-
287269
/**
288270
* Provides a partially filled in {@link HostHistory.Builder}
289271
*

core/src/main/java/google/registry/model/poll/PollMessage.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import google.registry.model.annotations.ExternalMessagingName;
2828
import google.registry.model.annotations.IdAllocation;
2929
import google.registry.model.contact.Contact;
30-
import google.registry.model.contact.ContactHistory;
3130
import google.registry.model.domain.Domain;
3231
import google.registry.model.domain.DomainHistory;
3332
import google.registry.model.domain.DomainRenewData;
@@ -272,12 +271,6 @@ public B setDomainHistoryId(HistoryEntryId historyId) {
272271
return thisCastToDerived();
273272
}
274273

275-
public B setContactHistoryId(HistoryEntryId historyId) {
276-
getInstance().contactRepoId = historyId.getRepoId();
277-
getInstance().contactHistoryRevisionId = historyId.getRevisionId();
278-
return thisCastToDerived();
279-
}
280-
281274
public B setHostHistoryId(HistoryEntryId historyId) {
282275
getInstance().hostRepoId = historyId.getRepoId();
283276
getInstance().hostHistoryRevisionId = historyId.getRevisionId();
@@ -290,9 +283,6 @@ public B setHistoryEntry(HistoryEntry history) {
290283
if (history instanceof DomainHistory) {
291284
return setDomainHistoryId(historyId);
292285
}
293-
if (history instanceof ContactHistory) {
294-
return setContactHistoryId(historyId);
295-
}
296286
if (history instanceof HostHistory) {
297287
return setHostHistoryId(historyId);
298288
}

core/src/main/java/google/registry/model/reporting/HistoryEntry.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
import google.registry.model.ImmutableObject;
2424
import google.registry.model.UnsafeSerializable;
2525
import google.registry.model.annotations.IdAllocation;
26-
import google.registry.model.contact.ContactBase;
27-
import google.registry.model.contact.ContactHistory;
2826
import google.registry.model.domain.DomainBase;
2927
import google.registry.model.domain.DomainHistory;
3028
import google.registry.model.eppcommon.Trid;
@@ -348,8 +346,6 @@ public B setRequestedByRegistrar(Boolean requestedByRegistrar) {
348346
HistoryEntry.Builder<? extends HistoryEntry, ?> createBuilderForResource(E parent) {
349347
if (parent instanceof DomainBase) {
350348
return new DomainHistory.Builder().setDomain((DomainBase) parent);
351-
} else if (parent instanceof ContactBase) {
352-
return new ContactHistory.Builder().setContact((ContactBase) parent);
353349
} else if (parent instanceof HostBase) {
354350
return new HostHistory.Builder().setHost((HostBase) parent);
355351
} else {

core/src/main/java/google/registry/model/reporting/HistoryEntryDao.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525
import com.google.common.collect.ImmutableMap;
2626
import com.google.common.collect.Streams;
2727
import google.registry.model.EppResource;
28-
import google.registry.model.contact.Contact;
29-
import google.registry.model.contact.ContactHistory;
3028
import google.registry.model.domain.Domain;
3129
import google.registry.model.domain.DomainHistory;
3230
import google.registry.model.host.Host;
@@ -46,8 +44,6 @@ public class HistoryEntryDao {
4644
public static ImmutableMap<Class<? extends EppResource>, Class<? extends HistoryEntry>>
4745
RESOURCE_TYPES_TO_HISTORY_TYPES =
4846
ImmutableMap.of(
49-
Contact.class,
50-
ContactHistory.class,
5147
Domain.class,
5248
DomainHistory.class,
5349
Host.class,
@@ -59,7 +55,6 @@ public static ImmutableList<HistoryEntry> loadAllHistoryObjects(
5955
return tm().transact(
6056
() ->
6157
new ImmutableList.Builder<HistoryEntry>()
62-
.addAll(loadAllHistoryObjects(ContactHistory.class, afterTime, beforeTime))
6358
.addAll(loadAllHistoryObjects(DomainHistory.class, afterTime, beforeTime))
6459
.addAll(loadAllHistoryObjects(HostHistory.class, afterTime, beforeTime))
6560
.build());
@@ -121,7 +116,6 @@ public static Iterable<HistoryEntry> loadHistoryObjectsByRegistrars(
121116
return tm().reTransact(
122117
() ->
123118
Streams.concat(
124-
loadHistoryObjectByRegistrarsInternal(ContactHistory.class, registrarIds),
125119
loadHistoryObjectByRegistrarsInternal(DomainHistory.class, registrarIds),
126120
loadHistoryObjectByRegistrarsInternal(HostHistory.class, registrarIds))
127121
.sorted(Comparator.comparing(HistoryEntry::getModificationTime))

core/src/test/java/google/registry/beam/resave/ResaveAllEppResourcesPipelineTest.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import static google.registry.testing.DatabaseHelper.loadByEntity;
2323
import static google.registry.testing.DatabaseHelper.persistActiveContact;
2424
import static google.registry.testing.DatabaseHelper.persistActiveDomain;
25-
import static google.registry.testing.DatabaseHelper.persistContactWithPendingTransfer;
2625
import static google.registry.testing.DatabaseHelper.persistDomainWithDependentResources;
2726
import static google.registry.testing.DatabaseHelper.persistDomainWithPendingTransfer;
2827
import static google.registry.testing.DatabaseHelper.persistNewRegistrars;
@@ -89,18 +88,6 @@ void testPipeline_unchangedEntity() {
8988
assertThat(loadByEntity(contact)).isEqualTo(contact);
9089
}
9190

92-
@Test
93-
void testPipeline_fulfilledContactTransfer() {
94-
Contact contact = persistActiveContact("test123");
95-
DateTime now = fakeClock.nowUtc();
96-
contact = persistContactWithPendingTransfer(contact, now, now.plusDays(5), now);
97-
fakeClock.advanceBy(Duration.standardDays(10));
98-
assertThat(loadByEntity(contact).getStatusValues()).contains(StatusValue.PENDING_TRANSFER);
99-
runPipeline();
100-
assertThat(loadByEntity(contact).getStatusValues())
101-
.doesNotContain(StatusValue.PENDING_TRANSFER);
102-
}
103-
10491
@Test
10592
void testPipeline_fulfilledDomainTransfer() {
10693
options.setFast(true);

core/src/test/java/google/registry/beam/wipeout/WipeOutContactHistoryPiiPipelineTest.java

Lines changed: 0 additions & 196 deletions
This file was deleted.

core/src/test/java/google/registry/flows/ResourceFlowTestCase.java

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,10 @@
2424
import com.google.common.testing.TestLogHandler;
2525
import google.registry.model.EppResource;
2626
import google.registry.model.ForeignKeyUtils;
27-
import google.registry.model.contact.ContactBase;
28-
import google.registry.model.contact.ContactHistory;
2927
import google.registry.model.domain.DomainBase;
3028
import google.registry.model.domain.DomainHistory;
3129
import google.registry.model.eppinput.EppInput.ResourceCommandWrapper;
3230
import google.registry.model.eppinput.ResourceCommand;
33-
import google.registry.model.host.HostBase;
3431
import google.registry.model.host.HostHistory;
3532
import google.registry.model.reporting.HistoryEntry;
3633
import google.registry.model.tmch.ClaimsList;
@@ -131,18 +128,12 @@ protected void assertIcannReportingActivityFieldLogged(String fieldName) {
131128

132129
protected void assertLastHistoryContainsResource(EppResource resource) {
133130
HistoryEntry historyEntry = Iterables.getLast(DatabaseHelper.getHistoryEntries(resource));
134-
if (resource instanceof ContactBase) {
135-
ContactHistory contactHistory = (ContactHistory) historyEntry;
136-
// Don't use direct equals comparison since one might be a subclass of the other
137-
assertAboutImmutableObjects()
138-
.that(contactHistory.getContactBase().get())
139-
.hasFieldsEqualTo(resource);
140-
} else if (resource instanceof DomainBase) {
131+
if (resource instanceof DomainBase) {
141132
DomainHistory domainHistory = (DomainHistory) historyEntry;
142133
assertAboutImmutableObjects()
143134
.that(domainHistory.getDomainBase().get())
144135
.isEqualExceptFields(resource, "gracePeriods", "dsData", "nsHosts");
145-
} else if (resource instanceof HostBase) {
136+
} else {
146137
HostHistory hostHistory = (HostHistory) historyEntry;
147138
// Don't use direct equals comparison since one might be a subclass of the other
148139
assertAboutImmutableObjects()

0 commit comments

Comments
 (0)