mirror of
https://github.com/google/nomulus
synced 2026-02-02 19:12:27 +00:00
Remove various ContactHistory references (#2949)
This keeps the ContactHistory class and tests, to avoid changing any database-related code in this PR.
This commit is contained in:
@@ -27,7 +27,6 @@ import google.registry.model.UnsafeSerializable;
|
||||
import google.registry.model.annotations.ExternalMessagingName;
|
||||
import google.registry.model.annotations.IdAllocation;
|
||||
import google.registry.model.contact.Contact;
|
||||
import google.registry.model.contact.ContactHistory;
|
||||
import google.registry.model.domain.Domain;
|
||||
import google.registry.model.domain.DomainHistory;
|
||||
import google.registry.model.domain.DomainRenewData;
|
||||
@@ -272,12 +271,6 @@ public abstract class PollMessage extends ImmutableObject
|
||||
return thisCastToDerived();
|
||||
}
|
||||
|
||||
public B setContactHistoryId(HistoryEntryId historyId) {
|
||||
getInstance().contactRepoId = historyId.getRepoId();
|
||||
getInstance().contactHistoryRevisionId = historyId.getRevisionId();
|
||||
return thisCastToDerived();
|
||||
}
|
||||
|
||||
public B setHostHistoryId(HistoryEntryId historyId) {
|
||||
getInstance().hostRepoId = historyId.getRepoId();
|
||||
getInstance().hostHistoryRevisionId = historyId.getRevisionId();
|
||||
@@ -290,9 +283,6 @@ public abstract class PollMessage extends ImmutableObject
|
||||
if (history instanceof DomainHistory) {
|
||||
return setDomainHistoryId(historyId);
|
||||
}
|
||||
if (history instanceof ContactHistory) {
|
||||
return setContactHistoryId(historyId);
|
||||
}
|
||||
if (history instanceof HostHistory) {
|
||||
return setHostHistoryId(historyId);
|
||||
}
|
||||
|
||||
@@ -23,8 +23,6 @@ import google.registry.model.EppResource;
|
||||
import google.registry.model.ImmutableObject;
|
||||
import google.registry.model.UnsafeSerializable;
|
||||
import google.registry.model.annotations.IdAllocation;
|
||||
import google.registry.model.contact.ContactBase;
|
||||
import google.registry.model.contact.ContactHistory;
|
||||
import google.registry.model.domain.DomainBase;
|
||||
import google.registry.model.domain.DomainHistory;
|
||||
import google.registry.model.eppcommon.Trid;
|
||||
@@ -348,8 +346,6 @@ public abstract class HistoryEntry extends ImmutableObject
|
||||
HistoryEntry.Builder<? extends HistoryEntry, ?> createBuilderForResource(E parent) {
|
||||
if (parent instanceof DomainBase) {
|
||||
return new DomainHistory.Builder().setDomain((DomainBase) parent);
|
||||
} else if (parent instanceof ContactBase) {
|
||||
return new ContactHistory.Builder().setContact((ContactBase) parent);
|
||||
} else if (parent instanceof HostBase) {
|
||||
return new HostHistory.Builder().setHost((HostBase) parent);
|
||||
} else {
|
||||
|
||||
@@ -25,8 +25,6 @@ import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Streams;
|
||||
import google.registry.model.EppResource;
|
||||
import google.registry.model.contact.Contact;
|
||||
import google.registry.model.contact.ContactHistory;
|
||||
import google.registry.model.domain.Domain;
|
||||
import google.registry.model.domain.DomainHistory;
|
||||
import google.registry.model.host.Host;
|
||||
@@ -46,8 +44,6 @@ public class HistoryEntryDao {
|
||||
public static ImmutableMap<Class<? extends EppResource>, Class<? extends HistoryEntry>>
|
||||
RESOURCE_TYPES_TO_HISTORY_TYPES =
|
||||
ImmutableMap.of(
|
||||
Contact.class,
|
||||
ContactHistory.class,
|
||||
Domain.class,
|
||||
DomainHistory.class,
|
||||
Host.class,
|
||||
@@ -59,7 +55,6 @@ public class HistoryEntryDao {
|
||||
return tm().transact(
|
||||
() ->
|
||||
new ImmutableList.Builder<HistoryEntry>()
|
||||
.addAll(loadAllHistoryObjects(ContactHistory.class, afterTime, beforeTime))
|
||||
.addAll(loadAllHistoryObjects(DomainHistory.class, afterTime, beforeTime))
|
||||
.addAll(loadAllHistoryObjects(HostHistory.class, afterTime, beforeTime))
|
||||
.build());
|
||||
@@ -121,7 +116,6 @@ public class HistoryEntryDao {
|
||||
return tm().reTransact(
|
||||
() ->
|
||||
Streams.concat(
|
||||
loadHistoryObjectByRegistrarsInternal(ContactHistory.class, registrarIds),
|
||||
loadHistoryObjectByRegistrarsInternal(DomainHistory.class, registrarIds),
|
||||
loadHistoryObjectByRegistrarsInternal(HostHistory.class, registrarIds))
|
||||
.sorted(Comparator.comparing(HistoryEntry::getModificationTime))
|
||||
|
||||
@@ -22,7 +22,6 @@ import static google.registry.testing.DatabaseHelper.loadAllOf;
|
||||
import static google.registry.testing.DatabaseHelper.loadByEntity;
|
||||
import static google.registry.testing.DatabaseHelper.persistActiveContact;
|
||||
import static google.registry.testing.DatabaseHelper.persistActiveDomain;
|
||||
import static google.registry.testing.DatabaseHelper.persistContactWithPendingTransfer;
|
||||
import static google.registry.testing.DatabaseHelper.persistDomainWithDependentResources;
|
||||
import static google.registry.testing.DatabaseHelper.persistDomainWithPendingTransfer;
|
||||
import static google.registry.testing.DatabaseHelper.persistNewRegistrars;
|
||||
@@ -89,18 +88,6 @@ public class ResaveAllEppResourcesPipelineTest {
|
||||
assertThat(loadByEntity(contact)).isEqualTo(contact);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testPipeline_fulfilledContactTransfer() {
|
||||
Contact contact = persistActiveContact("test123");
|
||||
DateTime now = fakeClock.nowUtc();
|
||||
contact = persistContactWithPendingTransfer(contact, now, now.plusDays(5), now);
|
||||
fakeClock.advanceBy(Duration.standardDays(10));
|
||||
assertThat(loadByEntity(contact).getStatusValues()).contains(StatusValue.PENDING_TRANSFER);
|
||||
runPipeline();
|
||||
assertThat(loadByEntity(contact).getStatusValues())
|
||||
.doesNotContain(StatusValue.PENDING_TRANSFER);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testPipeline_fulfilledDomainTransfer() {
|
||||
options.setFast(true);
|
||||
|
||||
@@ -24,13 +24,10 @@ import com.google.common.collect.Iterables;
|
||||
import com.google.common.testing.TestLogHandler;
|
||||
import google.registry.model.EppResource;
|
||||
import google.registry.model.ForeignKeyUtils;
|
||||
import google.registry.model.contact.ContactBase;
|
||||
import google.registry.model.contact.ContactHistory;
|
||||
import google.registry.model.domain.DomainBase;
|
||||
import google.registry.model.domain.DomainHistory;
|
||||
import google.registry.model.eppinput.EppInput.ResourceCommandWrapper;
|
||||
import google.registry.model.eppinput.ResourceCommand;
|
||||
import google.registry.model.host.HostBase;
|
||||
import google.registry.model.host.HostHistory;
|
||||
import google.registry.model.reporting.HistoryEntry;
|
||||
import google.registry.model.tmch.ClaimsList;
|
||||
@@ -131,18 +128,12 @@ public abstract class ResourceFlowTestCase<F extends Flow, R extends EppResource
|
||||
|
||||
protected void assertLastHistoryContainsResource(EppResource resource) {
|
||||
HistoryEntry historyEntry = Iterables.getLast(DatabaseHelper.getHistoryEntries(resource));
|
||||
if (resource instanceof ContactBase) {
|
||||
ContactHistory contactHistory = (ContactHistory) historyEntry;
|
||||
// Don't use direct equals comparison since one might be a subclass of the other
|
||||
assertAboutImmutableObjects()
|
||||
.that(contactHistory.getContactBase().get())
|
||||
.hasFieldsEqualTo(resource);
|
||||
} else if (resource instanceof DomainBase) {
|
||||
if (resource instanceof DomainBase) {
|
||||
DomainHistory domainHistory = (DomainHistory) historyEntry;
|
||||
assertAboutImmutableObjects()
|
||||
.that(domainHistory.getDomainBase().get())
|
||||
.isEqualExceptFields(resource, "gracePeriods", "dsData", "nsHosts");
|
||||
} else if (resource instanceof HostBase) {
|
||||
} else {
|
||||
HostHistory hostHistory = (HostHistory) historyEntry;
|
||||
// Don't use direct equals comparison since one might be a subclass of the other
|
||||
assertAboutImmutableObjects()
|
||||
|
||||
@@ -17,7 +17,6 @@ package google.registry.flows.poll;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.testing.DatabaseHelper.createHistoryEntryForEppResource;
|
||||
import static google.registry.testing.DatabaseHelper.createTld;
|
||||
import static google.registry.testing.DatabaseHelper.persistActiveContact;
|
||||
import static google.registry.testing.DatabaseHelper.persistResource;
|
||||
import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
@@ -28,7 +27,6 @@ import google.registry.flows.poll.PollAckFlow.InvalidMessageIdException;
|
||||
import google.registry.flows.poll.PollAckFlow.MessageDoesNotExistException;
|
||||
import google.registry.flows.poll.PollAckFlow.MissingMessageIdException;
|
||||
import google.registry.flows.poll.PollAckFlow.NotAuthorizedToAckMessageException;
|
||||
import google.registry.model.contact.Contact;
|
||||
import google.registry.model.domain.Domain;
|
||||
import google.registry.model.poll.PollMessage;
|
||||
import google.registry.testing.DatabaseHelper;
|
||||
@@ -43,7 +41,6 @@ class PollAckFlowTest extends FlowTestCase<PollAckFlow> {
|
||||
private static final long MESSAGE_ID = 3;
|
||||
|
||||
private Domain domain;
|
||||
private Contact contact;
|
||||
|
||||
@BeforeEach
|
||||
void setUp() {
|
||||
@@ -51,8 +48,7 @@ class PollAckFlowTest extends FlowTestCase<PollAckFlow> {
|
||||
clock.setTo(DateTime.parse("2011-01-02T01:01:01Z"));
|
||||
setRegistrarIdForFlow("NewRegistrar");
|
||||
createTld("example");
|
||||
contact = persistActiveContact("jd1234");
|
||||
domain = persistResource(DatabaseHelper.newDomain("test.example", contact));
|
||||
domain = persistResource(DatabaseHelper.newDomain("test.example"));
|
||||
}
|
||||
|
||||
private void persistOneTimePollMessage(long messageId) {
|
||||
@@ -85,43 +81,6 @@ class PollAckFlowTest extends FlowTestCase<PollAckFlow> {
|
||||
dryRunFlowAssertResponse(loadFile("poll_ack_response_empty.xml"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_contactPollMessage() throws Exception {
|
||||
setEppInput("poll_ack.xml", ImmutableMap.of("MSGID", "3-2011"));
|
||||
persistResource(
|
||||
new PollMessage.OneTime.Builder()
|
||||
.setId(MESSAGE_ID)
|
||||
.setRegistrarId(getRegistrarIdForFlow())
|
||||
.setEventTime(clock.nowUtc().minusDays(1))
|
||||
.setMsg("Some poll message.")
|
||||
.setHistoryEntry(createHistoryEntryForEppResource(contact))
|
||||
.build());
|
||||
assertMutatingFlow(true);
|
||||
runFlowAssertResponse(loadFile("poll_ack_response_empty.xml"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFailure_contactPollMessage_withIncorrectYearField() throws Exception {
|
||||
setEppInput("poll_ack.xml", ImmutableMap.of("MSGID", "3-1999"));
|
||||
persistResource(
|
||||
new PollMessage.OneTime.Builder()
|
||||
.setId(MESSAGE_ID)
|
||||
.setRegistrarId(getRegistrarIdForFlow())
|
||||
.setEventTime(clock.nowUtc().minusDays(1))
|
||||
.setMsg("Some poll message.")
|
||||
.setHistoryEntry(createHistoryEntryForEppResource(contact))
|
||||
.build());
|
||||
assertMutatingFlow(true);
|
||||
assertThrows(MessageDoesNotExistException.class, this::runFlow);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_messageOnContact() throws Exception {
|
||||
persistOneTimePollMessage(MESSAGE_ID);
|
||||
assertMutatingFlow(true);
|
||||
runFlowAssertResponse(loadFile("poll_ack_response_empty.xml"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_recentActiveAutorenew() throws Exception {
|
||||
setEppInput("poll_ack.xml", ImmutableMap.of("MSGID", "3-2010"));
|
||||
@@ -184,21 +143,6 @@ class PollAckFlowTest extends FlowTestCase<PollAckFlow> {
|
||||
assertThrows(InvalidMessageIdException.class, this::runFlow);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFailure_contactPollMessage_withMissingYearField() throws Exception {
|
||||
setEppInput("poll_ack.xml", ImmutableMap.of("MSGID", "3"));
|
||||
persistResource(
|
||||
new PollMessage.OneTime.Builder()
|
||||
.setId(MESSAGE_ID)
|
||||
.setRegistrarId(getRegistrarIdForFlow())
|
||||
.setEventTime(clock.nowUtc().minusDays(1))
|
||||
.setMsg("Some poll message.")
|
||||
.setHistoryEntry(createHistoryEntryForEppResource(contact))
|
||||
.build());
|
||||
assertMutatingFlow(true);
|
||||
assertThrows(InvalidMessageIdException.class, this::runFlow);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFailure_invalidId_stringInsteadOfNumeric() throws Exception {
|
||||
setEppInput("poll_ack.xml", ImmutableMap.of("MSGID", "ABC-12345"));
|
||||
|
||||
@@ -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.persistActiveContact;
|
||||
import static google.registry.testing.DatabaseHelper.persistActiveHost;
|
||||
import static google.registry.testing.DatabaseHelper.persistNewRegistrar;
|
||||
import static google.registry.testing.DatabaseHelper.persistResource;
|
||||
@@ -27,8 +26,6 @@ import com.google.common.collect.ImmutableList;
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.FlowTestCase;
|
||||
import google.registry.flows.poll.PollRequestFlow.UnexpectedMessageIdException;
|
||||
import google.registry.model.contact.Contact;
|
||||
import google.registry.model.contact.ContactHistory;
|
||||
import google.registry.model.domain.Domain;
|
||||
import google.registry.model.eppcommon.Trid;
|
||||
import google.registry.model.host.Host;
|
||||
@@ -36,7 +33,6 @@ import google.registry.model.host.HostHistory;
|
||||
import google.registry.model.poll.PendingActionNotificationResponse.DomainPendingActionNotificationResponse;
|
||||
import google.registry.model.poll.PollMessage;
|
||||
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;
|
||||
@@ -48,7 +44,6 @@ import org.junit.jupiter.api.Test;
|
||||
class PollRequestFlowTest extends FlowTestCase<PollRequestFlow> {
|
||||
|
||||
private Domain domain;
|
||||
private Contact contact;
|
||||
private Host host;
|
||||
|
||||
@BeforeEach
|
||||
@@ -58,8 +53,7 @@ class PollRequestFlowTest extends FlowTestCase<PollRequestFlow> {
|
||||
setRegistrarIdForFlow("NewRegistrar");
|
||||
createTld("example");
|
||||
persistNewRegistrar("BadRegistrar");
|
||||
contact = persistActiveContact("jd1234");
|
||||
domain = persistResource(DatabaseHelper.newDomain("test.example", contact));
|
||||
domain = persistResource(DatabaseHelper.newDomain("test.example"));
|
||||
host = persistActiveHost("ns1.test.example");
|
||||
}
|
||||
|
||||
@@ -99,31 +93,6 @@ class PollRequestFlowTest extends FlowTestCase<PollRequestFlow> {
|
||||
runFlowAssertResponse(loadFile("poll_response_domain_transfer_no_cltrid.xml"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_contactTransferPending() throws Exception {
|
||||
setRegistrarIdForFlow("TheRegistrar");
|
||||
persistResource(
|
||||
new PollMessage.OneTime.Builder()
|
||||
.setId(3L)
|
||||
.setRegistrarId(getRegistrarIdForFlow())
|
||||
.setEventTime(clock.nowUtc().minusDays(5))
|
||||
.setMsg("Transfer requested.")
|
||||
.setResponseData(
|
||||
ImmutableList.of(
|
||||
new ContactTransferResponse.Builder()
|
||||
.setContactId("sh8013")
|
||||
.setTransferStatus(TransferStatus.PENDING)
|
||||
.setGainingRegistrarId(getRegistrarIdForFlow())
|
||||
.setTransferRequestTime(clock.nowUtc().minusDays(5))
|
||||
.setLosingRegistrarId("NewRegistrar")
|
||||
.setPendingTransferExpirationTime(clock.nowUtc())
|
||||
.build()))
|
||||
.setHistoryEntry(createHistoryEntryForEppResource(contact))
|
||||
.build());
|
||||
assertMutatingFlow(false);
|
||||
runFlowAssertResponse(loadFile("poll_response_contact_transfer.xml"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_domainPendingActionComplete() throws Exception {
|
||||
persistResource(
|
||||
@@ -225,29 +194,6 @@ class PollRequestFlowTest extends FlowTestCase<PollRequestFlow> {
|
||||
runFlowAssertResponse(loadFile("poll_response_empty.xml"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_contactDelete() throws Exception {
|
||||
// Contact delete poll messages do not have any response data, so ensure that no
|
||||
// response data block is produced in the poll message.
|
||||
HistoryEntry historyEntry =
|
||||
persistResource(
|
||||
new ContactHistory.Builder()
|
||||
.setRegistrarId("NewRegistrar")
|
||||
.setModificationTime(clock.nowUtc().minusDays(1))
|
||||
.setType(HistoryEntry.Type.CONTACT_DELETE)
|
||||
.setContact(contact)
|
||||
.build());
|
||||
persistResource(
|
||||
new PollMessage.OneTime.Builder()
|
||||
.setRegistrarId("NewRegistrar")
|
||||
.setMsg("Deleted contact jd1234")
|
||||
.setHistoryEntry(historyEntry)
|
||||
.setEventTime(clock.nowUtc().minusDays(1))
|
||||
.build());
|
||||
assertMutatingFlow(false);
|
||||
runFlowAssertResponse(loadFile("poll_response_contact_delete.xml"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_hostDelete() throws Exception {
|
||||
// Host delete poll messages do not have any response data, so ensure that no
|
||||
|
||||
@@ -18,7 +18,6 @@ import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.model.poll.PollMessageExternalKeyConverter.makePollMessageExternalId;
|
||||
import static google.registry.model.poll.PollMessageExternalKeyConverter.parsePollMessageExternalId;
|
||||
import static google.registry.testing.DatabaseHelper.createTld;
|
||||
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;
|
||||
@@ -83,23 +82,6 @@ public class PollMessageExternalKeyConverterTest {
|
||||
assertVKeysEqual(parsePollMessageExternalId("5-2007"), pollMessage.createVKey());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_contact() {
|
||||
historyEntry =
|
||||
persistResource(
|
||||
DatabaseHelper.createHistoryEntryForEppResource(persistActiveContact("tim")));
|
||||
PollMessage.OneTime pollMessage =
|
||||
persistResource(
|
||||
new PollMessage.OneTime.Builder()
|
||||
.setRegistrarId("TheRegistrar")
|
||||
.setEventTime(clock.nowUtc())
|
||||
.setMsg("Test poll message")
|
||||
.setHistoryEntry(historyEntry)
|
||||
.build());
|
||||
assertThat(makePollMessageExternalId(pollMessage)).isEqualTo("7-2007");
|
||||
assertVKeysEqual(parsePollMessageExternalId("7-2007"), pollMessage.createVKey());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_host() {
|
||||
historyEntry =
|
||||
|
||||
@@ -18,7 +18,6 @@ import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.model.ImmutableObjectSubject.assertAboutImmutableObjects;
|
||||
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
||||
import static google.registry.testing.DatabaseHelper.createTld;
|
||||
import static google.registry.testing.DatabaseHelper.persistActiveContact;
|
||||
import static google.registry.testing.DatabaseHelper.persistActiveDomain;
|
||||
import static google.registry.testing.DatabaseHelper.persistResource;
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
@@ -26,13 +25,12 @@ import static org.junit.Assert.assertThrows;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import google.registry.model.EntityTestCase;
|
||||
import google.registry.model.contact.Contact;
|
||||
import google.registry.model.contact.ContactHistory;
|
||||
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.model.reporting.HistoryEntry.Type;
|
||||
import org.joda.time.DateTime;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -40,14 +38,13 @@ import org.junit.jupiter.api.Test;
|
||||
/** Unit tests for {@link HistoryEntry}. */
|
||||
class HistoryEntryTest extends EntityTestCase {
|
||||
|
||||
private Domain domain;
|
||||
private DomainHistory domainHistory;
|
||||
private Contact contact;
|
||||
|
||||
@BeforeEach
|
||||
void setUp() {
|
||||
createTld("foobar");
|
||||
Domain domain = persistActiveDomain("foo.foobar");
|
||||
contact = persistActiveContact("someone");
|
||||
domain = persistActiveDomain("foo.foobar");
|
||||
DomainTransactionRecord transactionRecord =
|
||||
new DomainTransactionRecord.Builder()
|
||||
.setTld("foobar")
|
||||
@@ -91,12 +88,12 @@ class HistoryEntryTest extends EntityTestCase {
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
new ContactHistory.Builder()
|
||||
new DomainHistory.Builder()
|
||||
.setRevisionId(5L)
|
||||
.setModificationTime(DateTime.parse("1985-07-12T22:30:00Z"))
|
||||
.setRegistrarId("TheRegistrar")
|
||||
.setReason("Reason")
|
||||
.setType(HistoryEntry.Type.CONTACT_CREATE)
|
||||
.setType(Type.DOMAIN_CREATE)
|
||||
.build());
|
||||
assertThat(thrown).hasMessageThat().isEqualTo("EPP resource must be specified");
|
||||
}
|
||||
@@ -107,10 +104,10 @@ class HistoryEntryTest extends EntityTestCase {
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
new ContactHistory.Builder()
|
||||
.setContact(contact)
|
||||
new DomainHistory.Builder()
|
||||
.setRevisionId(5L)
|
||||
.setModificationTime(DateTime.parse("1985-07-12T22:30:00Z"))
|
||||
.setDomain(domain)
|
||||
.setModificationTime(DateTime.parse("1985-07-12T22:30.00Z"))
|
||||
.setRegistrarId("TheRegistrar")
|
||||
.setReason("Reason")
|
||||
.build());
|
||||
@@ -123,12 +120,12 @@ class HistoryEntryTest extends EntityTestCase {
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
new ContactHistory.Builder()
|
||||
.setContact(contact)
|
||||
new DomainHistory.Builder()
|
||||
.setRevisionId(5L)
|
||||
.setType(HistoryEntry.Type.CONTACT_CREATE)
|
||||
.setDomain(domain)
|
||||
.setType(Type.DOMAIN_CREATE)
|
||||
.setRegistrarId("TheRegistrar")
|
||||
.setReason("Reason")
|
||||
.setReason("reason")
|
||||
.build());
|
||||
assertThat(thrown).hasMessageThat().isEqualTo("Modification time must be specified");
|
||||
}
|
||||
@@ -139,11 +136,11 @@ class HistoryEntryTest extends EntityTestCase {
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
new ContactHistory.Builder()
|
||||
new DomainHistory.Builder()
|
||||
.setRevisionId(5L)
|
||||
.setContact(contact)
|
||||
.setType(HistoryEntry.Type.CONTACT_CREATE)
|
||||
.setModificationTime(DateTime.parse("1985-07-12T22:30:00Z"))
|
||||
.setDomain(domain)
|
||||
.setType(Type.DOMAIN_CREATE)
|
||||
.setModificationTime(DateTime.parse("1985-07-12T22:30.00Z"))
|
||||
.setReason("Reason")
|
||||
.build());
|
||||
assertThat(thrown).hasMessageThat().isEqualTo("Registrar ID must be specified");
|
||||
@@ -155,11 +152,11 @@ class HistoryEntryTest extends EntityTestCase {
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
new ContactHistory.Builder()
|
||||
.setContact(contact)
|
||||
new DomainHistory.Builder()
|
||||
.setRevisionId(5L)
|
||||
.setType(HistoryEntry.Type.SYNTHETIC)
|
||||
.setModificationTime(DateTime.parse("1985-07-12T22:30:00Z"))
|
||||
.setDomain(domain)
|
||||
.setType(Type.SYNTHETIC)
|
||||
.setModificationTime(DateTime.parse("1985-07-12T22:30.00Z"))
|
||||
.setRegistrarId("TheRegistrar")
|
||||
.setReason("Reason")
|
||||
.setRequestedByRegistrar(true)
|
||||
|
||||
@@ -28,17 +28,12 @@ import static google.registry.xjc.rgp.XjcRgpStatusValueType.TRANSFER_PERIOD;
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
import static org.joda.money.CurrencyUnit.USD;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.net.InetAddresses;
|
||||
import google.registry.model.billing.BillingBase.Flag;
|
||||
import google.registry.model.billing.BillingBase.Reason;
|
||||
import google.registry.model.billing.BillingEvent;
|
||||
import google.registry.model.billing.BillingRecurrence;
|
||||
import google.registry.model.contact.Contact;
|
||||
import google.registry.model.contact.ContactAddress;
|
||||
import google.registry.model.contact.ContactPhoneNumber;
|
||||
import google.registry.model.contact.PostalInfo;
|
||||
import google.registry.model.domain.DesignatedContact;
|
||||
import google.registry.model.domain.Domain;
|
||||
import google.registry.model.domain.DomainAuthInfo;
|
||||
@@ -73,7 +68,6 @@ import google.registry.xjc.rgp.XjcRgpStatusType;
|
||||
import google.registry.xjc.secdns.XjcSecdnsDsDataType;
|
||||
import google.registry.xml.XmlException;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.util.Optional;
|
||||
import org.joda.money.Money;
|
||||
import org.joda.time.DateTime;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
@@ -109,7 +103,7 @@ public class DomainToXjcConverterTest {
|
||||
assertThat(
|
||||
bean.getContacts().stream()
|
||||
.map(input -> String.format("%s %s", input.getType().toString(), input.getValue())))
|
||||
.containsExactly("ADMIN 5372808-IRL", "TECH 5372808-TRL");
|
||||
.containsExactly("ADMIN contact1234", "TECH contact1234");
|
||||
|
||||
assertThat(bean.getCrDate()).isEqualTo(DateTime.parse("1900-01-01T00:00:00Z"));
|
||||
|
||||
@@ -138,7 +132,7 @@ public class DomainToXjcConverterTest {
|
||||
// name used to generate the IDN variant.
|
||||
// TODO(b/26125498): bean.getOriginalName()
|
||||
|
||||
assertThat(bean.getRegistrant()).isEqualTo("5372808-ERL");
|
||||
assertThat(bean.getRegistrant()).isEqualTo("contact1234");
|
||||
|
||||
// o Zero or more OPTIONAL <rgpStatus> element to represent
|
||||
// "pendingDelete" sub-statuses, including "redemptionPeriod",
|
||||
@@ -264,26 +258,6 @@ public class DomainToXjcConverterTest {
|
||||
domain
|
||||
.asBuilder()
|
||||
.setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("secret")))
|
||||
.setContacts(
|
||||
ImmutableSet.of(
|
||||
DesignatedContact.create(
|
||||
DesignatedContact.Type.ADMIN,
|
||||
makeContact(
|
||||
clock,
|
||||
"10-Q9JYB4C",
|
||||
"5372808-IRL",
|
||||
"be that word our sign in parting",
|
||||
"BOFH@cat.みんな")
|
||||
.createVKey()),
|
||||
DesignatedContact.create(
|
||||
DesignatedContact.Type.TECH,
|
||||
makeContact(
|
||||
clock,
|
||||
"11-Q9JYB4C",
|
||||
"5372808-TRL",
|
||||
"bird or fiend!? i shrieked upstarting",
|
||||
"bog@cat.みんな")
|
||||
.createVKey())))
|
||||
.setCreationRegistrarId("TheRegistrar")
|
||||
.setCreationTimeForTest(DateTime.parse("1900-01-01T00:00:00Z"))
|
||||
.setPersistedCurrentSponsorRegistrarId("TheRegistrar")
|
||||
@@ -298,15 +272,6 @@ public class DomainToXjcConverterTest {
|
||||
makeHost(clock, "3-Q9JYB4C", "bird.or.devil.みんな", "1.2.3.4").createVKey(),
|
||||
makeHost(clock, "4-Q9JYB4C", "ns2.cat.みんな", "bad:f00d:cafe::15:beef")
|
||||
.createVKey()))
|
||||
.setRegistrant(
|
||||
Optional.of(
|
||||
makeContact(
|
||||
clock,
|
||||
"12-Q9JYB4C",
|
||||
"5372808-ERL",
|
||||
"(◕‿◕) nevermore",
|
||||
"prophet@evil.みんな")
|
||||
.createVKey()))
|
||||
.setRegistrationExpirationTime(DateTime.parse("1930-01-01T00:00:00Z"))
|
||||
.setGracePeriods(
|
||||
ImmutableSet.of(
|
||||
@@ -404,37 +369,6 @@ public class DomainToXjcConverterTest {
|
||||
return persistResource(domain);
|
||||
}
|
||||
|
||||
private static Contact makeContact(
|
||||
FakeClock clock, String repoId, String id, String name, String email) {
|
||||
clock.advanceOneMilli();
|
||||
return persistEppResource(
|
||||
new Contact.Builder()
|
||||
.setContactId(id)
|
||||
.setEmailAddress(email)
|
||||
.setPersistedCurrentSponsorRegistrarId("TheRegistrar")
|
||||
.setCreationRegistrarId("TheRegistrar")
|
||||
.setCreationTimeForTest(END_OF_TIME)
|
||||
.setInternationalizedPostalInfo(
|
||||
new PostalInfo.Builder()
|
||||
.setType(PostalInfo.Type.INTERNATIONALIZED)
|
||||
.setName(name)
|
||||
.setOrg("SINNERS INCORPORATED")
|
||||
.setAddress(
|
||||
new ContactAddress.Builder()
|
||||
.setStreet(ImmutableList.of("123 Example Boulevard"))
|
||||
.setCity("KOKOMO")
|
||||
.setState("BM")
|
||||
.setZip("31337")
|
||||
.setCountryCode("US")
|
||||
.build())
|
||||
.build())
|
||||
.setRepoId(repoId)
|
||||
.setVoiceNumber(
|
||||
new ContactPhoneNumber.Builder().setPhoneNumber("+1.2126660420").build())
|
||||
.setFaxNumber(new ContactPhoneNumber.Builder().setPhoneNumber("+1.2126660421").build())
|
||||
.build());
|
||||
}
|
||||
|
||||
private static Host makeHost(FakeClock clock, String repoId, String fqhn, String ip) {
|
||||
clock.advanceOneMilli();
|
||||
return persistEppResource(
|
||||
|
||||
@@ -25,7 +25,6 @@ import static com.google.common.collect.MoreCollectors.onlyElement;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static com.google.common.truth.Truth.assertWithMessage;
|
||||
import static google.registry.config.RegistryConfig.getContactAndHostRoidSuffix;
|
||||
import static google.registry.config.RegistryConfig.getContactAutomaticTransferLength;
|
||||
import static google.registry.model.EppResourceUtils.createDomainRepoId;
|
||||
import static google.registry.model.EppResourceUtils.createRepoId;
|
||||
import static google.registry.model.ImmutableObjectSubject.assertAboutImmutableObjects;
|
||||
@@ -76,7 +75,6 @@ import google.registry.model.console.User;
|
||||
import google.registry.model.console.UserRoles;
|
||||
import google.registry.model.contact.Contact;
|
||||
import google.registry.model.contact.ContactAuthInfo;
|
||||
import google.registry.model.contact.ContactHistory;
|
||||
import google.registry.model.domain.DesignatedContact;
|
||||
import google.registry.model.domain.DesignatedContact.Type;
|
||||
import google.registry.model.domain.Domain;
|
||||
@@ -536,53 +534,6 @@ public final class DatabaseHelper {
|
||||
.build();
|
||||
}
|
||||
|
||||
public static Contact persistContactWithPendingTransfer(
|
||||
Contact contact, DateTime requestTime, DateTime expirationTime, DateTime now) {
|
||||
ContactHistory historyEntryContactTransfer =
|
||||
persistResource(
|
||||
new ContactHistory.Builder()
|
||||
.setType(HistoryEntry.Type.CONTACT_TRANSFER_REQUEST)
|
||||
.setContact(persistResource(contact))
|
||||
.setModificationTime(now)
|
||||
.setRegistrarId(contact.getCurrentSponsorRegistrarId())
|
||||
.build());
|
||||
return persistResource(
|
||||
contact
|
||||
.asBuilder()
|
||||
.setPersistedCurrentSponsorRegistrarId("TheRegistrar")
|
||||
.addStatusValue(StatusValue.PENDING_TRANSFER)
|
||||
.setTransferData(
|
||||
createContactTransferDataBuilder(requestTime, expirationTime)
|
||||
.setPendingTransferExpirationTime(now.plus(getContactAutomaticTransferLength()))
|
||||
.setServerApproveEntities(
|
||||
historyEntryContactTransfer.getRepoId(),
|
||||
historyEntryContactTransfer.getRevisionId(),
|
||||
ImmutableSet.of(
|
||||
// Pretend it's 3 days since the request
|
||||
persistResource(
|
||||
createPollMessageForImplicitTransfer(
|
||||
contact,
|
||||
historyEntryContactTransfer,
|
||||
"NewRegistrar",
|
||||
requestTime,
|
||||
expirationTime,
|
||||
null))
|
||||
.createVKey(),
|
||||
persistResource(
|
||||
createPollMessageForImplicitTransfer(
|
||||
contact,
|
||||
historyEntryContactTransfer,
|
||||
"TheRegistrar",
|
||||
requestTime,
|
||||
expirationTime,
|
||||
null))
|
||||
.createVKey()))
|
||||
.setTransferRequestTrid(
|
||||
Trid.create("transferClient-trid", "transferServer-trid"))
|
||||
.build())
|
||||
.build());
|
||||
}
|
||||
|
||||
public static Domain persistDomainWithDependentResources(
|
||||
String label,
|
||||
String tld,
|
||||
|
||||
Reference in New Issue
Block a user