mirror of
https://github.com/google/nomulus
synced 2026-06-05 14:32:51 +00: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:
@@ -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");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user