Convert DomainBase's contacts to VKeys (#574)

* Convert DomainBase's contacts to VKeys

Convert usage of DomainBase contacts from Key to VKey.  This is the same
change as done for nameserver hosts, as it affects all external interfaces.
As with nameserver hosts, we preserve the existing representation so as not to
afffect the datastore representation.
This commit is contained in:
Michael Muller 2020-05-07 11:19:15 -04:00 committed by GitHub
parent 40a4c3101c
commit 04f429c4d6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
34 changed files with 399 additions and 173 deletions

View file

@ -190,7 +190,9 @@ public class DeleteContactsAndHostsActionTest
.hasDeletionTime(END_OF_TIME);
DomainBase domainReloaded =
loadByForeignKey(DomainBase.class, "example.tld", clock.nowUtc()).get();
assertThat(domainReloaded.getReferencedContacts()).contains(Key.create(contactUpdated));
// We have to check for the objectify key here, specifically, as the SQL side of the key does
// not get persisted.
assertThat(domainReloaded.getReferencedContacts()).contains(contactUpdated.createVKey());
HistoryEntry historyEntry =
getOnlyHistoryEntryOfType(contactUpdated, HistoryEntry.Type.CONTACT_DELETE_FAILURE);
assertPollMessageFor(

View file

@ -151,7 +151,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
newDomainBase(getUniqueIdFromCommand())
.asBuilder()
.setCreationTimeForTest(TIME_BEFORE_FLOW)
.setRegistrant(Key.create(contact))
.setRegistrant(contact.createVKey())
.setRegistrationExpirationTime(expirationTime)
.build();
earlierHistoryEntry =
@ -700,7 +700,9 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
newDomainBase("example1.tld")
.asBuilder()
.setRegistrant(
Key.create(loadByForeignKey(ContactResource.class, "sh8013", clock.nowUtc()).get()))
loadByForeignKey(ContactResource.class, "sh8013", clock.nowUtc())
.get()
.createVKey())
.setNameservers(ImmutableSet.of(host.createKey()))
.setDeletionTime(START_OF_TIME)
.build());

View file

@ -112,11 +112,11 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
.setLastEppUpdateTime(DateTime.parse("1999-12-03T09:00:00.0Z"))
.setLastTransferTime(DateTime.parse("2000-04-08T09:00:00.0Z"))
.setRegistrationExpirationTime(DateTime.parse("2005-04-03T22:00:00.0Z"))
.setRegistrant(Key.create(registrant))
.setRegistrant(registrant.createVKey())
.setContacts(
ImmutableSet.of(
DesignatedContact.create(Type.ADMIN, Key.create(contact)),
DesignatedContact.create(Type.TECH, Key.create(contact))))
DesignatedContact.create(Type.ADMIN, contact.createVKey()),
DesignatedContact.create(Type.TECH, contact.createVKey())))
.setNameservers(
inactive ? null : ImmutableSet.of(host1.createKey(), host2.createKey()))
.setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("2fooBAR")))

View file

@ -19,8 +19,8 @@ import static com.google.common.io.BaseEncoding.base16;
import static com.google.common.truth.Truth.assertThat;
import static google.registry.model.EppResourceUtils.loadByForeignKey;
import static google.registry.model.eppcommon.StatusValue.SERVER_UPDATE_PROHIBITED;
import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.model.registry.Registry.TldState.QUIET_PERIOD;
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
import static google.registry.testing.DatastoreHelper.assertBillingEvents;
import static google.registry.testing.DatastoreHelper.assertNoBillingEvents;
import static google.registry.testing.DatastoreHelper.createTld;
@ -135,10 +135,10 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
.asBuilder()
.setContacts(
ImmutableSet.of(
DesignatedContact.create(Type.TECH, Key.create(mak21Contact)),
DesignatedContact.create(Type.ADMIN, Key.create(mak21Contact)),
DesignatedContact.create(Type.BILLING, Key.create(mak21Contact))))
.setRegistrant(Key.create(mak21Contact))
DesignatedContact.create(Type.TECH, mak21Contact.createVKey()),
DesignatedContact.create(Type.ADMIN, mak21Contact.createVKey()),
DesignatedContact.create(Type.BILLING, mak21Contact.createVKey())))
.setRegistrant(mak21Contact.createVKey())
.setNameservers(ImmutableSet.of(host.createKey()))
.build());
historyEntryDomainCreate =
@ -160,8 +160,8 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
.asBuilder()
.setContacts(
ImmutableSet.of(
DesignatedContact.create(Type.TECH, Key.create(sh8013Contact)),
DesignatedContact.create(Type.ADMIN, Key.create(unusedContact))))
DesignatedContact.create(Type.TECH, sh8013Contact.createVKey()),
DesignatedContact.create(Type.ADMIN, unusedContact.createVKey())))
.setNameservers(ImmutableSet.of(host.createKey()))
.build());
historyEntryDomainCreate =
@ -298,7 +298,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
contactsBuilder.add(
DesignatedContact.create(
DesignatedContact.Type.values()[i % 4],
Key.create(persistActiveContact(String.format("max_test_%d", i)))));
persistActiveContact(String.format("max_test_%d", i)).createVKey()));
}
ImmutableList<DesignatedContact> contacts = contactsBuilder.build();
persistResource(
@ -319,8 +319,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
assertThat(domain.getNameservers()).hasSize(13);
// getContacts does not return contacts of type REGISTRANT, so check these separately.
assertThat(domain.getContacts()).hasSize(3);
assertThat(ofy().load().key(domain.getRegistrant()).now().getContactId())
.isEqualTo("max_test_7");
assertThat(tm().load(domain.getRegistrant()).getContactId()).isEqualTo("max_test_7");
assertNoBillingEvents();
assertDnsTasksEnqueued("example.tld");
}
@ -403,7 +402,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
persistResource(
newDomainBase(getUniqueIdFromCommand())
.asBuilder()
.setRegistrant(Key.create(sh8013))
.setRegistrant(sh8013.createVKey())
.build());
clock.advanceOneMilli();
runFlowAssertResponse(loadFile("generic_success_response.xml"));
@ -415,7 +414,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
persistReferencedEntities();
ContactResource sh8013 =
loadByForeignKey(ContactResource.class, "sh8013", clock.nowUtc()).get();
Key<ContactResource> sh8013Key = Key.create(sh8013);
VKey<ContactResource> sh8013Key = sh8013.createVKey();
persistResource(
newDomainBase(getUniqueIdFromCommand())
.asBuilder()
@ -866,8 +865,9 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
.setContacts(
DesignatedContact.create(
Type.TECH,
Key.create(
loadByForeignKey(ContactResource.class, "foo", clock.nowUtc()).get())))
loadByForeignKey(ContactResource.class, "foo", clock.nowUtc())
.get()
.createVKey()))
.build());
EppException thrown = assertThrows(DuplicateContactForRoleException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -1077,8 +1077,9 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
.setContacts(
DesignatedContact.create(
Type.TECH,
Key.create(
loadByForeignKey(ContactResource.class, "sh8013", clock.nowUtc()).get())))
loadByForeignKey(ContactResource.class, "sh8013", clock.nowUtc())
.get()
.createVKey()))
.build());
EppException thrown = assertThrows(AddRemoveSameValueException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -1093,8 +1094,8 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
.asBuilder()
.setContacts(
ImmutableSet.of(
DesignatedContact.create(Type.ADMIN, Key.create(sh8013Contact)),
DesignatedContact.create(Type.TECH, Key.create(sh8013Contact))))
DesignatedContact.create(Type.ADMIN, sh8013Contact.createVKey()),
DesignatedContact.create(Type.TECH, sh8013Contact.createVKey())))
.build());
EppException thrown = assertThrows(MissingAdminContactException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -1109,8 +1110,8 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
.asBuilder()
.setContacts(
ImmutableSet.of(
DesignatedContact.create(Type.ADMIN, Key.create(sh8013Contact)),
DesignatedContact.create(Type.TECH, Key.create(sh8013Contact))))
DesignatedContact.create(Type.ADMIN, sh8013Contact.createVKey()),
DesignatedContact.create(Type.TECH, sh8013Contact.createVKey())))
.build());
EppException thrown = assertThrows(MissingTechnicalContactException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -1223,7 +1224,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns1.example.foo"))
.build());
runFlow();
assertThat(ofy().load().key(reloadResourceByForeignKey().getRegistrant()).now().getContactId())
assertThat(tm().load(reloadResourceByForeignKey().getRegistrant()).getContactId())
.isEqualTo("sh8013");
}
@ -1237,10 +1238,9 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
.getContacts()
.forEach(
contact -> {
assertThat(ofy().load().key(contact.getContactKey()).now().getContactId())
.isEqualTo("mak21");
assertThat(tm().load(contact.getContactKey()).getContactId()).isEqualTo("mak21");
});
assertThat(ofy().load().key(reloadResourceByForeignKey().getRegistrant()).now().getContactId())
assertThat(tm().load(reloadResourceByForeignKey().getRegistrant()).getContactId())
.isEqualTo("mak21");
runFlow();
@ -1249,10 +1249,9 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
.getContacts()
.forEach(
contact -> {
assertThat(ofy().load().key(contact.getContactKey()).now().getContactId())
.isEqualTo("sh8013");
assertThat(tm().load(contact.getContactKey()).getContactId()).isEqualTo("sh8013");
});
assertThat(ofy().load().key(reloadResourceByForeignKey().getRegistrant()).now().getContactId())
assertThat(tm().load(reloadResourceByForeignKey().getRegistrant()).getContactId())
.isEqualTo("sh8013");
}

View file

@ -22,7 +22,6 @@ import static google.registry.util.DateTimeUtils.START_OF_TIME;
import static org.joda.time.DateTimeZone.UTC;
import com.google.common.collect.ImmutableSet;
import com.googlecode.objectify.Key;
import google.registry.model.contact.ContactResource;
import google.registry.model.domain.DesignatedContact.Type;
import google.registry.model.domain.launch.LaunchNotice;
@ -30,6 +29,7 @@ import google.registry.model.domain.secdns.DelegationSignerData;
import google.registry.model.eppcommon.AuthInfo.PasswordAuth;
import google.registry.model.eppcommon.StatusValue;
import google.registry.model.host.HostResource;
import google.registry.model.transfer.TransferData;
import google.registry.persistence.VKey;
import google.registry.persistence.transaction.JpaTestRules;
import google.registry.persistence.transaction.JpaTestRules.JpaIntegrationWithCoverageExtension;
@ -56,15 +56,20 @@ public class DomainBaseSqlTest {
new JpaTestRules.Builder().withClock(fakeClock).buildIntegrationWithCoverageExtension();
DomainBase domain;
Key<ContactResource> contactKey;
Key<ContactResource> contact2Key;
VKey<ContactResource> contactKey;
VKey<ContactResource> contact2Key;
VKey<HostResource> host1VKey;
HostResource host;
ContactResource contact;
ContactResource contact2;
@BeforeEach
public void setUp() {
contactKey = Key.create(ContactResource.class, "contact_id1");
contact2Key = Key.create(ContactResource.class, "contact_id2");
saveRegistrar("registrar1");
saveRegistrar("registrar2");
saveRegistrar("registrar3");
contactKey = VKey.createSql(ContactResource.class, "contact_id1");
contact2Key = VKey.createSql(ContactResource.class, "contact_id2");
host1VKey = VKey.createSql(HostResource.class, "host1");
@ -104,23 +109,26 @@ public class DomainBaseSqlTest {
.setCreationClientId("registrar1")
.setPersistedCurrentSponsorClientId("registrar2")
.build();
contact = makeContact("contact_id1");
contact2 = makeContact("contact_id2");
}
@Test
public void testDomainBasePersistence() {
saveRegistrar("registrar1");
saveRegistrar("registrar2");
saveRegistrar("registrar3");
jpaTm()
.transact(
() -> {
// Persist the domain.
EntityManager em = jpaTm().getEntityManager();
em.persist(domain);
// Persist the contacts. Note that these need to be persisted before the domain
// otherwise we get a foreign key constraint error.
jpaTm().saveNew(contact);
jpaTm().saveNew(contact2);
// Persist the host.
em.persist(host);
// Persist the domain.
jpaTm().saveNew(domain);
// Persist the host. This does _not_ need to be persisted before the domain,
// presumably because its relationship is stored in a join table.
jpaTm().saveNew(host);
});
jpaTm()
@ -130,13 +138,11 @@ public class DomainBaseSqlTest {
EntityManager em = jpaTm().getEntityManager();
DomainBase result = em.find(DomainBase.class, "4-COM");
// Fix contacts, grace period and DS data, since we can't persist them yet.
// Fix grace period and DS data, since we can't persist them yet.
result =
result
.asBuilder()
.setRegistrant(contactKey)
.setContacts(
ImmutableSet.of(DesignatedContact.create(Type.ADMIN, contact2Key)))
.setDsData(
ImmutableSet.of(
DelegationSignerData.create(1, 2, 3, new byte[] {0, 1, 2})))
@ -151,16 +157,40 @@ public class DomainBaseSqlTest {
}
@Test
public void testForeignKeyConstraints() {
public void testHostForeignKeyConstraints() {
assertThrowForeignKeyViolation(
() -> {
jpaTm()
.transact(
() -> {
// Persist the domain without the associated host object.
EntityManager em = jpaTm().getEntityManager();
em.persist(domain);
jpaTm().saveNew(contact);
jpaTm().saveNew(contact2);
jpaTm().saveNew(domain);
});
});
}
@Test
public void testContactForeignKeyConstraints() {
assertThrowForeignKeyViolation(
() -> {
jpaTm()
.transact(
() -> {
// Persist the domain without the associated contact objects.
jpaTm().saveNew(domain);
jpaTm().saveNew(host);
});
});
}
public static ContactResource makeContact(String repoId) {
return new ContactResource.Builder()
.setRepoId(repoId)
.setCreationClientId("registrar1")
.setTransferData(new TransferData.Builder().build())
.setPersistedCurrentSponsorClientId("registrar1")
.build();
}
}

View file

@ -80,20 +80,20 @@ public class DomainBaseTest extends EntityTestCase {
.setRepoId("1-COM")
.build())
.createKey();
Key<ContactResource> contact1Key =
Key.create(
persistResource(
VKey<ContactResource> contact1Key =
persistResource(
new ContactResource.Builder()
.setContactId("contact_id1")
.setRepoId("2-COM")
.build()));
Key<ContactResource> contact2Key =
Key.create(
persistResource(
.build())
.createVKey();
VKey<ContactResource> contact2Key =
persistResource(
new ContactResource.Builder()
.setContactId("contact_id2")
.setRepoId("3-COM")
.build()));
.build())
.createVKey();
Key<HistoryEntry> historyEntryKey =
Key.create(persistResource(new HistoryEntry.Builder().setParent(domainKey).build()));
oneTimeBillKey = Key.create(historyEntryKey, BillingEvent.OneTime.class, 1);

View file

@ -240,22 +240,22 @@ public class DomainBaseToXjcConverterTest {
ImmutableSet.of(
DesignatedContact.create(
DesignatedContact.Type.ADMIN,
Key.create(
makeContactResource(
makeContactResource(
clock,
"10-Q9JYB4C",
"5372808-IRL",
"be that word our sign in parting",
"BOFH@cat.みんな"))),
"BOFH@cat.みんな")
.createVKey()),
DesignatedContact.create(
DesignatedContact.Type.TECH,
Key.create(
makeContactResource(
makeContactResource(
clock,
"11-Q9JYB4C",
"5372808-TRL",
"bird or fiend!? i shrieked upstarting",
"bog@cat.みんな")))))
"bog@cat.みんな")
.createVKey())))
.setCreationClientId("LawyerCat")
.setCreationTimeForTest(DateTime.parse("1900-01-01T00:00:00Z"))
.setPersistedCurrentSponsorClientId("GetTheeBack")
@ -273,9 +273,9 @@ public class DomainBaseToXjcConverterTest {
makeHostResource(clock, "4-Q9JYB4C", "ns2.cat.みんな", "bad:f00d:cafe::15:beef")
.createKey()))
.setRegistrant(
Key.create(
makeContactResource(
clock, "12-Q9JYB4C", "5372808-ERL", "(◕‿◕) nevermore", "prophet@evil.みんな")))
makeContactResource(
clock, "12-Q9JYB4C", "5372808-ERL", "(◕‿◕) nevermore", "prophet@evil.みんな")
.createVKey())
.setRegistrationExpirationTime(DateTime.parse("1930-01-01T00:00:00Z"))
.setGracePeriods(
ImmutableSet.of(

View file

@ -63,9 +63,8 @@ final class RdeFixtures {
.setFullyQualifiedDomainName("example." + tld)
.setRepoId(generateNewDomainRoid(tld))
.setRegistrant(
Key.create(
makeContactResource(
clock, "5372808-ERL", "(◕‿◕) nevermore", "prophet@evil.みんな")))
makeContactResource(clock, "5372808-ERL", "(◕‿◕) nevermore", "prophet@evil.みんな")
.createVKey())
.build();
HistoryEntry historyEntry =
persistResource(new HistoryEntry.Builder().setParent(domain).build());
@ -90,20 +89,20 @@ final class RdeFixtures {
ImmutableSet.of(
DesignatedContact.create(
DesignatedContact.Type.ADMIN,
Key.create(
makeContactResource(
makeContactResource(
clock,
"5372808-IRL",
"be that word our sign in parting",
"BOFH@cat.みんな"))),
"BOFH@cat.みんな")
.createVKey()),
DesignatedContact.create(
DesignatedContact.Type.TECH,
Key.create(
makeContactResource(
makeContactResource(
clock,
"5372808-TRL",
"bird or fiend!? i shrieked upstarting",
"bog@cat.みんな")))))
"bog@cat.みんな")
.createVKey())))
.setCreationClientId("TheRegistrar")
.setPersistedCurrentSponsorClientId("TheRegistrar")
.setCreationTimeForTest(clock.nowUtc())

View file

@ -27,7 +27,6 @@ import static google.registry.testing.DatastoreHelper.persistResource;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.googlecode.objectify.Key;
import google.registry.model.OteStatsTestHelper;
import google.registry.model.contact.ContactAddress;
import google.registry.model.contact.ContactResource;
@ -127,9 +126,9 @@ public enum Fixture {
.asBuilder()
.setContacts(
ImmutableSet.of(
DesignatedContact.create(ADMIN, Key.create(robert)),
DesignatedContact.create(BILLING, Key.create(google)),
DesignatedContact.create(TECH, Key.create(justine))))
DesignatedContact.create(ADMIN, robert.createVKey()),
DesignatedContact.create(BILLING, google.createVKey()),
DesignatedContact.create(TECH, justine.createVKey())))
.setNameservers(
ImmutableSet.of(
persistActiveHost("ns1.love.xn--q9jyb4c").createKey(),
@ -141,9 +140,9 @@ public enum Fixture {
.asBuilder()
.setContacts(
ImmutableSet.of(
DesignatedContact.create(ADMIN, Key.create(robert)),
DesignatedContact.create(BILLING, Key.create(google)),
DesignatedContact.create(TECH, Key.create(justine))))
DesignatedContact.create(ADMIN, robert.createVKey()),
DesignatedContact.create(BILLING, google.createVKey()),
DesignatedContact.create(TECH, justine.createVKey())))
.setNameservers(
ImmutableSet.of(
persistActiveHost("ns1.linode.com").createKey(),

View file

@ -93,6 +93,7 @@ import google.registry.model.registry.label.ReservedList;
import google.registry.model.reporting.HistoryEntry;
import google.registry.model.transfer.TransferData;
import google.registry.model.transfer.TransferStatus;
import google.registry.persistence.VKey;
import google.registry.tmch.LordnTaskUtils;
import java.util.Arrays;
import java.util.List;
@ -144,7 +145,7 @@ public class DatastoreHelper {
public static DomainBase newDomainBase(
String domainName, String repoId, ContactResource contact) {
Key<ContactResource> contactKey = Key.create(contact);
VKey<ContactResource> contactKey = contact.createVKey();
return new DomainBase.Builder()
.setRepoId(repoId)
.setFullyQualifiedDomainName(domainName)
@ -487,11 +488,11 @@ public class DatastoreHelper {
.setCreationClientId("TheRegistrar")
.setCreationTimeForTest(creationTime)
.setRegistrationExpirationTime(expirationTime)
.setRegistrant(Key.create(contact))
.setRegistrant(contact.createVKey())
.setContacts(
ImmutableSet.of(
DesignatedContact.create(Type.ADMIN, Key.create(contact)),
DesignatedContact.create(Type.TECH, Key.create(contact))))
DesignatedContact.create(Type.ADMIN, contact.createVKey()),
DesignatedContact.create(Type.TECH, contact.createVKey())))
.setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("fooBAR")))
.addGracePeriod(
GracePeriod.create(GracePeriodStatus.ADD, now.plusDays(10), "foo", null))

View file

@ -23,7 +23,6 @@ import static java.nio.charset.StandardCharsets.UTF_8;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.net.InetAddresses;
import com.googlecode.objectify.Key;
import google.registry.model.EppResource;
import google.registry.model.contact.ContactAddress;
import google.registry.model.contact.ContactPhoneNumber;
@ -360,17 +359,17 @@ public final class FullFieldsTestEntityHelper {
StatusValue.SERVER_UPDATE_PROHIBITED))
.setDsData(ImmutableSet.of(DelegationSignerData.create(1, 2, 3, "deadface")));
if (registrant != null) {
builder.setRegistrant(Key.create(registrant));
builder.setRegistrant(registrant.createVKey());
}
if ((admin != null) || (tech != null)) {
ImmutableSet.Builder<DesignatedContact> contactsBuilder = new ImmutableSet.Builder<>();
if (admin != null) {
contactsBuilder.add(DesignatedContact.create(
DesignatedContact.Type.ADMIN, Key.create(admin)));
contactsBuilder.add(
DesignatedContact.create(DesignatedContact.Type.ADMIN, admin.createVKey()));
}
if (tech != null) {
contactsBuilder.add(DesignatedContact.create(
DesignatedContact.Type.TECH, Key.create(tech)));
contactsBuilder.add(
DesignatedContact.create(DesignatedContact.Type.TECH, tech.createVKey()));
}
builder.setContacts(contactsBuilder.build());
}

View file

@ -24,7 +24,6 @@ import static google.registry.testing.DatastoreHelper.persistDomainAndEnqueueLor
import static google.registry.testing.TaskQueueHelper.assertTasksEnqueued;
import static org.junit.Assert.assertThrows;
import com.googlecode.objectify.Key;
import google.registry.model.domain.DomainBase;
import google.registry.model.domain.launch.LaunchNotice;
import google.registry.model.ofy.Ofy;
@ -63,7 +62,7 @@ public class LordnTaskUtilsTest {
private DomainBase.Builder newDomainBuilder() {
return new DomainBase.Builder()
.setFullyQualifiedDomainName("fleece.example")
.setRegistrant(Key.create(persistActiveContact("jd1234")))
.setRegistrant(persistActiveContact("jd1234").createVKey())
.setSmdId("smdzzzz")
.setCreationClientId("TheRegistrar");
}

View file

@ -26,7 +26,6 @@ import static org.junit.Assert.assertThrows;
import com.beust.jcommander.ParameterException;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.googlecode.objectify.Key;
import google.registry.model.contact.ContactResource;
import google.registry.model.domain.DesignatedContact;
import google.registry.model.eppcommon.StatusValue;
@ -187,10 +186,10 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase<UpdateDomain
ContactResource adminContact2 = persistResource(newContactResource("crr-admin2"));
ContactResource techContact1 = persistResource(newContactResource("crr-tech1"));
ContactResource techContact2 = persistResource(newContactResource("crr-tech2"));
Key<ContactResource> adminResourceKey1 = Key.create(adminContact1);
Key<ContactResource> adminResourceKey2 = Key.create(adminContact2);
Key<ContactResource> techResourceKey1 = Key.create(techContact1);
Key<ContactResource> techResourceKey2 = Key.create(techContact2);
VKey<ContactResource> adminResourceKey1 = adminContact1.createVKey();
VKey<ContactResource> adminResourceKey2 = adminContact2.createVKey();
VKey<ContactResource> techResourceKey1 = techContact1.createVKey();
VKey<ContactResource> techResourceKey2 = techContact2.createVKey();
persistResource(
newDomainBase("example.tld")

View file

@ -23,7 +23,6 @@ import static google.registry.whois.WhoisTestData.loadFile;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.googlecode.objectify.Key;
import google.registry.model.contact.ContactAddress;
import google.registry.model.contact.ContactPhoneNumber;
import google.registry.model.contact.ContactResource;
@ -223,9 +222,9 @@ public class DomainWhoisResponseTest {
VKey<HostResource> hostResource1Key = hostResource1.createKey();
VKey<HostResource> hostResource2Key = hostResource2.createKey();
Key<ContactResource> registrantResourceKey = Key.create(registrant);
Key<ContactResource> adminResourceKey = Key.create(adminContact);
Key<ContactResource> techResourceKey = Key.create(techContact);
VKey<ContactResource> registrantResourceKey = registrant.createVKey();
VKey<ContactResource> adminResourceKey = adminContact.createVKey();
VKey<ContactResource> techResourceKey = techContact.createVKey();
domainBase =
persistResource(