Update lastEppUpdateTime and lastEppUpdateClientId when necessary

EppResource's lastEppUpdateTime and lastEppUpdateClientId need
to be updated whenever the domain is updated, renewed, deleted or
transfered.

This commit applied the change to the following domain EPP commands:

 - Update (already implemented)
 - Renew
 - Delete
 - Restore
 - Transfer request
 - Transfer approve
 - Transfer reject
 - Transfer cancel

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=223344758
This commit is contained in:
shicong 2018-11-29 07:47:54 -08:00 committed by jianglai
parent b54227e938
commit 5d2bb892f3
28 changed files with 110 additions and 37 deletions

View file

@ -834,7 +834,11 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
runFlow();
assertAboutDomains()
.that(reloadResourceByForeignKey())
.hasOneHistoryEntryEachOfTypes(DOMAIN_CREATE, DOMAIN_DELETE);
.hasOneHistoryEntryEachOfTypes(DOMAIN_CREATE, DOMAIN_DELETE)
.and()
.hasLastEppUpdateTime(clock.nowUtc())
.and()
.hasLastEppUpdateClientId("TheRegistrar");
assertAboutHistoryEntries()
.that(getOnlyHistoryEntryOfType(domain, DOMAIN_DELETE))
.hasType(DOMAIN_DELETE)

View file

@ -169,7 +169,11 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
.hasRegistrationExpirationTime(newExpiration)
.and()
.hasOneHistoryEntryEachOfTypes(
HistoryEntry.Type.DOMAIN_CREATE, HistoryEntry.Type.DOMAIN_RENEW);
HistoryEntry.Type.DOMAIN_CREATE, HistoryEntry.Type.DOMAIN_RENEW)
.and()
.hasLastEppUpdateTime(clock.nowUtc())
.and()
.hasLastEppUpdateClientId("TheRegistrar");
assertAboutHistoryEntries().that(historyEntryDomainRenew).hasPeriodYears(renewalYears);
BillingEvent.OneTime renewBillingEvent =
new BillingEvent.OneTime.Builder()

View file

@ -151,7 +151,11 @@ public class DomainRestoreRequestFlowTest
.hasDeletionTime(END_OF_TIME)
.and()
.hasOneHistoryEntryEachOfTypes(
HistoryEntry.Type.DOMAIN_DELETE, HistoryEntry.Type.DOMAIN_RESTORE);
HistoryEntry.Type.DOMAIN_DELETE, HistoryEntry.Type.DOMAIN_RESTORE)
.and()
.hasLastEppUpdateTime(clock.nowUtc())
.and()
.hasLastEppUpdateClientId("TheRegistrar");
assertThat(domain.getGracePeriods()).isEmpty();
assertDnsTasksEnqueued("example.tld");
// The poll message for the delete should now be gone. The only poll message should be the new

View file

@ -115,7 +115,11 @@ public class DomainTransferApproveFlowTest
.and()
.hasLastTransferTime(clock.nowUtc())
.and()
.doesNotHaveStatusValue(StatusValue.PENDING_TRANSFER);
.doesNotHaveStatusValue(StatusValue.PENDING_TRANSFER)
.and()
.hasLastEppUpdateTime(clock.nowUtc())
.and()
.hasLastEppUpdateClientId("TheRegistrar");
// The domain TransferData should reflect the approved transfer as we expect, with
// all the speculative server-approve fields nulled out.
assertThat(domain.getTransferData())

View file

@ -133,7 +133,11 @@ public class DomainTransferCancelFlowTest
assertAboutDomains()
.that(domain)
.hasOneHistoryEntryEachOfTypes(
DOMAIN_CREATE, DOMAIN_TRANSFER_REQUEST, DOMAIN_TRANSFER_CANCEL);
DOMAIN_CREATE, DOMAIN_TRANSFER_REQUEST, DOMAIN_TRANSFER_CANCEL)
.and()
.hasLastEppUpdateTime(clock.nowUtc())
.and()
.hasLastEppUpdateClientId("NewRegistrar");
final HistoryEntry historyEntryTransferCancel =
getOnlyHistoryEntryOfType(domain, DOMAIN_TRANSFER_CANCEL);
assertAboutHistoryEntries()

View file

@ -102,7 +102,11 @@ public class DomainTransferRejectFlowTest
.hasLastTransferTimeNotEqualTo(clock.nowUtc())
.and()
.hasOneHistoryEntryEachOfTypes(
DOMAIN_CREATE, DOMAIN_TRANSFER_REQUEST, DOMAIN_TRANSFER_REJECT);
DOMAIN_CREATE, DOMAIN_TRANSFER_REQUEST, DOMAIN_TRANSFER_REJECT)
.and()
.hasLastEppUpdateTime(clock.nowUtc())
.and()
.hasLastEppUpdateClientId("TheRegistrar");
final HistoryEntry historyEntryTransferRejected =
getOnlyHistoryEntryOfType(domain, DOMAIN_TRANSFER_REJECT);
assertAboutHistoryEntries().that(historyEntryTransferRejected).hasOtherClientId("NewRegistrar");

View file

@ -153,7 +153,11 @@ public class DomainTransferRequestFlowTest
.that(domain)
.hasCurrentSponsorClientId("TheRegistrar")
.and()
.hasStatusValue(StatusValue.PENDING_TRANSFER);
.hasStatusValue(StatusValue.PENDING_TRANSFER)
.and()
.hasLastEppUpdateTime(clock.nowUtc())
.and()
.hasLastEppUpdateClientId("NewRegistrar");
Trid expectedTrid =
Trid.create(
getClientTrid(),

View file

@ -160,7 +160,11 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
.hasAuthInfoPwd("2BARfoo")
.and()
.hasOneHistoryEntryEachOfTypes(
HistoryEntry.Type.DOMAIN_CREATE, HistoryEntry.Type.DOMAIN_UPDATE);
HistoryEntry.Type.DOMAIN_CREATE, HistoryEntry.Type.DOMAIN_UPDATE)
.and()
.hasLastEppUpdateTime(clock.nowUtc())
.and()
.hasLastEppUpdateClientId("TheRegistrar");
assertNoBillingEvents();
assertDnsTasksEnqueued("example.tld");
}

View file

@ -21,8 +21,8 @@
<domain:clID>NewRegistrar</domain:clID>
<domain:crID>NewRegistrar</domain:crID>
<domain:crDate>2000-06-01T00:04:00Z</domain:crDate>
<domain:upID>NewRegistrar</domain:upID>
<domain:upDate>2000-06-08T00:00:00Z</domain:upDate>
<domain:upID>TheRegistrar</domain:upID>
<domain:upDate>2002-05-30T00:00:00Z</domain:upDate>
<domain:exDate>2002-06-01T00:04:00Z</domain:exDate>
<domain:authInfo>
<domain:pw>2fooBAR</domain:pw>

View file

@ -21,8 +21,8 @@
<domain:clID>TheRegistrar</domain:clID>
<domain:crID>NewRegistrar</domain:crID>
<domain:crDate>2000-06-01T00:04:00Z</domain:crDate>
<domain:upID>NewRegistrar</domain:upID>
<domain:upDate>2000-06-08T00:00:00Z</domain:upDate>
<domain:upID>TheRegistrar</domain:upID>
<domain:upDate>2002-05-30T00:00:00Z</domain:upDate>
<domain:exDate>2003-06-01T00:04:00Z</domain:exDate>
<domain:trDate>2002-06-04T00:00:00Z</domain:trDate>
<domain:authInfo>

View file

@ -19,6 +19,8 @@
<domain:clID>NewRegistrar</domain:clID>
<domain:crID>NewRegistrar</domain:crID>
<domain:crDate>2000-06-01T00:04:00Z</domain:crDate>
<domain:upID>NewRegistrar</domain:upID>
<domain:upDate>2002-05-30T01:01:00Z</domain:upDate>
<domain:exDate>2002-06-01T00:04:00Z</domain:exDate>
<domain:authInfo>
<domain:pw>2fooBAR</domain:pw>

View file

@ -19,6 +19,8 @@
<domain:clID>NewRegistrar</domain:clID>
<domain:crID>NewRegistrar</domain:crID>
<domain:crDate>2000-06-01T00:04:00Z</domain:crDate>
<domain:upID>TheRegistrar</domain:upID>
<domain:upDate>2002-05-30T00:00:00Z</domain:upDate>
<domain:exDate>2002-06-01T00:04:00Z</domain:exDate>
<domain:authInfo>
<domain:pw>2fooBAR</domain:pw>

View file

@ -19,6 +19,8 @@
<domain:clID>NewRegistrar</domain:clID>
<domain:crID>NewRegistrar</domain:crID>
<domain:crDate>2000-06-01T00:04:00Z</domain:crDate>
<domain:upID>TheRegistrar</domain:upID>
<domain:upDate>2002-05-30T00:00:00Z</domain:upDate>
<domain:exDate>2003-06-01T00:04:00Z</domain:exDate>
<domain:authInfo>
<domain:pw>2fooBAR</domain:pw>

View file

@ -19,6 +19,8 @@
<domain:clID>NewRegistrar</domain:clID>
<domain:crID>NewRegistrar</domain:crID>
<domain:crDate>2000-06-01T00:04:00Z</domain:crDate>
<domain:upID>NewRegistrar</domain:upID>
<domain:upDate>2002-05-30T01:03:00Z</domain:upDate>
<domain:exDate>2003-05-30T01:03:00Z</domain:exDate>
<domain:authInfo>
<domain:pw>2fooBAR</domain:pw>

View file

@ -19,6 +19,8 @@
<domain:clID>TheRegistrar</domain:clID>
<domain:crID>NewRegistrar</domain:crID>
<domain:crDate>2000-06-01T00:04:00Z</domain:crDate>
<domain:upID>TheRegistrar</domain:upID>
<domain:upDate>2002-05-30T00:00:00Z</domain:upDate>
<domain:exDate>2003-06-01T00:04:00Z</domain:exDate>
<domain:trDate>2002-06-04T00:00:00Z</domain:trDate>
<domain:authInfo>

View file

@ -19,6 +19,8 @@
<domain:clID>TheRegistrar</domain:clID>
<domain:crID>NewRegistrar</domain:crID>
<domain:crDate>2000-06-01T00:04:00Z</domain:crDate>
<domain:upID>TheRegistrar</domain:upID>
<domain:upDate>2002-05-30T00:00:00Z</domain:upDate>
<domain:exDate>2003-06-01T00:04:00Z</domain:exDate>
<domain:trDate>2002-06-04T00:00:00Z</domain:trDate>
<domain:authInfo>

View file

@ -17,6 +17,8 @@
<domain:clID>NewRegistrar</domain:clID>
<domain:crID>NewRegistrar</domain:crID>
<domain:crDate>2000-06-01T00:02:00.0Z</domain:crDate>
<domain:upID>NewRegistrar</domain:upID>
<domain:upDate>2000-07-07T00:02:00Z</domain:upDate>
<domain:exDate>2002-06-01T00:02:00.0Z</domain:exDate>
<domain:authInfo>
<domain:pw>2fooBAR</domain:pw>