diff --git a/core/src/main/java/google/registry/flows/domain/DomainTransferRequestFlow.java b/core/src/main/java/google/registry/flows/domain/DomainTransferRequestFlow.java index e00bc878d..aaa3f5473 100644 --- a/core/src/main/java/google/registry/flows/domain/DomainTransferRequestFlow.java +++ b/core/src/main/java/google/registry/flows/domain/DomainTransferRequestFlow.java @@ -31,7 +31,6 @@ import static google.registry.flows.domain.DomainTransferUtils.createPendingTran import static google.registry.flows.domain.DomainTransferUtils.createTransferResponse; import static google.registry.flows.domain.DomainTransferUtils.createTransferServerApproveEntities; import static google.registry.model.eppoutput.Result.Code.SUCCESS_WITH_ACTION_PENDING; -import static google.registry.model.ofy.ObjectifyService.ofy; import static google.registry.persistence.transaction.TransactionManagerFactory.tm; import com.google.common.collect.ImmutableList; @@ -227,12 +226,11 @@ public final class DomainTransferRequestFlow implements TransactionalFlow { .setLastEppUpdateClientId(gainingClientId) .build(); asyncTaskEnqueuer.enqueueAsyncResave(newDomain, now, automaticTransferTime); - ofy().save() - .entities(new ImmutableSet.Builder<>() - .add(newDomain, historyEntry, requestPollMessage) - .addAll(serverApproveEntities) - .build()) - .now(); + tm().putAll( + new ImmutableSet.Builder<>() + .add(newDomain, historyEntry, requestPollMessage) + .addAll(serverApproveEntities) + .build()); return responseBuilder .setResultFromCode(SUCCESS_WITH_ACTION_PENDING) .setResData(createResponse(period, existingDomain, newDomain, now)) diff --git a/core/src/main/java/google/registry/model/transfer/DomainTransferData.java b/core/src/main/java/google/registry/model/transfer/DomainTransferData.java index d0a16cfb4..075dcb12f 100644 --- a/core/src/main/java/google/registry/model/transfer/DomainTransferData.java +++ b/core/src/main/java/google/registry/model/transfer/DomainTransferData.java @@ -15,6 +15,7 @@ package google.registry.model.transfer; import static google.registry.util.CollectionUtils.forceEmptyToNull; +import static google.registry.util.CollectionUtils.isNullOrEmpty; import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.ImmutableSet; @@ -23,6 +24,7 @@ import com.googlecode.objectify.annotation.AlsoLoad; import com.googlecode.objectify.annotation.Embed; import com.googlecode.objectify.annotation.Ignore; import com.googlecode.objectify.annotation.IgnoreSave; +import com.googlecode.objectify.annotation.OnLoad; import com.googlecode.objectify.annotation.Unindex; import com.googlecode.objectify.condition.IfNull; import google.registry.model.billing.BillingEvent; @@ -31,6 +33,7 @@ import google.registry.model.domain.Period; import google.registry.model.domain.Period.Unit; import google.registry.model.poll.PollMessage; import google.registry.persistence.VKey; +import java.util.Set; import javax.annotation.Nullable; import javax.persistence.AttributeOverride; import javax.persistence.AttributeOverrides; @@ -80,7 +83,7 @@ public class DomainTransferData extends TransferData @Ignore @Column(name = "transfer_billing_cancellation_id") - Long billingCancellationId; + VKey billingCancellationId; /** * The regular one-time billing event that will be charged for a server-approved transfer. @@ -218,11 +221,20 @@ public class DomainTransferData extends TransferData return serverApproveAutorenewPollMessageHistoryId; } + @OnLoad + @Override + void onLoad( + @AlsoLoad("serverApproveEntities") + Set> serverApproveEntities) { + super.onLoad(serverApproveEntities); + mapBillingCancellationEntityToField(serverApproveEntities, this); + } + @PostLoad @Override void postLoad() { - // The superclass's serverApproveEntities should include the billing events if present super.postLoad(); + // The superclass's serverApproveEntities should include the billing events if present ImmutableSet.Builder> serverApproveEntitiesBuilder = new ImmutableSet.Builder<>(); if (serverApproveEntities != null) { @@ -234,8 +246,8 @@ public class DomainTransferData extends TransferData if (serverApproveAutorenewEvent != null) { serverApproveEntitiesBuilder.add(serverApproveAutorenewEvent); } - if (serverApproveAutorenewPollMessage != null) { - serverApproveEntitiesBuilder.add(serverApproveAutorenewPollMessage); + if (billingCancellationId != null) { + serverApproveEntitiesBuilder.add(billingCancellationId); } serverApproveEntities = forceEmptyToNull(serverApproveEntitiesBuilder.build()); } @@ -250,6 +262,23 @@ public class DomainTransferData extends TransferData return new Builder(clone(this)); } + /** Maps serverApproveEntities set to the individual fields. */ + @SuppressWarnings("unchecked") + static void mapBillingCancellationEntityToField( + Set> serverApproveEntities, + DomainTransferData domainTransferData) { + if (isNullOrEmpty(serverApproveEntities)) { + domainTransferData.billingCancellationId = null; + } else { + domainTransferData.billingCancellationId = + (VKey) + serverApproveEntities.stream() + .filter(k -> k.getKind().equals(BillingEvent.Cancellation.class)) + .findFirst() + .orElse(null); + } + } + public static class Builder extends TransferData.Builder { /** Create a {@link DomainTransferData.Builder} wrapping a new instance. */ public Builder() {} @@ -259,6 +288,12 @@ public class DomainTransferData extends TransferData super(instance); } + @Override + public DomainTransferData build() { + mapBillingCancellationEntityToField(getInstance().serverApproveEntities, getInstance()); + return super.build(); + } + public Builder setTransferPeriod(Period transferPeriod) { getInstance().transferPeriod = transferPeriod; return this; diff --git a/core/src/test/java/google/registry/flows/FlowTestCase.java b/core/src/test/java/google/registry/flows/FlowTestCase.java index ac659118f..10ba76d9d 100644 --- a/core/src/test/java/google/registry/flows/FlowTestCase.java +++ b/core/src/test/java/google/registry/flows/FlowTestCase.java @@ -22,6 +22,7 @@ import static com.google.common.truth.Truth.assertWithMessage; import static google.registry.model.eppcommon.EppXmlTransformer.marshal; import static google.registry.model.ofy.ObjectifyService.ofy; import static google.registry.persistence.transaction.TransactionManagerFactory.tm; +import static google.registry.persistence.transaction.TransactionManagerUtil.transactIfJpaTm; import static google.registry.testing.DatabaseHelper.stripBillingEventId; import static google.registry.xml.XmlTestUtils.assertXmlEquals; import static java.nio.charset.StandardCharsets.UTF_8; @@ -203,9 +204,12 @@ public abstract class FlowTestCase { assertWithMessage("Billing event is present for grace period: " + gracePeriod) .that(gracePeriod.hasBillingEvent()) .isTrue(); - return tm().loadByKey( - firstNonNull( - gracePeriod.getOneTimeBillingEvent(), gracePeriod.getRecurringBillingEvent())); + return transactIfJpaTm( + () -> + tm().loadByKey( + firstNonNull( + gracePeriod.getOneTimeBillingEvent(), + gracePeriod.getRecurringBillingEvent()))); } /** diff --git a/core/src/test/java/google/registry/flows/domain/DomainTransferRequestFlowTest.java b/core/src/test/java/google/registry/flows/domain/DomainTransferRequestFlowTest.java index 166461246..79881e886 100644 --- a/core/src/test/java/google/registry/flows/domain/DomainTransferRequestFlowTest.java +++ b/core/src/test/java/google/registry/flows/domain/DomainTransferRequestFlowTest.java @@ -22,12 +22,12 @@ import static google.registry.batch.AsyncTaskEnqueuer.PARAM_REQUESTED_TIME; import static google.registry.batch.AsyncTaskEnqueuer.PARAM_RESOURCE_KEY; import static google.registry.batch.AsyncTaskEnqueuer.PATH_RESAVE_ENTITY; import static google.registry.batch.AsyncTaskEnqueuer.QUEUE_ASYNC_ACTIONS; -import static google.registry.model.ofy.ObjectifyService.ofy; import static google.registry.model.registry.Registry.TldState.QUIET_PERIOD; import static google.registry.model.reporting.DomainTransactionRecord.TransactionReportField.TRANSFER_SUCCESSFUL; import static google.registry.model.reporting.HistoryEntry.Type.DOMAIN_CREATE; import static google.registry.model.reporting.HistoryEntry.Type.DOMAIN_TRANSFER_REQUEST; import static google.registry.persistence.transaction.TransactionManagerFactory.tm; +import static google.registry.persistence.transaction.TransactionManagerUtil.transactIfJpaTm; import static google.registry.testing.DatabaseHelper.assertBillingEvents; import static google.registry.testing.DatabaseHelper.assertBillingEventsEqual; import static google.registry.testing.DatabaseHelper.assertPollMessagesEqual; @@ -102,7 +102,9 @@ import google.registry.model.transfer.DomainTransferData; import google.registry.model.transfer.TransferResponse; import google.registry.model.transfer.TransferStatus; import google.registry.persistence.VKey; +import google.registry.testing.DualDatabaseTest; import google.registry.testing.TaskQueueHelper.TaskMatcher; +import google.registry.testing.TestOfyAndSql; import java.util.Map; import java.util.Optional; import java.util.stream.Stream; @@ -110,9 +112,9 @@ import org.joda.money.Money; import org.joda.time.DateTime; import org.joda.time.Duration; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; /** Unit tests for {@link DomainTransferRequestFlow}. */ +@DualDatabaseTest class DomainTransferRequestFlowTest extends DomainTransferFlowTestCase { @@ -291,13 +293,15 @@ class DomainTransferRequestFlowTest // Assert that the domain's TransferData server-approve billing events match the above. if (expectTransferBillingEvent) { assertBillingEventsEqual( - tm().loadByKey(domain.getTransferData().getServerApproveBillingEvent()), + transactIfJpaTm( + () -> tm().loadByKey(domain.getTransferData().getServerApproveBillingEvent())), optionalTransferBillingEvent.get()); } else { assertThat(domain.getTransferData().getServerApproveBillingEvent()).isNull(); } assertBillingEventsEqual( - tm().loadByKey(domain.getTransferData().getServerApproveAutorenewEvent()), + transactIfJpaTm( + () -> tm().loadByKey(domain.getTransferData().getServerApproveAutorenewEvent())), gainingClientAutorenew); // Assert that the full set of server-approve billing events is exactly the extra ones plus // the transfer billing event (if present) and the gaining client autorenew. @@ -307,18 +311,14 @@ class DomainTransferRequestFlowTest .collect(toImmutableSet()); assertBillingEventsEqual( Iterables.filter( - ofy() - .load() - // Use toArray() to coerce the type to something keys() will accept. - .keys( - domain.getTransferData().getServerApproveEntities().stream() - .map(VKey::getOfyKey) - .toArray(Key[]::new)) - .values(), + transactIfJpaTm( + () -> + tm().loadByKeys(domain.getTransferData().getServerApproveEntities()).values()), BillingEvent.class), Sets.union(expectedServeApproveBillingEvents, extraBillingEvents)); // The domain's autorenew billing event should still point to the losing client's event. - BillingEvent.Recurring domainAutorenewEvent = tm().loadByKey(domain.getAutorenewBillingEvent()); + BillingEvent.Recurring domainAutorenewEvent = + transactIfJpaTm(() -> tm().loadByKey(domain.getAutorenewBillingEvent())); assertThat(domainAutorenewEvent.getClientId()).isEqualTo("TheRegistrar"); assertThat(domainAutorenewEvent.getRecurrenceEndTime()).isEqualTo(implicitTransferTime); // The original grace periods should remain untouched. @@ -414,20 +414,16 @@ class DomainTransferRequestFlowTest // Assert that the poll messages show up in the TransferData server approve entities. assertPollMessagesEqual( - tm().loadByKey(domain.getTransferData().getServerApproveAutorenewPollMessage()), + transactIfJpaTm( + () -> tm().loadByKey(domain.getTransferData().getServerApproveAutorenewPollMessage())), autorenewPollMessage); // Assert that the full set of server-approve poll messages is exactly the server approve // OneTime messages to gaining and losing registrars plus the gaining client autorenew. assertPollMessagesEqual( Iterables.filter( - ofy() - .load() - // Use toArray() to coerce the type to something keys() will accept. - .keys( - domain.getTransferData().getServerApproveEntities().stream() - .map(VKey::getOfyKey) - .toArray(Key[]::new)) - .values(), + transactIfJpaTm( + () -> + tm().loadByKeys(domain.getTransferData().getServerApproveEntities()).values()), PollMessage.class), ImmutableList.of( transferApprovedPollMessage, losingTransferApprovedPollMessage, autorenewPollMessage)); @@ -447,7 +443,10 @@ class DomainTransferRequestFlowTest .and() .hasLastEppUpdateClientId("NewRegistrar"); assertThat( - tm().loadByKey(domainAfterAutomaticTransfer.getAutorenewBillingEvent()).getEventTime()) + transactIfJpaTm( + () -> + tm().loadByKey(domainAfterAutomaticTransfer.getAutorenewBillingEvent()) + .getEventTime())) .isEqualTo(expectedExpirationTime); // And after the expected grace time, the grace period should be gone. DomainBase afterGracePeriod = @@ -590,7 +589,7 @@ class DomainTransferRequestFlowTest if (expectedAutomaticTransferLength.equals(Duration.ZERO)) { // The transfer is going to happen immediately. To observe the domain in the pending transfer // state, grab it directly from the database. - domain = Iterables.getOnlyElement(ofy().load().type(DomainBase.class).list()); + domain = Iterables.getOnlyElement(transactIfJpaTm(() -> tm().loadAllOf(DomainBase.class))); assertThat(domain.getDomainName()).isEqualTo("example.tld"); } else { // Transfer should have been requested. @@ -651,7 +650,7 @@ class DomainTransferRequestFlowTest runTest(commandFilename, UserPrivileges.NORMAL, ImmutableMap.of()); } - @Test + @TestOfyAndSql void testDryRun() throws Exception { setupDomain("example", "tld"); setEppInput("domain_transfer_request.xml"); @@ -659,34 +658,34 @@ class DomainTransferRequestFlowTest dryRunFlowAssertResponse(loadFile("domain_transfer_request_response.xml")); } - @Test + @TestOfyAndSql void testSuccess() throws Exception { setupDomain("example", "tld"); doSuccessfulTest("domain_transfer_request.xml", "domain_transfer_request_response.xml"); } - @Test + @TestOfyAndSql void testSuccess_fee_v06() throws Exception { setupDomain("example", "tld"); doSuccessfulTest( "domain_transfer_request_fee.xml", "domain_transfer_request_response_fee.xml", FEE_06_MAP); } - @Test + @TestOfyAndSql void testSuccess_fee_v11() throws Exception { setupDomain("example", "tld"); doSuccessfulTest( "domain_transfer_request_fee.xml", "domain_transfer_request_response_fee.xml", FEE_11_MAP); } - @Test + @TestOfyAndSql void testSuccess_fee_v12() throws Exception { setupDomain("example", "tld"); doSuccessfulTest( "domain_transfer_request_fee.xml", "domain_transfer_request_response_fee.xml", FEE_12_MAP); } - @Test + @TestOfyAndSql void testSuccess_fee_withDefaultAttributes_v06() throws Exception { setupDomain("example", "tld"); doSuccessfulTest( @@ -695,7 +694,7 @@ class DomainTransferRequestFlowTest FEE_06_MAP); } - @Test + @TestOfyAndSql void testSuccess_fee_withDefaultAttributes_v11() throws Exception { setupDomain("example", "tld"); doSuccessfulTest( @@ -704,7 +703,7 @@ class DomainTransferRequestFlowTest FEE_11_MAP); } - @Test + @TestOfyAndSql void testSuccess_fee_withDefaultAttributes_v12() throws Exception { setupDomain("example", "tld"); doSuccessfulTest( @@ -713,7 +712,7 @@ class DomainTransferRequestFlowTest FEE_12_MAP); } - @Test + @TestOfyAndSql void testFailure_refundableFee_v06() { setupDomain("example", "tld"); EppException thrown = @@ -723,7 +722,7 @@ class DomainTransferRequestFlowTest assertAboutEppExceptions().that(thrown).marshalsToXml(); } - @Test + @TestOfyAndSql void testFailure_refundableFee_v11() { setupDomain("example", "tld"); EppException thrown = @@ -733,7 +732,7 @@ class DomainTransferRequestFlowTest assertAboutEppExceptions().that(thrown).marshalsToXml(); } - @Test + @TestOfyAndSql void testFailure_refundableFee_v12() { setupDomain("example", "tld"); EppException thrown = @@ -743,7 +742,7 @@ class DomainTransferRequestFlowTest assertAboutEppExceptions().that(thrown).marshalsToXml(); } - @Test + @TestOfyAndSql void testFailure_gracePeriodFee_v06() { setupDomain("example", "tld"); EppException thrown = @@ -753,7 +752,7 @@ class DomainTransferRequestFlowTest assertAboutEppExceptions().that(thrown).marshalsToXml(); } - @Test + @TestOfyAndSql void testFailure_gracePeriodFee_v11() { setupDomain("example", "tld"); EppException thrown = @@ -763,7 +762,7 @@ class DomainTransferRequestFlowTest assertAboutEppExceptions().that(thrown).marshalsToXml(); } - @Test + @TestOfyAndSql void testFailure_gracePeriodFee_v12() { setupDomain("example", "tld"); EppException thrown = @@ -773,7 +772,7 @@ class DomainTransferRequestFlowTest assertAboutEppExceptions().that(thrown).marshalsToXml(); } - @Test + @TestOfyAndSql void testFailure_appliedFee_v06() { setupDomain("example", "tld"); EppException thrown = @@ -783,7 +782,7 @@ class DomainTransferRequestFlowTest assertAboutEppExceptions().that(thrown).marshalsToXml(); } - @Test + @TestOfyAndSql void testFailure_appliedFee_v11() { setupDomain("example", "tld"); EppException thrown = @@ -793,7 +792,7 @@ class DomainTransferRequestFlowTest assertAboutEppExceptions().that(thrown).marshalsToXml(); } - @Test + @TestOfyAndSql void testFailure_appliedFee_v12() { setupDomain("example", "tld"); EppException thrown = @@ -803,7 +802,7 @@ class DomainTransferRequestFlowTest assertAboutEppExceptions().that(thrown).marshalsToXml(); } - @Test + @TestOfyAndSql void testFailure_suspendedRegistrarCantTransferDomain() { setupDomain("example", "tld"); clock.advanceOneMilli(); @@ -820,7 +819,7 @@ class DomainTransferRequestFlowTest assertAboutEppExceptions().that(thrown).marshalsToXml(); } - @Test + @TestOfyAndSql void testFailure_pendingRegistrarCantTransferDomain() { setupDomain("example", "tld"); clock.advanceOneMilli(); @@ -837,7 +836,7 @@ class DomainTransferRequestFlowTest assertAboutEppExceptions().that(thrown).marshalsToXml(); } - @Test + @TestOfyAndSql void testSuccess_nonDefaultAutomaticTransferLength() throws Exception { setupDomain("example", "tld"); persistResource( @@ -849,7 +848,7 @@ class DomainTransferRequestFlowTest "domain_transfer_request.xml", "domain_transfer_request_response_15_minutes.xml"); } - @Test + @TestOfyAndSql void testSuccess_nonDefaultTransferGracePeriod() throws Exception { setupDomain("example", "tld"); persistResource( @@ -860,14 +859,14 @@ class DomainTransferRequestFlowTest doSuccessfulTest("domain_transfer_request.xml", "domain_transfer_request_response.xml"); } - @Test + @TestOfyAndSql void testSuccess_missingPeriod_defaultsToOneYear() throws Exception { setupDomain("example", "tld"); doSuccessfulTest( "domain_transfer_request_missing_period.xml", "domain_transfer_request_response.xml"); } - @Test + @TestOfyAndSql void testSuccess_canTransferAwayFromSuspendedRegistrar() throws Exception { setupDomain("example", "tld"); clock.advanceOneMilli(); @@ -880,7 +879,7 @@ class DomainTransferRequestFlowTest doSuccessfulTest("domain_transfer_request.xml", "domain_transfer_request_response.xml"); } - @Test + @TestOfyAndSql void testSuccess_inQuietPeriod() throws Exception { setupDomain("example", "tld"); persistResource( @@ -891,7 +890,7 @@ class DomainTransferRequestFlowTest doSuccessfulTest("domain_transfer_request.xml", "domain_transfer_request_response.xml"); } - @Test + @TestOfyAndSql void testFailure_multiYearPeriod() { setupDomain("example", "tld"); clock.advanceOneMilli(); @@ -902,7 +901,7 @@ class DomainTransferRequestFlowTest assertAboutEppExceptions().that(thrown).marshalsToXml(); } - @Test + @TestOfyAndSql void testSuccess_superuserExtension_zeroPeriod_nonZeroAutomaticTransferLength() throws Exception { setupDomain("example", "tld"); clock.advanceOneMilli(); @@ -916,7 +915,7 @@ class DomainTransferRequestFlowTest Duration.standardDays(5)); } - @Test + @TestOfyAndSql void testSuccess_superuserExtension_zeroPeriod_zeroAutomaticTransferLength() throws Exception { setupDomain("example", "tld"); clock.advanceOneMilli(); @@ -930,7 +929,7 @@ class DomainTransferRequestFlowTest Duration.ZERO); } - @Test + @TestOfyAndSql void testSuccess_superuserExtension_nonZeroPeriod_nonZeroAutomaticTransferLength() throws Exception { setupDomain("example", "tld"); @@ -945,7 +944,7 @@ class DomainTransferRequestFlowTest Duration.standardDays(5)); } - @Test + @TestOfyAndSql void testSuccess_superuserExtension_zeroPeriod_autorenewGraceActive() throws Exception { setupDomain("example", "tld"); VKey existingAutorenewEvent = domain.getAutorenewBillingEvent(); @@ -977,7 +976,7 @@ class DomainTransferRequestFlowTest Duration.ZERO); } - @Test + @TestOfyAndSql void testFailure_superuserExtension_twoYearPeriod() { setupDomain("example", "tld"); eppRequestSource = EppRequestSource.TOOL; @@ -991,7 +990,7 @@ class DomainTransferRequestFlowTest ImmutableMap.of("PERIOD", "2", "AUTOMATIC_TRANSFER_LENGTH", "5"))); } - @Test + @TestOfyAndSql void testFailure_superuserExtension_zeroPeriod_feeTransferExtension() { setupDomain("example", "tld"); eppRequestSource = EppRequestSource.TOOL; @@ -1005,7 +1004,7 @@ class DomainTransferRequestFlowTest ImmutableMap.of("PERIOD", "0", "AUTOMATIC_TRANSFER_LENGTH", "5"))); } - @Test + @TestOfyAndSql void testSuccess_cappedExpiration() throws Exception { setupDomain("example", "tld"); // Set the domain to expire 10 years from now (as if it were just created with a 10-year term). @@ -1022,14 +1021,14 @@ class DomainTransferRequestFlowTest clock.nowUtc().plus(Registry.get("tld").getAutomaticTransferLength()).plusYears(10)); } - @Test + @TestOfyAndSql void testSuccess_domainAuthInfo() throws Exception { setupDomain("example", "tld"); doSuccessfulTest( "domain_transfer_request_domain_authinfo.xml", "domain_transfer_request_response.xml"); } - @Test + @TestOfyAndSql void testSuccess_customLogicFee() throws Exception { setupDomain("expensive-domain", "foo"); clock.advanceOneMilli(); @@ -1048,7 +1047,7 @@ class DomainTransferRequestFlowTest Optional.of(Money.of(USD, 111))); } - @Test + @TestOfyAndSql void testFailure_notAuthorizedForTld() { setupDomain("example", "tld"); persistResource( @@ -1062,7 +1061,7 @@ class DomainTransferRequestFlowTest assertAboutEppExceptions().that(thrown).marshalsToXml(); } - @Test + @TestOfyAndSql void testSuccess_superuserNotAuthorizedForTld() throws Exception { setupDomain("example", "tld"); persistResource( @@ -1072,7 +1071,7 @@ class DomainTransferRequestFlowTest runTest("domain_transfer_request.xml", UserPrivileges.SUPERUSER); } - @Test + @TestOfyAndSql void testSuccess_autorenewGraceActive_onlyAtTransferRequestTime() throws Exception { setupDomain("example", "tld"); // Set the domain to have auto-renewed long enough ago that it is still in the autorenew grace @@ -1102,7 +1101,7 @@ class DomainTransferRequestFlowTest expirationTime.plusYears(1)); } - @Test + @TestOfyAndSql void testSuccess_autorenewGraceActive_throughoutTransferWindow() throws Exception { setupDomain("example", "tld"); VKey existingAutorenewEvent = domain.getAutorenewBillingEvent(); @@ -1141,7 +1140,7 @@ class DomainTransferRequestFlowTest .setRecurringEventKey(existingAutorenewEvent)); } - @Test + @TestOfyAndSql void testSuccess_autorenewGraceActive_onlyAtAutomaticTransferTime() throws Exception { setupDomain("example", "tld"); VKey existingAutorenewEvent = domain.getAutorenewBillingEvent(); @@ -1169,7 +1168,7 @@ class DomainTransferRequestFlowTest .setRecurringEventKey(existingAutorenewEvent)); } - @Test + @TestOfyAndSql void testSuccess_premiumNotBlocked() throws Exception { setupDomain("rich", "example"); clock.advanceOneMilli(); @@ -1177,7 +1176,7 @@ class DomainTransferRequestFlowTest runTest("domain_transfer_request_fee.xml", UserPrivileges.NORMAL, RICH_DOMAIN_MAP); } - @Test + @TestOfyAndSql void testSuccess_premiumNotBlockedInSuperuserMode() throws Exception { setupDomain("rich", "example"); clock.advanceOneMilli(); @@ -1199,22 +1198,22 @@ class DomainTransferRequestFlowTest assertAboutEppExceptions().that(thrown).marshalsToXml(); } - @Test + @TestOfyAndSql void testFailure_wrongCurrency_v06() { runWrongCurrencyTest(FEE_06_MAP); } - @Test + @TestOfyAndSql void testFailure_wrongCurrency_v11() { runWrongCurrencyTest(FEE_11_MAP); } - @Test + @TestOfyAndSql void testFailure_wrongCurrency_v12() { runWrongCurrencyTest(FEE_12_MAP); } - @Test + @TestOfyAndSql void testFailure_unknownCurrency() { Map substitutions = Maps.newHashMap(); substitutions.putAll(FEE_06_MAP); @@ -1225,7 +1224,7 @@ class DomainTransferRequestFlowTest assertAboutEppExceptions().that(thrown).marshalsToXml(); } - @Test + @TestOfyAndSql void testFailure_feeGivenInWrongScale_v06() { setupDomain("example", "tld"); EppException thrown = @@ -1235,7 +1234,7 @@ class DomainTransferRequestFlowTest assertAboutEppExceptions().that(thrown).marshalsToXml(); } - @Test + @TestOfyAndSql void testFailure_feeGivenInWrongScale_v11() { setupDomain("example", "tld"); EppException thrown = @@ -1245,7 +1244,7 @@ class DomainTransferRequestFlowTest assertAboutEppExceptions().that(thrown).marshalsToXml(); } - @Test + @TestOfyAndSql void testFailure_feeGivenInWrongScale_v12() { setupDomain("example", "tld"); EppException thrown = @@ -1268,25 +1267,25 @@ class DomainTransferRequestFlowTest assertAboutEppExceptions().that(thrown).marshalsToXml(); } - @Test + @TestOfyAndSql void testFailure_wrongFeeAmount_v06() { setupDomain("example", "tld"); runWrongFeeAmountTest(FEE_06_MAP); } - @Test + @TestOfyAndSql void testFailure_wrongFeeAmount_v11() { setupDomain("example", "tld"); runWrongFeeAmountTest(FEE_11_MAP); } - @Test + @TestOfyAndSql void testFailure_wrongFeeAmount_v12() { setupDomain("example", "tld"); runWrongFeeAmountTest(FEE_12_MAP); } - @Test + @TestOfyAndSql void testFailure_premiumBlocked() { setupDomain("rich", "example"); // Modify the Registrar to block premium names. @@ -1298,7 +1297,7 @@ class DomainTransferRequestFlowTest assertAboutEppExceptions().that(thrown).marshalsToXml(); } - @Test + @TestOfyAndSql void testFailure_feeNotProvidedOnPremiumName() { setupDomain("rich", "example"); EppException thrown = @@ -1308,7 +1307,7 @@ class DomainTransferRequestFlowTest assertAboutEppExceptions().that(thrown).marshalsToXml(); } - @Test + @TestOfyAndSql void testFailure_noAuthInfo() { setupDomain("example", "tld"); EppException thrown = @@ -1318,7 +1317,7 @@ class DomainTransferRequestFlowTest assertAboutEppExceptions().that(thrown).marshalsToXml(); } - @Test + @TestOfyAndSql void testFailure_badContactPassword() { setupDomain("example", "tld"); // Change the contact's password so it does not match the password in the file. @@ -1335,7 +1334,7 @@ class DomainTransferRequestFlowTest assertAboutEppExceptions().that(thrown).marshalsToXml(); } - @Test + @TestOfyAndSql void testFailure_badContactRepoId() { setupDomain("example", "tld"); // Set the contact to a different ROID, but don't persist it; this is just so the substitution @@ -1348,42 +1347,42 @@ class DomainTransferRequestFlowTest assertAboutEppExceptions().that(thrown).marshalsToXml(); } - @Test + @TestOfyAndSql void testSuccess_clientApproved() throws Exception { setupDomain("example", "tld"); changeTransferStatus(TransferStatus.CLIENT_APPROVED); doSuccessfulTest("domain_transfer_request.xml", "domain_transfer_request_response.xml"); } - @Test + @TestOfyAndSql void testSuccess_clientRejected() throws Exception { setupDomain("example", "tld"); changeTransferStatus(TransferStatus.CLIENT_REJECTED); doSuccessfulTest("domain_transfer_request.xml", "domain_transfer_request_response.xml"); } - @Test + @TestOfyAndSql void testSuccess_clientCancelled() throws Exception { setupDomain("example", "tld"); changeTransferStatus(TransferStatus.CLIENT_CANCELLED); doSuccessfulTest("domain_transfer_request.xml", "domain_transfer_request_response.xml"); } - @Test + @TestOfyAndSql void testSuccess_serverApproved() throws Exception { setupDomain("example", "tld"); changeTransferStatus(TransferStatus.SERVER_APPROVED); doSuccessfulTest("domain_transfer_request.xml", "domain_transfer_request_response.xml"); } - @Test + @TestOfyAndSql void testSuccess_serverCancelled() throws Exception { setupDomain("example", "tld"); changeTransferStatus(TransferStatus.SERVER_CANCELLED); doSuccessfulTest("domain_transfer_request.xml", "domain_transfer_request_response.xml"); } - @Test + @TestOfyAndSql void testFailure_pending() { setupDomain("example", "tld"); domain = @@ -1405,7 +1404,7 @@ class DomainTransferRequestFlowTest assertAboutEppExceptions().that(thrown).marshalsToXml(); } - @Test + @TestOfyAndSql void testFailure_badDomainPassword() { setupDomain("example", "tld"); // Change the domain's password so it does not match the password in the file. @@ -1422,7 +1421,7 @@ class DomainTransferRequestFlowTest assertAboutEppExceptions().that(thrown).marshalsToXml(); } - @Test + @TestOfyAndSql void testFailure_sponsoringClient() { setupDomain("example", "tld"); setClientIdForFlow("TheRegistrar"); @@ -1433,7 +1432,7 @@ class DomainTransferRequestFlowTest assertAboutEppExceptions().that(thrown).marshalsToXml(); } - @Test + @TestOfyAndSql void testFailure_deletedDomain() throws Exception { setupDomain("example", "tld"); domain = @@ -1445,7 +1444,7 @@ class DomainTransferRequestFlowTest assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); } - @Test + @TestOfyAndSql void testFailure_invalidDomain() throws Exception { setupDomain("example", "tld"); setEppInput( @@ -1460,7 +1459,7 @@ class DomainTransferRequestFlowTest assertThat(thrown).hasMessageThat().contains("(--invalid)"); } - @Test + @TestOfyAndSql void testFailure_nonexistentDomain() { createTld("tld"); contact = persistActiveContact("jd1234"); @@ -1471,7 +1470,7 @@ class DomainTransferRequestFlowTest assertThat(thrown).hasMessageThat().contains(String.format("(%s)", "example.tld")); } - @Test + @TestOfyAndSql void testFailure_periodInMonths() { setupDomain("example", "tld"); EppException thrown = @@ -1481,7 +1480,7 @@ class DomainTransferRequestFlowTest assertAboutEppExceptions().that(thrown).marshalsToXml(); } - @Test + @TestOfyAndSql void testFailure_clientTransferProhibited() { setupDomain("example", "tld"); domain = @@ -1494,7 +1493,7 @@ class DomainTransferRequestFlowTest assertThat(thrown).hasMessageThat().contains("clientTransferProhibited"); } - @Test + @TestOfyAndSql void testFailure_serverTransferProhibited() { setupDomain("example", "tld"); domain = @@ -1507,7 +1506,7 @@ class DomainTransferRequestFlowTest assertThat(thrown).hasMessageThat().contains("serverTransferProhibited"); } - @Test + @TestOfyAndSql void testFailure_pendingDelete() { setupDomain("example", "tld"); domain = persistResource(domain.asBuilder().addStatusValue(StatusValue.PENDING_DELETE).build()); @@ -1518,7 +1517,7 @@ class DomainTransferRequestFlowTest assertThat(thrown).hasMessageThat().contains("pendingDelete"); } - @Test + @TestOfyAndSql void testIcannActivityReportField_getsLogged() throws Exception { setupDomain("example", "tld"); clock.advanceOneMilli(); @@ -1527,7 +1526,7 @@ class DomainTransferRequestFlowTest assertTldsFieldLogged("tld"); } - @Test + @TestOfyAndSql void testIcannTransactionRecord_getsStored() throws Exception { setupDomain("example", "tld"); persistResource(