Convert DomainTransferRequestFlow to tm() calls (#1002)

* Convert DomainTransferRequestFlow to tm() calls

Besides the standard ofy-to-tm conversions this includes storing the
billing event cancellation VKey in the DomainTransferData object so that
we know to handle it on process / cancellation.
This commit is contained in:
gbrodman 2021-03-15 20:01:59 -04:00 committed by GitHub
parent c8385617bd
commit cdbecac103
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 147 additions and 111 deletions

View file

@ -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<F extends Flow> {
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())));
}
/**

View file

@ -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<DomainTransferRequestFlow, DomainBase> {
@ -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<BillingEvent.Recurring> 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<BillingEvent.Recurring> existingAutorenewEvent = domain.getAutorenewBillingEvent();
@ -1141,7 +1140,7 @@ class DomainTransferRequestFlowTest
.setRecurringEventKey(existingAutorenewEvent));
}
@Test
@TestOfyAndSql
void testSuccess_autorenewGraceActive_onlyAtAutomaticTransferTime() throws Exception {
setupDomain("example", "tld");
VKey<BillingEvent.Recurring> 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<String, String> 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(