Scope down lastTransferTime to only ContactResource, DomainResource

and HostResource.

DomainApplication is not transferable and has no need for this
field. HostResource needs it because it can be transferred with
a domain.

This is all in service of removing the ofy().load() inside of
host's cloneProjectedAtTime.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=139346925
This commit is contained in:
cgoldfeder 2016-11-16 10:18:31 -08:00 committed by Ben McIlwain
parent 5368489987
commit fdc8ceb6bb
15 changed files with 121 additions and 56 deletions

View file

@ -90,7 +90,6 @@ public class DomainApplicationInfoFlowTest
.setLastEppUpdateClientId("NewRegistrar")
.setCreationTimeForTest(DateTime.parse("1999-04-03T22:00:00.0Z"))
.setLastEppUpdateTime(DateTime.parse("1999-12-03T09:00:00.0Z"))
.setLastTransferTime(DateTime.parse("2000-04-08T09:00:00.0Z"))
.setRegistrant(Key.create(registrant))
.setContacts(ImmutableSet.of(
DesignatedContact.create(Type.ADMIN, Key.create(contact)),
@ -125,7 +124,6 @@ public class DomainApplicationInfoFlowTest
.setLastEppUpdateClientId("NewRegistrar")
.setCreationTimeForTest(DateTime.parse("1999-04-03T22:00:00.0Z"))
.setLastEppUpdateTime(DateTime.parse("1999-12-03T09:00:00.0Z"))
.setLastTransferTime(DateTime.parse("2000-04-08T09:00:00.0Z"))
.setRegistrant(Key.create(registrant))
.setContacts(ImmutableSet.of(
DesignatedContact.create(Type.ADMIN, Key.create(contact)),
@ -350,7 +348,7 @@ public class DomainApplicationInfoFlowTest
thrown.expect(ApplicationLaunchPhaseMismatchException.class);
runFlow();
}
/** Test registry extra logic manager with no flags. */
@Test

View file

@ -26,7 +26,7 @@ import static google.registry.testing.DatastoreHelper.getOnlyPollMessage;
import static google.registry.testing.DatastoreHelper.getPollMessages;
import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.DomainResourceSubject.assertAboutDomains;
import static google.registry.testing.GenericEppResourceSubject.assertAboutEppResources;
import static google.registry.testing.HostResourceSubject.assertAboutHosts;
import static google.registry.util.DateTimeUtils.START_OF_TIME;
import static java.util.Arrays.asList;
import static org.joda.money.CurrencyUnit.USD;
@ -111,7 +111,7 @@ public class DomainTransferApproveFlowTest
}
private void assertTransferApproved(HostResource host) {
assertAboutEppResources().that(host)
assertAboutHosts().that(host)
.hasCurrentSponsorClientId("NewRegistrar").and()
.hasLastTransferTime(clock.nowUtc()).and()
.doesNotHaveStatusValue(StatusValue.PENDING_TRANSFER);

View file

@ -132,7 +132,7 @@ public class DomainTransferRequestFlowTest
private void assertTransferApproved(HostResource host) {
DateTime afterAutoAck = clock.nowUtc().plus(Registry.get("tld").getAutomaticTransferLength());
assertAboutEppResources().that(host)
assertAboutHosts().that(host)
.hasCurrentSponsorClientId("NewRegistrar").and()
.hasLastTransferTime(afterAutoAck).and()
.doesNotHaveStatusValue(StatusValue.PENDING_TRANSFER);

View file

@ -72,7 +72,6 @@ public class DomainApplicationTest extends EntityTestCase {
.setCreationClientId("a registrar")
.setLastEppUpdateTime(clock.nowUtc())
.setLastEppUpdateClientId("another registrar")
.setLastTransferTime(clock.nowUtc())
.setStatusValues(ImmutableSet.of(
StatusValue.CLIENT_DELETE_PROHIBITED,
StatusValue.SERVER_DELETE_PROHIBITED,

View file

@ -220,7 +220,6 @@ class google.registry.model.domain.DomainApplication {
org.joda.money.Money auctionPrice;
org.joda.time.DateTime deletionTime;
org.joda.time.DateTime lastEppUpdateTime;
org.joda.time.DateTime lastTransferTime;
}
class google.registry.model.domain.DomainAuthInfo {
google.registry.model.eppcommon.AuthInfo$PasswordAuth pw;
@ -244,7 +243,6 @@ class google.registry.model.domain.DomainBase {
java.util.Set<google.registry.model.eppcommon.StatusValue> status;
org.joda.time.DateTime deletionTime;
org.joda.time.DateTime lastEppUpdateTime;
org.joda.time.DateTime lastTransferTime;
}
class google.registry.model.domain.DomainResource {
@Id java.lang.String repoId;

View file

@ -150,20 +150,6 @@ abstract class AbstractEppResourceSubject
"has deletionTime");
}
public And<S> hasLastTransferTime(DateTime lastTransferTime) {
return hasValue(
lastTransferTime,
actual().getLastTransferTime(),
"has lastTransferTime");
}
public And<S> hasLastTransferTimeNotEqualTo(DateTime lastTransferTime) {
return doesNotHaveValue(
lastTransferTime,
actual().getLastTransferTime(),
"lastTransferTime");
}
public And<S> hasLastEppUpdateTime(DateTime lastUpdateTime) {
return hasValue(
lastUpdateTime,

View file

@ -162,6 +162,19 @@ public final class ContactResourceSubject
"has transfer losingClientId");
}
public And<ContactResourceSubject> hasLastTransferTime(DateTime lastTransferTime) {
return hasValue(
lastTransferTime,
actual().getLastTransferTime(),
"has lastTransferTime");
}
public And<ContactResourceSubject> hasLastTransferTimeNotEqualTo(DateTime lastTransferTime) {
return doesNotHaveValue(
lastTransferTime,
actual().getLastTransferTime(),
"lastTransferTime");
}
public static DelegatedVerb<ContactResourceSubject, ContactResource> assertAboutContacts() {
return assertAbout(new SubjectFactory());
}

View file

@ -79,6 +79,20 @@ public final class DomainResourceSubject
return andChainer();
}
public And<DomainResourceSubject> hasLastTransferTime(DateTime lastTransferTime) {
return hasValue(
lastTransferTime,
actual().getLastTransferTime(),
"has lastTransferTime");
}
public And<DomainResourceSubject> hasLastTransferTimeNotEqualTo(DateTime lastTransferTime) {
return doesNotHaveValue(
lastTransferTime,
actual().getLastTransferTime(),
"lastTransferTime");
}
public And<DomainResourceSubject> hasDeletePollMessage() {
if (actual().getDeletePollMessage() == null) {
fail("has a delete poll message");

View file

@ -20,6 +20,8 @@ import static com.google.common.truth.Truth.assertAbout;
import com.google.common.truth.AbstractVerb.DelegatedVerb;
import com.google.common.truth.FailureStrategy;
import google.registry.model.host.HostResource;
import google.registry.testing.TruthChainer.And;
import org.joda.time.DateTime;
/** Truth subject for asserting things about {@link HostResource} instances. */
public final class HostResourceSubject
@ -36,4 +38,18 @@ public final class HostResourceSubject
public static DelegatedVerb<HostResourceSubject, HostResource> assertAboutHosts() {
return assertAbout(new SubjectFactory());
}
public And<HostResourceSubject> hasLastTransferTime(DateTime lastTransferTime) {
return hasValue(
lastTransferTime,
actual().getLastTransferTime(),
"has lastTransferTime");
}
public And<HostResourceSubject> hasLastTransferTimeNotEqualTo(DateTime lastTransferTime) {
return doesNotHaveValue(
lastTransferTime,
actual().getLastTransferTime(),
"lastTransferTime");
}
}