mirror of
https://github.com/google/nomulus
synced 2026-01-08 07:11:44 +00:00
Load foreign keys more efficiently for xml marshalling.
Before this CL, each contact and host was independently loaded via the ReferenceUnion adapter. Since fields are processed serially by JAXB, this means worst-case there were 17 loads, best case 3 (the 3 required contacts) and usual case 5-6 (some hosts). This CL reduces that to 1 datastore roundtrip in all cases. A side effect of this CL is the further hollowing-out of ReferenceUnion, since it no longer is involved in marshalling at all. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=123712842
This commit is contained in:
@@ -34,6 +34,7 @@ import static google.registry.testing.HistoryEntrySubject.assertAboutHistoryEntr
|
||||
import static google.registry.testing.TaskQueueHelper.assertDnsTasksEnqueued;
|
||||
import static org.joda.money.CurrencyUnit.USD;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
@@ -380,20 +381,19 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||
nameservers.add(Ref.create(host));
|
||||
}
|
||||
}
|
||||
ImmutableSet.Builder<DesignatedContact> contacts = new ImmutableSet.Builder<>();
|
||||
ImmutableList.Builder<DesignatedContact> contactsBuilder = new ImmutableList.Builder<>();
|
||||
for (int i = 0; i < 8; i++) {
|
||||
ContactResource contact = persistActiveContact(String.format("max_test_%d", i));
|
||||
if (i < 4) {
|
||||
contacts.add(
|
||||
DesignatedContact.create(
|
||||
DesignatedContact.Type.values()[i],
|
||||
Ref.create(contact)));
|
||||
}
|
||||
contactsBuilder.add(
|
||||
DesignatedContact.create(
|
||||
DesignatedContact.Type.values()[i % 4],
|
||||
Ref.create(persistActiveContact(String.format("max_test_%d", i)))));
|
||||
}
|
||||
ImmutableList<DesignatedContact> contacts = contactsBuilder.build();
|
||||
persistResource(
|
||||
reloadResourceByUniqueId().asBuilder()
|
||||
.setNameservers(nameservers.build())
|
||||
.setContacts(contacts.build())
|
||||
.setContacts(ImmutableSet.copyOf(contacts.subList(0, 3)))
|
||||
.setRegistrant(contacts.get(3).getContactRef())
|
||||
.build());
|
||||
clock.advanceOneMilli();
|
||||
assertTransactionalFlow(true);
|
||||
|
||||
Reference in New Issue
Block a user