Add db-compare tests to three more flows (#963)

* Add db-compare tests to three more flows

Add database comparison to the replay tests for DomainDeleteFlowTest,
DomainRenewFlowTest and DomainUpdateFlowTest.
This commit is contained in:
Michael Muller 2021-02-11 11:35:13 -05:00 committed by GitHub
parent f983d564f8
commit 17cd9ba4f1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 20 additions and 4 deletions

View file

@ -337,6 +337,10 @@ public class DomainContent extends EppResource
nullToEmptyImmutableCopy(dsData).stream() nullToEmptyImmutableCopy(dsData).stream()
.map(dsData -> dsData.cloneWithDomainRepoId(getRepoId())) .map(dsData -> dsData.cloneWithDomainRepoId(getRepoId()))
.collect(toImmutableSet()); .collect(toImmutableSet());
if (transferData != null) {
transferData.convertVKeys();
}
} }
@PostLoad @PostLoad

View file

@ -295,7 +295,7 @@ public abstract class PollMessage extends ImmutableObject
@Transient @ImmutableObject.DoNotCompare @Transient @ImmutableObject.DoNotCompare
List<DomainPendingActionNotificationResponse> domainPendingActionNotificationResponses; List<DomainPendingActionNotificationResponse> domainPendingActionNotificationResponses;
@Transient List<DomainTransferResponse> domainTransferResponses; @Transient @ImmutableObject.DoNotCompare List<DomainTransferResponse> domainTransferResponses;
@Transient List<HostPendingActionNotificationResponse> hostPendingActionNotificationResponses; @Transient List<HostPendingActionNotificationResponse> hostPendingActionNotificationResponses;

View file

@ -144,6 +144,16 @@ public class DomainTransferData extends TransferData<DomainTransferData.Builder>
rootKey, serverApproveAutorenewPollMessage, serverApproveAutorenewPollMessageHistoryId); rootKey, serverApproveAutorenewPollMessage, serverApproveAutorenewPollMessageHistoryId);
} }
/**
* Fix the VKey "kind" for the PollMessage keys.
*
* <p>For use by DomainBase/DomainHistory OnLoad methods ONLY.
*/
public void convertVKeys() {
serverApproveAutorenewPollMessage =
PollMessage.Autorenew.convertVKey(serverApproveAutorenewPollMessage);
}
@SuppressWarnings("unused") // For Hibernate. @SuppressWarnings("unused") // For Hibernate.
private void loadServerApproveBillingEventHistoryId( private void loadServerApproveBillingEventHistoryId(
@AlsoLoad("serverApproveBillingEvent") VKey<BillingEvent.OneTime> val) { @AlsoLoad("serverApproveBillingEvent") VKey<BillingEvent.OneTime> val) {

View file

@ -15,6 +15,7 @@
package google.registry.model.transfer; package google.registry.model.transfer;
import static com.google.common.collect.ImmutableList.toImmutableList; import static com.google.common.collect.ImmutableList.toImmutableList;
import static google.registry.model.ImmutableObject.DoNotCompare;
import static google.registry.util.CollectionUtils.isNullOrEmpty; import static google.registry.util.CollectionUtils.isNullOrEmpty;
import static google.registry.util.CollectionUtils.nullToEmpty; import static google.registry.util.CollectionUtils.nullToEmpty;
import static google.registry.util.CollectionUtils.nullToEmptyImmutableCopy; import static google.registry.util.CollectionUtils.nullToEmptyImmutableCopy;
@ -76,6 +77,7 @@ public abstract class TransferData<
* be deleted. * be deleted.
*/ */
@Transient @Transient
@DoNotCompare
@IgnoreSave(IfNull.class) @IgnoreSave(IfNull.class)
Set<VKey<? extends TransferServerApproveEntity>> serverApproveEntities; Set<VKey<? extends TransferServerApproveEntity>> serverApproveEntities;

View file

@ -112,7 +112,7 @@ class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow, Domain
@Order(value = Order.DEFAULT - 2) @Order(value = Order.DEFAULT - 2)
@RegisterExtension @RegisterExtension
final ReplayExtension replayExtension = ReplayExtension.createWithoutCompare(clock); final ReplayExtension replayExtension = ReplayExtension.createWithCompare(clock);
private DomainBase domain; private DomainBase domain;
private HistoryEntry earlierHistoryEntry; private HistoryEntry earlierHistoryEntry;

View file

@ -108,7 +108,7 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, DomainBa
@Order(value = Order.DEFAULT - 2) @Order(value = Order.DEFAULT - 2)
@RegisterExtension @RegisterExtension
final ReplayExtension replayExtension = ReplayExtension.createWithoutCompare(clock); final ReplayExtension replayExtension = ReplayExtension.createWithCompare(clock);
@BeforeEach @BeforeEach
void initDomainTest() { void initDomainTest() {

View file

@ -117,7 +117,7 @@ class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow, Domain
@Order(value = Order.DEFAULT - 2) @Order(value = Order.DEFAULT - 2)
@RegisterExtension @RegisterExtension
final ReplayExtension replayExtension = ReplayExtension.createWithoutCompare(clock); final ReplayExtension replayExtension = ReplayExtension.createWithCompare(clock);
@BeforeEach @BeforeEach
void initDomainTest() { void initDomainTest() {