mirror of
https://github.com/google/nomulus.git
synced 2025-07-25 20:18:34 +02:00
Replace loadByUniqueId() with methods that don't overload unique id
It is replaced by loadByForeignKey(), which does the same thing that loadByUniqueId() did for contacts, hosts, and domains, and also loadDomainApplication(), which loads domain application by ROID. This eliminates the ugly mode-switching of attemping to load by other foreign key or ROID. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=133980156
This commit is contained in:
parent
025a4ae012
commit
21a98b899c
57 changed files with 367 additions and 340 deletions
|
@ -15,7 +15,7 @@
|
|||
package google.registry.flows;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.model.EppResourceUtils.loadByUniqueId;
|
||||
import static google.registry.model.EppResourceUtils.loadByForeignKey;
|
||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||
import static google.registry.model.tmch.ClaimsListShardTest.createTestClaimsListShard;
|
||||
import static google.registry.testing.TaskQueueHelper.assertTasksEnqueued;
|
||||
|
@ -27,6 +27,8 @@ import com.google.common.collect.ImmutableMap;
|
|||
import com.googlecode.objectify.Key;
|
||||
import google.registry.flows.EppException.CommandUseErrorException;
|
||||
import google.registry.model.EppResource;
|
||||
import google.registry.model.EppResourceUtils;
|
||||
import google.registry.model.domain.DomainApplication;
|
||||
import google.registry.model.domain.launch.ApplicationIdTargetExtension;
|
||||
import google.registry.model.eppinput.EppInput.ResourceCommandWrapper;
|
||||
import google.registry.model.eppinput.ResourceCommand;
|
||||
|
@ -54,19 +56,20 @@ public abstract class ResourceFlowTestCase<F extends Flow, R extends EppResource
|
|||
@Rule
|
||||
public final ExceptionRule thrown = new ExceptionRule();
|
||||
|
||||
private R reloadResourceByUniqueId(DateTime now) throws Exception {
|
||||
protected R reloadResourceByForeignKey(DateTime now) throws Exception {
|
||||
// Force the session to be cleared so that when we read it back, we read from the datastore and
|
||||
// not from the transaction cache or memcache.
|
||||
ofy().clearSessionCache();
|
||||
return loadByUniqueId(getResourceClass(), getUniqueIdFromCommand(), now);
|
||||
return loadByForeignKey(getResourceClass(), getUniqueIdFromCommand(), now);
|
||||
}
|
||||
|
||||
protected R reloadResourceByUniqueId() throws Exception {
|
||||
return reloadResourceByUniqueId(clock.nowUtc());
|
||||
protected R reloadResourceByForeignKey() throws Exception {
|
||||
return reloadResourceByForeignKey(clock.nowUtc());
|
||||
}
|
||||
|
||||
protected R reloadResourceByUniqueIdYesterday() throws Exception {
|
||||
return reloadResourceByUniqueId(clock.nowUtc().minusDays(1));
|
||||
protected DomainApplication reloadDomainApplication() throws Exception {
|
||||
ofy().clearSessionCache();
|
||||
return EppResourceUtils.loadDomainApplication(getUniqueIdFromCommand(), clock.nowUtc());
|
||||
}
|
||||
|
||||
protected <T extends EppResource> T reloadResourceAndCloneAtTime(T resource, DateTime now) {
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
package google.registry.flows.async;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.model.EppResourceUtils.loadByUniqueId;
|
||||
import static google.registry.model.EppResourceUtils.loadByForeignKey;
|
||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||
import static google.registry.testing.ContactResourceSubject.assertAboutContacts;
|
||||
import static google.registry.testing.DatastoreHelper.assertNoBillingEvents;
|
||||
|
@ -70,10 +70,10 @@ public class DeleteContactResourceActionTest
|
|||
.addStatusValue(StatusValue.PENDING_DELETE)
|
||||
.build());
|
||||
runMapreduceWithKeyParam(Key.create(contactUsed).getString());
|
||||
contactUsed = loadByUniqueId(ContactResource.class, "blah1234", now);
|
||||
contactUsed = loadByForeignKey(ContactResource.class, "blah1234", now);
|
||||
assertAboutContacts().that(contactUsed).doesNotHaveStatusValue(StatusValue.PENDING_DELETE)
|
||||
.and().hasDeletionTime(END_OF_TIME);
|
||||
domain = loadByUniqueId(DomainResource.class, "example.tld", now);
|
||||
domain = loadByForeignKey(DomainResource.class, "example.tld", now);
|
||||
assertThat(domain.getReferencedContacts()).contains(Key.create(contactUsed));
|
||||
HistoryEntry historyEntry =
|
||||
getOnlyHistoryEntryOfType(contactUsed, HistoryEntry.Type.CONTACT_DELETE_FAILURE);
|
||||
|
@ -113,7 +113,7 @@ public class DeleteContactResourceActionTest
|
|||
.and().hasNonNullFaxNumber();
|
||||
Key<ContactResource> key = Key.create(contactUnused);
|
||||
runMapreduceWithKeyParam(key.getString());
|
||||
assertThat(loadByUniqueId(ContactResource.class, "blah1235", now)).isNull();
|
||||
assertThat(loadByForeignKey(ContactResource.class, "blah1235", now)).isNull();
|
||||
ContactResource contactAfterDeletion = ofy().load().key(key).now();
|
||||
assertAboutContacts().that(contactAfterDeletion).hasDeletionTime(now)
|
||||
// Note that there will be another history entry of CONTACT_PENDING_DELETE, but this is
|
||||
|
@ -140,10 +140,10 @@ public class DeleteContactResourceActionTest
|
|||
clock.nowUtc());
|
||||
runMapreduceWithKeyParam(Key.create(contact).getString());
|
||||
// Check that the contact is deleted as of now.
|
||||
assertThat(loadByUniqueId(ContactResource.class, "sh8013", now)).isNull();
|
||||
assertThat(loadByForeignKey(ContactResource.class, "sh8013", now)).isNull();
|
||||
// Check that it's still there (it wasn't deleted yesterday) and that it has history.
|
||||
assertAboutContacts()
|
||||
.that(loadByUniqueId(ContactResource.class, "sh8013", now.minusDays(1)))
|
||||
.that(loadByForeignKey(ContactResource.class, "sh8013", now.minusDays(1)))
|
||||
.hasOneHistoryEntryEachOfTypes(
|
||||
HistoryEntry.Type.CONTACT_TRANSFER_REQUEST,
|
||||
HistoryEntry.Type.CONTACT_DELETE);
|
||||
|
@ -181,9 +181,9 @@ public class DeleteContactResourceActionTest
|
|||
.setDeletionTime(now.minusDays(3))
|
||||
.build());
|
||||
runMapreduceWithKeyParam(Key.create(contactUsed).getString());
|
||||
assertThat(loadByUniqueId(ContactResource.class, "blah1234", now)).isNull();
|
||||
assertThat(loadByForeignKey(ContactResource.class, "blah1234", now)).isNull();
|
||||
ContactResource contactBeforeDeletion =
|
||||
loadByUniqueId(ContactResource.class, "blah1234", now.minusDays(1));
|
||||
loadByForeignKey(ContactResource.class, "blah1234", now.minusDays(1));
|
||||
assertAboutContacts().that(contactBeforeDeletion).hasDeletionTime(now)
|
||||
.and().hasExactlyStatusValues(StatusValue.OK)
|
||||
// Note that there will be another history entry of CONTACT_PENDING_DELETE, but this is
|
||||
|
@ -199,7 +199,7 @@ public class DeleteContactResourceActionTest
|
|||
thrown.expect(IllegalStateException.class, "Resource blah1235 is not set as PENDING_DELETE");
|
||||
runMapreduceWithKeyParam(Key.create(contactUnused).getString());
|
||||
assertThat(
|
||||
loadByUniqueId(ContactResource.class, "blah1235", now)).isEqualTo(contactUnused);
|
||||
loadByForeignKey(ContactResource.class, "blah1235", now)).isEqualTo(contactUnused);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -210,10 +210,10 @@ public class DeleteContactResourceActionTest
|
|||
.build());
|
||||
Key<ContactResource> key = Key.create(contactUnused);
|
||||
runMapreduceWithParams(key.getString(), "OtherRegistrar", false);
|
||||
contactUnused = loadByUniqueId(ContactResource.class, "blah1235", now);
|
||||
contactUnused = loadByForeignKey(ContactResource.class, "blah1235", now);
|
||||
assertAboutContacts().that(contactUnused).doesNotHaveStatusValue(StatusValue.PENDING_DELETE)
|
||||
.and().hasDeletionTime(END_OF_TIME);
|
||||
domain = loadByUniqueId(DomainResource.class, "example.tld", now);
|
||||
domain = loadByForeignKey(DomainResource.class, "example.tld", now);
|
||||
HistoryEntry historyEntry =
|
||||
getOnlyHistoryEntryOfType(contactUnused, HistoryEntry.Type.CONTACT_DELETE_FAILURE);
|
||||
assertPollMessageFor(
|
||||
|
@ -247,7 +247,7 @@ public class DeleteContactResourceActionTest
|
|||
.build());
|
||||
Key<ContactResource> key = Key.create(contactUnused);
|
||||
runMapreduceWithParams(key.getString(), "OtherRegistrar", true);
|
||||
assertThat(loadByUniqueId(ContactResource.class, "blah1235", now)).isNull();
|
||||
assertThat(loadByForeignKey(ContactResource.class, "blah1235", now)).isNull();
|
||||
ContactResource contactAfterDeletion = ofy().load().key(key).now();
|
||||
assertAboutContacts().that(contactAfterDeletion).hasDeletionTime(now)
|
||||
// Note that there will be another history entry of CONTACT_PENDING_DELETE, but this is
|
||||
|
|
|
@ -19,7 +19,7 @@ import static com.google.appengine.api.taskqueue.QueueFactory.getQueue;
|
|||
import static com.google.common.collect.Iterables.getOnlyElement;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.flows.async.DeleteContactsAndHostsAction.QUEUE_ASYNC_DELETE;
|
||||
import static google.registry.model.EppResourceUtils.loadByUniqueId;
|
||||
import static google.registry.model.EppResourceUtils.loadByForeignKey;
|
||||
import static google.registry.model.eppcommon.StatusValue.PENDING_DELETE;
|
||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||
import static google.registry.model.reporting.HistoryEntry.Type.CONTACT_DELETE;
|
||||
|
@ -154,14 +154,14 @@ public class DeleteContactsAndHostsActionTest
|
|||
enqueuer.enqueueAsyncDelete(contact, "TheRegistrar", false);
|
||||
runMapreduce();
|
||||
ContactResource contactUpdated =
|
||||
loadByUniqueId(ContactResource.class, "blah8221", clock.nowUtc());
|
||||
loadByForeignKey(ContactResource.class, "blah8221", clock.nowUtc());
|
||||
assertAboutContacts()
|
||||
.that(contactUpdated)
|
||||
.doesNotHaveStatusValue(PENDING_DELETE)
|
||||
.and()
|
||||
.hasDeletionTime(END_OF_TIME);
|
||||
DomainResource domainReloaded =
|
||||
loadByUniqueId(DomainResource.class, "example.tld", clock.nowUtc());
|
||||
loadByForeignKey(DomainResource.class, "example.tld", clock.nowUtc());
|
||||
assertThat(domainReloaded.getReferencedContacts()).contains(Key.create(contactUpdated));
|
||||
HistoryEntry historyEntry =
|
||||
getOnlyHistoryEntryOfType(contactUpdated, HistoryEntry.Type.CONTACT_DELETE_FAILURE);
|
||||
|
@ -176,7 +176,7 @@ public class DeleteContactsAndHostsActionTest
|
|||
ContactResource contact = persistContactWithPii("jim919");
|
||||
enqueuer.enqueueAsyncDelete(contact, "TheRegistrar", false);
|
||||
runMapreduce();
|
||||
assertThat(loadByUniqueId(ContactResource.class, "jim919", clock.nowUtc())).isNull();
|
||||
assertThat(loadByForeignKey(ContactResource.class, "jim919", clock.nowUtc())).isNull();
|
||||
ContactResource contactAfterDeletion = ofy().load().entity(contact).now();
|
||||
assertAboutContacts()
|
||||
.that(contactAfterDeletion)
|
||||
|
@ -213,10 +213,10 @@ public class DeleteContactsAndHostsActionTest
|
|||
enqueuer.enqueueAsyncDelete(contact, "TheRegistrar", false);
|
||||
runMapreduce();
|
||||
// Check that the contact is deleted as of now.
|
||||
assertThat(loadByUniqueId(ContactResource.class, "sh8013", clock.nowUtc())).isNull();
|
||||
assertThat(loadByForeignKey(ContactResource.class, "sh8013", clock.nowUtc())).isNull();
|
||||
// Check that it's still there (it wasn't deleted yesterday) and that it has history.
|
||||
assertAboutContacts()
|
||||
.that(loadByUniqueId(ContactResource.class, "sh8013", clock.nowUtc().minusDays(1)))
|
||||
.that(loadByForeignKey(ContactResource.class, "sh8013", clock.nowUtc().minusDays(1)))
|
||||
.hasOneHistoryEntryEachOfTypes(CONTACT_TRANSFER_REQUEST, CONTACT_DELETE);
|
||||
assertNoBillingEvents();
|
||||
PollMessage deletePollMessage =
|
||||
|
@ -252,9 +252,9 @@ public class DeleteContactsAndHostsActionTest
|
|||
.build());
|
||||
enqueuer.enqueueAsyncDelete(contactUsed, "TheRegistrar", false);
|
||||
runMapreduce();
|
||||
assertThat(loadByUniqueId(ContactResource.class, "blah1234", clock.nowUtc())).isNull();
|
||||
assertThat(loadByForeignKey(ContactResource.class, "blah1234", clock.nowUtc())).isNull();
|
||||
ContactResource contactBeforeDeletion =
|
||||
loadByUniqueId(ContactResource.class, "blah1234", clock.nowUtc().minusDays(1));
|
||||
loadByForeignKey(ContactResource.class, "blah1234", clock.nowUtc().minusDays(1));
|
||||
assertAboutContacts()
|
||||
.that(contactBeforeDeletion)
|
||||
.isNotActiveAt(clock.nowUtc())
|
||||
|
@ -276,9 +276,9 @@ public class DeleteContactsAndHostsActionTest
|
|||
enqueuer.enqueueAsyncDelete(contact, "TheRegistrar", false);
|
||||
enqueuer.enqueueAsyncDelete(host, "TheRegistrar", false);
|
||||
runMapreduce();
|
||||
assertThat(loadByUniqueId(ContactResource.class, "blah2222", clock.nowUtc()))
|
||||
assertThat(loadByForeignKey(ContactResource.class, "blah2222", clock.nowUtc()))
|
||||
.isEqualTo(contact);
|
||||
assertThat(loadByUniqueId(HostResource.class, "rustles.your.jimmies", clock.nowUtc()))
|
||||
assertThat(loadByForeignKey(HostResource.class, "rustles.your.jimmies", clock.nowUtc()))
|
||||
.isEqualTo(host);
|
||||
}
|
||||
|
||||
|
@ -288,7 +288,7 @@ public class DeleteContactsAndHostsActionTest
|
|||
enqueuer.enqueueAsyncDelete(contact, "OtherRegistrar", false);
|
||||
runMapreduce();
|
||||
ContactResource contactAfter =
|
||||
loadByUniqueId(ContactResource.class, "jane0991", clock.nowUtc());
|
||||
loadByForeignKey(ContactResource.class, "jane0991", clock.nowUtc());
|
||||
assertAboutContacts()
|
||||
.that(contactAfter)
|
||||
.doesNotHaveStatusValue(PENDING_DELETE)
|
||||
|
@ -306,7 +306,7 @@ public class DeleteContactsAndHostsActionTest
|
|||
ContactResource contact = persistContactWithPii("nate007");
|
||||
enqueuer.enqueueAsyncDelete(contact, "OtherRegistrar", true);
|
||||
runMapreduce();
|
||||
assertThat(loadByUniqueId(ContactResource.class, "nate007", clock.nowUtc())).isNull();
|
||||
assertThat(loadByForeignKey(ContactResource.class, "nate007", clock.nowUtc())).isNull();
|
||||
ContactResource contactAfterDeletion = ofy().load().entity(contact).now();
|
||||
assertAboutContacts()
|
||||
.that(contactAfterDeletion)
|
||||
|
@ -357,13 +357,14 @@ public class DeleteContactsAndHostsActionTest
|
|||
persistUsedDomain("example.tld", persistActiveContact("abc456"), host);
|
||||
enqueuer.enqueueAsyncDelete(host, "TheRegistrar", false);
|
||||
runMapreduce();
|
||||
HostResource hostAfter = loadByUniqueId(HostResource.class, "ns1.example.tld", clock.nowUtc());
|
||||
HostResource hostAfter =
|
||||
loadByForeignKey(HostResource.class, "ns1.example.tld", clock.nowUtc());
|
||||
assertAboutHosts()
|
||||
.that(hostAfter)
|
||||
.doesNotHaveStatusValue(PENDING_DELETE)
|
||||
.and()
|
||||
.hasDeletionTime(END_OF_TIME);
|
||||
DomainResource domain = loadByUniqueId(DomainResource.class, "example.tld", clock.nowUtc());
|
||||
DomainResource domain = loadByForeignKey(DomainResource.class, "example.tld", clock.nowUtc());
|
||||
assertThat(domain.getNameservers()).contains(Key.create(hostAfter));
|
||||
HistoryEntry historyEntry = getOnlyHistoryEntryOfType(hostAfter, HOST_DELETE_FAILURE);
|
||||
assertPollMessageFor(
|
||||
|
@ -377,9 +378,9 @@ public class DeleteContactsAndHostsActionTest
|
|||
HostResource host = persistHostPendingDelete("ns2.example.tld");
|
||||
enqueuer.enqueueAsyncDelete(host, "TheRegistrar", false);
|
||||
runMapreduce();
|
||||
assertThat(loadByUniqueId(HostResource.class, "ns2.example.tld", clock.nowUtc())).isNull();
|
||||
assertThat(loadByForeignKey(HostResource.class, "ns2.example.tld", clock.nowUtc())).isNull();
|
||||
HostResource hostBeforeDeletion =
|
||||
loadByUniqueId(HostResource.class, "ns2.example.tld", clock.nowUtc().minusDays(1));
|
||||
loadByForeignKey(HostResource.class, "ns2.example.tld", clock.nowUtc().minusDays(1));
|
||||
assertAboutHosts()
|
||||
.that(hostBeforeDeletion)
|
||||
.isNotActiveAt(clock.nowUtc())
|
||||
|
@ -405,9 +406,9 @@ public class DeleteContactsAndHostsActionTest
|
|||
.build());
|
||||
enqueuer.enqueueAsyncDelete(host, "TheRegistrar", false);
|
||||
runMapreduce();
|
||||
assertThat(loadByUniqueId(HostResource.class, "ns1.example.tld", clock.nowUtc())).isNull();
|
||||
assertThat(loadByForeignKey(HostResource.class, "ns1.example.tld", clock.nowUtc())).isNull();
|
||||
HostResource hostBeforeDeletion =
|
||||
loadByUniqueId(HostResource.class, "ns1.example.tld", clock.nowUtc().minusDays(1));
|
||||
loadByForeignKey(HostResource.class, "ns1.example.tld", clock.nowUtc().minusDays(1));
|
||||
assertAboutHosts()
|
||||
.that(hostBeforeDeletion)
|
||||
.isNotActiveAt(clock.nowUtc())
|
||||
|
@ -439,15 +440,15 @@ public class DeleteContactsAndHostsActionTest
|
|||
enqueuer.enqueueAsyncDelete(host, "TheRegistrar", false);
|
||||
runMapreduce();
|
||||
// Check that the host is deleted as of now.
|
||||
assertThat(loadByUniqueId(HostResource.class, "ns2.example.tld", clock.nowUtc())).isNull();
|
||||
assertThat(loadByForeignKey(HostResource.class, "ns2.example.tld", clock.nowUtc())).isNull();
|
||||
assertNoBillingEvents();
|
||||
assertThat(
|
||||
loadByUniqueId(DomainResource.class, "example.tld", clock.nowUtc())
|
||||
loadByForeignKey(DomainResource.class, "example.tld", clock.nowUtc())
|
||||
.getSubordinateHosts())
|
||||
.isEmpty();
|
||||
assertDnsTasksEnqueued("ns2.example.tld");
|
||||
HostResource hostBeforeDeletion =
|
||||
loadByUniqueId(HostResource.class, "ns2.example.tld", clock.nowUtc().minusDays(1));
|
||||
loadByForeignKey(HostResource.class, "ns2.example.tld", clock.nowUtc().minusDays(1));
|
||||
assertAboutHosts()
|
||||
.that(hostBeforeDeletion)
|
||||
.isNotActiveAt(clock.nowUtc())
|
||||
|
@ -465,7 +466,8 @@ public class DeleteContactsAndHostsActionTest
|
|||
HostResource host = persistHostPendingDelete("ns2.example.tld");
|
||||
enqueuer.enqueueAsyncDelete(host, "OtherRegistrar", false);
|
||||
runMapreduce();
|
||||
HostResource hostAfter = loadByUniqueId(HostResource.class, "ns2.example.tld", clock.nowUtc());
|
||||
HostResource hostAfter =
|
||||
loadByForeignKey(HostResource.class, "ns2.example.tld", clock.nowUtc());
|
||||
assertAboutHosts()
|
||||
.that(hostAfter)
|
||||
.doesNotHaveStatusValue(PENDING_DELETE)
|
||||
|
@ -483,9 +485,9 @@ public class DeleteContactsAndHostsActionTest
|
|||
HostResource host = persistHostPendingDelete("ns66.example.tld");
|
||||
enqueuer.enqueueAsyncDelete(host, "OtherRegistrar", true);
|
||||
runMapreduce();
|
||||
assertThat(loadByUniqueId(HostResource.class, "ns66.example.tld", clock.nowUtc())).isNull();
|
||||
assertThat(loadByForeignKey(HostResource.class, "ns66.example.tld", clock.nowUtc())).isNull();
|
||||
HostResource hostBeforeDeletion =
|
||||
loadByUniqueId(HostResource.class, "ns66.example.tld", clock.nowUtc().minusDays(1));
|
||||
loadByForeignKey(HostResource.class, "ns66.example.tld", clock.nowUtc().minusDays(1));
|
||||
assertAboutHosts()
|
||||
.that(hostBeforeDeletion)
|
||||
.isNotActiveAt(clock.nowUtc())
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
package google.registry.flows.async;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.model.EppResourceUtils.loadByUniqueId;
|
||||
import static google.registry.model.EppResourceUtils.loadByForeignKey;
|
||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
import static google.registry.testing.DatastoreHelper.getOnlyPollMessageForHistoryEntry;
|
||||
|
@ -127,7 +127,7 @@ public abstract class DeleteEppResourceActionTestCase<T extends DeleteEppResourc
|
|||
thrown.expect(
|
||||
IllegalArgumentException.class, "Cannot delete a DomainResource via this action.");
|
||||
runMapreduceWithKeyParam(Key.create(domain).getString());
|
||||
assertThat(loadByUniqueId(DomainResource.class, "fail.tld", now)).isEqualTo(domain);
|
||||
assertThat(loadByForeignKey(DomainResource.class, "fail.tld", now)).isEqualTo(domain);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
package google.registry.flows.async;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.model.EppResourceUtils.loadByUniqueId;
|
||||
import static google.registry.model.EppResourceUtils.loadByForeignKey;
|
||||
import static google.registry.testing.DatastoreHelper.assertNoBillingEvents;
|
||||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
import static google.registry.testing.DatastoreHelper.getOnlyHistoryEntryOfType;
|
||||
|
@ -59,10 +59,10 @@ public class DeleteHostResourceActionTest
|
|||
.addStatusValue(StatusValue.PENDING_DELETE)
|
||||
.build());
|
||||
runMapreduceWithKeyParam(Key.create(hostUsed).getString());
|
||||
hostUsed = loadByUniqueId(HostResource.class, "ns1.example.tld", now);
|
||||
hostUsed = loadByForeignKey(HostResource.class, "ns1.example.tld", now);
|
||||
assertAboutHosts().that(hostUsed).doesNotHaveStatusValue(StatusValue.PENDING_DELETE)
|
||||
.and().hasDeletionTime(END_OF_TIME);
|
||||
domain = loadByUniqueId(DomainResource.class, "example.tld", now);
|
||||
domain = loadByForeignKey(DomainResource.class, "example.tld", now);
|
||||
assertThat(domain.getNameservers()).contains(Key.create(hostUsed));
|
||||
HistoryEntry historyEntry =
|
||||
getOnlyHistoryEntryOfType(hostUsed, HistoryEntry.Type.HOST_DELETE_FAILURE);
|
||||
|
@ -79,9 +79,9 @@ public class DeleteHostResourceActionTest
|
|||
.addStatusValue(StatusValue.PENDING_DELETE)
|
||||
.build());
|
||||
runMapreduceWithKeyParam(Key.create(hostUnused).getString());
|
||||
assertThat(loadByUniqueId(HostResource.class, "ns2.example.tld", now)).isNull();
|
||||
assertThat(loadByForeignKey(HostResource.class, "ns2.example.tld", now)).isNull();
|
||||
HostResource hostBeforeDeletion =
|
||||
loadByUniqueId(HostResource.class, "ns2.example.tld", now.minusDays(1));
|
||||
loadByForeignKey(HostResource.class, "ns2.example.tld", now.minusDays(1));
|
||||
assertAboutHosts().that(hostBeforeDeletion).hasDeletionTime(now)
|
||||
.and().hasExactlyStatusValues(StatusValue.OK)
|
||||
// Note that there will be another history entry of HOST_PENDING_DELETE, but this is
|
||||
|
@ -103,9 +103,9 @@ public class DeleteHostResourceActionTest
|
|||
.setDeletionTime(now.minusDays(3))
|
||||
.build());
|
||||
runMapreduceWithKeyParam(Key.create(hostUsed).getString());
|
||||
assertThat(loadByUniqueId(HostResource.class, "ns1.example.tld", now)).isNull();
|
||||
assertThat(loadByForeignKey(HostResource.class, "ns1.example.tld", now)).isNull();
|
||||
HostResource hostBeforeDeletion =
|
||||
loadByUniqueId(HostResource.class, "ns1.example.tld", now.minusDays(1));
|
||||
loadByForeignKey(HostResource.class, "ns1.example.tld", now.minusDays(1));
|
||||
assertAboutHosts().that(hostBeforeDeletion).hasDeletionTime(now)
|
||||
.and().hasExactlyStatusValues(StatusValue.OK)
|
||||
// Note that there will be another history entry of HOST_PENDING_DELETE, but this is
|
||||
|
@ -129,15 +129,15 @@ public class DeleteHostResourceActionTest
|
|||
.build());
|
||||
runMapreduceWithKeyParam(Key.create(hostUnused).getString());
|
||||
// Check that the host is deleted as of now.
|
||||
assertThat(loadByUniqueId(HostResource.class, "ns2.example.tld", clock.nowUtc()))
|
||||
assertThat(loadByForeignKey(HostResource.class, "ns2.example.tld", clock.nowUtc()))
|
||||
.isNull();
|
||||
assertNoBillingEvents();
|
||||
assertThat(loadByUniqueId(DomainResource.class, "example.tld", clock.nowUtc())
|
||||
assertThat(loadByForeignKey(DomainResource.class, "example.tld", clock.nowUtc())
|
||||
.getSubordinateHosts())
|
||||
.isEmpty();
|
||||
assertDnsTasksEnqueued("ns2.example.tld");
|
||||
HostResource hostBeforeDeletion =
|
||||
loadByUniqueId(HostResource.class, "ns2.example.tld", now.minusDays(1));
|
||||
loadByForeignKey(HostResource.class, "ns2.example.tld", now.minusDays(1));
|
||||
assertAboutHosts().that(hostBeforeDeletion).hasDeletionTime(now)
|
||||
.and().hasExactlyStatusValues(StatusValue.OK)
|
||||
.and().hasOnlyOneHistoryEntryWhich().hasType(HistoryEntry.Type.HOST_DELETE);
|
||||
|
@ -152,7 +152,7 @@ public class DeleteHostResourceActionTest
|
|||
IllegalStateException.class, "Resource ns2.example.tld is not set as PENDING_DELETE");
|
||||
runMapreduceWithKeyParam(Key.create(hostUnused).getString());
|
||||
assertThat(
|
||||
loadByUniqueId(HostResource.class, "ns2.example.tld", now)).isEqualTo(hostUnused);
|
||||
loadByForeignKey(HostResource.class, "ns2.example.tld", now)).isEqualTo(hostUnused);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -163,10 +163,10 @@ public class DeleteHostResourceActionTest
|
|||
.build());
|
||||
Key<HostResource> key = Key.create(hostUnused);
|
||||
runMapreduceWithParams(key.getString(), "OtherRegistrar", false);
|
||||
hostUnused = loadByUniqueId(HostResource.class, "ns2.example.tld", now);
|
||||
hostUnused = loadByForeignKey(HostResource.class, "ns2.example.tld", now);
|
||||
assertAboutHosts().that(hostUnused).doesNotHaveStatusValue(StatusValue.PENDING_DELETE)
|
||||
.and().hasDeletionTime(END_OF_TIME);
|
||||
domain = loadByUniqueId(DomainResource.class, "example.tld", now);
|
||||
domain = loadByForeignKey(DomainResource.class, "example.tld", now);
|
||||
HistoryEntry historyEntry =
|
||||
getOnlyHistoryEntryOfType(hostUnused, HistoryEntry.Type.HOST_DELETE_FAILURE);
|
||||
assertPollMessageFor(
|
||||
|
@ -183,9 +183,9 @@ public class DeleteHostResourceActionTest
|
|||
.build());
|
||||
Key<HostResource> key = Key.create(hostUnused);
|
||||
runMapreduceWithParams(key.getString(), "OtherRegistrar", true);
|
||||
assertThat(loadByUniqueId(HostResource.class, "ns2.example.tld", now)).isNull();
|
||||
assertThat(loadByForeignKey(HostResource.class, "ns2.example.tld", now)).isNull();
|
||||
HostResource hostBeforeDeletion =
|
||||
loadByUniqueId(HostResource.class, "ns2.example.tld", now.minusDays(1));
|
||||
loadByForeignKey(HostResource.class, "ns2.example.tld", now.minusDays(1));
|
||||
assertAboutHosts().that(hostBeforeDeletion).hasDeletionTime(now)
|
||||
.and().hasExactlyStatusValues(StatusValue.OK)
|
||||
// Note that there will be another history entry of HOST_PENDING_DELETE, but this is
|
||||
|
|
|
@ -40,10 +40,10 @@ public class ContactCreateFlowTest
|
|||
assertTransactionalFlow(true);
|
||||
runFlowAssertResponse(readFile("contact_create_response.xml"));
|
||||
// Check that the contact was created and persisted with a history entry.
|
||||
assertAboutContacts().that(reloadResourceByUniqueId())
|
||||
assertAboutContacts().that(reloadResourceByForeignKey())
|
||||
.hasOnlyOneHistoryEntryWhich().hasNoXml();
|
||||
assertNoBillingEvents();
|
||||
assertEppResourceIndexEntityFor(reloadResourceByUniqueId());
|
||||
assertEppResourceIndexEntityFor(reloadResourceByForeignKey());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -66,7 +66,7 @@ public class ContactDeleteFlowTest
|
|||
clock.advanceOneMilli();
|
||||
assertTransactionalFlow(true);
|
||||
runFlowAssertResponse(readFile("contact_delete_response.xml"));
|
||||
ContactResource deletedContact = reloadResourceByUniqueId();
|
||||
ContactResource deletedContact = reloadResourceByForeignKey();
|
||||
assertAboutContacts().that(deletedContact).hasStatusValue(StatusValue.PENDING_DELETE);
|
||||
assertAsyncDeletionTaskEnqueued(deletedContact, "TheRegistrar", false);
|
||||
assertAboutContacts().that(deletedContact)
|
||||
|
@ -125,7 +125,7 @@ public class ContactDeleteFlowTest
|
|||
clock.advanceOneMilli();
|
||||
runFlowAssertResponse(
|
||||
CommitMode.LIVE, UserPrivileges.SUPERUSER, readFile("contact_delete_response.xml"));
|
||||
ContactResource deletedContact = reloadResourceByUniqueId();
|
||||
ContactResource deletedContact = reloadResourceByForeignKey();
|
||||
assertAboutContacts().that(deletedContact).hasStatusValue(StatusValue.PENDING_DELETE);
|
||||
assertAsyncDeletionTaskEnqueued(deletedContact, "NewRegistrar", true);
|
||||
assertAboutContacts().that(deletedContact)
|
||||
|
|
|
@ -68,7 +68,7 @@ public class ContactTransferApproveFlowTest
|
|||
runFlowAssertResponse(readFile(expectedXmlFilename));
|
||||
|
||||
// Transfer should have succeeded. Verify correct fields were set.
|
||||
contact = reloadResourceByUniqueId();
|
||||
contact = reloadResourceByForeignKey();
|
||||
assertAboutContacts().that(contact)
|
||||
.hasCurrentSponsorClientId("NewRegistrar").and()
|
||||
.hasLastTransferTime(clock.nowUtc()).and()
|
||||
|
|
|
@ -62,7 +62,7 @@ public class ContactTransferCancelFlowTest
|
|||
runFlowAssertResponse(readFile(expectedXmlFilename));
|
||||
|
||||
// Transfer should have been cancelled. Verify correct fields were set.
|
||||
contact = reloadResourceByUniqueId();
|
||||
contact = reloadResourceByForeignKey();
|
||||
assertAboutContacts().that(contact)
|
||||
.hasCurrentSponsorClientId("TheRegistrar").and()
|
||||
.hasLastTransferTimeNotEqualTo(clock.nowUtc()).and()
|
||||
|
|
|
@ -51,7 +51,7 @@ public class ContactTransferQueryFlowTest
|
|||
// Setup done; run the test.
|
||||
assertTransactionalFlow(false);
|
||||
runFlowAssertResponse(readFile(expectedXmlFilename));
|
||||
assertAboutContacts().that(reloadResourceByUniqueIdYesterday())
|
||||
assertAboutContacts().that(reloadResourceByForeignKey(clock.nowUtc().minusDays(1)))
|
||||
.hasOneHistoryEntryEachOfTypes(HistoryEntry.Type.CONTACT_TRANSFER_REQUEST);
|
||||
assertNoBillingEvents();
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ public class ContactTransferRejectFlowTest
|
|||
runFlowAssertResponse(readFile(expectedXmlFilename));
|
||||
|
||||
// Transfer should have failed. Verify correct fields were set.
|
||||
contact = reloadResourceByUniqueId();
|
||||
contact = reloadResourceByForeignKey();
|
||||
assertAboutContacts().that(contact)
|
||||
.hasCurrentSponsorClientId("TheRegistrar").and()
|
||||
.hasLastTransferTimeNotEqualTo(clock.nowUtc()).and()
|
||||
|
|
|
@ -65,7 +65,7 @@ public class ContactTransferRequestFlowTest
|
|||
runFlowAssertResponse(readFile(expectedXmlFilename));
|
||||
|
||||
// Transfer should have been requested. Verify correct fields were set.
|
||||
contact = reloadResourceByUniqueId();
|
||||
contact = reloadResourceByForeignKey();
|
||||
assertAboutContacts().that(contact)
|
||||
.hasTransferStatus(TransferStatus.PENDING).and()
|
||||
.hasTransferGainingClientId("NewRegistrar").and()
|
||||
|
|
|
@ -53,7 +53,7 @@ public class ContactUpdateFlowTest
|
|||
assertTransactionalFlow(true);
|
||||
runFlowAssertResponse(readFile("contact_update_response.xml"));
|
||||
// Check that the contact was updated. This value came from the xml.
|
||||
assertAboutContacts().that(reloadResourceByUniqueId())
|
||||
assertAboutContacts().that(reloadResourceByForeignKey())
|
||||
.hasAuthInfoPwd("2fooBAR").and()
|
||||
.hasOnlyOneHistoryEntryWhich()
|
||||
.hasNoXml();
|
||||
|
@ -79,7 +79,7 @@ public class ContactUpdateFlowTest
|
|||
.setStatusValues(ImmutableSet.of(StatusValue.CLIENT_UPDATE_PROHIBITED))
|
||||
.build());
|
||||
doSuccessfulTest();
|
||||
assertAboutContacts().that(reloadResourceByUniqueId())
|
||||
assertAboutContacts().that(reloadResourceByForeignKey())
|
||||
.doesNotHaveStatusValue(StatusValue.CLIENT_UPDATE_PROHIBITED);
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,7 @@ public class ContactUpdateFlowTest
|
|||
.hasInternationalizedPostalInfo(null);
|
||||
|
||||
runFlowAssertResponse(readFile("contact_update_response.xml"));
|
||||
assertAboutContacts().that(reloadResourceByUniqueId())
|
||||
assertAboutContacts().that(reloadResourceByForeignKey())
|
||||
.hasLocalizedPostalInfo(null).and()
|
||||
.hasNonNullInternationalizedPostalInfo();
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ public class ContactUpdateFlowTest
|
|||
clock.advanceOneMilli();
|
||||
// The test xml updates the address of the postal info and should leave the name untouched.
|
||||
runFlowAssertResponse(readFile("contact_update_response.xml"));
|
||||
assertAboutContacts().that(reloadResourceByUniqueId()).hasLocalizedPostalInfo(
|
||||
assertAboutContacts().that(reloadResourceByForeignKey()).hasLocalizedPostalInfo(
|
||||
new PostalInfo.Builder()
|
||||
.setType(Type.LOCALIZED)
|
||||
.setName("A. Person")
|
||||
|
@ -213,7 +213,7 @@ public class ContactUpdateFlowTest
|
|||
CommitMode.LIVE,
|
||||
UserPrivileges.SUPERUSER,
|
||||
readFile("contact_update_response.xml"));
|
||||
assertAboutContacts().that(reloadResourceByUniqueId())
|
||||
assertAboutContacts().that(reloadResourceByForeignKey())
|
||||
.hasStatusValue(StatusValue.CLIENT_UPDATE_PROHIBITED).and()
|
||||
.hasStatusValue(StatusValue.SERVER_DELETE_PROHIBITED);
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ package google.registry.flows.domain;
|
|||
|
||||
import static com.google.common.io.BaseEncoding.base16;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.model.EppResourceUtils.loadByUniqueId;
|
||||
import static google.registry.model.EppResourceUtils.loadDomainApplication;
|
||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||
import static google.registry.testing.DatastoreHelper.assertBillingEvents;
|
||||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
|
@ -132,7 +132,7 @@ public class DomainAllocateFlowTest
|
|||
UserPrivileges.SUPERUSER,
|
||||
readFile("domain_allocate_response.xml"));
|
||||
// Check that the domain was created and persisted with a history entry.
|
||||
DomainResource domain = reloadResourceByUniqueId();
|
||||
DomainResource domain = reloadResourceByForeignKey();
|
||||
assertAboutDomains().that(domain)
|
||||
.hasOnlyOneHistoryEntryWhich()
|
||||
.hasType(HistoryEntry.Type.DOMAIN_ALLOCATE);
|
||||
|
@ -142,8 +142,7 @@ public class DomainAllocateFlowTest
|
|||
boolean sunrushAddGracePeriod = (nameservers == 0);
|
||||
|
||||
// The application should be marked as allocated, with a new history entry.
|
||||
DomainApplication application =
|
||||
loadByUniqueId(DomainApplication.class, applicationId, clock.nowUtc());
|
||||
DomainApplication application = loadDomainApplication(applicationId, clock.nowUtc());
|
||||
assertAboutApplications().that(application)
|
||||
.hasApplicationStatus(ApplicationStatus.ALLOCATED).and()
|
||||
.hasHistoryEntryAtIndex(1)
|
||||
|
@ -284,7 +283,7 @@ public class DomainAllocateFlowTest
|
|||
setupDomainApplication("tld", TldState.QUIET_PERIOD);
|
||||
setEppInput("domain_allocate_dsdata.xml");
|
||||
doSuccessfulTest(2);
|
||||
assertAboutDomains().that(reloadResourceByUniqueId())
|
||||
assertAboutDomains().that(reloadResourceByForeignKey())
|
||||
.hasExactlyDsData(DelegationSignerData.create(
|
||||
12345, 3, 1, base16().decode("49FD46E6C4B45C55D4AC")));
|
||||
}
|
||||
|
@ -295,7 +294,7 @@ public class DomainAllocateFlowTest
|
|||
setEppInput("domain_allocate_dsdata_8_records.xml");
|
||||
doSuccessfulTest(2);
|
||||
assertThat(getOnlyGlobalResource(DomainResource.class)).isNotNull();
|
||||
assertThat(reloadResourceByUniqueId().getDsData()).hasSize(8);
|
||||
assertThat(reloadResourceByForeignKey().getDsData()).hasSize(8);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -326,7 +325,7 @@ public class DomainAllocateFlowTest
|
|||
String expectedCsv = String.format(
|
||||
"%s,example-one.tld,370d0b7c9223372036854775807,1,"
|
||||
+ "2010-09-16T10:00:00.000Z,2010-07-16T09:00:00.000Z,2010-08-16T10:00:00.000Z",
|
||||
reloadResourceByUniqueId().getRepoId());
|
||||
reloadResourceByForeignKey().getRepoId());
|
||||
assertTasksEnqueued(
|
||||
"lordn-claims", new TaskMatcher().payload(expectedCsv).tag("tld"));
|
||||
}
|
||||
|
@ -339,7 +338,7 @@ public class DomainAllocateFlowTest
|
|||
String expectedCsv = String.format(
|
||||
"%s,example-one.tld,370d0b7c9223372036854775807,1,"
|
||||
+ "2011-08-17T09:00:00.000Z,2010-07-16T09:00:00.000Z,2010-08-16T10:00:00.000Z",
|
||||
reloadResourceByUniqueId().getRepoId());
|
||||
reloadResourceByForeignKey().getRepoId());
|
||||
assertTasksEnqueued("lordn-claims", new TaskMatcher().payload(expectedCsv).tag("tld"));
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
package google.registry.flows.domain;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.model.EppResourceUtils.loadByUniqueId;
|
||||
import static google.registry.model.EppResourceUtils.loadByForeignKey;
|
||||
import static google.registry.testing.DatastoreHelper.assertNoBillingEvents;
|
||||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
import static google.registry.testing.DatastoreHelper.newDomainApplication;
|
||||
|
@ -65,7 +65,7 @@ public class DomainApplicationDeleteFlowTest
|
|||
clock.advanceOneMilli();
|
||||
runFlowAssertResponse(readFile("domain_delete_response.xml"));
|
||||
// Check that the domain is fully deleted.
|
||||
assertThat(reloadResourceByUniqueId()).isNull();
|
||||
assertThat(reloadDomainApplication()).isNull();
|
||||
assertNoBillingEvents();
|
||||
}
|
||||
|
||||
|
@ -86,15 +86,15 @@ public class DomainApplicationDeleteFlowTest
|
|||
.setRepoId("1-TLD")
|
||||
.setRegistrant(
|
||||
Key.create(
|
||||
loadByUniqueId(ContactResource.class, "sh8013", clock.nowUtc())))
|
||||
loadByForeignKey(ContactResource.class, "sh8013", clock.nowUtc())))
|
||||
.setNameservers(ImmutableSet.of(
|
||||
Key.create(
|
||||
loadByUniqueId(HostResource.class, "ns1.example.net", clock.nowUtc()))))
|
||||
loadByForeignKey(HostResource.class, "ns1.example.net", clock.nowUtc()))))
|
||||
.build());
|
||||
doSuccessfulTest();
|
||||
for (EppResource resource : new EppResource[]{
|
||||
loadByUniqueId(ContactResource.class, "sh8013", clock.nowUtc()),
|
||||
loadByUniqueId(HostResource.class, "ns1.example.net", clock.nowUtc()) }) {
|
||||
loadByForeignKey(ContactResource.class, "sh8013", clock.nowUtc()),
|
||||
loadByForeignKey(HostResource.class, "ns1.example.net", clock.nowUtc()) }) {
|
||||
assertAboutEppResources().that(resource).doesNotHaveStatusValue(StatusValue.LINKED);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ package google.registry.flows.domain;
|
|||
import static com.google.common.collect.Sets.union;
|
||||
import static com.google.common.io.BaseEncoding.base16;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.model.EppResourceUtils.loadByUniqueId;
|
||||
import static google.registry.model.EppResourceUtils.loadByForeignKey;
|
||||
import static google.registry.testing.DatastoreHelper.assertNoBillingEvents;
|
||||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
import static google.registry.testing.DatastoreHelper.generateNewDomainRoid;
|
||||
|
@ -107,7 +107,7 @@ public class DomainApplicationUpdateFlowTest
|
|||
DesignatedContact.create(Type.TECH, Key.create(sh8013Contact)),
|
||||
DesignatedContact.create(Type.ADMIN, Key.create(unusedContact))))
|
||||
.setNameservers(ImmutableSet.of(Key.create(
|
||||
loadByUniqueId(HostResource.class, "ns1.example.tld", clock.nowUtc()))))
|
||||
loadByForeignKey(HostResource.class, "ns1.example.tld", clock.nowUtc()))))
|
||||
.build());
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,7 @@ public class DomainApplicationUpdateFlowTest
|
|||
clock.advanceOneMilli();
|
||||
runFlowAssertResponse(readFile("domain_update_response.xml"));
|
||||
// Check that the application was updated. These values came from the xml.
|
||||
DomainApplication application = reloadResourceByUniqueId();
|
||||
DomainApplication application = reloadDomainApplication();
|
||||
assertAboutApplications().that(application)
|
||||
.hasStatusValue(StatusValue.CLIENT_HOLD).and()
|
||||
.hasOnlyOneHistoryEntryWhich()
|
||||
|
@ -168,7 +168,7 @@ public class DomainApplicationUpdateFlowTest
|
|||
public void testSuccess_registrantMovedToTechContact() throws Exception {
|
||||
setEppInput("domain_update_sunrise_registrant_to_tech.xml");
|
||||
persistReferencedEntities();
|
||||
ContactResource sh8013 = loadByUniqueId(ContactResource.class, "sh8013", clock.nowUtc());
|
||||
ContactResource sh8013 = loadByForeignKey(ContactResource.class, "sh8013", clock.nowUtc());
|
||||
persistResource(
|
||||
newApplicationBuilder().setRegistrant(Key.create(sh8013)).build());
|
||||
clock.advanceOneMilli();
|
||||
|
@ -179,7 +179,7 @@ public class DomainApplicationUpdateFlowTest
|
|||
public void testSuccess_multipleReferencesToSameContactRemoved() throws Exception {
|
||||
setEppInput("domain_update_sunrise_remove_multiple_contacts.xml");
|
||||
persistReferencedEntities();
|
||||
ContactResource sh8013 = loadByUniqueId(ContactResource.class, "sh8013", clock.nowUtc());
|
||||
ContactResource sh8013 = loadByForeignKey(ContactResource.class, "sh8013", clock.nowUtc());
|
||||
Key<ContactResource> sh8013Key = Key.create(sh8013);
|
||||
persistResource(newApplicationBuilder()
|
||||
.setRegistrant(sh8013Key)
|
||||
|
@ -199,7 +199,7 @@ public class DomainApplicationUpdateFlowTest
|
|||
ImmutableSet.of(StatusValue.CLIENT_UPDATE_PROHIBITED)).build());
|
||||
clock.advanceOneMilli();
|
||||
runFlow();
|
||||
assertAboutApplications().that(reloadResourceByUniqueId())
|
||||
assertAboutApplications().that(reloadDomainApplication())
|
||||
.doesNotHaveStatusValue(StatusValue.CLIENT_UPDATE_PROHIBITED);
|
||||
}
|
||||
|
||||
|
@ -213,7 +213,7 @@ public class DomainApplicationUpdateFlowTest
|
|||
assertTransactionalFlow(true);
|
||||
clock.advanceOneMilli();
|
||||
runFlowAssertResponse(readFile("domain_update_response.xml"));
|
||||
assertAboutApplications().that(reloadResourceByUniqueId())
|
||||
assertAboutApplications().that(reloadDomainApplication())
|
||||
.hasExactlyDsData(expectedDsData).and()
|
||||
.hasOnlyOneHistoryEntryWhich()
|
||||
.hasType(HistoryEntry.Type.DOMAIN_APPLICATION_UPDATE);
|
||||
|
@ -372,11 +372,11 @@ public class DomainApplicationUpdateFlowTest
|
|||
ImmutableSet.Builder<Key<HostResource>> nameservers = new ImmutableSet.Builder<>();
|
||||
for (int i = 1; i < 15; i++) {
|
||||
if (i != 2) { // Skip 2 since that's the one that the tests will add.
|
||||
nameservers.add(Key.create(loadByUniqueId(
|
||||
nameservers.add(Key.create(loadByForeignKey(
|
||||
HostResource.class, String.format("ns%d.example.tld", i), clock.nowUtc())));
|
||||
}
|
||||
}
|
||||
persistResource(reloadResourceByUniqueId().asBuilder()
|
||||
persistResource(reloadDomainApplication().asBuilder()
|
||||
.setNameservers(nameservers.build())
|
||||
.build());
|
||||
}
|
||||
|
@ -491,9 +491,9 @@ public class DomainApplicationUpdateFlowTest
|
|||
persistNewApplication();
|
||||
// Add a tech contact to the persisted entity, which should cause the flow to fail when it tries
|
||||
// to add "mak21" as a second tech contact.
|
||||
persistResource(reloadResourceByUniqueId().asBuilder().setContacts(ImmutableSet.of(
|
||||
persistResource(reloadDomainApplication().asBuilder().setContacts(ImmutableSet.of(
|
||||
DesignatedContact.create(Type.TECH, Key.create(
|
||||
loadByUniqueId(ContactResource.class, "foo", clock.nowUtc()))))).build());
|
||||
loadByForeignKey(ContactResource.class, "foo", clock.nowUtc()))))).build());
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -577,7 +577,7 @@ public class DomainApplicationUpdateFlowTest
|
|||
persistReferencedEntities();
|
||||
persistResource(newApplicationBuilder()
|
||||
.setNameservers(ImmutableSet.of(Key.create(
|
||||
loadByUniqueId(HostResource.class, "ns1.example.tld", clock.nowUtc()))))
|
||||
loadByForeignKey(HostResource.class, "ns1.example.tld", clock.nowUtc()))))
|
||||
.build());
|
||||
runFlow();
|
||||
}
|
||||
|
@ -591,7 +591,7 @@ public class DomainApplicationUpdateFlowTest
|
|||
.setContacts(ImmutableSet.of(DesignatedContact.create(
|
||||
Type.TECH,
|
||||
Key.create(
|
||||
loadByUniqueId(ContactResource.class, "sh8013", clock.nowUtc())))))
|
||||
loadByForeignKey(ContactResource.class, "sh8013", clock.nowUtc())))))
|
||||
.build());
|
||||
runFlow();
|
||||
}
|
||||
|
|
|
@ -165,7 +165,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
|
|||
}
|
||||
|
||||
private void assertSuccessfulCreate(String domainTld, boolean isAnchorTenant) throws Exception {
|
||||
DomainResource domain = reloadResourceByUniqueId();
|
||||
DomainResource domain = reloadResourceByForeignKey();
|
||||
|
||||
// Calculate the total cost.
|
||||
Money cost = getPricesForDomainName(getUniqueIdFromCommand(), clock.nowUtc()).isPremium()
|
||||
|
@ -255,21 +255,21 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
|
|||
|
||||
private void assertNoLordn() throws Exception {
|
||||
// TODO(b/26161326): Assert tasks NOT enqueued.
|
||||
assertAboutDomains().that(reloadResourceByUniqueId())
|
||||
assertAboutDomains().that(reloadResourceByForeignKey())
|
||||
.hasSmdId(null).and()
|
||||
.hasLaunchNotice(null);
|
||||
}
|
||||
|
||||
private void assertSunriseLordn() throws Exception {
|
||||
// TODO(b/26161326): Assert tasks enqueued.
|
||||
assertAboutDomains().that(reloadResourceByUniqueId())
|
||||
assertAboutDomains().that(reloadResourceByForeignKey())
|
||||
.hasSmdId("0000001761376042759136-65535").and()
|
||||
.hasLaunchNotice(null);
|
||||
}
|
||||
|
||||
private void assertClaimsLordn() throws Exception {
|
||||
// TODO(b/26161326): Assert tasks enqueued.
|
||||
assertAboutDomains().that(reloadResourceByUniqueId())
|
||||
assertAboutDomains().that(reloadResourceByForeignKey())
|
||||
.hasSmdId(null).and()
|
||||
.hasLaunchNotice(LaunchNotice.create(
|
||||
"370d0b7c9223372036854775807",
|
||||
|
@ -479,7 +479,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
|
|||
setEppInput("domain_create_metadata.xml");
|
||||
persistContactsAndHosts();
|
||||
doSuccessfulTest();
|
||||
assertAboutDomains().that(reloadResourceByUniqueId())
|
||||
assertAboutDomains().that(reloadResourceByForeignKey())
|
||||
.hasOnlyOneHistoryEntryWhich()
|
||||
.hasType(HistoryEntry.Type.DOMAIN_CREATE).and()
|
||||
.hasMetadataReason("domain-create-test").and()
|
||||
|
@ -545,7 +545,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
|
|||
setEppInput("domain_create_dsdata_no_maxsiglife.xml");
|
||||
persistContactsAndHosts("tld"); // For some reason this sample uses "tld".
|
||||
doSuccessfulTest("tld");
|
||||
assertAboutDomains().that(reloadResourceByUniqueId()).hasExactlyDsData(
|
||||
assertAboutDomains().that(reloadResourceByForeignKey()).hasExactlyDsData(
|
||||
DelegationSignerData.create(12345, 3, 1, base16().decode("49FD46E6C4B45C55D4AC")));
|
||||
}
|
||||
|
||||
|
@ -554,7 +554,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
|
|||
setEppInput("domain_create_dsdata_8_records.xml");
|
||||
persistContactsAndHosts("tld"); // For some reason this sample uses "tld".
|
||||
doSuccessfulTest("tld");
|
||||
assertAboutDomains().that(reloadResourceByUniqueId()).hasNumDsData(8);
|
||||
assertAboutDomains().that(reloadResourceByForeignKey()).hasNumDsData(8);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -581,7 +581,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
|
|||
persistContactsAndHosts();
|
||||
runFlowAssertResponse(readFile("domain_create_response.xml"),
|
||||
"epp.response.resData.creData.exDate"); // Ignore expiration date; we verify it below
|
||||
assertAboutDomains().that(reloadResourceByUniqueId())
|
||||
assertAboutDomains().that(reloadResourceByForeignKey())
|
||||
.hasRegistrationExpirationTime(clock.nowUtc().plusYears(1));
|
||||
assertDnsTasksEnqueued("example.tld");
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ package google.registry.flows.domain;
|
|||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.flows.domain.DomainTransferFlowTestCase.persistWithPendingTransfer;
|
||||
import static google.registry.model.EppResourceUtils.loadByUniqueId;
|
||||
import static google.registry.model.EppResourceUtils.loadByForeignKey;
|
||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||
import static google.registry.testing.DatastoreHelper.assertBillingEvents;
|
||||
import static google.registry.testing.DatastoreHelper.createTlds;
|
||||
|
@ -255,7 +255,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
|
|||
clock.advanceOneMilli();
|
||||
runFlowAssertResponse(readFile(responseFilename, substitutions));
|
||||
// Check that the domain is fully deleted.
|
||||
assertThat(reloadResourceByUniqueId()).isNull();
|
||||
assertThat(reloadResourceByForeignKey()).isNull();
|
||||
// The add grace period is for a billable action, so it should trigger a cancellation.
|
||||
assertAutorenewClosedAndCancellationCreatedFor(
|
||||
graceBillingEvent,
|
||||
|
@ -313,7 +313,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
|
|||
assertPollMessages(createAutorenewPollMessage("TheRegistrar").build());
|
||||
clock.advanceOneMilli();
|
||||
runFlowAssertResponse(readFile(responseFilename, substitutions));
|
||||
DomainResource resource = reloadResourceByUniqueId();
|
||||
DomainResource resource = reloadResourceByForeignKey();
|
||||
// Check that the domain is in the pending delete state.
|
||||
assertAboutDomains().that(resource)
|
||||
.hasStatusValue(StatusValue.PENDING_DELETE).and()
|
||||
|
@ -375,14 +375,14 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
|
|||
// Modify the autorenew poll message so that it has unacked messages in the past. This should
|
||||
// prevent it from being deleted when the domain is deleted.
|
||||
persistResource(
|
||||
ofy().load().key(reloadResourceByUniqueId().getAutorenewPollMessage()).now().asBuilder()
|
||||
ofy().load().key(reloadResourceByForeignKey().getAutorenewPollMessage()).now().asBuilder()
|
||||
.setEventTime(A_MONTH_FROM_NOW.minusYears(3))
|
||||
.build());
|
||||
clock.advanceOneMilli();
|
||||
runFlowAssertResponse(readFile("domain_delete_response_pending.xml"));
|
||||
// There should now be two poll messages; one for the delete of the domain (in the future), and
|
||||
// another for the unacked autorenew messages.
|
||||
DateTime deletionTime = reloadResourceByUniqueId().getDeletionTime();
|
||||
DateTime deletionTime = reloadResourceByForeignKey().getDeletionTime();
|
||||
assertThat(getPollMessages("TheRegistrar", deletionTime.minusMinutes(1)))
|
||||
.hasSize(1);
|
||||
assertThat(getPollMessages("TheRegistrar", deletionTime)).hasSize(2);
|
||||
|
@ -482,10 +482,10 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
|
|||
setupSuccessfulTest();
|
||||
// Modify the domain we are testing to include a pending transfer.
|
||||
TransferData oldTransferData =
|
||||
persistWithPendingTransfer(reloadResourceByUniqueId()).getTransferData();
|
||||
persistWithPendingTransfer(reloadResourceByForeignKey()).getTransferData();
|
||||
clock.advanceOneMilli();
|
||||
runFlowAssertResponse(readFile("domain_delete_response_pending.xml"));
|
||||
DomainResource domain = reloadResourceByUniqueId();
|
||||
DomainResource domain = reloadResourceByForeignKey();
|
||||
// Check that the domain is in the pending delete state.
|
||||
// The PENDING_TRANSFER status should be gone.
|
||||
assertAboutDomains().that(domain)
|
||||
|
@ -554,17 +554,20 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
|
|||
setupGracePeriods(GracePeriod.forBillingEvent(GracePeriodStatus.ADD, graceBillingEvent));
|
||||
// Add a nameserver.
|
||||
HostResource host = persistResource(newHostResource("ns1.example.tld"));
|
||||
persistResource(loadByUniqueId(
|
||||
persistResource(loadByForeignKey(
|
||||
DomainResource.class, getUniqueIdFromCommand(), clock.nowUtc())
|
||||
.asBuilder()
|
||||
.setNameservers(ImmutableSet.of(Key.create(host)))
|
||||
.build());
|
||||
// Persist another domain that's already been deleted and references this contact and host.
|
||||
persistResource(newDomainResource("example1.tld").asBuilder()
|
||||
.setRegistrant(Key.create(loadByUniqueId(ContactResource.class, "sh8013", clock.nowUtc())))
|
||||
.setNameservers(ImmutableSet.of(Key.create(host)))
|
||||
.setDeletionTime(START_OF_TIME)
|
||||
.build());
|
||||
persistResource(
|
||||
newDomainResource("example1.tld")
|
||||
.asBuilder()
|
||||
.setRegistrant(
|
||||
Key.create(loadByForeignKey(ContactResource.class, "sh8013", clock.nowUtc())))
|
||||
.setNameservers(ImmutableSet.of(Key.create(host)))
|
||||
.setDeletionTime(START_OF_TIME)
|
||||
.build());
|
||||
clock.advanceOneMilli();
|
||||
runFlowAssertResponse(readFile("domain_delete_response.xml"));
|
||||
assertDnsTasksEnqueued("example.tld");
|
||||
|
@ -578,7 +581,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
|
|||
setupSuccessfulTest();
|
||||
persistResource(
|
||||
newHostResource("ns1." + getUniqueIdFromCommand()).asBuilder()
|
||||
.setSuperordinateDomain(Key.create(reloadResourceByUniqueId()))
|
||||
.setSuperordinateDomain(Key.create(reloadResourceByForeignKey()))
|
||||
.setDeletionTime(clock.nowUtc().minusDays(1))
|
||||
.build());
|
||||
clock.advanceOneMilli();
|
||||
|
@ -610,7 +613,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
|
|||
DomainResource domain = persistActiveDomain(getUniqueIdFromCommand());
|
||||
HostResource subordinateHost = persistResource(
|
||||
newHostResource("ns1." + getUniqueIdFromCommand()).asBuilder()
|
||||
.setSuperordinateDomain(Key.create(reloadResourceByUniqueId()))
|
||||
.setSuperordinateDomain(Key.create(reloadResourceByForeignKey()))
|
||||
.build());
|
||||
domain = persistResource(domain.asBuilder()
|
||||
.addSubordinateHost(subordinateHost.getFullyQualifiedHostName())
|
||||
|
@ -681,7 +684,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
|
|||
setupSuccessfulTest();
|
||||
clock.advanceOneMilli();
|
||||
runFlow();
|
||||
assertAboutDomains().that(reloadResourceByUniqueId())
|
||||
assertAboutDomains().that(reloadResourceByForeignKey())
|
||||
.hasOneHistoryEntryEachOfTypes(
|
||||
HistoryEntry.Type.DOMAIN_CREATE,
|
||||
HistoryEntry.Type.DOMAIN_DELETE);
|
||||
|
@ -699,7 +702,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
|
|||
persistResource(newDomainResource(getUniqueIdFromCommand()));
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testSuccess_flags() throws Exception {
|
||||
setEppInput("domain_delete_flags.xml");
|
||||
|
|
|
@ -135,10 +135,10 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
|
|||
int renewalYears,
|
||||
Map<String, String> substitutions) throws Exception {
|
||||
assertTransactionalFlow(true);
|
||||
DateTime currentExpiration = reloadResourceByUniqueId().getRegistrationExpirationTime();
|
||||
DateTime currentExpiration = reloadResourceByForeignKey().getRegistrationExpirationTime();
|
||||
DateTime newExpiration = currentExpiration.plusYears(renewalYears);
|
||||
runFlowAssertResponse(readFile(responseFilename, substitutions));
|
||||
DomainResource domain = reloadResourceByUniqueId();
|
||||
DomainResource domain = reloadResourceByForeignKey();
|
||||
HistoryEntry historyEntryDomainRenew =
|
||||
getOnlyHistoryEntryOfType(domain, HistoryEntry.Type.DOMAIN_RENEW);
|
||||
assertThat(ofy().load().key(domain.getAutorenewBillingEvent()).now().getEventTime())
|
||||
|
@ -351,12 +351,12 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
|
|||
persistDomain();
|
||||
// Modify the autorenew poll message so that it has an undelivered message in the past.
|
||||
persistResource(
|
||||
ofy().load().key(reloadResourceByUniqueId().getAutorenewPollMessage()).now().asBuilder()
|
||||
ofy().load().key(reloadResourceByForeignKey().getAutorenewPollMessage()).now().asBuilder()
|
||||
.setEventTime(expirationTime.minusYears(1))
|
||||
.build());
|
||||
runFlowAssertResponse(readFile("domain_renew_response.xml"));
|
||||
HistoryEntry historyEntryDomainRenew =
|
||||
getOnlyHistoryEntryOfType(reloadResourceByUniqueId(), HistoryEntry.Type.DOMAIN_RENEW);
|
||||
getOnlyHistoryEntryOfType(reloadResourceByForeignKey(), HistoryEntry.Type.DOMAIN_RENEW);
|
||||
assertPollMessages(
|
||||
new PollMessage.Autorenew.Builder()
|
||||
.setTargetId(getUniqueIdFromCommand())
|
||||
|
@ -365,12 +365,12 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
|
|||
.setAutorenewEndTime(clock.nowUtc())
|
||||
.setMsg("Domain was auto-renewed.")
|
||||
.setParent(getOnlyHistoryEntryOfType(
|
||||
reloadResourceByUniqueId(), HistoryEntry.Type.DOMAIN_CREATE))
|
||||
reloadResourceByForeignKey(), HistoryEntry.Type.DOMAIN_CREATE))
|
||||
.build(),
|
||||
new PollMessage.Autorenew.Builder()
|
||||
.setTargetId(getUniqueIdFromCommand())
|
||||
.setClientId("TheRegistrar")
|
||||
.setEventTime(reloadResourceByUniqueId().getRegistrationExpirationTime())
|
||||
.setEventTime(reloadResourceByForeignKey().getRegistrationExpirationTime())
|
||||
.setAutorenewEndTime(END_OF_TIME)
|
||||
.setMsg("Domain was auto-renewed.")
|
||||
.setParent(historyEntryDomainRenew)
|
||||
|
@ -529,7 +529,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
|
|||
public void testFailure_pendingTransfer() throws Exception {
|
||||
thrown.expect(DomainHasPendingTransferException.class);
|
||||
persistDomain();
|
||||
persistWithPendingTransfer(reloadResourceByUniqueId()
|
||||
persistWithPendingTransfer(reloadResourceByForeignKey()
|
||||
.asBuilder()
|
||||
.setRegistrationExpirationTime(DateTime.parse("2001-09-08T22:00:00.0Z"))
|
||||
.build());
|
||||
|
@ -568,7 +568,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
|
|||
thrown.expect(IncorrectCurrentExpirationDateException.class);
|
||||
persistDomain();
|
||||
// Note expiration time is off by one day.
|
||||
persistResource(reloadResourceByUniqueId().asBuilder()
|
||||
persistResource(reloadResourceByForeignKey().asBuilder()
|
||||
.setRegistrationExpirationTime(DateTime.parse("2000-04-04T22:00:00.0Z"))
|
||||
.build());
|
||||
runFlow();
|
||||
|
|
|
@ -129,7 +129,7 @@ public class DomainRestoreRequestFlowTest extends
|
|||
assertThat(getPollMessages("TheRegistrar", clock.nowUtc().plusMonths(1)))
|
||||
.hasSize(1);
|
||||
runFlowAssertResponse(readFile("domain_update_response.xml"));
|
||||
DomainResource domain = reloadResourceByUniqueId();
|
||||
DomainResource domain = reloadResourceByForeignKey();
|
||||
HistoryEntry historyEntryDomainRestore =
|
||||
getOnlyHistoryEntryOfType(domain, HistoryEntry.Type.DOMAIN_RESTORE);
|
||||
assertThat(ofy().load().key(domain.getAutorenewBillingEvent()).now().getEventTime())
|
||||
|
|
|
@ -16,7 +16,7 @@ package google.registry.flows.domain;
|
|||
|
||||
import static com.google.common.collect.Iterables.getOnlyElement;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.model.EppResourceUtils.loadByUniqueId;
|
||||
import static google.registry.model.EppResourceUtils.loadByForeignKey;
|
||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||
import static google.registry.testing.DatastoreHelper.assertBillingEventsForResource;
|
||||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
|
@ -141,7 +141,7 @@ public class DomainTransferApproveFlowTest
|
|||
assertTransactionalFlow(true);
|
||||
runFlowAssertResponse(readFile(expectedXmlFilename));
|
||||
// Transfer should have succeeded. Verify correct fields were set.
|
||||
domain = reloadResourceByUniqueId();
|
||||
domain = reloadResourceByForeignKey();
|
||||
assertAboutDomains().that(domain).hasOneHistoryEntryEachOfTypes(
|
||||
HistoryEntry.Type.DOMAIN_CREATE,
|
||||
HistoryEntry.Type.DOMAIN_TRANSFER_REQUEST,
|
||||
|
@ -280,7 +280,7 @@ public class DomainTransferApproveFlowTest
|
|||
|
||||
@Test
|
||||
public void testSuccess_lastTransferTime_reflectedOnSubordinateHost() throws Exception {
|
||||
domain = reloadResourceByUniqueId();
|
||||
domain = reloadResourceByForeignKey();
|
||||
// Set an older last transfer time on the subordinate host.
|
||||
subordinateHost = persistResource(
|
||||
subordinateHost.asBuilder()
|
||||
|
@ -288,7 +288,7 @@ public class DomainTransferApproveFlowTest
|
|||
.build());
|
||||
|
||||
doSuccessfulTest("tld", "domain_transfer_approve.xml", "domain_transfer_approve_response.xml");
|
||||
subordinateHost = loadByUniqueId(
|
||||
subordinateHost = loadByForeignKey(
|
||||
HostResource.class, subordinateHost.getFullyQualifiedHostName(), clock.nowUtc());
|
||||
// Verify that the host's last transfer time is now that of when the superordinate domain was
|
||||
// transferred.
|
||||
|
@ -297,7 +297,7 @@ public class DomainTransferApproveFlowTest
|
|||
|
||||
@Test
|
||||
public void testSuccess_lastTransferTime_overridesExistingOnSubordinateHost() throws Exception {
|
||||
domain = reloadResourceByUniqueId();
|
||||
domain = reloadResourceByForeignKey();
|
||||
// Set an older last transfer time on the subordinate host.
|
||||
subordinateHost = persistResource(
|
||||
subordinateHost.asBuilder()
|
||||
|
@ -306,7 +306,7 @@ public class DomainTransferApproveFlowTest
|
|||
.build());
|
||||
|
||||
doSuccessfulTest("tld", "domain_transfer_approve.xml", "domain_transfer_approve_response.xml");
|
||||
subordinateHost = loadByUniqueId(
|
||||
subordinateHost = loadByForeignKey(
|
||||
HostResource.class, subordinateHost.getFullyQualifiedHostName(), clock.nowUtc());
|
||||
// Verify that the host's last transfer time is now that of when the superordinate domain was
|
||||
// transferred.
|
||||
|
@ -316,7 +316,7 @@ public class DomainTransferApproveFlowTest
|
|||
@Test
|
||||
public void testSuccess_lastTransferTime_overridesExistingOnSubordinateHostWithNullTransferTime()
|
||||
throws Exception {
|
||||
domain = reloadResourceByUniqueId();
|
||||
domain = reloadResourceByForeignKey();
|
||||
// Set an older last transfer time on the subordinate host.
|
||||
subordinateHost = persistResource(
|
||||
subordinateHost.asBuilder()
|
||||
|
@ -325,7 +325,7 @@ public class DomainTransferApproveFlowTest
|
|||
.build());
|
||||
|
||||
doSuccessfulTest("tld", "domain_transfer_approve.xml", "domain_transfer_approve_response.xml");
|
||||
subordinateHost = loadByUniqueId(
|
||||
subordinateHost = loadByForeignKey(
|
||||
HostResource.class, subordinateHost.getFullyQualifiedHostName(), clock.nowUtc());
|
||||
// Verify that the host's last transfer time is now that of when the superordinate domain was
|
||||
// transferred.
|
||||
|
@ -350,7 +350,7 @@ public class DomainTransferApproveFlowTest
|
|||
|
||||
@Test
|
||||
public void testSuccess_autorenewBeforeTransfer() throws Exception {
|
||||
DomainResource domain = reloadResourceByUniqueId();
|
||||
DomainResource domain = reloadResourceByForeignKey();
|
||||
DateTime oldExpirationTime = clock.nowUtc().minusDays(1);
|
||||
persistResource(domain.asBuilder()
|
||||
.setRegistrationExpirationTime(oldExpirationTime)
|
||||
|
|
|
@ -107,7 +107,7 @@ public class DomainTransferCancelFlowTest
|
|||
runFlowAssertResponse(readFile(expectedXmlFilename));
|
||||
|
||||
// Transfer should have been cancelled. Verify correct fields were set.
|
||||
domain = reloadResourceByUniqueId();
|
||||
domain = reloadResourceByForeignKey();
|
||||
assertTransferFailed(domain, TransferStatus.CLIENT_CANCELLED);
|
||||
assertAboutDomains().that(domain)
|
||||
.hasRegistrationExpirationTime(originalExpirationTime).and()
|
||||
|
|
|
@ -16,7 +16,7 @@ package google.registry.flows.domain;
|
|||
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.model.EppResourceUtils.loadByUniqueId;
|
||||
import static google.registry.model.EppResourceUtils.loadByForeignKey;
|
||||
import static google.registry.testing.DatastoreHelper.createBillingEventForTransfer;
|
||||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
import static google.registry.testing.DatastoreHelper.getOnlyHistoryEntryOfType;
|
||||
|
@ -120,14 +120,15 @@ public class DomainTransferFlowTestCase<F extends Flow, R extends EppResource>
|
|||
.setCreationClientId("TheRegistrar")
|
||||
.setCreationTimeForTest(DateTime.parse("1999-04-03T22:00:00.0Z"))
|
||||
.setRegistrationExpirationTime(REGISTRATION_EXPIRATION_TIME)
|
||||
.setRegistrant(Key.create(loadByUniqueId(ContactResource.class, "jd1234", clock.nowUtc())))
|
||||
.setRegistrant(
|
||||
Key.create(loadByForeignKey(ContactResource.class, "jd1234", clock.nowUtc())))
|
||||
.setContacts(ImmutableSet.of(
|
||||
DesignatedContact.create(
|
||||
Type.ADMIN,
|
||||
Key.create(loadByUniqueId(ContactResource.class, "jd1234", clock.nowUtc()))),
|
||||
Key.create(loadByForeignKey(ContactResource.class, "jd1234", clock.nowUtc()))),
|
||||
DesignatedContact.create(
|
||||
Type.TECH,
|
||||
Key.create(loadByUniqueId(ContactResource.class, "jd1234", clock.nowUtc())))))
|
||||
Key.create(loadByForeignKey(ContactResource.class, "jd1234", clock.nowUtc())))))
|
||||
.setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("fooBAR")))
|
||||
.addGracePeriod(GracePeriod.create(
|
||||
GracePeriodStatus.ADD, clock.nowUtc().plusDays(10), "foo", null))
|
||||
|
|
|
@ -80,7 +80,7 @@ public class DomainTransferRejectFlowTest
|
|||
ImmutableSet<GracePeriod> originalGracePeriods = domain.getGracePeriods();
|
||||
runFlowAssertResponse(readFile(expectedXmlFilename));
|
||||
// Transfer should have been rejected. Verify correct fields were set.
|
||||
domain = reloadResourceByUniqueId();
|
||||
domain = reloadResourceByForeignKey();
|
||||
assertTransferFailed(domain, TransferStatus.CLIENT_REJECTED);
|
||||
assertTransferFailed(
|
||||
reloadResourceAndCloneAtTime(subordinateHost, clock.nowUtc()),
|
||||
|
|
|
@ -147,7 +147,7 @@ public class DomainTransferRequestFlowTest
|
|||
assertTransactionalFlow(true);
|
||||
runFlowAssertResponse(readFile(expectedXmlFilename, substitutions));
|
||||
// Transfer should have been requested. Verify correct fields were set.
|
||||
domain = reloadResourceByUniqueId();
|
||||
domain = reloadResourceByForeignKey();
|
||||
final HistoryEntry historyEntryTransferRequest =
|
||||
getOnlyHistoryEntryOfType(domain, HistoryEntry.Type.DOMAIN_TRANSFER_REQUEST);
|
||||
int registrationYears = domain.getTransferData().getExtendedRegistrationYears();
|
||||
|
@ -503,7 +503,7 @@ public class DomainTransferRequestFlowTest
|
|||
|
||||
@Test
|
||||
public void testSuccess_autorenewBeforeAutomaticTransfer() throws Exception {
|
||||
DomainResource oldResource = persistResource(reloadResourceByUniqueId().asBuilder()
|
||||
DomainResource oldResource = persistResource(reloadResourceByForeignKey().asBuilder()
|
||||
.setRegistrationExpirationTime(clock.nowUtc().plusDays(1).plus(1))
|
||||
.build());
|
||||
clock.advanceOneMilli();
|
||||
|
|
|
@ -17,7 +17,7 @@ package google.registry.flows.domain;
|
|||
import static com.google.common.collect.Sets.union;
|
||||
import static com.google.common.io.BaseEncoding.base16;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.model.EppResourceUtils.loadByUniqueId;
|
||||
import static google.registry.model.EppResourceUtils.loadByForeignKey;
|
||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||
import static google.registry.testing.DatastoreHelper.assertBillingEvents;
|
||||
import static google.registry.testing.DatastoreHelper.assertNoBillingEvents;
|
||||
|
@ -121,7 +121,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
|||
}
|
||||
|
||||
private DomainResource persistDomain() throws Exception {
|
||||
HostResource host = loadByUniqueId(HostResource.class, "ns1.example.foo", clock.nowUtc());
|
||||
HostResource host = loadByForeignKey(HostResource.class, "ns1.example.foo", clock.nowUtc());
|
||||
DomainResource domain = persistResource(
|
||||
newDomainResource(getUniqueIdFromCommand()).asBuilder()
|
||||
.setContacts(ImmutableSet.of(
|
||||
|
@ -142,7 +142,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
|||
assertTransactionalFlow(true);
|
||||
runFlowAssertResponse(readFile("domain_update_response.xml"));
|
||||
// Check that the domain was updated. These values came from the xml.
|
||||
assertAboutDomains().that(reloadResourceByUniqueId())
|
||||
assertAboutDomains().that(reloadResourceByForeignKey())
|
||||
.hasStatusValue(StatusValue.CLIENT_HOLD).and()
|
||||
.hasAuthInfoPwd("2BARfoo").and()
|
||||
.hasOneHistoryEntryEachOfTypes(
|
||||
|
@ -178,12 +178,12 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
|||
CommitMode.LIVE, userPrivileges, readFile("domain_update_response.xml"));
|
||||
|
||||
// Verify that the domain now has the new nameserver and is in the add grace period.
|
||||
DomainResource resource = reloadResourceByUniqueId();
|
||||
DomainResource resource = reloadResourceByForeignKey();
|
||||
HistoryEntry historyEntryDomainUpdate =
|
||||
getOnlyHistoryEntryOfType(resource, HistoryEntry.Type.DOMAIN_UPDATE);
|
||||
assertThat(resource.getNameservers()).containsExactly(
|
||||
Key.create(
|
||||
loadByUniqueId(HostResource.class, "ns2.example.foo", clock.nowUtc())));
|
||||
loadByForeignKey(HostResource.class, "ns2.example.foo", clock.nowUtc())));
|
||||
BillingEvent.OneTime regularAddBillingEvent = new BillingEvent.OneTime.Builder()
|
||||
.setReason(Reason.CREATE)
|
||||
.setTargetId("example.tld")
|
||||
|
@ -236,7 +236,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
|||
getSunrushAddBillingEvent(clock.nowUtc().plusDays(20)));
|
||||
// Modify domain so it has no nameservers and is in the sunrush add grace period.
|
||||
persistResource(
|
||||
reloadResourceByUniqueId().asBuilder()
|
||||
reloadResourceByForeignKey().asBuilder()
|
||||
.setNameservers(null)
|
||||
.addGracePeriod(GracePeriod.forBillingEvent(
|
||||
GracePeriodStatus.SUNRUSH_ADD, sunrushAddBillingEvent))
|
||||
|
@ -260,7 +260,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
|||
// that grace period only has a couple days left so that the resultant add grace period will get
|
||||
// truncated.
|
||||
persistResource(
|
||||
reloadResourceByUniqueId().asBuilder()
|
||||
reloadResourceByForeignKey().asBuilder()
|
||||
.setNameservers(null)
|
||||
.addGracePeriod(GracePeriod.forBillingEvent(
|
||||
GracePeriodStatus.SUNRUSH_ADD, sunrushAddBillingEvent))
|
||||
|
@ -279,9 +279,9 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
|||
// Modify domain so that it is in the sunrush add grace period, has nameservers, but has a
|
||||
// serverHold on it.
|
||||
persistResource(
|
||||
reloadResourceByUniqueId().asBuilder()
|
||||
reloadResourceByForeignKey().asBuilder()
|
||||
.setNameservers(ImmutableSet.of(Key.create(
|
||||
loadByUniqueId(HostResource.class, "ns2.example.foo", clock.nowUtc()))))
|
||||
loadByForeignKey(HostResource.class, "ns2.example.foo", clock.nowUtc()))))
|
||||
.addGracePeriod(GracePeriod.forBillingEvent(
|
||||
GracePeriodStatus.SUNRUSH_ADD, sunrushAddBillingEvent))
|
||||
.addStatusValue(StatusValue.SERVER_HOLD)
|
||||
|
@ -303,9 +303,9 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
|||
// Modify domain so that it is in the sunrush add grace period, has nameservers, but has a
|
||||
// serverHold on it.
|
||||
persistResource(
|
||||
reloadResourceByUniqueId().asBuilder()
|
||||
reloadResourceByForeignKey().asBuilder()
|
||||
.setNameservers(ImmutableSet.of(Key.create(
|
||||
loadByUniqueId(HostResource.class, "ns2.example.foo", clock.nowUtc()))))
|
||||
loadByForeignKey(HostResource.class, "ns2.example.foo", clock.nowUtc()))))
|
||||
.addGracePeriod(GracePeriod.forBillingEvent(
|
||||
GracePeriodStatus.SUNRUSH_ADD, sunrushAddBillingEvent))
|
||||
.addStatusValue(StatusValue.CLIENT_HOLD)
|
||||
|
@ -328,7 +328,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
|||
// Modify domain so it has no nameservers and is in the sunrush add grace period, but also has a
|
||||
// server hold on it that will prevent the sunrush add grace period from being removed.
|
||||
persistResource(
|
||||
reloadResourceByUniqueId().asBuilder()
|
||||
reloadResourceByForeignKey().asBuilder()
|
||||
.setNameservers(null)
|
||||
.addGracePeriod(GracePeriod.forBillingEvent(
|
||||
GracePeriodStatus.SUNRUSH_ADD, sunrushAddBillingEvent))
|
||||
|
@ -339,7 +339,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
|||
CommitMode.LIVE, UserPrivileges.NORMAL, readFile("domain_update_response.xml"));
|
||||
// Verify that the domain is still in the sunrush add grace period.
|
||||
assertGracePeriods(
|
||||
reloadResourceByUniqueId().getGracePeriods(),
|
||||
reloadResourceByForeignKey().getGracePeriods(),
|
||||
ImmutableMap.of(
|
||||
GracePeriod.create(
|
||||
GracePeriodStatus.SUNRUSH_ADD, endOfGracePeriod, "TheRegistrar", null),
|
||||
|
@ -350,12 +350,12 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
|||
ImmutableSet.Builder<Key<HostResource>> nameservers = new ImmutableSet.Builder<>();
|
||||
for (int i = 1; i < 15; i++) {
|
||||
if (i != 2) { // Skip 2 since that's the one that the tests will add.
|
||||
nameservers.add(Key.create(loadByUniqueId(
|
||||
nameservers.add(Key.create(loadByForeignKey(
|
||||
HostResource.class, String.format("ns%d.example.foo", i), clock.nowUtc())));
|
||||
}
|
||||
}
|
||||
persistResource(
|
||||
reloadResourceByUniqueId().asBuilder()
|
||||
reloadResourceByForeignKey().asBuilder()
|
||||
.setNameservers(nameservers.build())
|
||||
.build());
|
||||
clock.advanceOneMilli();
|
||||
|
@ -392,7 +392,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
|||
}
|
||||
ImmutableList<DesignatedContact> contacts = contactsBuilder.build();
|
||||
persistResource(
|
||||
reloadResourceByUniqueId().asBuilder()
|
||||
reloadResourceByForeignKey().asBuilder()
|
||||
.setNameservers(nameservers.build())
|
||||
.setContacts(ImmutableSet.copyOf(contacts.subList(0, 3)))
|
||||
.setRegistrant(contacts.get(3).getContactKey())
|
||||
|
@ -400,7 +400,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
|||
clock.advanceOneMilli();
|
||||
assertTransactionalFlow(true);
|
||||
runFlowAssertResponse(readFile("domain_update_response.xml"));
|
||||
DomainResource domain = reloadResourceByUniqueId();
|
||||
DomainResource domain = reloadResourceByForeignKey();
|
||||
assertAboutDomains().that(domain)
|
||||
.hasOneHistoryEntryEachOfTypes(
|
||||
HistoryEntry.Type.DOMAIN_CREATE,
|
||||
|
@ -421,7 +421,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
|||
persistReferencedEntities();
|
||||
persistDomain();
|
||||
runFlow();
|
||||
DomainResource domain = reloadResourceByUniqueId();
|
||||
DomainResource domain = reloadResourceByForeignKey();
|
||||
assertAboutDomains().that(domain)
|
||||
.hasOneHistoryEntryEachOfTypes(
|
||||
HistoryEntry.Type.DOMAIN_CREATE,
|
||||
|
@ -462,16 +462,16 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
|||
.addSubordinateHost("ns1.example.tld")
|
||||
.addSubordinateHost("ns2.example.tld")
|
||||
.setNameservers(ImmutableSet.of(Key.create(
|
||||
loadByUniqueId(HostResource.class, "ns1.example.tld", clock.nowUtc()))))
|
||||
loadByForeignKey(HostResource.class, "ns1.example.tld", clock.nowUtc()))))
|
||||
.build());
|
||||
clock.advanceOneMilli();
|
||||
assertTransactionalFlow(true);
|
||||
runFlowAssertResponse(readFile("domain_update_response.xml"));
|
||||
domain = reloadResourceByUniqueId();
|
||||
domain = reloadResourceByForeignKey();
|
||||
assertThat(domain.getNameservers()).containsExactly(Key.create(addedHost));
|
||||
assertThat(domain.getSubordinateHosts()).containsExactly("ns1.example.tld", "ns2.example.tld");
|
||||
existingHost = loadByUniqueId(HostResource.class, "ns1.example.tld", clock.nowUtc());
|
||||
addedHost = loadByUniqueId(HostResource.class, "ns2.example.tld", clock.nowUtc());
|
||||
existingHost = loadByForeignKey(HostResource.class, "ns1.example.tld", clock.nowUtc());
|
||||
addedHost = loadByForeignKey(HostResource.class, "ns2.example.tld", clock.nowUtc());
|
||||
assertThat(existingHost.getSuperordinateDomain()).isEqualTo(Key.create(domain));
|
||||
assertThat(addedHost.getSuperordinateDomain()).isEqualTo(Key.create(domain));
|
||||
}
|
||||
|
@ -480,7 +480,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
|||
public void testSuccess_registrantMovedToTechContact() throws Exception {
|
||||
setEppInput("domain_update_registrant_to_tech.xml");
|
||||
persistReferencedEntities();
|
||||
ContactResource sh8013 = loadByUniqueId(ContactResource.class, "sh8013", clock.nowUtc());
|
||||
ContactResource sh8013 = loadByForeignKey(ContactResource.class, "sh8013", clock.nowUtc());
|
||||
persistResource(
|
||||
newDomainResource(getUniqueIdFromCommand()).asBuilder()
|
||||
.setRegistrant(Key.create(sh8013))
|
||||
|
@ -493,7 +493,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
|||
public void testSuccess_multipleReferencesToSameContactRemoved() throws Exception {
|
||||
setEppInput("domain_update_remove_multiple_contacts.xml");
|
||||
persistReferencedEntities();
|
||||
ContactResource sh8013 = loadByUniqueId(ContactResource.class, "sh8013", clock.nowUtc());
|
||||
ContactResource sh8013 = loadByForeignKey(ContactResource.class, "sh8013", clock.nowUtc());
|
||||
Key<ContactResource> sh8013Key = Key.create(sh8013);
|
||||
persistResource(
|
||||
newDomainResource(getUniqueIdFromCommand()).asBuilder()
|
||||
|
@ -516,7 +516,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
|||
.build());
|
||||
clock.advanceOneMilli();
|
||||
runFlow();
|
||||
assertAboutDomains().that(reloadResourceByUniqueId())
|
||||
assertAboutDomains().that(reloadResourceByForeignKey())
|
||||
.doesNotHaveStatusValue(StatusValue.CLIENT_UPDATE_PROHIBITED);
|
||||
}
|
||||
|
||||
|
@ -533,7 +533,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
|||
assertTransactionalFlow(true);
|
||||
clock.advanceOneMilli();
|
||||
runFlowAssertResponse(readFile("domain_update_response.xml"));
|
||||
DomainResource resource = reloadResourceByUniqueId();
|
||||
DomainResource resource = reloadResourceByForeignKey();
|
||||
assertAboutDomains().that(resource)
|
||||
.hasOnlyOneHistoryEntryWhich()
|
||||
.hasType(HistoryEntry.Type.DOMAIN_UPDATE);
|
||||
|
@ -660,7 +660,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
|||
.setEventTime(clock.nowUtc())
|
||||
.setBillingTime(clock.nowUtc())
|
||||
.setParent(getOnlyHistoryEntryOfType(
|
||||
reloadResourceByUniqueId(), HistoryEntry.Type.DOMAIN_UPDATE))
|
||||
reloadResourceByForeignKey(), HistoryEntry.Type.DOMAIN_UPDATE))
|
||||
.build());
|
||||
} else {
|
||||
assertNoBillingEvents();
|
||||
|
@ -742,7 +742,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
|||
CommitMode.LIVE,
|
||||
UserPrivileges.SUPERUSER,
|
||||
readFile("domain_update_response.xml"));
|
||||
assertAboutDomains().that(reloadResourceByUniqueId())
|
||||
assertAboutDomains().that(reloadResourceByForeignKey())
|
||||
.hasStatusValue(StatusValue.CLIENT_UPDATE_PROHIBITED).and()
|
||||
.hasStatusValue(StatusValue.SERVER_HOLD);
|
||||
}
|
||||
|
@ -891,10 +891,10 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
|||
// Add a tech contact to the persisted entity, which should cause the flow to fail when it tries
|
||||
// to add "mak21" as a second tech contact.
|
||||
persistResource(
|
||||
reloadResourceByUniqueId().asBuilder()
|
||||
reloadResourceByForeignKey().asBuilder()
|
||||
.setContacts(ImmutableSet.of(
|
||||
DesignatedContact.create(Type.TECH, Key.create(
|
||||
loadByUniqueId(ContactResource.class, "foo", clock.nowUtc())))))
|
||||
loadByForeignKey(ContactResource.class, "foo", clock.nowUtc())))))
|
||||
.build());
|
||||
runFlow();
|
||||
}
|
||||
|
@ -990,7 +990,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
|||
persistResource(
|
||||
newDomainResource(getUniqueIdFromCommand()).asBuilder()
|
||||
.setNameservers(ImmutableSet.of(Key.create(
|
||||
loadByUniqueId(HostResource.class, "ns1.example.foo", clock.nowUtc()))))
|
||||
loadByForeignKey(HostResource.class, "ns1.example.foo", clock.nowUtc()))))
|
||||
.build());
|
||||
runFlow();
|
||||
}
|
||||
|
@ -1005,7 +1005,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
|||
.setContacts(ImmutableSet.of(DesignatedContact.create(
|
||||
Type.TECH,
|
||||
Key.create(
|
||||
loadByUniqueId(ContactResource.class, "sh8013", clock.nowUtc())))))
|
||||
loadByForeignKey(ContactResource.class, "sh8013", clock.nowUtc())))))
|
||||
.build());
|
||||
runFlow();
|
||||
}
|
||||
|
@ -1048,7 +1048,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
|||
persistActiveHost("ns1.example.foo");
|
||||
persistActiveHost("ns2.example.foo");
|
||||
persistActiveContact("sh8013");
|
||||
persistResource(loadByUniqueId(ContactResource.class, "mak21", clock.nowUtc()).asBuilder()
|
||||
persistResource(loadByForeignKey(ContactResource.class, "mak21", clock.nowUtc()).asBuilder()
|
||||
.addStatusValue(StatusValue.PENDING_DELETE)
|
||||
.build());
|
||||
clock.advanceOneMilli();
|
||||
|
@ -1066,7 +1066,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
|||
persistActiveContact("mak21");
|
||||
persistActiveContact("sh8013");
|
||||
persistResource(
|
||||
loadByUniqueId(HostResource.class, "ns2.example.foo", clock.nowUtc()).asBuilder()
|
||||
loadByForeignKey(HostResource.class, "ns2.example.foo", clock.nowUtc()).asBuilder()
|
||||
.addStatusValue(StatusValue.PENDING_DELETE)
|
||||
.build());
|
||||
clock.advanceOneMilli();
|
||||
|
@ -1111,11 +1111,11 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
|||
.setAllowedFullyQualifiedHostNames(
|
||||
ImmutableSet.of("ns1.example.foo", "ns2.example.foo"))
|
||||
.build());
|
||||
assertThat(reloadResourceByUniqueId().getNameservers()).doesNotContain(
|
||||
Key.create(loadByUniqueId(HostResource.class, "ns2.example.foo", clock.nowUtc())));
|
||||
assertThat(reloadResourceByForeignKey().getNameservers()).doesNotContain(
|
||||
Key.create(loadByForeignKey(HostResource.class, "ns2.example.foo", clock.nowUtc())));
|
||||
runFlow();
|
||||
assertThat(reloadResourceByUniqueId().getNameservers()).contains(
|
||||
Key.create(loadByUniqueId(HostResource.class, "ns2.example.foo", clock.nowUtc())));
|
||||
assertThat(reloadResourceByForeignKey().getNameservers()).contains(
|
||||
Key.create(loadByForeignKey(HostResource.class, "ns2.example.foo", clock.nowUtc())));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -1130,7 +1130,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
|||
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns1.example.foo"))
|
||||
.build());
|
||||
runFlow();
|
||||
assertThat(ofy().load().key(reloadResourceByUniqueId().getRegistrant()).now().getContactId())
|
||||
assertThat(ofy().load().key(reloadResourceByForeignKey().getRegistrant()).now().getContactId())
|
||||
.isEqualTo("sh8013");
|
||||
}
|
||||
|
||||
|
@ -1152,21 +1152,21 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
|||
persistReferencedEntities();
|
||||
persistDomain();
|
||||
persistResource(
|
||||
reloadResourceByUniqueId().asBuilder()
|
||||
reloadResourceByForeignKey().asBuilder()
|
||||
.addNameservers(ImmutableSet.of(Key.create(
|
||||
loadByUniqueId(HostResource.class, "ns2.example.foo", clock.nowUtc()))))
|
||||
loadByForeignKey(HostResource.class, "ns2.example.foo", clock.nowUtc()))))
|
||||
.build());
|
||||
persistResource(
|
||||
Registry.get("tld").asBuilder()
|
||||
.setAllowedFullyQualifiedHostNames(
|
||||
ImmutableSet.of("ns1.example.foo", "ns2.example.foo"))
|
||||
.build());
|
||||
assertThat(reloadResourceByUniqueId().getNameservers()).contains(
|
||||
Key.create(loadByUniqueId(HostResource.class, "ns1.example.foo", clock.nowUtc())));
|
||||
assertThat(reloadResourceByForeignKey().getNameservers()).contains(
|
||||
Key.create(loadByForeignKey(HostResource.class, "ns1.example.foo", clock.nowUtc())));
|
||||
clock.advanceOneMilli();
|
||||
runFlow();
|
||||
assertThat(reloadResourceByUniqueId().getNameservers()).doesNotContain(
|
||||
Key.create(loadByUniqueId(HostResource.class, "ns1.example.foo", clock.nowUtc())));
|
||||
assertThat(reloadResourceByForeignKey().getNameservers()).doesNotContain(
|
||||
Key.create(loadByForeignKey(HostResource.class, "ns1.example.foo", clock.nowUtc())));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -76,11 +76,11 @@ public class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, Hos
|
|||
assertTransactionalFlow(true);
|
||||
runFlowAssertResponse(readFile("host_create_response.xml"));
|
||||
// Check that the host was created and persisted with a history entry.
|
||||
assertAboutHosts().that(reloadResourceByUniqueId())
|
||||
assertAboutHosts().that(reloadResourceByForeignKey())
|
||||
.hasOnlyOneHistoryEntryWhich()
|
||||
.hasType(HistoryEntry.Type.HOST_CREATE);
|
||||
assertNoBillingEvents();
|
||||
assertEppResourceIndexEntityFor(reloadResourceByUniqueId());
|
||||
assertEppResourceIndexEntityFor(reloadResourceByForeignKey());
|
||||
}
|
||||
|
||||
private void doSuccessfulInternalTest(String tld) throws Exception {
|
||||
|
@ -104,10 +104,10 @@ public class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, Hos
|
|||
@Test
|
||||
public void testSuccess_internalNeverExisted() throws Exception {
|
||||
doSuccessfulInternalTest("tld");
|
||||
assertThat(ofy().load().key(reloadResourceByUniqueId().getSuperordinateDomain())
|
||||
assertThat(ofy().load().key(reloadResourceByForeignKey().getSuperordinateDomain())
|
||||
.now().getFullyQualifiedDomainName())
|
||||
.isEqualTo("example.tld");
|
||||
assertThat(ofy().load().key(reloadResourceByUniqueId().getSuperordinateDomain())
|
||||
assertThat(ofy().load().key(reloadResourceByForeignKey().getSuperordinateDomain())
|
||||
.now().getSubordinateHosts()).containsExactly("ns1.example.tld");
|
||||
assertDnsTasksEnqueued("ns1.example.tld");
|
||||
}
|
||||
|
@ -123,10 +123,10 @@ public class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, Hos
|
|||
public void testSuccess_internalExistedButWasDeleted() throws Exception {
|
||||
persistDeletedHost(getUniqueIdFromCommand(), clock.nowUtc());
|
||||
doSuccessfulInternalTest("tld");
|
||||
assertThat(ofy().load().key(reloadResourceByUniqueId().getSuperordinateDomain())
|
||||
assertThat(ofy().load().key(reloadResourceByForeignKey().getSuperordinateDomain())
|
||||
.now().getFullyQualifiedDomainName())
|
||||
.isEqualTo("example.tld");
|
||||
assertThat(ofy().load().key(reloadResourceByUniqueId().getSuperordinateDomain())
|
||||
assertThat(ofy().load().key(reloadResourceByForeignKey().getSuperordinateDomain())
|
||||
.now().getSubordinateHosts()).containsExactly("ns1.example.tld");
|
||||
assertDnsTasksEnqueued("ns1.example.tld");
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ public class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, Hos
|
|||
clock.advanceOneMilli();
|
||||
assertTransactionalFlow(true);
|
||||
runFlowAssertResponse(readFile("host_delete_response.xml"));
|
||||
HostResource deletedHost = reloadResourceByUniqueId();
|
||||
HostResource deletedHost = reloadResourceByForeignKey();
|
||||
assertAboutHosts().that(deletedHost).hasStatusValue(StatusValue.PENDING_DELETE);
|
||||
assertAsyncDeletionTaskEnqueued(deletedHost, "TheRegistrar", false);
|
||||
assertAboutHosts().that(deletedHost)
|
||||
|
@ -127,7 +127,7 @@ public class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, Hos
|
|||
clock.advanceOneMilli();
|
||||
runFlowAssertResponse(
|
||||
CommitMode.LIVE, UserPrivileges.SUPERUSER, readFile("host_delete_response.xml"));
|
||||
HostResource deletedHost = reloadResourceByUniqueId();
|
||||
HostResource deletedHost = reloadResourceByForeignKey();
|
||||
assertAboutHosts().that(deletedHost).hasStatusValue(StatusValue.PENDING_DELETE);
|
||||
assertAsyncDeletionTaskEnqueued(deletedHost, "NewRegistrar", true);
|
||||
assertAboutHosts().that(deletedHost)
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
package google.registry.flows.host;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.model.EppResourceUtils.loadByUniqueId;
|
||||
import static google.registry.model.EppResourceUtils.loadByForeignKey;
|
||||
import static google.registry.request.Actions.getPathForAction;
|
||||
import static google.registry.testing.DatastoreHelper.assertNoBillingEvents;
|
||||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
|
@ -106,10 +106,10 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
|
|||
runFlowAssertResponse(readFile("host_update_response.xml"));
|
||||
// The example xml does a host rename, so reloading the host (which uses the original host name)
|
||||
// should now return null.
|
||||
assertThat(reloadResourceByUniqueId()).isNull();
|
||||
assertThat(reloadResourceByForeignKey()).isNull();
|
||||
// However, it should load correctly if we use the new name (taken from the xml).
|
||||
HostResource renamedHost =
|
||||
loadByUniqueId(HostResource.class, "ns2.example.tld", clock.nowUtc());
|
||||
loadByForeignKey(HostResource.class, "ns2.example.tld", clock.nowUtc());
|
||||
assertAboutHosts().that(renamedHost)
|
||||
.hasOnlyOneHistoryEntryWhich()
|
||||
.hasType(HistoryEntry.Type.HOST_UPDATE);
|
||||
|
@ -127,7 +127,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
|
|||
.build());
|
||||
clock.advanceOneMilli();
|
||||
runFlow();
|
||||
assertAboutEppResources().that(reloadResourceByUniqueId())
|
||||
assertAboutEppResources().that(reloadResourceByForeignKey())
|
||||
.doesNotHaveStatusValue(StatusValue.CLIENT_UPDATE_PROHIBITED);
|
||||
}
|
||||
|
||||
|
@ -175,7 +175,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
|
|||
clock.advanceOneMilli();
|
||||
runFlowAssertResponse(readFile("host_update_response.xml"));
|
||||
// The example xml doesn't do a host rename, so reloading the host should work.
|
||||
assertAboutHosts().that(reloadResourceByUniqueId())
|
||||
assertAboutHosts().that(reloadResourceByForeignKey())
|
||||
.hasOnlyOneHistoryEntryWhich()
|
||||
.hasType(HistoryEntry.Type.HOST_UPDATE);
|
||||
assertDnsTasksEnqueued("ns1.example.tld");
|
||||
|
@ -196,13 +196,13 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
|
|||
.setSubordinateHosts(ImmutableSet.of(oldHostName()))
|
||||
.build());
|
||||
assertThat(
|
||||
loadByUniqueId(
|
||||
loadByForeignKey(
|
||||
DomainResource.class, "example.tld", clock.nowUtc()).getSubordinateHosts())
|
||||
.containsExactly("ns1.example.tld");
|
||||
HostResource renamedHost = doSuccessfulTest();
|
||||
assertThat(renamedHost.getSuperordinateDomain()).isEqualTo(Key.create(domain));
|
||||
assertThat(
|
||||
loadByUniqueId(
|
||||
loadByForeignKey(
|
||||
DomainResource.class, "example.tld", clock.nowUtc()).getSubordinateHosts())
|
||||
.containsExactly("ns2.example.tld");
|
||||
assertDnsTasksEnqueued("ns1.example.tld", "ns2.example.tld");
|
||||
|
@ -224,21 +224,21 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
|
|||
.setSubordinateHosts(ImmutableSet.of(oldHostName()))
|
||||
.build());
|
||||
assertThat(
|
||||
loadByUniqueId(
|
||||
loadByForeignKey(
|
||||
DomainResource.class, "foo.tld", clock.nowUtc()).getSubordinateHosts())
|
||||
.containsExactly("ns2.foo.tld");
|
||||
assertThat(
|
||||
loadByUniqueId(
|
||||
loadByForeignKey(
|
||||
DomainResource.class, "example.tld", clock.nowUtc()).getSubordinateHosts())
|
||||
.isEmpty();
|
||||
HostResource renamedHost = doSuccessfulTest();
|
||||
assertThat(renamedHost.getSuperordinateDomain()).isEqualTo(Key.create(example));
|
||||
assertThat(
|
||||
loadByUniqueId(
|
||||
loadByForeignKey(
|
||||
DomainResource.class, "foo.tld", clock.nowUtc()).getSubordinateHosts())
|
||||
.isEmpty();
|
||||
assertThat(
|
||||
loadByUniqueId(
|
||||
loadByForeignKey(
|
||||
DomainResource.class, "example.tld", clock.nowUtc()).getSubordinateHosts())
|
||||
.containsExactly("ns2.example.tld");
|
||||
assertDnsTasksEnqueued("ns2.foo.tld", "ns2.example.tld");
|
||||
|
@ -259,7 +259,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
|
|||
.setSubordinateHosts(ImmutableSet.of(oldHostName()))
|
||||
.build());
|
||||
assertThat(
|
||||
loadByUniqueId(
|
||||
loadByForeignKey(
|
||||
DomainResource.class, "example.foo", clock.nowUtc()).getSubordinateHosts())
|
||||
.containsExactly("ns1.example.foo");
|
||||
HostResource renamedHost = doSuccessfulTest();
|
||||
|
@ -268,7 +268,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
|
|||
// comes from the field on the host itself, because the superordinate domain is null).
|
||||
assertThat(renamedHost.getCurrentSponsorClientId()).isEqualTo("TheRegistrar");
|
||||
assertThat(
|
||||
loadByUniqueId(
|
||||
loadByForeignKey(
|
||||
DomainResource.class, "example.foo", clock.nowUtc()).getSubordinateHosts())
|
||||
.isEmpty();
|
||||
assertDnsTasksEnqueued("ns1.example.foo");
|
||||
|
@ -287,16 +287,16 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
|
|||
DomainResource tldDomain = persistActiveDomain("example.tld");
|
||||
persistActiveHost(oldHostName());
|
||||
|
||||
assertThat(loadByUniqueId(
|
||||
assertThat(loadByForeignKey(
|
||||
HostResource.class, oldHostName(), clock.nowUtc()).getCurrentSponsorClientId())
|
||||
.isEqualTo("TheRegistrar");
|
||||
assertThat(
|
||||
loadByUniqueId(
|
||||
loadByForeignKey(
|
||||
DomainResource.class, "example.tld", clock.nowUtc()).getSubordinateHosts())
|
||||
.isEmpty();
|
||||
HostResource renamedHost = doSuccessfulTest();
|
||||
assertThat(renamedHost.getSuperordinateDomain()).isEqualTo(Key.create(tldDomain));
|
||||
assertThat(loadByUniqueId(
|
||||
assertThat(loadByForeignKey(
|
||||
DomainResource.class, "example.tld", clock.nowUtc()).getSubordinateHosts())
|
||||
.containsExactly("ns2.example.tld");
|
||||
assertDnsTasksEnqueued("ns2.example.tld");
|
||||
|
@ -319,15 +319,15 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
|
|||
DomainResource domain = persistActiveDomain("example.tld");
|
||||
persistActiveHost(oldHostName());
|
||||
|
||||
assertThat(loadByUniqueId(
|
||||
assertThat(loadByForeignKey(
|
||||
HostResource.class, oldHostName(), clock.nowUtc()).getCurrentSponsorClientId())
|
||||
.isEqualTo("TheRegistrar");
|
||||
assertThat(loadByUniqueId(
|
||||
assertThat(loadByForeignKey(
|
||||
DomainResource.class, "example.tld", clock.nowUtc()).getSubordinateHosts())
|
||||
.isEmpty();
|
||||
HostResource renamedHost = doSuccessfulTest();
|
||||
assertThat(renamedHost.getSuperordinateDomain()).isEqualTo(Key.create(domain));
|
||||
assertThat(loadByUniqueId(
|
||||
assertThat(loadByForeignKey(
|
||||
DomainResource.class, "example.tld", clock.nowUtc()).getSubordinateHosts())
|
||||
.containsExactly("ns2.example.tld");
|
||||
assertDnsTasksEnqueued("ns2.example.tld");
|
||||
|
@ -351,7 +351,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
|
|||
CommitMode.LIVE,
|
||||
UserPrivileges.SUPERUSER,
|
||||
readFile("host_update_response.xml"));
|
||||
assertAboutHosts().that(reloadResourceByUniqueId())
|
||||
assertAboutHosts().that(reloadResourceByForeignKey())
|
||||
.hasStatusValue(StatusValue.CLIENT_UPDATE_PROHIBITED).and()
|
||||
.hasStatusValue(StatusValue.SERVER_UPDATE_PROHIBITED);
|
||||
}
|
||||
|
@ -893,7 +893,8 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
|
|||
eppRequestSource = EppRequestSource.TOOL;
|
||||
runFlowAssertResponse(readFile("host_update_response.xml"));
|
||||
assertAboutHistoryEntries()
|
||||
.that(getOnlyHistoryEntryOfType(reloadResourceByUniqueId(), HistoryEntry.Type.HOST_UPDATE))
|
||||
.that(getOnlyHistoryEntryOfType(
|
||||
reloadResourceByForeignKey(), HistoryEntry.Type.HOST_UPDATE))
|
||||
.hasMetadataReason("host-update-test").and()
|
||||
.hasMetadataRequestedByRegistrar(false);
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ package google.registry.mapreduce.inputs;
|
|||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static com.google.common.truth.Truth.assert_;
|
||||
import static google.registry.mapreduce.inputs.EppResourceInputs.createChildEntityInput;
|
||||
import static google.registry.model.EppResourceUtils.loadByUniqueId;
|
||||
import static google.registry.model.EppResourceUtils.loadByForeignKey;
|
||||
import static google.registry.model.index.EppResourceIndexBucket.getBucketKey;
|
||||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
import static google.registry.testing.DatastoreHelper.newDomainResource;
|
||||
|
@ -102,7 +102,7 @@ public class ChildEntityInputTest {
|
|||
.build());
|
||||
contactHistoryEntry = persistResource(
|
||||
new HistoryEntry.Builder()
|
||||
.setParent(loadByUniqueId(ContactResource.class, "contact1234", now))
|
||||
.setParent(loadByForeignKey(ContactResource.class, "contact1234", now))
|
||||
.setModificationTime(now)
|
||||
.build());
|
||||
oneTimeA = persistResource(
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
package google.registry.model.contact;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.model.EppResourceUtils.loadByUniqueId;
|
||||
import static google.registry.model.EppResourceUtils.loadByForeignKey;
|
||||
import static google.registry.testing.ContactResourceSubject.assertAboutContacts;
|
||||
import static google.registry.testing.DatastoreHelper.cloneAndSetAutoTimestamps;
|
||||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
|
@ -120,7 +120,7 @@ public class ContactResourceTest extends EntityTestCase {
|
|||
@Test
|
||||
public void testPersistence() throws Exception {
|
||||
assertThat(
|
||||
loadByUniqueId(ContactResource.class, contactResource.getForeignKey(), clock.nowUtc()))
|
||||
loadByForeignKey(ContactResource.class, contactResource.getForeignKey(), clock.nowUtc()))
|
||||
.isEqualTo(contactResource);
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
package google.registry.model.domain;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.model.EppResourceUtils.loadByUniqueId;
|
||||
import static google.registry.model.EppResourceUtils.loadDomainApplication;
|
||||
import static google.registry.testing.DatastoreHelper.cloneAndSetAutoTimestamps;
|
||||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
import static google.registry.testing.DatastoreHelper.newDomainApplication;
|
||||
|
@ -111,10 +111,8 @@ public class DomainApplicationTest extends EntityTestCase {
|
|||
|
||||
@Test
|
||||
public void testPersistence() throws Exception {
|
||||
assertThat(
|
||||
loadByUniqueId(
|
||||
DomainApplication.class, domainApplication.getForeignKey(), clock.nowUtc()))
|
||||
.isEqualTo(domainApplication);
|
||||
assertThat(loadDomainApplication(domainApplication.getForeignKey(), clock.nowUtc()))
|
||||
.isEqualTo(domainApplication);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -18,7 +18,7 @@ import static com.google.appengine.tools.development.testing.LocalMemcacheServic
|
|||
import static com.google.common.collect.Iterables.getOnlyElement;
|
||||
import static com.google.common.collect.Iterables.skip;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.model.EppResourceUtils.loadByUniqueId;
|
||||
import static google.registry.model.EppResourceUtils.loadByForeignKey;
|
||||
import static google.registry.testing.DatastoreHelper.cloneAndSetAutoTimestamps;
|
||||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
import static google.registry.testing.DatastoreHelper.newDomainResource;
|
||||
|
@ -157,7 +157,7 @@ public class DomainResourceTest extends EntityTestCase {
|
|||
|
||||
@Test
|
||||
public void testPersistence() throws Exception {
|
||||
assertThat(loadByUniqueId(DomainResource.class, domain.getForeignKey(), clock.nowUtc()))
|
||||
assertThat(loadByForeignKey(DomainResource.class, domain.getForeignKey(), clock.nowUtc()))
|
||||
.isEqualTo(domain);
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
package google.registry.model.host;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.model.EppResourceUtils.loadByUniqueId;
|
||||
import static google.registry.model.EppResourceUtils.loadByForeignKey;
|
||||
import static google.registry.testing.DatastoreHelper.cloneAndSetAutoTimestamps;
|
||||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
import static google.registry.testing.DatastoreHelper.newDomainResource;
|
||||
|
@ -83,14 +83,15 @@ public class HostResourceTest extends EntityTestCase {
|
|||
.setInetAddresses(ImmutableSet.of(InetAddresses.forString("127.0.0.1")))
|
||||
.setStatusValues(ImmutableSet.of(StatusValue.OK))
|
||||
.setSuperordinateDomain(
|
||||
Key.create(loadByUniqueId(DomainResource.class, "example.com", clock.nowUtc())))
|
||||
Key.create(
|
||||
loadByForeignKey(DomainResource.class, "example.com", clock.nowUtc())))
|
||||
.build());
|
||||
persistResource(hostResource);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPersistence() throws Exception {
|
||||
assertThat(loadByUniqueId(
|
||||
assertThat(loadByForeignKey(
|
||||
HostResource.class, hostResource.getForeignKey(), clock.nowUtc()))
|
||||
.isEqualTo(hostResource.cloneProjectedAtTime(clock.nowUtc()));
|
||||
}
|
||||
|
@ -125,9 +126,9 @@ public class HostResourceTest extends EntityTestCase {
|
|||
public void testCurrentSponsorClientId_comesFromSuperordinateDomain() {
|
||||
assertThat(hostResource.getCurrentSponsorClientId()).isNull();
|
||||
HostResource projectedHost =
|
||||
loadByUniqueId(HostResource.class, hostResource.getForeignKey(), clock.nowUtc());
|
||||
loadByForeignKey(HostResource.class, hostResource.getForeignKey(), clock.nowUtc());
|
||||
assertThat(projectedHost.getCurrentSponsorClientId())
|
||||
.isEqualTo(loadByUniqueId(
|
||||
.isEqualTo(loadByForeignKey(
|
||||
DomainResource.class,
|
||||
"example.com",
|
||||
clock.nowUtc())
|
||||
|
@ -196,7 +197,7 @@ public class HostResourceTest extends EntityTestCase {
|
|||
@Nullable DateTime domainTransferTime,
|
||||
@Nullable DateTime hostTransferTime,
|
||||
@Nullable DateTime superordinateChangeTime) {
|
||||
DomainResource domain = loadByUniqueId(
|
||||
DomainResource domain = loadByForeignKey(
|
||||
DomainResource.class, "example.com", clock.nowUtc());
|
||||
persistResource(
|
||||
domain.asBuilder().setTransferData(null).setLastTransferTime(domainTransferTime).build());
|
||||
|
@ -256,7 +257,7 @@ public class HostResourceTest extends EntityTestCase {
|
|||
|
||||
@Test
|
||||
public void testExpiredTransfer_subordinateHost() {
|
||||
DomainResource domain = loadByUniqueId(
|
||||
DomainResource domain = loadByForeignKey(
|
||||
DomainResource.class, "example.com", clock.nowUtc());
|
||||
persistResource(domain.asBuilder()
|
||||
.setTransferData(domain.getTransferData().asBuilder()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue