mirror of
https://github.com/google/nomulus.git
synced 2025-06-28 07:13: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.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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue