mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 16:07:15 +02:00
Re-add EppException marshalling assertions in remaining domain flows
Apologies for the reformatting, but this refactoring is quite rote and it's definitely a bigger use of total time to perform the reformatting individually than to simply do it file-wide. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=179238504
This commit is contained in:
parent
5e4a6b0235
commit
e17109a0eb
6 changed files with 931 additions and 661 deletions
|
@ -31,8 +31,8 @@ import static google.registry.testing.DatastoreHelper.getPollMessages;
|
||||||
import static google.registry.testing.DatastoreHelper.loadRegistrar;
|
import static google.registry.testing.DatastoreHelper.loadRegistrar;
|
||||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||||
import static google.registry.testing.DomainResourceSubject.assertAboutDomains;
|
import static google.registry.testing.DomainResourceSubject.assertAboutDomains;
|
||||||
|
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
|
||||||
import static google.registry.testing.HistoryEntrySubject.assertAboutHistoryEntries;
|
import static google.registry.testing.HistoryEntrySubject.assertAboutHistoryEntries;
|
||||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
|
||||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||||
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||||
import static org.joda.money.CurrencyUnit.USD;
|
import static org.joda.money.CurrencyUnit.USD;
|
||||||
|
@ -44,6 +44,7 @@ import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.collect.ImmutableSortedMap;
|
import com.google.common.collect.ImmutableSortedMap;
|
||||||
import com.google.common.collect.Ordering;
|
import com.google.common.collect.Ordering;
|
||||||
import com.googlecode.objectify.Key;
|
import com.googlecode.objectify.Key;
|
||||||
|
import google.registry.flows.EppException;
|
||||||
import google.registry.flows.ResourceFlowUtils.BadAuthInfoForResourceException;
|
import google.registry.flows.ResourceFlowUtils.BadAuthInfoForResourceException;
|
||||||
import google.registry.flows.ResourceFlowUtils.ResourceDoesNotExistException;
|
import google.registry.flows.ResourceFlowUtils.ResourceDoesNotExistException;
|
||||||
import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException;
|
import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException;
|
||||||
|
@ -107,15 +108,19 @@ public class DomainTransferApproveFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertTransferApproved(DomainResource domain, TransferData oldTransferData) {
|
private void assertTransferApproved(DomainResource domain, TransferData oldTransferData) {
|
||||||
assertAboutDomains().that(domain)
|
assertAboutDomains()
|
||||||
.hasCurrentSponsorClientId("NewRegistrar").and()
|
.that(domain)
|
||||||
.hasLastTransferTime(clock.nowUtc()).and()
|
.hasCurrentSponsorClientId("NewRegistrar")
|
||||||
|
.and()
|
||||||
|
.hasLastTransferTime(clock.nowUtc())
|
||||||
|
.and()
|
||||||
.doesNotHaveStatusValue(StatusValue.PENDING_TRANSFER);
|
.doesNotHaveStatusValue(StatusValue.PENDING_TRANSFER);
|
||||||
// The domain TransferData should reflect the approved transfer as we expect, with
|
// The domain TransferData should reflect the approved transfer as we expect, with
|
||||||
// all the speculative server-approve fields nulled out.
|
// all the speculative server-approve fields nulled out.
|
||||||
assertThat(domain.getTransferData())
|
assertThat(domain.getTransferData())
|
||||||
.isEqualTo(
|
.isEqualTo(
|
||||||
oldTransferData.copyConstantFieldsToBuilder()
|
oldTransferData
|
||||||
|
.copyConstantFieldsToBuilder()
|
||||||
.setTransferStatus(TransferStatus.CLIENT_APPROVED)
|
.setTransferStatus(TransferStatus.CLIENT_APPROVED)
|
||||||
.setPendingTransferExpirationTime(clock.nowUtc())
|
.setPendingTransferExpirationTime(clock.nowUtc())
|
||||||
.setTransferredRegistrationExpirationTime(domain.getRegistrationExpirationTime())
|
.setTransferredRegistrationExpirationTime(domain.getRegistrationExpirationTime())
|
||||||
|
@ -139,12 +144,10 @@ public class DomainTransferApproveFlowTest
|
||||||
String expectedXmlFilename,
|
String expectedXmlFilename,
|
||||||
DateTime expectedExpirationTime,
|
DateTime expectedExpirationTime,
|
||||||
int expectedYearsToCharge,
|
int expectedYearsToCharge,
|
||||||
BillingEvent.Cancellation.Builder... expectedCancellationBillingEvents) throws Exception {
|
BillingEvent.Cancellation.Builder... expectedCancellationBillingEvents)
|
||||||
|
throws Exception {
|
||||||
runSuccessfulFlowWithAssertions(
|
runSuccessfulFlowWithAssertions(
|
||||||
tld,
|
tld, commandFilename, expectedXmlFilename, expectedExpirationTime);
|
||||||
commandFilename,
|
|
||||||
expectedXmlFilename,
|
|
||||||
expectedExpirationTime);
|
|
||||||
assertHistoryEntriesContainBillingEventsAndGracePeriods(
|
assertHistoryEntriesContainBillingEventsAndGracePeriods(
|
||||||
tld, expectedYearsToCharge, expectedCancellationBillingEvents);
|
tld, expectedYearsToCharge, expectedCancellationBillingEvents);
|
||||||
}
|
}
|
||||||
|
@ -153,7 +156,8 @@ public class DomainTransferApproveFlowTest
|
||||||
String tld,
|
String tld,
|
||||||
String commandFilename,
|
String commandFilename,
|
||||||
String expectedXmlFilename,
|
String expectedXmlFilename,
|
||||||
DateTime expectedExpirationTime) throws Exception {
|
DateTime expectedExpirationTime)
|
||||||
|
throws Exception {
|
||||||
setEppLoader(commandFilename);
|
setEppLoader(commandFilename);
|
||||||
Registry registry = Registry.get(tld);
|
Registry registry = Registry.get(tld);
|
||||||
domain = reloadResourceByForeignKey();
|
domain = reloadResourceByForeignKey();
|
||||||
|
@ -179,8 +183,7 @@ public class DomainTransferApproveFlowTest
|
||||||
DOMAIN_CREATE, DOMAIN_TRANSFER_REQUEST, DOMAIN_TRANSFER_APPROVE);
|
DOMAIN_CREATE, DOMAIN_TRANSFER_REQUEST, DOMAIN_TRANSFER_APPROVE);
|
||||||
final HistoryEntry historyEntryTransferApproved =
|
final HistoryEntry historyEntryTransferApproved =
|
||||||
getOnlyHistoryEntryOfType(domain, DOMAIN_TRANSFER_APPROVE);
|
getOnlyHistoryEntryOfType(domain, DOMAIN_TRANSFER_APPROVE);
|
||||||
assertAboutHistoryEntries().that(historyEntryTransferApproved)
|
assertAboutHistoryEntries().that(historyEntryTransferApproved).hasOtherClientId("NewRegistrar");
|
||||||
.hasOtherClientId("NewRegistrar");
|
|
||||||
assertTransferApproved(domain, originalTransferData);
|
assertTransferApproved(domain, originalTransferData);
|
||||||
assertAboutDomains().that(domain).hasRegistrationExpirationTime(expectedExpirationTime);
|
assertAboutDomains().that(domain).hasRegistrationExpirationTime(expectedExpirationTime);
|
||||||
assertThat(ofy().load().key(domain.getAutorenewBillingEvent()).now().getEventTime())
|
assertThat(ofy().load().key(domain.getAutorenewBillingEvent()).now().getEventTime())
|
||||||
|
@ -197,7 +200,8 @@ public class DomainTransferApproveFlowTest
|
||||||
|
|
||||||
PollMessage gainingTransferPollMessage =
|
PollMessage gainingTransferPollMessage =
|
||||||
getOnlyPollMessage(domain, "NewRegistrar", clock.nowUtc(), PollMessage.OneTime.class);
|
getOnlyPollMessage(domain, "NewRegistrar", clock.nowUtc(), PollMessage.OneTime.class);
|
||||||
PollMessage gainingAutorenewPollMessage = getOnlyPollMessage(
|
PollMessage gainingAutorenewPollMessage =
|
||||||
|
getOnlyPollMessage(
|
||||||
domain,
|
domain,
|
||||||
"NewRegistrar",
|
"NewRegistrar",
|
||||||
domain.getRegistrationExpirationTime(),
|
domain.getRegistrationExpirationTime(),
|
||||||
|
@ -228,8 +232,10 @@ public class DomainTransferApproveFlowTest
|
||||||
|
|
||||||
// After the expected grace time, the grace period should be gone.
|
// After the expected grace time, the grace period should be gone.
|
||||||
assertThat(
|
assertThat(
|
||||||
domain.cloneProjectedAtTime(clock.nowUtc().plus(registry.getTransferGracePeriodLength()))
|
domain
|
||||||
.getGracePeriods()).isEmpty();
|
.cloneProjectedAtTime(clock.nowUtc().plus(registry.getTransferGracePeriodLength()))
|
||||||
|
.getGracePeriods())
|
||||||
|
.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertHistoryEntriesContainBillingEventsAndGracePeriods(
|
private void assertHistoryEntriesContainBillingEventsAndGracePeriods(
|
||||||
|
@ -285,8 +291,7 @@ public class DomainTransferApproveFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertHistoryEntriesDoNotContainTransferBillingEventsOrGracePeriods(
|
private void assertHistoryEntriesDoNotContainTransferBillingEventsOrGracePeriods(
|
||||||
BillingEvent.Cancellation.Builder... expectedCancellationBillingEvents)
|
BillingEvent.Cancellation.Builder... expectedCancellationBillingEvents) throws Exception {
|
||||||
throws Exception {
|
|
||||||
domain = reloadResourceByForeignKey();
|
domain = reloadResourceByForeignKey();
|
||||||
final HistoryEntry historyEntryTransferApproved =
|
final HistoryEntry historyEntryTransferApproved =
|
||||||
getOnlyHistoryEntryOfType(domain, DOMAIN_TRANSFER_APPROVE);
|
getOnlyHistoryEntryOfType(domain, DOMAIN_TRANSFER_APPROVE);
|
||||||
|
@ -354,9 +359,7 @@ public class DomainTransferApproveFlowTest
|
||||||
.build());
|
.build());
|
||||||
setupDomainWithPendingTransfer("example", "net");
|
setupDomainWithPendingTransfer("example", "net");
|
||||||
doSuccessfulTest(
|
doSuccessfulTest(
|
||||||
"net",
|
"net", "domain_transfer_approve_net.xml", "domain_transfer_approve_response_net.xml");
|
||||||
"domain_transfer_approve_net.xml",
|
|
||||||
"domain_transfer_approve_response_net.xml");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -379,9 +382,7 @@ public class DomainTransferApproveFlowTest
|
||||||
public void testSuccess_autorenewBeforeTransfer() throws Exception {
|
public void testSuccess_autorenewBeforeTransfer() throws Exception {
|
||||||
domain = reloadResourceByForeignKey();
|
domain = reloadResourceByForeignKey();
|
||||||
DateTime oldExpirationTime = clock.nowUtc().minusDays(1);
|
DateTime oldExpirationTime = clock.nowUtc().minusDays(1);
|
||||||
persistResource(domain.asBuilder()
|
persistResource(domain.asBuilder().setRegistrationExpirationTime(oldExpirationTime).build());
|
||||||
.setRegistrationExpirationTime(oldExpirationTime)
|
|
||||||
.build());
|
|
||||||
// The autorenew should be subsumed into the transfer resulting in 1 year of renewal in total.
|
// The autorenew should be subsumed into the transfer resulting in 1 year of renewal in total.
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
doSuccessfulTest(
|
doSuccessfulTest(
|
||||||
|
@ -404,86 +405,109 @@ public class DomainTransferApproveFlowTest
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_badContactPassword() throws Exception {
|
public void testFailure_badContactPassword() throws Exception {
|
||||||
// Change the contact's password so it does not match the password in the file.
|
// Change the contact's password so it does not match the password in the file.
|
||||||
contact = persistResource(
|
contact =
|
||||||
contact.asBuilder()
|
persistResource(
|
||||||
|
contact
|
||||||
|
.asBuilder()
|
||||||
.setAuthInfo(ContactAuthInfo.create(PasswordAuth.create("badpassword")))
|
.setAuthInfo(ContactAuthInfo.create(PasswordAuth.create("badpassword")))
|
||||||
.build());
|
.build());
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
BadAuthInfoForResourceException.class,
|
BadAuthInfoForResourceException.class,
|
||||||
() -> doFailingTest("domain_transfer_approve_contact_authinfo.xml"));
|
() -> doFailingTest("domain_transfer_approve_contact_authinfo.xml"));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_badDomainPassword() throws Exception {
|
public void testFailure_badDomainPassword() throws Exception {
|
||||||
// Change the domain's password so it does not match the password in the file.
|
// Change the domain's password so it does not match the password in the file.
|
||||||
persistResource(domain.asBuilder()
|
persistResource(
|
||||||
|
domain
|
||||||
|
.asBuilder()
|
||||||
.setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("badpassword")))
|
.setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("badpassword")))
|
||||||
.build());
|
.build());
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
BadAuthInfoForResourceException.class,
|
BadAuthInfoForResourceException.class,
|
||||||
() -> doFailingTest("domain_transfer_approve_domain_authinfo.xml"));
|
() -> doFailingTest("domain_transfer_approve_domain_authinfo.xml"));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_neverBeenTransferred() throws Exception {
|
public void testFailure_neverBeenTransferred() throws Exception {
|
||||||
changeTransferStatus(null);
|
changeTransferStatus(null);
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_approve.xml"));
|
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_approve.xml"));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_clientApproved() throws Exception {
|
public void testFailure_clientApproved() throws Exception {
|
||||||
changeTransferStatus(TransferStatus.CLIENT_APPROVED);
|
changeTransferStatus(TransferStatus.CLIENT_APPROVED);
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_approve.xml"));
|
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_approve.xml"));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_clientRejected() throws Exception {
|
public void testFailure_clientRejected() throws Exception {
|
||||||
changeTransferStatus(TransferStatus.CLIENT_REJECTED);
|
changeTransferStatus(TransferStatus.CLIENT_REJECTED);
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_approve.xml"));
|
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_approve.xml"));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_clientCancelled() throws Exception {
|
public void testFailure_clientCancelled() throws Exception {
|
||||||
changeTransferStatus(TransferStatus.CLIENT_CANCELLED);
|
changeTransferStatus(TransferStatus.CLIENT_CANCELLED);
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_approve.xml"));
|
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_approve.xml"));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_serverApproved() throws Exception {
|
public void testFailure_serverApproved() throws Exception {
|
||||||
changeTransferStatus(TransferStatus.SERVER_APPROVED);
|
changeTransferStatus(TransferStatus.SERVER_APPROVED);
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_approve.xml"));
|
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_approve.xml"));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_serverCancelled() throws Exception {
|
public void testFailure_serverCancelled() throws Exception {
|
||||||
changeTransferStatus(TransferStatus.SERVER_CANCELLED);
|
changeTransferStatus(TransferStatus.SERVER_CANCELLED);
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_approve.xml"));
|
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_approve.xml"));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_gainingClient() throws Exception {
|
public void testFailure_gainingClient() throws Exception {
|
||||||
setClientIdForFlow("NewRegistrar");
|
setClientIdForFlow("NewRegistrar");
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
ResourceNotOwnedException.class, () -> doFailingTest("domain_transfer_approve.xml"));
|
ResourceNotOwnedException.class, () -> doFailingTest("domain_transfer_approve.xml"));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_unrelatedClient() throws Exception {
|
public void testFailure_unrelatedClient() throws Exception {
|
||||||
setClientIdForFlow("ClientZ");
|
setClientIdForFlow("ClientZ");
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
ResourceNotOwnedException.class, () -> doFailingTest("domain_transfer_approve.xml"));
|
ResourceNotOwnedException.class, () -> doFailingTest("domain_transfer_approve.xml"));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_deletedDomain() throws Exception {
|
public void testFailure_deletedDomain() throws Exception {
|
||||||
persistResource(
|
persistResource(domain.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
|
||||||
domain.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
|
|
||||||
ResourceDoesNotExistException thrown =
|
ResourceDoesNotExistException thrown =
|
||||||
expectThrows(
|
expectThrows(
|
||||||
ResourceDoesNotExistException.class,
|
ResourceDoesNotExistException.class,
|
||||||
|
@ -505,11 +529,13 @@ public class DomainTransferApproveFlowTest
|
||||||
public void testFailure_notAuthorizedForTld() throws Exception {
|
public void testFailure_notAuthorizedForTld() throws Exception {
|
||||||
persistResource(
|
persistResource(
|
||||||
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
|
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
NotAuthorizedForTldException.class,
|
NotAuthorizedForTldException.class,
|
||||||
() ->
|
() ->
|
||||||
doSuccessfulTest(
|
doSuccessfulTest(
|
||||||
"tld", "domain_transfer_approve.xml", "domain_transfer_approve_response.xml"));
|
"tld", "domain_transfer_approve.xml", "domain_transfer_approve_response.xml"));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -559,8 +585,7 @@ public class DomainTransferApproveFlowTest
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
setUpGracePeriodDurations();
|
setUpGracePeriodDurations();
|
||||||
DomainTransactionRecord previousSuccessRecord =
|
DomainTransactionRecord previousSuccessRecord =
|
||||||
DomainTransactionRecord.create(
|
DomainTransactionRecord.create("tld", clock.nowUtc().plusDays(1), TRANSFER_SUCCESSFUL, 1);
|
||||||
"tld", clock.nowUtc().plusDays(1), TRANSFER_SUCCESSFUL, 1);
|
|
||||||
// We only want to cancel TRANSFER_SUCCESSFUL records
|
// We only want to cancel TRANSFER_SUCCESSFUL records
|
||||||
DomainTransactionRecord notCancellableRecord =
|
DomainTransactionRecord notCancellableRecord =
|
||||||
DomainTransactionRecord.create("tld", clock.nowUtc().plusDays(1), NET_ADDS_4_YR, 5);
|
DomainTransactionRecord.create("tld", clock.nowUtc().plusDays(1), NET_ADDS_4_YR, 5);
|
||||||
|
|
|
@ -28,13 +28,14 @@ import static google.registry.testing.DatastoreHelper.getPollMessages;
|
||||||
import static google.registry.testing.DatastoreHelper.loadRegistrar;
|
import static google.registry.testing.DatastoreHelper.loadRegistrar;
|
||||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||||
import static google.registry.testing.DomainResourceSubject.assertAboutDomains;
|
import static google.registry.testing.DomainResourceSubject.assertAboutDomains;
|
||||||
|
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
|
||||||
import static google.registry.testing.HistoryEntrySubject.assertAboutHistoryEntries;
|
import static google.registry.testing.HistoryEntrySubject.assertAboutHistoryEntries;
|
||||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
|
||||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||||
import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
import google.registry.flows.EppException;
|
||||||
import google.registry.flows.ResourceFlowUtils.BadAuthInfoForResourceException;
|
import google.registry.flows.ResourceFlowUtils.BadAuthInfoForResourceException;
|
||||||
import google.registry.flows.ResourceFlowUtils.ResourceDoesNotExistException;
|
import google.registry.flows.ResourceFlowUtils.ResourceDoesNotExistException;
|
||||||
import google.registry.flows.domain.DomainFlowUtils.NotAuthorizedForTldException;
|
import google.registry.flows.domain.DomainFlowUtils.NotAuthorizedForTldException;
|
||||||
|
@ -124,8 +125,10 @@ public class DomainTransferCancelFlowTest
|
||||||
// Transfer should have been cancelled. Verify correct fields were set.
|
// Transfer should have been cancelled. Verify correct fields were set.
|
||||||
domain = reloadResourceByForeignKey();
|
domain = reloadResourceByForeignKey();
|
||||||
assertTransferFailed(domain, TransferStatus.CLIENT_CANCELLED, originalTransferData);
|
assertTransferFailed(domain, TransferStatus.CLIENT_CANCELLED, originalTransferData);
|
||||||
assertAboutDomains().that(domain)
|
assertAboutDomains()
|
||||||
.hasRegistrationExpirationTime(originalExpirationTime).and()
|
.that(domain)
|
||||||
|
.hasRegistrationExpirationTime(originalExpirationTime)
|
||||||
|
.and()
|
||||||
.hasLastTransferTimeNotEqualTo(clock.nowUtc());
|
.hasLastTransferTimeNotEqualTo(clock.nowUtc());
|
||||||
assertAboutDomains()
|
assertAboutDomains()
|
||||||
.that(domain)
|
.that(domain)
|
||||||
|
@ -133,14 +136,16 @@ public class DomainTransferCancelFlowTest
|
||||||
DOMAIN_CREATE, DOMAIN_TRANSFER_REQUEST, DOMAIN_TRANSFER_CANCEL);
|
DOMAIN_CREATE, DOMAIN_TRANSFER_REQUEST, DOMAIN_TRANSFER_CANCEL);
|
||||||
final HistoryEntry historyEntryTransferCancel =
|
final HistoryEntry historyEntryTransferCancel =
|
||||||
getOnlyHistoryEntryOfType(domain, DOMAIN_TRANSFER_CANCEL);
|
getOnlyHistoryEntryOfType(domain, DOMAIN_TRANSFER_CANCEL);
|
||||||
assertAboutHistoryEntries().that(historyEntryTransferCancel).hasClientId("NewRegistrar")
|
assertAboutHistoryEntries()
|
||||||
.and().hasOtherClientId("TheRegistrar");
|
.that(historyEntryTransferCancel)
|
||||||
|
.hasClientId("NewRegistrar")
|
||||||
|
.and()
|
||||||
|
.hasOtherClientId("TheRegistrar");
|
||||||
// The only billing event left should be the original autorenew event, now reopened.
|
// The only billing event left should be the original autorenew event, now reopened.
|
||||||
assertBillingEvents(
|
assertBillingEvents(
|
||||||
getLosingClientAutorenewEvent().asBuilder().setRecurrenceEndTime(END_OF_TIME).build());
|
getLosingClientAutorenewEvent().asBuilder().setRecurrenceEndTime(END_OF_TIME).build());
|
||||||
// The poll message (in the future) to the gaining registrar for implicit ack should be gone.
|
// The poll message (in the future) to the gaining registrar for implicit ack should be gone.
|
||||||
assertThat(getPollMessages("NewRegistrar", clock.nowUtc().plusMonths(1)))
|
assertThat(getPollMessages("NewRegistrar", clock.nowUtc().plusMonths(1))).isEmpty();
|
||||||
.isEmpty();
|
|
||||||
// The poll message in the future to the losing registrar should be gone too, but there should
|
// The poll message in the future to the losing registrar should be gone too, but there should
|
||||||
// be two at the current time to the losing registrar - one for the original autorenew event,
|
// be two at the current time to the losing registrar - one for the original autorenew event,
|
||||||
// and another for the transfer being cancelled.
|
// and another for the transfer being cancelled.
|
||||||
|
@ -157,7 +162,9 @@ public class DomainTransferCancelFlowTest
|
||||||
new PollMessage.OneTime.Builder()
|
new PollMessage.OneTime.Builder()
|
||||||
.setClientId("TheRegistrar")
|
.setClientId("TheRegistrar")
|
||||||
.setEventTime(clock.nowUtc())
|
.setEventTime(clock.nowUtc())
|
||||||
.setResponseData(ImmutableList.of(new DomainTransferResponse.Builder()
|
.setResponseData(
|
||||||
|
ImmutableList.of(
|
||||||
|
new DomainTransferResponse.Builder()
|
||||||
.setFullyQualifiedDomainName(getUniqueIdFromCommand())
|
.setFullyQualifiedDomainName(getUniqueIdFromCommand())
|
||||||
.setTransferStatus(TransferStatus.CLIENT_CANCELLED)
|
.setTransferStatus(TransferStatus.CLIENT_CANCELLED)
|
||||||
.setTransferRequestTime(TRANSFER_REQUEST_TIME)
|
.setTransferRequestTime(TRANSFER_REQUEST_TIME)
|
||||||
|
@ -196,99 +203,124 @@ public class DomainTransferCancelFlowTest
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_domainAuthInfo() throws Exception {
|
public void testSuccess_domainAuthInfo() throws Exception {
|
||||||
doSuccessfulTest("domain_transfer_cancel_domain_authinfo.xml",
|
doSuccessfulTest(
|
||||||
"domain_transfer_cancel_response.xml");
|
"domain_transfer_cancel_domain_authinfo.xml", "domain_transfer_cancel_response.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_contactAuthInfo() throws Exception {
|
public void testSuccess_contactAuthInfo() throws Exception {
|
||||||
doSuccessfulTest("domain_transfer_cancel_contact_authinfo.xml",
|
doSuccessfulTest(
|
||||||
"domain_transfer_cancel_response.xml");
|
"domain_transfer_cancel_contact_authinfo.xml", "domain_transfer_cancel_response.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_badContactPassword() throws Exception {
|
public void testFailure_badContactPassword() throws Exception {
|
||||||
// Change the contact's password so it does not match the password in the file.
|
// Change the contact's password so it does not match the password in the file.
|
||||||
contact = persistResource(
|
contact =
|
||||||
contact.asBuilder()
|
persistResource(
|
||||||
|
contact
|
||||||
|
.asBuilder()
|
||||||
.setAuthInfo(ContactAuthInfo.create(PasswordAuth.create("badpassword")))
|
.setAuthInfo(ContactAuthInfo.create(PasswordAuth.create("badpassword")))
|
||||||
.build());
|
.build());
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
BadAuthInfoForResourceException.class,
|
BadAuthInfoForResourceException.class,
|
||||||
() -> doFailingTest("domain_transfer_cancel_contact_authinfo.xml"));
|
() -> doFailingTest("domain_transfer_cancel_contact_authinfo.xml"));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_badDomainPassword() throws Exception {
|
public void testFailure_badDomainPassword() throws Exception {
|
||||||
// Change the domain's password so it does not match the password in the file.
|
// Change the domain's password so it does not match the password in the file.
|
||||||
domain = persistResource(domain.asBuilder()
|
domain =
|
||||||
|
persistResource(
|
||||||
|
domain
|
||||||
|
.asBuilder()
|
||||||
.setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("badpassword")))
|
.setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("badpassword")))
|
||||||
.build());
|
.build());
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
BadAuthInfoForResourceException.class,
|
BadAuthInfoForResourceException.class,
|
||||||
() -> doFailingTest("domain_transfer_cancel_domain_authinfo.xml"));
|
() -> doFailingTest("domain_transfer_cancel_domain_authinfo.xml"));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_neverBeenTransferred() throws Exception {
|
public void testFailure_neverBeenTransferred() throws Exception {
|
||||||
changeTransferStatus(null);
|
changeTransferStatus(null);
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_cancel.xml"));
|
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_cancel.xml"));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_clientApproved() throws Exception {
|
public void testFailure_clientApproved() throws Exception {
|
||||||
changeTransferStatus(TransferStatus.CLIENT_APPROVED);
|
changeTransferStatus(TransferStatus.CLIENT_APPROVED);
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_cancel.xml"));
|
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_cancel.xml"));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_clientRejected() throws Exception {
|
public void testFailure_clientRejected() throws Exception {
|
||||||
changeTransferStatus(TransferStatus.CLIENT_REJECTED);
|
changeTransferStatus(TransferStatus.CLIENT_REJECTED);
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_cancel.xml"));
|
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_cancel.xml"));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_clientCancelled() throws Exception {
|
public void testFailure_clientCancelled() throws Exception {
|
||||||
changeTransferStatus(TransferStatus.CLIENT_CANCELLED);
|
changeTransferStatus(TransferStatus.CLIENT_CANCELLED);
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_cancel.xml"));
|
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_cancel.xml"));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_serverApproved() throws Exception {
|
public void testFailure_serverApproved() throws Exception {
|
||||||
changeTransferStatus(TransferStatus.SERVER_APPROVED);
|
changeTransferStatus(TransferStatus.SERVER_APPROVED);
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_cancel.xml"));
|
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_cancel.xml"));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_serverCancelled() throws Exception {
|
public void testFailure_serverCancelled() throws Exception {
|
||||||
changeTransferStatus(TransferStatus.SERVER_CANCELLED);
|
changeTransferStatus(TransferStatus.SERVER_CANCELLED);
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_cancel.xml"));
|
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_cancel.xml"));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_sponsoringClient() throws Exception {
|
public void testFailure_sponsoringClient() throws Exception {
|
||||||
setClientIdForFlow("TheRegistrar");
|
setClientIdForFlow("TheRegistrar");
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
NotTransferInitiatorException.class, () -> doFailingTest("domain_transfer_cancel.xml"));
|
NotTransferInitiatorException.class, () -> doFailingTest("domain_transfer_cancel.xml"));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_unrelatedClient() throws Exception {
|
public void testFailure_unrelatedClient() throws Exception {
|
||||||
setClientIdForFlow("ClientZ");
|
setClientIdForFlow("ClientZ");
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
NotTransferInitiatorException.class, () -> doFailingTest("domain_transfer_cancel.xml"));
|
NotTransferInitiatorException.class, () -> doFailingTest("domain_transfer_cancel.xml"));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_deletedDomain() throws Exception {
|
public void testFailure_deletedDomain() throws Exception {
|
||||||
domain = persistResource(
|
domain =
|
||||||
domain.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
|
persistResource(domain.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
|
||||||
ResourceDoesNotExistException thrown =
|
ResourceDoesNotExistException thrown =
|
||||||
expectThrows(
|
expectThrows(
|
||||||
ResourceDoesNotExistException.class, () -> doFailingTest("domain_transfer_cancel.xml"));
|
ResourceDoesNotExistException.class, () -> doFailingTest("domain_transfer_cancel.xml"));
|
||||||
|
@ -308,10 +340,13 @@ public class DomainTransferCancelFlowTest
|
||||||
public void testFailure_notAuthorizedForTld() throws Exception {
|
public void testFailure_notAuthorizedForTld() throws Exception {
|
||||||
persistResource(
|
persistResource(
|
||||||
loadRegistrar("NewRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
|
loadRegistrar("NewRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
NotAuthorizedForTldException.class,
|
NotAuthorizedForTldException.class,
|
||||||
() ->
|
() ->
|
||||||
doSuccessfulTest("domain_transfer_cancel.xml", "domain_transfer_cancel_response.xml"));
|
doSuccessfulTest(
|
||||||
|
"domain_transfer_cancel.xml", "domain_transfer_cancel_response.xml"));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -20,9 +20,10 @@ import static google.registry.testing.DatastoreHelper.deleteResource;
|
||||||
import static google.registry.testing.DatastoreHelper.getPollMessages;
|
import static google.registry.testing.DatastoreHelper.getPollMessages;
|
||||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||||
import static google.registry.testing.DomainResourceSubject.assertAboutDomains;
|
import static google.registry.testing.DomainResourceSubject.assertAboutDomains;
|
||||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
|
||||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||||
|
|
||||||
|
import google.registry.flows.EppException;
|
||||||
import google.registry.flows.ResourceFlowUtils.BadAuthInfoForResourceException;
|
import google.registry.flows.ResourceFlowUtils.BadAuthInfoForResourceException;
|
||||||
import google.registry.flows.ResourceFlowUtils.ResourceDoesNotExistException;
|
import google.registry.flows.ResourceFlowUtils.ResourceDoesNotExistException;
|
||||||
import google.registry.flows.exceptions.NoTransferHistoryToQueryException;
|
import google.registry.flows.exceptions.NoTransferHistoryToQueryException;
|
||||||
|
@ -47,18 +48,18 @@ public class DomainTransferQueryFlowTest
|
||||||
setupDomainWithPendingTransfer("example", "tld");
|
setupDomainWithPendingTransfer("example", "tld");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doSuccessfulTest(
|
private void doSuccessfulTest(String commandFilename, String expectedXmlFilename)
|
||||||
String commandFilename,
|
throws Exception {
|
||||||
String expectedXmlFilename) throws Exception {
|
|
||||||
setEppInput(commandFilename);
|
setEppInput(commandFilename);
|
||||||
// Replace the ROID in the xml file with the one generated in our test.
|
// Replace the ROID in the xml file with the one generated in our test.
|
||||||
eppLoader.replaceAll("JD1234-REP", contact.getRepoId());
|
eppLoader.replaceAll("JD1234-REP", contact.getRepoId());
|
||||||
// Setup done; run the test.
|
// Setup done; run the test.
|
||||||
assertTransactionalFlow(false);
|
assertTransactionalFlow(false);
|
||||||
runFlowAssertResponse(loadFile(expectedXmlFilename));
|
runFlowAssertResponse(loadFile(expectedXmlFilename));
|
||||||
assertAboutDomains().that(domain).hasOneHistoryEntryEachOfTypes(
|
assertAboutDomains()
|
||||||
HistoryEntry.Type.DOMAIN_CREATE,
|
.that(domain)
|
||||||
HistoryEntry.Type.DOMAIN_TRANSFER_REQUEST);
|
.hasOneHistoryEntryEachOfTypes(
|
||||||
|
HistoryEntry.Type.DOMAIN_CREATE, HistoryEntry.Type.DOMAIN_TRANSFER_REQUEST);
|
||||||
assertBillingEvents(
|
assertBillingEvents(
|
||||||
getBillingEventForImplicitTransfer(),
|
getBillingEventForImplicitTransfer(),
|
||||||
getGainingClientAutorenewEvent(),
|
getGainingClientAutorenewEvent(),
|
||||||
|
@ -79,139 +80,142 @@ public class DomainTransferQueryFlowTest
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess() throws Exception {
|
public void testSuccess() throws Exception {
|
||||||
doSuccessfulTest(
|
doSuccessfulTest("domain_transfer_query.xml", "domain_transfer_query_response.xml");
|
||||||
"domain_transfer_query.xml",
|
|
||||||
"domain_transfer_query_response.xml");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_sponsoringClient() throws Exception {
|
public void testSuccess_sponsoringClient() throws Exception {
|
||||||
setClientIdForFlow("TheRegistrar");
|
setClientIdForFlow("TheRegistrar");
|
||||||
doSuccessfulTest(
|
doSuccessfulTest("domain_transfer_query.xml", "domain_transfer_query_response.xml");
|
||||||
"domain_transfer_query.xml",
|
|
||||||
"domain_transfer_query_response.xml");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_domainAuthInfo() throws Exception {
|
public void testSuccess_domainAuthInfo() throws Exception {
|
||||||
setClientIdForFlow("ClientZ");
|
setClientIdForFlow("ClientZ");
|
||||||
doSuccessfulTest(
|
doSuccessfulTest(
|
||||||
"domain_transfer_query_domain_authinfo.xml",
|
"domain_transfer_query_domain_authinfo.xml", "domain_transfer_query_response.xml");
|
||||||
"domain_transfer_query_response.xml");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_contactAuthInfo() throws Exception {
|
public void testSuccess_contactAuthInfo() throws Exception {
|
||||||
setClientIdForFlow("ClientZ");
|
setClientIdForFlow("ClientZ");
|
||||||
doSuccessfulTest(
|
doSuccessfulTest(
|
||||||
"domain_transfer_query_contact_authinfo.xml",
|
"domain_transfer_query_contact_authinfo.xml", "domain_transfer_query_response.xml");
|
||||||
"domain_transfer_query_response.xml");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_clientApproved() throws Exception {
|
public void testSuccess_clientApproved() throws Exception {
|
||||||
changeTransferStatus(TransferStatus.CLIENT_APPROVED);
|
changeTransferStatus(TransferStatus.CLIENT_APPROVED);
|
||||||
doSuccessfulTest(
|
doSuccessfulTest(
|
||||||
"domain_transfer_query.xml",
|
"domain_transfer_query.xml", "domain_transfer_query_response_client_approved.xml");
|
||||||
"domain_transfer_query_response_client_approved.xml");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_clientRejected() throws Exception {
|
public void testSuccess_clientRejected() throws Exception {
|
||||||
changeTransferStatus(TransferStatus.CLIENT_REJECTED);
|
changeTransferStatus(TransferStatus.CLIENT_REJECTED);
|
||||||
doSuccessfulTest(
|
doSuccessfulTest(
|
||||||
"domain_transfer_query.xml",
|
"domain_transfer_query.xml", "domain_transfer_query_response_client_rejected.xml");
|
||||||
"domain_transfer_query_response_client_rejected.xml");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_clientCancelled() throws Exception {
|
public void testSuccess_clientCancelled() throws Exception {
|
||||||
changeTransferStatus(TransferStatus.CLIENT_CANCELLED);
|
changeTransferStatus(TransferStatus.CLIENT_CANCELLED);
|
||||||
doSuccessfulTest(
|
doSuccessfulTest(
|
||||||
"domain_transfer_query.xml",
|
"domain_transfer_query.xml", "domain_transfer_query_response_client_cancelled.xml");
|
||||||
"domain_transfer_query_response_client_cancelled.xml");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_serverApproved() throws Exception {
|
public void testSuccess_serverApproved() throws Exception {
|
||||||
changeTransferStatus(TransferStatus.SERVER_APPROVED);
|
changeTransferStatus(TransferStatus.SERVER_APPROVED);
|
||||||
doSuccessfulTest(
|
doSuccessfulTest(
|
||||||
"domain_transfer_query.xml",
|
"domain_transfer_query.xml", "domain_transfer_query_response_server_approved.xml");
|
||||||
"domain_transfer_query_response_server_approved.xml");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_serverCancelled() throws Exception {
|
public void testSuccess_serverCancelled() throws Exception {
|
||||||
changeTransferStatus(TransferStatus.SERVER_CANCELLED);
|
changeTransferStatus(TransferStatus.SERVER_CANCELLED);
|
||||||
doSuccessfulTest(
|
doSuccessfulTest(
|
||||||
"domain_transfer_query.xml",
|
"domain_transfer_query.xml", "domain_transfer_query_response_server_cancelled.xml");
|
||||||
"domain_transfer_query_response_server_cancelled.xml");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_tenYears() throws Exception {
|
public void testSuccess_tenYears() throws Exception {
|
||||||
// Extend registration by 9 years here; with the extra 1 year from the transfer, we should
|
// Extend registration by 9 years here; with the extra 1 year from the transfer, we should
|
||||||
// hit the 10-year capping.
|
// hit the 10-year capping.
|
||||||
domain = persistResource(domain.asBuilder()
|
domain =
|
||||||
|
persistResource(
|
||||||
|
domain
|
||||||
|
.asBuilder()
|
||||||
.setRegistrationExpirationTime(domain.getRegistrationExpirationTime().plusYears(9))
|
.setRegistrationExpirationTime(domain.getRegistrationExpirationTime().plusYears(9))
|
||||||
.build());
|
.build());
|
||||||
doSuccessfulTest(
|
doSuccessfulTest("domain_transfer_query.xml", "domain_transfer_query_response_10_years.xml");
|
||||||
"domain_transfer_query.xml",
|
|
||||||
"domain_transfer_query_response_10_years.xml");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_pendingDeleteDomain() throws Exception {
|
public void testFailure_pendingDeleteDomain() throws Exception {
|
||||||
changeTransferStatus(TransferStatus.SERVER_CANCELLED);
|
changeTransferStatus(TransferStatus.SERVER_CANCELLED);
|
||||||
domain = persistResource(
|
domain =
|
||||||
domain.asBuilder().setDeletionTime(clock.nowUtc().plusDays(1)).build());
|
persistResource(domain.asBuilder().setDeletionTime(clock.nowUtc().plusDays(1)).build());
|
||||||
doSuccessfulTest(
|
doSuccessfulTest(
|
||||||
"domain_transfer_query.xml",
|
"domain_transfer_query.xml", "domain_transfer_query_response_server_cancelled.xml");
|
||||||
"domain_transfer_query_response_server_cancelled.xml");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_badContactPassword() throws Exception {
|
public void testFailure_badContactPassword() throws Exception {
|
||||||
// Change the contact's password so it does not match the password in the file.
|
// Change the contact's password so it does not match the password in the file.
|
||||||
contact = persistResource(
|
contact =
|
||||||
contact.asBuilder()
|
persistResource(
|
||||||
|
contact
|
||||||
|
.asBuilder()
|
||||||
.setAuthInfo(ContactAuthInfo.create(PasswordAuth.create("badpassword")))
|
.setAuthInfo(ContactAuthInfo.create(PasswordAuth.create("badpassword")))
|
||||||
.build());
|
.build());
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
BadAuthInfoForResourceException.class,
|
BadAuthInfoForResourceException.class,
|
||||||
() -> doFailingTest("domain_transfer_query_contact_authinfo.xml"));
|
() -> doFailingTest("domain_transfer_query_contact_authinfo.xml"));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_badDomainPassword() throws Exception {
|
public void testFailure_badDomainPassword() throws Exception {
|
||||||
// Change the domain's password so it does not match the password in the file.
|
// Change the domain's password so it does not match the password in the file.
|
||||||
domain = persistResource(domain.asBuilder()
|
domain =
|
||||||
|
persistResource(
|
||||||
|
domain
|
||||||
|
.asBuilder()
|
||||||
.setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("badpassword")))
|
.setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("badpassword")))
|
||||||
.build());
|
.build());
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
BadAuthInfoForResourceException.class,
|
BadAuthInfoForResourceException.class,
|
||||||
() -> doFailingTest("domain_transfer_query_domain_authinfo.xml"));
|
() -> doFailingTest("domain_transfer_query_domain_authinfo.xml"));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_neverBeenTransferred() throws Exception {
|
public void testFailure_neverBeenTransferred() throws Exception {
|
||||||
changeTransferStatus(null);
|
changeTransferStatus(null);
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
NoTransferHistoryToQueryException.class, () -> doFailingTest("domain_transfer_query.xml"));
|
expectThrows(
|
||||||
|
NoTransferHistoryToQueryException.class,
|
||||||
|
() -> doFailingTest("domain_transfer_query.xml"));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_unrelatedClient() throws Exception {
|
public void testFailure_unrelatedClient() throws Exception {
|
||||||
setClientIdForFlow("ClientZ");
|
setClientIdForFlow("ClientZ");
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
NotAuthorizedToViewTransferException.class,
|
NotAuthorizedToViewTransferException.class,
|
||||||
() -> doFailingTest("domain_transfer_query.xml"));
|
() -> doFailingTest("domain_transfer_query.xml"));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_deletedDomain() throws Exception {
|
public void testFailure_deletedDomain() throws Exception {
|
||||||
domain = persistResource(
|
domain =
|
||||||
domain.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
|
persistResource(domain.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
|
||||||
ResourceDoesNotExistException thrown =
|
ResourceDoesNotExistException thrown =
|
||||||
expectThrows(
|
expectThrows(
|
||||||
ResourceDoesNotExistException.class, () -> doFailingTest("domain_transfer_query.xml"));
|
ResourceDoesNotExistException.class, () -> doFailingTest("domain_transfer_query.xml"));
|
||||||
|
|
|
@ -30,12 +30,13 @@ import static google.registry.testing.DatastoreHelper.getPollMessages;
|
||||||
import static google.registry.testing.DatastoreHelper.loadRegistrar;
|
import static google.registry.testing.DatastoreHelper.loadRegistrar;
|
||||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||||
import static google.registry.testing.DomainResourceSubject.assertAboutDomains;
|
import static google.registry.testing.DomainResourceSubject.assertAboutDomains;
|
||||||
|
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
|
||||||
import static google.registry.testing.HistoryEntrySubject.assertAboutHistoryEntries;
|
import static google.registry.testing.HistoryEntrySubject.assertAboutHistoryEntries;
|
||||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
|
||||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||||
import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
import google.registry.flows.EppException;
|
||||||
import google.registry.flows.ResourceFlowUtils.BadAuthInfoForResourceException;
|
import google.registry.flows.ResourceFlowUtils.BadAuthInfoForResourceException;
|
||||||
import google.registry.flows.ResourceFlowUtils.ResourceDoesNotExistException;
|
import google.registry.flows.ResourceFlowUtils.ResourceDoesNotExistException;
|
||||||
import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException;
|
import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException;
|
||||||
|
@ -83,10 +84,8 @@ public class DomainTransferRejectFlowTest
|
||||||
getGainingClientAutorenewEvent(),
|
getGainingClientAutorenewEvent(),
|
||||||
getLosingClientAutorenewEvent());
|
getLosingClientAutorenewEvent());
|
||||||
// Look in the future and make sure the poll messages for implicit ack are there.
|
// Look in the future and make sure the poll messages for implicit ack are there.
|
||||||
assertThat(getPollMessages("NewRegistrar", clock.nowUtc().plusMonths(1)))
|
assertThat(getPollMessages("NewRegistrar", clock.nowUtc().plusMonths(1))).hasSize(1);
|
||||||
.hasSize(1);
|
assertThat(getPollMessages("TheRegistrar", clock.nowUtc().plusMonths(1))).hasSize(1);
|
||||||
assertThat(getPollMessages("TheRegistrar", clock.nowUtc().plusMonths(1)))
|
|
||||||
.hasSize(1);
|
|
||||||
// Setup done; run the test.
|
// Setup done; run the test.
|
||||||
assertTransactionalFlow(true);
|
assertTransactionalFlow(true);
|
||||||
DateTime originalExpirationTime = domain.getRegistrationExpirationTime();
|
DateTime originalExpirationTime = domain.getRegistrationExpirationTime();
|
||||||
|
@ -96,22 +95,22 @@ public class DomainTransferRejectFlowTest
|
||||||
// Transfer should have been rejected. Verify correct fields were set.
|
// Transfer should have been rejected. Verify correct fields were set.
|
||||||
domain = reloadResourceByForeignKey();
|
domain = reloadResourceByForeignKey();
|
||||||
assertTransferFailed(domain, TransferStatus.CLIENT_REJECTED, originalTransferData);
|
assertTransferFailed(domain, TransferStatus.CLIENT_REJECTED, originalTransferData);
|
||||||
assertAboutDomains().that(domain)
|
assertAboutDomains()
|
||||||
.hasRegistrationExpirationTime(originalExpirationTime).and()
|
.that(domain)
|
||||||
.hasLastTransferTimeNotEqualTo(clock.nowUtc()).and()
|
.hasRegistrationExpirationTime(originalExpirationTime)
|
||||||
|
.and()
|
||||||
|
.hasLastTransferTimeNotEqualTo(clock.nowUtc())
|
||||||
|
.and()
|
||||||
.hasOneHistoryEntryEachOfTypes(
|
.hasOneHistoryEntryEachOfTypes(
|
||||||
DOMAIN_CREATE, DOMAIN_TRANSFER_REQUEST, DOMAIN_TRANSFER_REJECT);
|
DOMAIN_CREATE, DOMAIN_TRANSFER_REQUEST, DOMAIN_TRANSFER_REJECT);
|
||||||
final HistoryEntry historyEntryTransferRejected =
|
final HistoryEntry historyEntryTransferRejected =
|
||||||
getOnlyHistoryEntryOfType(domain, DOMAIN_TRANSFER_REJECT);
|
getOnlyHistoryEntryOfType(domain, DOMAIN_TRANSFER_REJECT);
|
||||||
assertAboutHistoryEntries()
|
assertAboutHistoryEntries().that(historyEntryTransferRejected).hasOtherClientId("NewRegistrar");
|
||||||
.that(historyEntryTransferRejected)
|
|
||||||
.hasOtherClientId("NewRegistrar");
|
|
||||||
// The only billing event left should be the original autorenew event, now reopened.
|
// The only billing event left should be the original autorenew event, now reopened.
|
||||||
assertBillingEvents(
|
assertBillingEvents(
|
||||||
getLosingClientAutorenewEvent().asBuilder().setRecurrenceEndTime(END_OF_TIME).build());
|
getLosingClientAutorenewEvent().asBuilder().setRecurrenceEndTime(END_OF_TIME).build());
|
||||||
// The poll message (in the future) to the losing registrar for implicit ack should be gone.
|
// The poll message (in the future) to the losing registrar for implicit ack should be gone.
|
||||||
assertThat(getPollMessages("TheRegistrar", clock.nowUtc().plusMonths(1)))
|
assertThat(getPollMessages("TheRegistrar", clock.nowUtc().plusMonths(1))).isEmpty();
|
||||||
.isEmpty();
|
|
||||||
// The poll message in the future to the gaining registrar should be gone too, but there
|
// The poll message in the future to the gaining registrar should be gone too, but there
|
||||||
// should be one at the current time to the gaining registrar.
|
// should be one at the current time to the gaining registrar.
|
||||||
PollMessage gainingPollMessage = getOnlyPollMessage("NewRegistrar");
|
PollMessage gainingPollMessage = getOnlyPollMessage("NewRegistrar");
|
||||||
|
@ -162,24 +161,27 @@ public class DomainTransferRejectFlowTest
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_domainAuthInfo() throws Exception {
|
public void testSuccess_domainAuthInfo() throws Exception {
|
||||||
doSuccessfulTest("domain_transfer_reject_domain_authinfo.xml",
|
doSuccessfulTest(
|
||||||
"domain_transfer_reject_response.xml");
|
"domain_transfer_reject_domain_authinfo.xml", "domain_transfer_reject_response.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_contactAuthInfo() throws Exception {
|
public void testSuccess_contactAuthInfo() throws Exception {
|
||||||
doSuccessfulTest("domain_transfer_reject_contact_authinfo.xml",
|
doSuccessfulTest(
|
||||||
"domain_transfer_reject_response.xml");
|
"domain_transfer_reject_contact_authinfo.xml", "domain_transfer_reject_response.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_notAuthorizedForTld() throws Exception {
|
public void testFailure_notAuthorizedForTld() throws Exception {
|
||||||
persistResource(
|
persistResource(
|
||||||
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
|
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
NotAuthorizedForTldException.class,
|
NotAuthorizedForTldException.class,
|
||||||
() ->
|
() ->
|
||||||
doSuccessfulTest("domain_transfer_reject.xml", "domain_transfer_reject_response.xml"));
|
doSuccessfulTest(
|
||||||
|
"domain_transfer_reject.xml", "domain_transfer_reject_response.xml"));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -193,87 +195,111 @@ public class DomainTransferRejectFlowTest
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_badContactPassword() throws Exception {
|
public void testFailure_badContactPassword() throws Exception {
|
||||||
// Change the contact's password so it does not match the password in the file.
|
// Change the contact's password so it does not match the password in the file.
|
||||||
contact = persistResource(
|
contact =
|
||||||
contact.asBuilder()
|
persistResource(
|
||||||
|
contact
|
||||||
|
.asBuilder()
|
||||||
.setAuthInfo(ContactAuthInfo.create(PasswordAuth.create("badpassword")))
|
.setAuthInfo(ContactAuthInfo.create(PasswordAuth.create("badpassword")))
|
||||||
.build());
|
.build());
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
BadAuthInfoForResourceException.class,
|
BadAuthInfoForResourceException.class,
|
||||||
() -> doFailingTest("domain_transfer_reject_contact_authinfo.xml"));
|
() -> doFailingTest("domain_transfer_reject_contact_authinfo.xml"));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_badDomainPassword() throws Exception {
|
public void testFailure_badDomainPassword() throws Exception {
|
||||||
// Change the domain's password so it does not match the password in the file.
|
// Change the domain's password so it does not match the password in the file.
|
||||||
domain = persistResource(
|
domain =
|
||||||
domain.asBuilder()
|
persistResource(
|
||||||
|
domain
|
||||||
|
.asBuilder()
|
||||||
.setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("badpassword")))
|
.setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("badpassword")))
|
||||||
.build());
|
.build());
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
BadAuthInfoForResourceException.class,
|
BadAuthInfoForResourceException.class,
|
||||||
() -> doFailingTest("domain_transfer_reject_domain_authinfo.xml"));
|
() -> doFailingTest("domain_transfer_reject_domain_authinfo.xml"));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_neverBeenTransferred() throws Exception {
|
public void testFailure_neverBeenTransferred() throws Exception {
|
||||||
changeTransferStatus(null);
|
changeTransferStatus(null);
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_reject.xml"));
|
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_reject.xml"));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_clientApproved() throws Exception {
|
public void testFailure_clientApproved() throws Exception {
|
||||||
changeTransferStatus(TransferStatus.CLIENT_APPROVED);
|
changeTransferStatus(TransferStatus.CLIENT_APPROVED);
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_reject.xml"));
|
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_reject.xml"));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_clientRejected() throws Exception {
|
public void testFailure_clientRejected() throws Exception {
|
||||||
changeTransferStatus(TransferStatus.CLIENT_REJECTED);
|
changeTransferStatus(TransferStatus.CLIENT_REJECTED);
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_reject.xml"));
|
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_reject.xml"));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_clientCancelled() throws Exception {
|
public void testFailure_clientCancelled() throws Exception {
|
||||||
changeTransferStatus(TransferStatus.CLIENT_CANCELLED);
|
changeTransferStatus(TransferStatus.CLIENT_CANCELLED);
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_reject.xml"));
|
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_reject.xml"));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_serverApproved() throws Exception {
|
public void testFailure_serverApproved() throws Exception {
|
||||||
changeTransferStatus(TransferStatus.SERVER_APPROVED);
|
changeTransferStatus(TransferStatus.SERVER_APPROVED);
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_reject.xml"));
|
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_reject.xml"));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_serverCancelled() throws Exception {
|
public void testFailure_serverCancelled() throws Exception {
|
||||||
changeTransferStatus(TransferStatus.SERVER_CANCELLED);
|
changeTransferStatus(TransferStatus.SERVER_CANCELLED);
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_reject.xml"));
|
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_reject.xml"));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_gainingClient() throws Exception {
|
public void testFailure_gainingClient() throws Exception {
|
||||||
setClientIdForFlow("NewRegistrar");
|
setClientIdForFlow("NewRegistrar");
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
ResourceNotOwnedException.class, () -> doFailingTest("domain_transfer_reject.xml"));
|
ResourceNotOwnedException.class, () -> doFailingTest("domain_transfer_reject.xml"));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_unrelatedClient() throws Exception {
|
public void testFailure_unrelatedClient() throws Exception {
|
||||||
setClientIdForFlow("ClientZ");
|
setClientIdForFlow("ClientZ");
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
ResourceNotOwnedException.class, () -> doFailingTest("domain_transfer_reject.xml"));
|
ResourceNotOwnedException.class, () -> doFailingTest("domain_transfer_reject.xml"));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_deletedDomain() throws Exception {
|
public void testFailure_deletedDomain() throws Exception {
|
||||||
domain = persistResource(
|
domain =
|
||||||
domain.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
|
persistResource(domain.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
|
||||||
ResourceDoesNotExistException thrown =
|
ResourceDoesNotExistException thrown =
|
||||||
expectThrows(
|
expectThrows(
|
||||||
ResourceDoesNotExistException.class, () -> doFailingTest("domain_transfer_reject.xml"));
|
ResourceDoesNotExistException.class, () -> doFailingTest("domain_transfer_reject.xml"));
|
||||||
|
@ -322,8 +348,7 @@ public class DomainTransferRejectFlowTest
|
||||||
public void testIcannTransactionRecord_cancelsPreviousRecords() throws Exception {
|
public void testIcannTransactionRecord_cancelsPreviousRecords() throws Exception {
|
||||||
setUpGracePeriodDurations();
|
setUpGracePeriodDurations();
|
||||||
DomainTransactionRecord previousSuccessRecord =
|
DomainTransactionRecord previousSuccessRecord =
|
||||||
DomainTransactionRecord.create(
|
DomainTransactionRecord.create("tld", clock.nowUtc().plusDays(1), TRANSFER_SUCCESSFUL, 1);
|
||||||
"tld", clock.nowUtc().plusDays(1), TRANSFER_SUCCESSFUL, 1);
|
|
||||||
// We only want to cancel TRANSFER_SUCCESSFUL records
|
// We only want to cancel TRANSFER_SUCCESSFUL records
|
||||||
DomainTransactionRecord notCancellableRecord =
|
DomainTransactionRecord notCancellableRecord =
|
||||||
DomainTransactionRecord.create("tld", clock.nowUtc().plusDays(1), NET_RENEWS_3_YR, 5);
|
DomainTransactionRecord.create("tld", clock.nowUtc().plusDays(1), NET_RENEWS_3_YR, 5);
|
||||||
|
|
|
@ -31,6 +31,7 @@ import static google.registry.testing.DatastoreHelper.loadRegistrar;
|
||||||
import static google.registry.testing.DatastoreHelper.persistActiveContact;
|
import static google.registry.testing.DatastoreHelper.persistActiveContact;
|
||||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||||
import static google.registry.testing.DomainResourceSubject.assertAboutDomains;
|
import static google.registry.testing.DomainResourceSubject.assertAboutDomains;
|
||||||
|
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
|
||||||
import static google.registry.testing.HistoryEntrySubject.assertAboutHistoryEntries;
|
import static google.registry.testing.HistoryEntrySubject.assertAboutHistoryEntries;
|
||||||
import static google.registry.testing.HostResourceSubject.assertAboutHosts;
|
import static google.registry.testing.HostResourceSubject.assertAboutHosts;
|
||||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||||
|
@ -49,6 +50,7 @@ import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.collect.ImmutableSortedMap;
|
import com.google.common.collect.ImmutableSortedMap;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
import com.googlecode.objectify.Key;
|
import com.googlecode.objectify.Key;
|
||||||
|
import google.registry.flows.EppException;
|
||||||
import google.registry.flows.EppRequestSource;
|
import google.registry.flows.EppRequestSource;
|
||||||
import google.registry.flows.ResourceFlowUtils.BadAuthInfoForResourceException;
|
import google.registry.flows.ResourceFlowUtils.BadAuthInfoForResourceException;
|
||||||
import google.registry.flows.ResourceFlowUtils.ResourceDoesNotExistException;
|
import google.registry.flows.ResourceFlowUtils.ResourceDoesNotExistException;
|
||||||
|
@ -136,9 +138,12 @@ public class DomainTransferRequestFlowTest
|
||||||
DomainResource domain,
|
DomainResource domain,
|
||||||
DateTime automaticTransferTime,
|
DateTime automaticTransferTime,
|
||||||
Period expectedPeriod,
|
Period expectedPeriod,
|
||||||
DateTime expectedExpirationTime) throws Exception {
|
DateTime expectedExpirationTime)
|
||||||
assertAboutDomains().that(domain)
|
throws Exception {
|
||||||
.hasCurrentSponsorClientId("TheRegistrar").and()
|
assertAboutDomains()
|
||||||
|
.that(domain)
|
||||||
|
.hasCurrentSponsorClientId("TheRegistrar")
|
||||||
|
.and()
|
||||||
.hasStatusValue(StatusValue.PENDING_TRANSFER);
|
.hasStatusValue(StatusValue.PENDING_TRANSFER);
|
||||||
Trid expectedTrid =
|
Trid expectedTrid =
|
||||||
Trid.create(
|
Trid.create(
|
||||||
|
@ -149,7 +154,9 @@ public class DomainTransferRequestFlowTest
|
||||||
// Compare against only the following fields by rebuilding the existing TransferData.
|
// Compare against only the following fields by rebuilding the existing TransferData.
|
||||||
// Equivalent to assertThat(transferData.getGainingClientId()).isEqualTo("NewReg")
|
// Equivalent to assertThat(transferData.getGainingClientId()).isEqualTo("NewReg")
|
||||||
// and similar individual assertions, but produces a nicer error message this way.
|
// and similar individual assertions, but produces a nicer error message this way.
|
||||||
domain.getTransferData().asBuilder()
|
domain
|
||||||
|
.getTransferData()
|
||||||
|
.asBuilder()
|
||||||
.setGainingClientId("NewRegistrar")
|
.setGainingClientId("NewRegistrar")
|
||||||
.setLosingClientId("TheRegistrar")
|
.setLosingClientId("TheRegistrar")
|
||||||
.setTransferRequestTrid(expectedTrid)
|
.setTransferRequestTrid(expectedTrid)
|
||||||
|
@ -166,9 +173,12 @@ public class DomainTransferRequestFlowTest
|
||||||
private void assertTransferApproved(
|
private void assertTransferApproved(
|
||||||
DomainResource domain, DateTime automaticTransferTime, Period expectedPeriod)
|
DomainResource domain, DateTime automaticTransferTime, Period expectedPeriod)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
assertAboutDomains().that(domain)
|
assertAboutDomains()
|
||||||
.hasCurrentSponsorClientId("NewRegistrar").and()
|
.that(domain)
|
||||||
.hasLastTransferTime(automaticTransferTime).and()
|
.hasCurrentSponsorClientId("NewRegistrar")
|
||||||
|
.and()
|
||||||
|
.hasLastTransferTime(automaticTransferTime)
|
||||||
|
.and()
|
||||||
.doesNotHaveStatusValue(StatusValue.PENDING_TRANSFER);
|
.doesNotHaveStatusValue(StatusValue.PENDING_TRANSFER);
|
||||||
Trid expectedTrid =
|
Trid expectedTrid =
|
||||||
Trid.create(
|
Trid.create(
|
||||||
|
@ -200,7 +210,8 @@ public class DomainTransferRequestFlowTest
|
||||||
DateTime expectedExpirationTime,
|
DateTime expectedExpirationTime,
|
||||||
Map<String, String> substitutions,
|
Map<String, String> substitutions,
|
||||||
Optional<Money> transferCost,
|
Optional<Money> transferCost,
|
||||||
BillingEvent.Cancellation.Builder... extraExpectedBillingEvents) throws Exception {
|
BillingEvent.Cancellation.Builder... extraExpectedBillingEvents)
|
||||||
|
throws Exception {
|
||||||
setEppInput(commandFilename, substitutions);
|
setEppInput(commandFilename, substitutions);
|
||||||
ImmutableSet<GracePeriod> originalGracePeriods = domain.getGracePeriods();
|
ImmutableSet<GracePeriod> originalGracePeriods = domain.getGracePeriods();
|
||||||
// Replace the ROID in the xml file with the one generated in our test.
|
// Replace the ROID in the xml file with the one generated in our test.
|
||||||
|
@ -216,7 +227,8 @@ public class DomainTransferRequestFlowTest
|
||||||
// Transfer should have been requested.
|
// Transfer should have been requested.
|
||||||
domain = reloadResourceByForeignKey();
|
domain = reloadResourceByForeignKey();
|
||||||
// Verify that HistoryEntry was created.
|
// Verify that HistoryEntry was created.
|
||||||
assertAboutDomains().that(domain)
|
assertAboutDomains()
|
||||||
|
.that(domain)
|
||||||
.hasOneHistoryEntryEachOfTypes(DOMAIN_CREATE, DOMAIN_TRANSFER_REQUEST);
|
.hasOneHistoryEntryEachOfTypes(DOMAIN_CREATE, DOMAIN_TRANSFER_REQUEST);
|
||||||
final HistoryEntry historyEntryTransferRequest =
|
final HistoryEntry historyEntryTransferRequest =
|
||||||
getOnlyHistoryEntryOfType(domain, DOMAIN_TRANSFER_REQUEST);
|
getOnlyHistoryEntryOfType(domain, DOMAIN_TRANSFER_REQUEST);
|
||||||
|
@ -285,13 +297,12 @@ public class DomainTransferRequestFlowTest
|
||||||
// request by definition takes place on day 1, so we need to edit the times in the
|
// request by definition takes place on day 1, so we need to edit the times in the
|
||||||
// autorenew events from the base test case.
|
// autorenew events from the base test case.
|
||||||
BillingEvent.Recurring losingClientAutorenew =
|
BillingEvent.Recurring losingClientAutorenew =
|
||||||
getLosingClientAutorenewEvent().asBuilder()
|
getLosingClientAutorenewEvent()
|
||||||
|
.asBuilder()
|
||||||
.setRecurrenceEndTime(implicitTransferTime)
|
.setRecurrenceEndTime(implicitTransferTime)
|
||||||
.build();
|
.build();
|
||||||
BillingEvent.Recurring gainingClientAutorenew =
|
BillingEvent.Recurring gainingClientAutorenew =
|
||||||
getGainingClientAutorenewEvent().asBuilder()
|
getGainingClientAutorenewEvent().asBuilder().setEventTime(expectedExpirationTime).build();
|
||||||
.setEventTime(expectedExpirationTime)
|
|
||||||
.build();
|
|
||||||
// Construct extra billing events expected by the specific test.
|
// Construct extra billing events expected by the specific test.
|
||||||
Set<BillingEvent> extraBillingEvents =
|
Set<BillingEvent> extraBillingEvents =
|
||||||
Stream.of(extraExpectedBillingEvents)
|
Stream.of(extraExpectedBillingEvents)
|
||||||
|
@ -364,10 +375,10 @@ public class DomainTransferRequestFlowTest
|
||||||
// Two poll messages on the gaining registrar's side at the expected expiration time: a
|
// Two poll messages on the gaining registrar's side at the expected expiration time: a
|
||||||
// (OneTime) transfer approved message, and an Autorenew poll message.
|
// (OneTime) transfer approved message, and an Autorenew poll message.
|
||||||
assertThat(getPollMessages("NewRegistrar", expectedExpirationTime)).hasSize(2);
|
assertThat(getPollMessages("NewRegistrar", expectedExpirationTime)).hasSize(2);
|
||||||
PollMessage transferApprovedPollMessage = getOnlyPollMessage(
|
PollMessage transferApprovedPollMessage =
|
||||||
"NewRegistrar", implicitTransferTime, PollMessage.OneTime.class);
|
getOnlyPollMessage("NewRegistrar", implicitTransferTime, PollMessage.OneTime.class);
|
||||||
PollMessage autorenewPollMessage = getOnlyPollMessage(
|
PollMessage autorenewPollMessage =
|
||||||
"NewRegistrar", expectedExpirationTime, PollMessage.Autorenew.class);
|
getOnlyPollMessage("NewRegistrar", expectedExpirationTime, PollMessage.Autorenew.class);
|
||||||
assertThat(transferApprovedPollMessage.getEventTime()).isEqualTo(implicitTransferTime);
|
assertThat(transferApprovedPollMessage.getEventTime()).isEqualTo(implicitTransferTime);
|
||||||
assertThat(autorenewPollMessage.getEventTime()).isEqualTo(expectedExpirationTime);
|
assertThat(autorenewPollMessage.getEventTime()).isEqualTo(expectedExpirationTime);
|
||||||
assertThat(
|
assertThat(
|
||||||
|
@ -431,15 +442,14 @@ public class DomainTransferRequestFlowTest
|
||||||
// OneTime messages to gaining and losing registrars plus the gaining client autorenew.
|
// OneTime messages to gaining and losing registrars plus the gaining client autorenew.
|
||||||
assertPollMessagesEqual(
|
assertPollMessagesEqual(
|
||||||
Iterables.filter(
|
Iterables.filter(
|
||||||
ofy().load()
|
ofy()
|
||||||
|
.load()
|
||||||
// Use toArray() to coerce the type to something keys() will accept.
|
// Use toArray() to coerce the type to something keys() will accept.
|
||||||
.keys(domain.getTransferData().getServerApproveEntities().toArray(new Key<?>[] {}))
|
.keys(domain.getTransferData().getServerApproveEntities().toArray(new Key<?>[] {}))
|
||||||
.values(),
|
.values(),
|
||||||
PollMessage.class),
|
PollMessage.class),
|
||||||
ImmutableList.of(
|
ImmutableList.of(
|
||||||
transferApprovedPollMessage,
|
transferApprovedPollMessage, losingTransferApprovedPollMessage, autorenewPollMessage));
|
||||||
losingTransferApprovedPollMessage,
|
|
||||||
autorenewPollMessage));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertAboutDomainAfterAutomaticTransfer(
|
private void assertAboutDomainAfterAutomaticTransfer(
|
||||||
|
@ -448,15 +458,23 @@ public class DomainTransferRequestFlowTest
|
||||||
Registry registry = Registry.get(domain.getTld());
|
Registry registry = Registry.get(domain.getTld());
|
||||||
DomainResource domainAfterAutomaticTransfer = domain.cloneProjectedAtTime(implicitTransferTime);
|
DomainResource domainAfterAutomaticTransfer = domain.cloneProjectedAtTime(implicitTransferTime);
|
||||||
assertTransferApproved(domainAfterAutomaticTransfer, implicitTransferTime, expectedPeriod);
|
assertTransferApproved(domainAfterAutomaticTransfer, implicitTransferTime, expectedPeriod);
|
||||||
assertAboutDomains().that(domainAfterAutomaticTransfer)
|
assertAboutDomains()
|
||||||
|
.that(domainAfterAutomaticTransfer)
|
||||||
.hasRegistrationExpirationTime(expectedExpirationTime);
|
.hasRegistrationExpirationTime(expectedExpirationTime);
|
||||||
assertThat(ofy().load().key(domainAfterAutomaticTransfer.getAutorenewBillingEvent()).now()
|
assertThat(
|
||||||
|
ofy()
|
||||||
|
.load()
|
||||||
|
.key(domainAfterAutomaticTransfer.getAutorenewBillingEvent())
|
||||||
|
.now()
|
||||||
.getEventTime())
|
.getEventTime())
|
||||||
.isEqualTo(expectedExpirationTime);
|
.isEqualTo(expectedExpirationTime);
|
||||||
// And after the expected grace time, the grace period should be gone.
|
// And after the expected grace time, the grace period should be gone.
|
||||||
DomainResource afterGracePeriod = domain.cloneProjectedAtTime(
|
DomainResource afterGracePeriod =
|
||||||
clock.nowUtc().plus(registry.getAutomaticTransferLength()).plus(
|
domain.cloneProjectedAtTime(
|
||||||
registry.getTransferGracePeriodLength()));
|
clock
|
||||||
|
.nowUtc()
|
||||||
|
.plus(registry.getAutomaticTransferLength())
|
||||||
|
.plus(registry.getTransferGracePeriodLength()));
|
||||||
assertThat(afterGracePeriod.getGracePeriods()).isEmpty();
|
assertThat(afterGracePeriod.getGracePeriods()).isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -464,7 +482,8 @@ public class DomainTransferRequestFlowTest
|
||||||
String commandFilename,
|
String commandFilename,
|
||||||
String expectedXmlFilename,
|
String expectedXmlFilename,
|
||||||
DateTime expectedExpirationTime,
|
DateTime expectedExpirationTime,
|
||||||
BillingEvent.Cancellation.Builder... extraExpectedBillingEvents) throws Exception {
|
BillingEvent.Cancellation.Builder... extraExpectedBillingEvents)
|
||||||
|
throws Exception {
|
||||||
doSuccessfulTest(
|
doSuccessfulTest(
|
||||||
commandFilename,
|
commandFilename,
|
||||||
expectedXmlFilename,
|
expectedXmlFilename,
|
||||||
|
@ -475,9 +494,8 @@ public class DomainTransferRequestFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doSuccessfulTest(
|
private void doSuccessfulTest(
|
||||||
String commandFilename,
|
String commandFilename, String expectedXmlFilename, Map<String, String> substitutions)
|
||||||
String expectedXmlFilename,
|
throws Exception {
|
||||||
Map<String, String> substitutions) throws Exception {
|
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
doSuccessfulTest(
|
doSuccessfulTest(
|
||||||
commandFilename,
|
commandFilename,
|
||||||
|
@ -502,7 +520,8 @@ public class DomainTransferRequestFlowTest
|
||||||
Optional<Money> transferCost,
|
Optional<Money> transferCost,
|
||||||
Period expectedPeriod,
|
Period expectedPeriod,
|
||||||
Duration expectedAutomaticTransferLength,
|
Duration expectedAutomaticTransferLength,
|
||||||
BillingEvent.Cancellation.Builder... extraExpectedBillingEvents) throws Exception {
|
BillingEvent.Cancellation.Builder... extraExpectedBillingEvents)
|
||||||
|
throws Exception {
|
||||||
setEppInput(commandFilename, substitutions);
|
setEppInput(commandFilename, substitutions);
|
||||||
ImmutableSet<GracePeriod> originalGracePeriods = domain.getGracePeriods();
|
ImmutableSet<GracePeriod> originalGracePeriods = domain.getGracePeriods();
|
||||||
// Replace the ROID in the xml file with the one generated in our test.
|
// Replace the ROID in the xml file with the one generated in our test.
|
||||||
|
@ -526,7 +545,8 @@ public class DomainTransferRequestFlowTest
|
||||||
domain = reloadResourceByForeignKey();
|
domain = reloadResourceByForeignKey();
|
||||||
}
|
}
|
||||||
// Verify that HistoryEntry was created.
|
// Verify that HistoryEntry was created.
|
||||||
assertAboutDomains().that(domain)
|
assertAboutDomains()
|
||||||
|
.that(domain)
|
||||||
.hasOneHistoryEntryEachOfTypes(DOMAIN_CREATE, DOMAIN_TRANSFER_REQUEST);
|
.hasOneHistoryEntryEachOfTypes(DOMAIN_CREATE, DOMAIN_TRANSFER_REQUEST);
|
||||||
final HistoryEntry historyEntryTransferRequest =
|
final HistoryEntry historyEntryTransferRequest =
|
||||||
getOnlyHistoryEntryOfType(domain, DOMAIN_TRANSFER_REQUEST);
|
getOnlyHistoryEntryOfType(domain, DOMAIN_TRANSFER_REQUEST);
|
||||||
|
@ -556,9 +576,8 @@ public class DomainTransferRequestFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
private void runTest(
|
private void runTest(
|
||||||
String commandFilename,
|
String commandFilename, UserPrivileges userPrivileges, Map<String, String> substitutions)
|
||||||
UserPrivileges userPrivileges,
|
throws Exception {
|
||||||
Map<String, String> substitutions) throws Exception {
|
|
||||||
setEppInput(commandFilename, substitutions);
|
setEppInput(commandFilename, substitutions);
|
||||||
// Replace the ROID in the xml file with the one generated in our test.
|
// Replace the ROID in the xml file with the one generated in our test.
|
||||||
eppLoader.replaceAll("JD1234-REP", contact.getRepoId());
|
eppLoader.replaceAll("JD1234-REP", contact.getRepoId());
|
||||||
|
@ -571,8 +590,8 @@ public class DomainTransferRequestFlowTest
|
||||||
runTest(commandFilename, userPrivileges, ImmutableMap.of());
|
runTest(commandFilename, userPrivileges, ImmutableMap.of());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doFailingTest(
|
private void doFailingTest(String commandFilename, Map<String, String> substitutions)
|
||||||
String commandFilename, Map<String, String> substitutions) throws Exception {
|
throws Exception {
|
||||||
runTest(commandFilename, UserPrivileges.NORMAL, substitutions);
|
runTest(commandFilename, UserPrivileges.NORMAL, substitutions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -645,73 +664,91 @@ public class DomainTransferRequestFlowTest
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_refundableFee_v06() throws Exception {
|
public void testFailure_refundableFee_v06() throws Exception {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
UnsupportedFeeAttributeException.class,
|
UnsupportedFeeAttributeException.class,
|
||||||
() -> doFailingTest("domain_transfer_request_fee_refundable.xml", FEE_06_MAP));
|
() -> doFailingTest("domain_transfer_request_fee_refundable.xml", FEE_06_MAP));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_refundableFee_v11() throws Exception {
|
public void testFailure_refundableFee_v11() throws Exception {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
UnsupportedFeeAttributeException.class,
|
UnsupportedFeeAttributeException.class,
|
||||||
() -> doFailingTest("domain_transfer_request_fee_refundable.xml", FEE_11_MAP));
|
() -> doFailingTest("domain_transfer_request_fee_refundable.xml", FEE_11_MAP));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_refundableFee_v12() throws Exception {
|
public void testFailure_refundableFee_v12() throws Exception {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
UnsupportedFeeAttributeException.class,
|
UnsupportedFeeAttributeException.class,
|
||||||
() -> doFailingTest("domain_transfer_request_fee_refundable.xml", FEE_12_MAP));
|
() -> doFailingTest("domain_transfer_request_fee_refundable.xml", FEE_12_MAP));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_gracePeriodFee_v06() throws Exception {
|
public void testFailure_gracePeriodFee_v06() throws Exception {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
UnsupportedFeeAttributeException.class,
|
UnsupportedFeeAttributeException.class,
|
||||||
() -> doFailingTest("domain_transfer_request_fee_grace_period.xml", FEE_06_MAP));
|
() -> doFailingTest("domain_transfer_request_fee_grace_period.xml", FEE_06_MAP));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_gracePeriodFee_v11() throws Exception {
|
public void testFailure_gracePeriodFee_v11() throws Exception {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
UnsupportedFeeAttributeException.class,
|
UnsupportedFeeAttributeException.class,
|
||||||
() -> doFailingTest("domain_transfer_request_fee_grace_period.xml", FEE_11_MAP));
|
() -> doFailingTest("domain_transfer_request_fee_grace_period.xml", FEE_11_MAP));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_gracePeriodFee_v12() throws Exception {
|
public void testFailure_gracePeriodFee_v12() throws Exception {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
UnsupportedFeeAttributeException.class,
|
UnsupportedFeeAttributeException.class,
|
||||||
() -> doFailingTest("domain_transfer_request_fee_grace_period.xml", FEE_12_MAP));
|
() -> doFailingTest("domain_transfer_request_fee_grace_period.xml", FEE_12_MAP));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_appliedFee_v06() throws Exception {
|
public void testFailure_appliedFee_v06() throws Exception {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
UnsupportedFeeAttributeException.class,
|
UnsupportedFeeAttributeException.class,
|
||||||
() -> doFailingTest("domain_transfer_request_fee_applied.xml", FEE_06_MAP));
|
() -> doFailingTest("domain_transfer_request_fee_applied.xml", FEE_06_MAP));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_appliedFee_v11() throws Exception {
|
public void testFailure_appliedFee_v11() throws Exception {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
UnsupportedFeeAttributeException.class,
|
UnsupportedFeeAttributeException.class,
|
||||||
() -> doFailingTest("domain_transfer_request_fee_applied.xml", FEE_11_MAP));
|
() -> doFailingTest("domain_transfer_request_fee_applied.xml", FEE_11_MAP));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_appliedFee_v12() throws Exception {
|
public void testFailure_appliedFee_v12() throws Exception {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
UnsupportedFeeAttributeException.class,
|
UnsupportedFeeAttributeException.class,
|
||||||
() -> doFailingTest("domain_transfer_request_fee_applied.xml", FEE_12_MAP));
|
() -> doFailingTest("domain_transfer_request_fee_applied.xml", FEE_12_MAP));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -723,8 +760,7 @@ public class DomainTransferRequestFlowTest
|
||||||
.setAutomaticTransferLength(Duration.standardMinutes(15))
|
.setAutomaticTransferLength(Duration.standardMinutes(15))
|
||||||
.build());
|
.build());
|
||||||
doSuccessfulTest(
|
doSuccessfulTest(
|
||||||
"domain_transfer_request.xml",
|
"domain_transfer_request.xml", "domain_transfer_request_response_15_minutes.xml");
|
||||||
"domain_transfer_request_response_15_minutes.xml");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -742,17 +778,18 @@ public class DomainTransferRequestFlowTest
|
||||||
public void testSuccess_missingPeriod_defaultsToOneYear() throws Exception {
|
public void testSuccess_missingPeriod_defaultsToOneYear() throws Exception {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
doSuccessfulTest(
|
doSuccessfulTest(
|
||||||
"domain_transfer_request_missing_period.xml",
|
"domain_transfer_request_missing_period.xml", "domain_transfer_request_response.xml");
|
||||||
"domain_transfer_request_response.xml");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_multiYearPeriod() throws Exception {
|
public void testFailure_multiYearPeriod() throws Exception {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
TransferPeriodMustBeOneYearException.class,
|
TransferPeriodMustBeOneYearException.class,
|
||||||
() -> doFailingTest("domain_transfer_request_2_years.xml"));
|
() -> doFailingTest("domain_transfer_request_2_years.xml"));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -804,19 +841,21 @@ public class DomainTransferRequestFlowTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_superuserExtension_zeroPeriod_autorenewGraceActive()
|
public void testSuccess_superuserExtension_zeroPeriod_autorenewGraceActive() throws Exception {
|
||||||
throws Exception {
|
|
||||||
eppRequestSource = EppRequestSource.TOOL;
|
eppRequestSource = EppRequestSource.TOOL;
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
Key<BillingEvent.Recurring> existingAutorenewEvent =
|
Key<BillingEvent.Recurring> existingAutorenewEvent = domain.getAutorenewBillingEvent();
|
||||||
domain.getAutorenewBillingEvent();
|
|
||||||
// Set domain to have auto-renewed just before the transfer request, so that it will have an
|
// Set domain to have auto-renewed just before the transfer request, so that it will have an
|
||||||
// active autorenew grace period spanning the entire transfer window.
|
// active autorenew grace period spanning the entire transfer window.
|
||||||
DateTime autorenewTime = clock.nowUtc().minusDays(1);
|
DateTime autorenewTime = clock.nowUtc().minusDays(1);
|
||||||
DateTime expirationTime = autorenewTime.plusYears(1);
|
DateTime expirationTime = autorenewTime.plusYears(1);
|
||||||
domain = persistResource(domain.asBuilder()
|
domain =
|
||||||
|
persistResource(
|
||||||
|
domain
|
||||||
|
.asBuilder()
|
||||||
.setRegistrationExpirationTime(expirationTime)
|
.setRegistrationExpirationTime(expirationTime)
|
||||||
.addGracePeriod(GracePeriod.createForRecurring(
|
.addGracePeriod(
|
||||||
|
GracePeriod.createForRecurring(
|
||||||
GracePeriodStatus.AUTO_RENEW,
|
GracePeriodStatus.AUTO_RENEW,
|
||||||
autorenewTime.plus(Registry.get("tld").getAutoRenewGracePeriodLength()),
|
autorenewTime.plus(Registry.get("tld").getAutoRenewGracePeriodLength()),
|
||||||
"TheRegistrar",
|
"TheRegistrar",
|
||||||
|
@ -865,9 +904,9 @@ public class DomainTransferRequestFlowTest
|
||||||
public void testSuccess_cappedExpiration() throws Exception {
|
public void testSuccess_cappedExpiration() throws Exception {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
// Set the domain to expire 10 years from now (as if it were just created with a 10-year term).
|
// Set the domain to expire 10 years from now (as if it were just created with a 10-year term).
|
||||||
domain = persistResource(domain.asBuilder()
|
domain =
|
||||||
.setRegistrationExpirationTime(clock.nowUtc().plusYears(10))
|
persistResource(
|
||||||
.build());
|
domain.asBuilder().setRegistrationExpirationTime(clock.nowUtc().plusYears(10)).build());
|
||||||
// New expiration time should be capped at exactly 10 years from the transfer server-approve
|
// New expiration time should be capped at exactly 10 years from the transfer server-approve
|
||||||
// time, so the domain only ends up gaining the 5-day transfer window's worth of extra
|
// time, so the domain only ends up gaining the 5-day transfer window's worth of extra
|
||||||
// registration time.
|
// registration time.
|
||||||
|
@ -882,8 +921,7 @@ public class DomainTransferRequestFlowTest
|
||||||
public void testSuccess_domainAuthInfo() throws Exception {
|
public void testSuccess_domainAuthInfo() throws Exception {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
doSuccessfulTest(
|
doSuccessfulTest(
|
||||||
"domain_transfer_request_domain_authinfo.xml",
|
"domain_transfer_request_domain_authinfo.xml", "domain_transfer_request_response.xml");
|
||||||
"domain_transfer_request_response.xml");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -910,11 +948,13 @@ public class DomainTransferRequestFlowTest
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
persistResource(
|
persistResource(
|
||||||
loadRegistrar("NewRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
|
loadRegistrar("NewRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
NotAuthorizedForTldException.class,
|
NotAuthorizedForTldException.class,
|
||||||
() ->
|
() ->
|
||||||
doSuccessfulTest(
|
doSuccessfulTest(
|
||||||
"domain_transfer_request.xml", "domain_transfer_request_response.xml"));
|
"domain_transfer_request.xml", "domain_transfer_request_response.xml"));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -935,9 +975,13 @@ public class DomainTransferRequestFlowTest
|
||||||
DateTime autorenewTime =
|
DateTime autorenewTime =
|
||||||
clock.nowUtc().minus(Registry.get("tld").getAutoRenewGracePeriodLength()).plusDays(1);
|
clock.nowUtc().minus(Registry.get("tld").getAutoRenewGracePeriodLength()).plusDays(1);
|
||||||
DateTime expirationTime = autorenewTime.plusYears(1);
|
DateTime expirationTime = autorenewTime.plusYears(1);
|
||||||
domain = persistResource(domain.asBuilder()
|
domain =
|
||||||
|
persistResource(
|
||||||
|
domain
|
||||||
|
.asBuilder()
|
||||||
.setRegistrationExpirationTime(expirationTime)
|
.setRegistrationExpirationTime(expirationTime)
|
||||||
.addGracePeriod(GracePeriod.createForRecurring(
|
.addGracePeriod(
|
||||||
|
GracePeriod.createForRecurring(
|
||||||
GracePeriodStatus.AUTO_RENEW,
|
GracePeriodStatus.AUTO_RENEW,
|
||||||
autorenewTime.plus(Registry.get("tld").getAutoRenewGracePeriodLength()),
|
autorenewTime.plus(Registry.get("tld").getAutoRenewGracePeriodLength()),
|
||||||
"TheRegistrar",
|
"TheRegistrar",
|
||||||
|
@ -958,15 +1002,18 @@ public class DomainTransferRequestFlowTest
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_autorenewGraceActive_throughoutTransferWindow() throws Exception {
|
public void testSuccess_autorenewGraceActive_throughoutTransferWindow() throws Exception {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
Key<BillingEvent.Recurring> existingAutorenewEvent =
|
Key<BillingEvent.Recurring> existingAutorenewEvent = domain.getAutorenewBillingEvent();
|
||||||
domain.getAutorenewBillingEvent();
|
|
||||||
// Set domain to have auto-renewed just before the transfer request, so that it will have an
|
// Set domain to have auto-renewed just before the transfer request, so that it will have an
|
||||||
// active autorenew grace period spanning the entire transfer window.
|
// active autorenew grace period spanning the entire transfer window.
|
||||||
DateTime autorenewTime = clock.nowUtc().minusDays(1);
|
DateTime autorenewTime = clock.nowUtc().minusDays(1);
|
||||||
DateTime expirationTime = autorenewTime.plusYears(1);
|
DateTime expirationTime = autorenewTime.plusYears(1);
|
||||||
domain = persistResource(domain.asBuilder()
|
domain =
|
||||||
|
persistResource(
|
||||||
|
domain
|
||||||
|
.asBuilder()
|
||||||
.setRegistrationExpirationTime(expirationTime)
|
.setRegistrationExpirationTime(expirationTime)
|
||||||
.addGracePeriod(GracePeriod.createForRecurring(
|
.addGracePeriod(
|
||||||
|
GracePeriod.createForRecurring(
|
||||||
GracePeriodStatus.AUTO_RENEW,
|
GracePeriodStatus.AUTO_RENEW,
|
||||||
autorenewTime.plus(Registry.get("tld").getAutoRenewGracePeriodLength()),
|
autorenewTime.plus(Registry.get("tld").getAutoRenewGracePeriodLength()),
|
||||||
"TheRegistrar",
|
"TheRegistrar",
|
||||||
|
@ -985,8 +1032,7 @@ public class DomainTransferRequestFlowTest
|
||||||
.setClientId("TheRegistrar")
|
.setClientId("TheRegistrar")
|
||||||
// The cancellation happens at the moment of transfer.
|
// The cancellation happens at the moment of transfer.
|
||||||
.setEventTime(clock.nowUtc().plus(Registry.get("tld").getAutomaticTransferLength()))
|
.setEventTime(clock.nowUtc().plus(Registry.get("tld").getAutomaticTransferLength()))
|
||||||
.setBillingTime(autorenewTime.plus(
|
.setBillingTime(autorenewTime.plus(Registry.get("tld").getAutoRenewGracePeriodLength()))
|
||||||
Registry.get("tld").getAutoRenewGracePeriodLength()))
|
|
||||||
// The cancellation should refer to the old autorenew billing event.
|
// The cancellation should refer to the old autorenew billing event.
|
||||||
.setRecurringEventKey(existingAutorenewEvent));
|
.setRecurringEventKey(existingAutorenewEvent));
|
||||||
}
|
}
|
||||||
|
@ -994,14 +1040,12 @@ public class DomainTransferRequestFlowTest
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_autorenewGraceActive_onlyAtAutomaticTransferTime() throws Exception {
|
public void testSuccess_autorenewGraceActive_onlyAtAutomaticTransferTime() throws Exception {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
Key<BillingEvent.Recurring> existingAutorenewEvent =
|
Key<BillingEvent.Recurring> existingAutorenewEvent = domain.getAutorenewBillingEvent();
|
||||||
domain.getAutorenewBillingEvent();
|
|
||||||
// Set domain to expire in 1 day, so that it will be in the autorenew grace period by the
|
// Set domain to expire in 1 day, so that it will be in the autorenew grace period by the
|
||||||
// automatic transfer time, even though it isn't yet.
|
// automatic transfer time, even though it isn't yet.
|
||||||
DateTime expirationTime = clock.nowUtc().plusDays(1);
|
DateTime expirationTime = clock.nowUtc().plusDays(1);
|
||||||
domain = persistResource(domain.asBuilder()
|
domain =
|
||||||
.setRegistrationExpirationTime(expirationTime)
|
persistResource(domain.asBuilder().setRegistrationExpirationTime(expirationTime).build());
|
||||||
.build());
|
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
// The transfer will subsume the future autorenew, meaning that the expected server-approve
|
// The transfer will subsume the future autorenew, meaning that the expected server-approve
|
||||||
// expiration time will be 1 year beyond the current one, and we must write a Cancellation.
|
// expiration time will be 1 year beyond the current one, and we must write a Cancellation.
|
||||||
|
@ -1036,8 +1080,7 @@ public class DomainTransferRequestFlowTest
|
||||||
persistResource(Registry.get("example").asBuilder().setPremiumPriceAckRequired(false).build());
|
persistResource(Registry.get("example").asBuilder().setPremiumPriceAckRequired(false).build());
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
// Modify the Registrar to block premium names.
|
// Modify the Registrar to block premium names.
|
||||||
persistResource(
|
persistResource(loadRegistrar("NewRegistrar").asBuilder().setBlockPremiumNames(true).build());
|
||||||
loadRegistrar("NewRegistrar").asBuilder().setBlockPremiumNames(true).build());
|
|
||||||
// We don't verify the results; just check that the flow doesn't fail.
|
// We don't verify the results; just check that the flow doesn't fail.
|
||||||
runTest("domain_transfer_request_premium.xml", UserPrivileges.SUPERUSER);
|
runTest("domain_transfer_request_premium.xml", UserPrivileges.SUPERUSER);
|
||||||
}
|
}
|
||||||
|
@ -1054,9 +1097,11 @@ public class DomainTransferRequestFlowTest
|
||||||
.setEapFeeSchedule(ImmutableSortedMap.of(START_OF_TIME, Money.zero(EUR)))
|
.setEapFeeSchedule(ImmutableSortedMap.of(START_OF_TIME, Money.zero(EUR)))
|
||||||
.setServerStatusChangeBillingCost(Money.of(EUR, 19))
|
.setServerStatusChangeBillingCost(Money.of(EUR, 19))
|
||||||
.build());
|
.build());
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
CurrencyUnitMismatchException.class,
|
CurrencyUnitMismatchException.class,
|
||||||
() -> doFailingTest("domain_transfer_request_fee.xml", substitutions));
|
() -> doFailingTest("domain_transfer_request_fee.xml", substitutions));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -1080,25 +1125,31 @@ public class DomainTransferRequestFlowTest
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_feeGivenInWrongScale_v06() throws Exception {
|
public void testFailure_feeGivenInWrongScale_v06() throws Exception {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
CurrencyValueScaleException.class,
|
CurrencyValueScaleException.class,
|
||||||
() -> doFailingTest("domain_transfer_request_fee_bad_scale.xml", FEE_06_MAP));
|
() -> doFailingTest("domain_transfer_request_fee_bad_scale.xml", FEE_06_MAP));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_feeGivenInWrongScale_v11() throws Exception {
|
public void testFailure_feeGivenInWrongScale_v11() throws Exception {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
CurrencyValueScaleException.class,
|
CurrencyValueScaleException.class,
|
||||||
() -> doFailingTest("domain_transfer_request_fee_bad_scale.xml", FEE_11_MAP));
|
() -> doFailingTest("domain_transfer_request_fee_bad_scale.xml", FEE_11_MAP));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_feeGivenInWrongScale_v12() throws Exception {
|
public void testFailure_feeGivenInWrongScale_v12() throws Exception {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
CurrencyValueScaleException.class,
|
CurrencyValueScaleException.class,
|
||||||
() -> doFailingTest("domain_transfer_request_fee_bad_scale.xml", FEE_12_MAP));
|
() -> doFailingTest("domain_transfer_request_fee_bad_scale.xml", FEE_12_MAP));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void runWrongFeeAmountTest(Map<String, String> substitutions) throws Exception {
|
private void runWrongFeeAmountTest(Map<String, String> substitutions) throws Exception {
|
||||||
|
@ -1107,9 +1158,11 @@ public class DomainTransferRequestFlowTest
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setRenewBillingCostTransitions(ImmutableSortedMap.of(START_OF_TIME, Money.of(USD, 20)))
|
.setRenewBillingCostTransitions(ImmutableSortedMap.of(START_OF_TIME, Money.of(USD, 20)))
|
||||||
.build());
|
.build());
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
FeesMismatchException.class,
|
FeesMismatchException.class,
|
||||||
() -> doFailingTest("domain_transfer_request_fee.xml", substitutions));
|
() -> doFailingTest("domain_transfer_request_fee.xml", substitutions));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -1134,39 +1187,49 @@ public class DomainTransferRequestFlowTest
|
||||||
public void testFailure_premiumBlocked() throws Exception {
|
public void testFailure_premiumBlocked() throws Exception {
|
||||||
setupDomain("rich", "example");
|
setupDomain("rich", "example");
|
||||||
// Modify the Registrar to block premium names.
|
// Modify the Registrar to block premium names.
|
||||||
persistResource(
|
persistResource(loadRegistrar("NewRegistrar").asBuilder().setBlockPremiumNames(true).build());
|
||||||
loadRegistrar("NewRegistrar").asBuilder().setBlockPremiumNames(true).build());
|
EppException thrown =
|
||||||
assertThrows(
|
expectThrows(
|
||||||
PremiumNameBlockedException.class,
|
PremiumNameBlockedException.class,
|
||||||
() -> doFailingTest("domain_transfer_request_premium.xml"));
|
() -> doFailingTest("domain_transfer_request_premium.xml"));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_feeNotProvidedOnPremiumName() throws Exception {
|
public void testFailure_feeNotProvidedOnPremiumName() throws Exception {
|
||||||
setupDomain("rich", "example");
|
setupDomain("rich", "example");
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
FeesRequiredForPremiumNameException.class,
|
FeesRequiredForPremiumNameException.class,
|
||||||
() -> doFailingTest("domain_transfer_request_premium.xml"));
|
() -> doFailingTest("domain_transfer_request_premium.xml"));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_noAuthInfo() throws Exception {
|
public void testFailure_noAuthInfo() throws Exception {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
MissingTransferRequestAuthInfoException.class,
|
MissingTransferRequestAuthInfoException.class,
|
||||||
() -> doFailingTest("domain_transfer_request_no_authinfo.xml"));
|
() -> doFailingTest("domain_transfer_request_no_authinfo.xml"));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_badContactPassword() throws Exception {
|
public void testFailure_badContactPassword() throws Exception {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
// Change the contact's password so it does not match the password in the file.
|
// Change the contact's password so it does not match the password in the file.
|
||||||
contact = persistResource(
|
contact =
|
||||||
contact.asBuilder()
|
persistResource(
|
||||||
|
contact
|
||||||
|
.asBuilder()
|
||||||
.setAuthInfo(ContactAuthInfo.create(PasswordAuth.create("badpassword")))
|
.setAuthInfo(ContactAuthInfo.create(PasswordAuth.create("badpassword")))
|
||||||
.build());
|
.build());
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
BadAuthInfoForResourceException.class, () -> doFailingTest("domain_transfer_request.xml"));
|
expectThrows(
|
||||||
|
BadAuthInfoForResourceException.class,
|
||||||
|
() -> doFailingTest("domain_transfer_request.xml"));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -1175,8 +1238,11 @@ public class DomainTransferRequestFlowTest
|
||||||
// Set the contact to a different ROID, but don't persist it; this is just so the substitution
|
// Set the contact to a different ROID, but don't persist it; this is just so the substitution
|
||||||
// code above will write the wrong ROID into the file.
|
// code above will write the wrong ROID into the file.
|
||||||
contact = contact.asBuilder().setRepoId("DEADBEEF_TLD-ROID").build();
|
contact = contact.asBuilder().setRepoId("DEADBEEF_TLD-ROID").build();
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
BadAuthInfoForResourceException.class, () -> doFailingTest("domain_transfer_request.xml"));
|
expectThrows(
|
||||||
|
BadAuthInfoForResourceException.class,
|
||||||
|
() -> doFailingTest("domain_transfer_request.xml"));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -1217,41 +1283,58 @@ public class DomainTransferRequestFlowTest
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_pending() throws Exception {
|
public void testFailure_pending() throws Exception {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
domain = persistResource(domain.asBuilder()
|
domain =
|
||||||
.setTransferData(domain.getTransferData().asBuilder()
|
persistResource(
|
||||||
|
domain
|
||||||
|
.asBuilder()
|
||||||
|
.setTransferData(
|
||||||
|
domain
|
||||||
|
.getTransferData()
|
||||||
|
.asBuilder()
|
||||||
.setTransferStatus(TransferStatus.PENDING)
|
.setTransferStatus(TransferStatus.PENDING)
|
||||||
.setPendingTransferExpirationTime(clock.nowUtc().plusDays(1))
|
.setPendingTransferExpirationTime(clock.nowUtc().plusDays(1))
|
||||||
.build())
|
.build())
|
||||||
.build());
|
.build());
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
AlreadyPendingTransferException.class, () -> doFailingTest("domain_transfer_request.xml"));
|
expectThrows(
|
||||||
|
AlreadyPendingTransferException.class,
|
||||||
|
() -> doFailingTest("domain_transfer_request.xml"));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_badDomainPassword() throws Exception {
|
public void testFailure_badDomainPassword() throws Exception {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
// Change the domain's password so it does not match the password in the file.
|
// Change the domain's password so it does not match the password in the file.
|
||||||
domain = persistResource(domain.asBuilder()
|
domain =
|
||||||
|
persistResource(
|
||||||
|
domain
|
||||||
|
.asBuilder()
|
||||||
.setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("badpassword")))
|
.setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("badpassword")))
|
||||||
.build());
|
.build());
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
BadAuthInfoForResourceException.class,
|
BadAuthInfoForResourceException.class,
|
||||||
() -> doFailingTest("domain_transfer_request_domain_authinfo.xml"));
|
() -> doFailingTest("domain_transfer_request_domain_authinfo.xml"));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_sponsoringClient() throws Exception {
|
public void testFailure_sponsoringClient() throws Exception {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
setClientIdForFlow("TheRegistrar");
|
setClientIdForFlow("TheRegistrar");
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
ObjectAlreadySponsoredException.class, () -> doFailingTest("domain_transfer_request.xml"));
|
expectThrows(
|
||||||
|
ObjectAlreadySponsoredException.class,
|
||||||
|
() -> doFailingTest("domain_transfer_request.xml"));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_deletedDomain() throws Exception {
|
public void testFailure_deletedDomain() throws Exception {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
domain = persistResource(
|
domain =
|
||||||
domain.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
|
persistResource(domain.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
|
||||||
ResourceDoesNotExistException thrown =
|
ResourceDoesNotExistException thrown =
|
||||||
expectThrows(
|
expectThrows(
|
||||||
ResourceDoesNotExistException.class,
|
ResourceDoesNotExistException.class,
|
||||||
|
@ -1288,14 +1371,18 @@ public class DomainTransferRequestFlowTest
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_periodInMonths() throws Exception {
|
public void testFailure_periodInMonths() throws Exception {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
BadPeriodUnitException.class, () -> doFailingTest("domain_transfer_request_months.xml"));
|
expectThrows(
|
||||||
|
BadPeriodUnitException.class,
|
||||||
|
() -> doFailingTest("domain_transfer_request_months.xml"));
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_clientTransferProhibited() throws Exception {
|
public void testFailure_clientTransferProhibited() throws Exception {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
domain = persistResource(
|
domain =
|
||||||
|
persistResource(
|
||||||
domain.asBuilder().addStatusValue(StatusValue.CLIENT_TRANSFER_PROHIBITED).build());
|
domain.asBuilder().addStatusValue(StatusValue.CLIENT_TRANSFER_PROHIBITED).build());
|
||||||
ResourceStatusProhibitsOperationException thrown =
|
ResourceStatusProhibitsOperationException thrown =
|
||||||
expectThrows(
|
expectThrows(
|
||||||
|
@ -1307,7 +1394,8 @@ public class DomainTransferRequestFlowTest
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_serverTransferProhibited() throws Exception {
|
public void testFailure_serverTransferProhibited() throws Exception {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
domain = persistResource(
|
domain =
|
||||||
|
persistResource(
|
||||||
domain.asBuilder().addStatusValue(StatusValue.SERVER_TRANSFER_PROHIBITED).build());
|
domain.asBuilder().addStatusValue(StatusValue.SERVER_TRANSFER_PROHIBITED).build());
|
||||||
ResourceStatusProhibitsOperationException thrown =
|
ResourceStatusProhibitsOperationException thrown =
|
||||||
expectThrows(
|
expectThrows(
|
||||||
|
@ -1319,8 +1407,7 @@ public class DomainTransferRequestFlowTest
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_pendingDelete() throws Exception {
|
public void testFailure_pendingDelete() throws Exception {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
domain = persistResource(
|
domain = persistResource(domain.asBuilder().addStatusValue(StatusValue.PENDING_DELETE).build());
|
||||||
domain.asBuilder().addStatusValue(StatusValue.PENDING_DELETE).build());
|
|
||||||
ResourceStatusProhibitsOperationException thrown =
|
ResourceStatusProhibitsOperationException thrown =
|
||||||
expectThrows(
|
expectThrows(
|
||||||
ResourceStatusProhibitsOperationException.class,
|
ResourceStatusProhibitsOperationException.class,
|
||||||
|
|
|
@ -34,8 +34,8 @@ import static google.registry.testing.DatastoreHelper.persistDeletedDomain;
|
||||||
import static google.registry.testing.DatastoreHelper.persistReservedList;
|
import static google.registry.testing.DatastoreHelper.persistReservedList;
|
||||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||||
import static google.registry.testing.DomainResourceSubject.assertAboutDomains;
|
import static google.registry.testing.DomainResourceSubject.assertAboutDomains;
|
||||||
|
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
|
||||||
import static google.registry.testing.HistoryEntrySubject.assertAboutHistoryEntries;
|
import static google.registry.testing.HistoryEntrySubject.assertAboutHistoryEntries;
|
||||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
|
||||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||||
import static google.registry.testing.TaskQueueHelper.assertDnsTasksEnqueued;
|
import static google.registry.testing.TaskQueueHelper.assertDnsTasksEnqueued;
|
||||||
import static org.joda.money.CurrencyUnit.USD;
|
import static org.joda.money.CurrencyUnit.USD;
|
||||||
|
@ -44,6 +44,7 @@ import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.googlecode.objectify.Key;
|
import com.googlecode.objectify.Key;
|
||||||
|
import google.registry.flows.EppException;
|
||||||
import google.registry.flows.EppException.UnimplementedExtensionException;
|
import google.registry.flows.EppException.UnimplementedExtensionException;
|
||||||
import google.registry.flows.EppRequestSource;
|
import google.registry.flows.EppRequestSource;
|
||||||
import google.registry.flows.ResourceFlowTestCase;
|
import google.registry.flows.ResourceFlowTestCase;
|
||||||
|
@ -125,14 +126,18 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
|
|
||||||
private DomainResource persistDomain() throws Exception {
|
private DomainResource persistDomain() throws Exception {
|
||||||
HostResource host = loadByForeignKey(HostResource.class, "ns1.example.foo", clock.nowUtc());
|
HostResource host = loadByForeignKey(HostResource.class, "ns1.example.foo", clock.nowUtc());
|
||||||
DomainResource domain = persistResource(
|
DomainResource domain =
|
||||||
newDomainResource(getUniqueIdFromCommand()).asBuilder()
|
persistResource(
|
||||||
.setContacts(ImmutableSet.of(
|
newDomainResource(getUniqueIdFromCommand())
|
||||||
|
.asBuilder()
|
||||||
|
.setContacts(
|
||||||
|
ImmutableSet.of(
|
||||||
DesignatedContact.create(Type.TECH, Key.create(sh8013Contact)),
|
DesignatedContact.create(Type.TECH, Key.create(sh8013Contact)),
|
||||||
DesignatedContact.create(Type.ADMIN, Key.create(unusedContact))))
|
DesignatedContact.create(Type.ADMIN, Key.create(unusedContact))))
|
||||||
.setNameservers(ImmutableSet.of(Key.create(host)))
|
.setNameservers(ImmutableSet.of(Key.create(host)))
|
||||||
.build());
|
.build());
|
||||||
historyEntryDomainCreate = persistResource(
|
historyEntryDomainCreate =
|
||||||
|
persistResource(
|
||||||
new HistoryEntry.Builder()
|
new HistoryEntry.Builder()
|
||||||
.setType(HistoryEntry.Type.DOMAIN_CREATE)
|
.setType(HistoryEntry.Type.DOMAIN_CREATE)
|
||||||
.setParent(domain)
|
.setParent(domain)
|
||||||
|
@ -145,12 +150,14 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
assertTransactionalFlow(true);
|
assertTransactionalFlow(true);
|
||||||
runFlowAssertResponse(loadFile("domain_update_response.xml"));
|
runFlowAssertResponse(loadFile("domain_update_response.xml"));
|
||||||
// Check that the domain was updated. These values came from the xml.
|
// Check that the domain was updated. These values came from the xml.
|
||||||
assertAboutDomains().that(reloadResourceByForeignKey())
|
assertAboutDomains()
|
||||||
.hasStatusValue(StatusValue.CLIENT_HOLD).and()
|
.that(reloadResourceByForeignKey())
|
||||||
.hasAuthInfoPwd("2BARfoo").and()
|
.hasStatusValue(StatusValue.CLIENT_HOLD)
|
||||||
|
.and()
|
||||||
|
.hasAuthInfoPwd("2BARfoo")
|
||||||
|
.and()
|
||||||
.hasOneHistoryEntryEachOfTypes(
|
.hasOneHistoryEntryEachOfTypes(
|
||||||
HistoryEntry.Type.DOMAIN_CREATE,
|
HistoryEntry.Type.DOMAIN_CREATE, HistoryEntry.Type.DOMAIN_UPDATE);
|
||||||
HistoryEntry.Type.DOMAIN_UPDATE);
|
|
||||||
assertNoBillingEvents();
|
assertNoBillingEvents();
|
||||||
assertDnsTasksEnqueued("example.tld");
|
assertDnsTasksEnqueued("example.tld");
|
||||||
}
|
}
|
||||||
|
@ -172,22 +179,23 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
private void doSunrushAddTest(
|
private void doSunrushAddTest(
|
||||||
BillingEvent.OneTime sunrushAddBillingEvent,
|
BillingEvent.OneTime sunrushAddBillingEvent,
|
||||||
UserPrivileges userPrivileges,
|
UserPrivileges userPrivileges,
|
||||||
DateTime addExpirationTime) throws Exception {
|
DateTime addExpirationTime)
|
||||||
|
throws Exception {
|
||||||
// The billing event for the original sunrush add should already exist; check for it now to
|
// The billing event for the original sunrush add should already exist; check for it now to
|
||||||
// avoid a confusing assertBillingEvents() later if it doesn't exist.
|
// avoid a confusing assertBillingEvents() later if it doesn't exist.
|
||||||
assertBillingEvents(sunrushAddBillingEvent);
|
assertBillingEvents(sunrushAddBillingEvent);
|
||||||
|
|
||||||
runFlowAssertResponse(
|
runFlowAssertResponse(CommitMode.LIVE, userPrivileges, loadFile("domain_update_response.xml"));
|
||||||
CommitMode.LIVE, userPrivileges, loadFile("domain_update_response.xml"));
|
|
||||||
|
|
||||||
// Verify that the domain now has the new nameserver and is in the add grace period.
|
// Verify that the domain now has the new nameserver and is in the add grace period.
|
||||||
DomainResource resource = reloadResourceByForeignKey();
|
DomainResource resource = reloadResourceByForeignKey();
|
||||||
HistoryEntry historyEntryDomainUpdate =
|
HistoryEntry historyEntryDomainUpdate =
|
||||||
getOnlyHistoryEntryOfType(resource, HistoryEntry.Type.DOMAIN_UPDATE);
|
getOnlyHistoryEntryOfType(resource, HistoryEntry.Type.DOMAIN_UPDATE);
|
||||||
assertThat(resource.getNameservers()).containsExactly(
|
assertThat(resource.getNameservers())
|
||||||
Key.create(
|
.containsExactly(
|
||||||
loadByForeignKey(HostResource.class, "ns2.example.foo", clock.nowUtc())));
|
Key.create(loadByForeignKey(HostResource.class, "ns2.example.foo", clock.nowUtc())));
|
||||||
BillingEvent.OneTime regularAddBillingEvent = new BillingEvent.OneTime.Builder()
|
BillingEvent.OneTime regularAddBillingEvent =
|
||||||
|
new BillingEvent.OneTime.Builder()
|
||||||
.setReason(Reason.CREATE)
|
.setReason(Reason.CREATE)
|
||||||
.setTargetId("example.tld")
|
.setTargetId("example.tld")
|
||||||
.setClientId("TheRegistrar")
|
.setClientId("TheRegistrar")
|
||||||
|
@ -235,14 +243,15 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
setEppInput("domain_update_add_nameserver.xml");
|
setEppInput("domain_update_add_nameserver.xml");
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
persistDomain();
|
persistDomain();
|
||||||
BillingEvent.OneTime sunrushAddBillingEvent = persistResource(
|
BillingEvent.OneTime sunrushAddBillingEvent =
|
||||||
getSunrushAddBillingEvent(clock.nowUtc().plusDays(20)));
|
persistResource(getSunrushAddBillingEvent(clock.nowUtc().plusDays(20)));
|
||||||
// Modify domain so it has no nameservers and is in the sunrush add grace period.
|
// Modify domain so it has no nameservers and is in the sunrush add grace period.
|
||||||
persistResource(
|
persistResource(
|
||||||
reloadResourceByForeignKey().asBuilder()
|
reloadResourceByForeignKey()
|
||||||
|
.asBuilder()
|
||||||
.setNameservers(null)
|
.setNameservers(null)
|
||||||
.addGracePeriod(GracePeriod.forBillingEvent(
|
.addGracePeriod(
|
||||||
GracePeriodStatus.SUNRUSH_ADD, sunrushAddBillingEvent))
|
GracePeriod.forBillingEvent(GracePeriodStatus.SUNRUSH_ADD, sunrushAddBillingEvent))
|
||||||
.build());
|
.build());
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
doSunrushAddTest(
|
doSunrushAddTest(
|
||||||
|
@ -263,10 +272,11 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
// that grace period only has a couple days left so that the resultant add grace period will get
|
// that grace period only has a couple days left so that the resultant add grace period will get
|
||||||
// truncated.
|
// truncated.
|
||||||
persistResource(
|
persistResource(
|
||||||
reloadResourceByForeignKey().asBuilder()
|
reloadResourceByForeignKey()
|
||||||
|
.asBuilder()
|
||||||
.setNameservers(null)
|
.setNameservers(null)
|
||||||
.addGracePeriod(GracePeriod.forBillingEvent(
|
.addGracePeriod(
|
||||||
GracePeriodStatus.SUNRUSH_ADD, sunrushAddBillingEvent))
|
GracePeriod.forBillingEvent(GracePeriodStatus.SUNRUSH_ADD, sunrushAddBillingEvent))
|
||||||
.build());
|
.build());
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
doSunrushAddTest(sunrushAddBillingEvent, UserPrivileges.NORMAL, billingTime);
|
doSunrushAddTest(sunrushAddBillingEvent, UserPrivileges.NORMAL, billingTime);
|
||||||
|
@ -282,11 +292,14 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
// Modify domain so that it is in the sunrush add grace period, has nameservers, but has a
|
// Modify domain so that it is in the sunrush add grace period, has nameservers, but has a
|
||||||
// serverHold on it.
|
// serverHold on it.
|
||||||
persistResource(
|
persistResource(
|
||||||
reloadResourceByForeignKey().asBuilder()
|
reloadResourceByForeignKey()
|
||||||
.setNameservers(ImmutableSet.of(Key.create(
|
.asBuilder()
|
||||||
|
.setNameservers(
|
||||||
|
ImmutableSet.of(
|
||||||
|
Key.create(
|
||||||
loadByForeignKey(HostResource.class, "ns2.example.foo", clock.nowUtc()))))
|
loadByForeignKey(HostResource.class, "ns2.example.foo", clock.nowUtc()))))
|
||||||
.addGracePeriod(GracePeriod.forBillingEvent(
|
.addGracePeriod(
|
||||||
GracePeriodStatus.SUNRUSH_ADD, sunrushAddBillingEvent))
|
GracePeriod.forBillingEvent(GracePeriodStatus.SUNRUSH_ADD, sunrushAddBillingEvent))
|
||||||
.addStatusValue(StatusValue.SERVER_HOLD)
|
.addStatusValue(StatusValue.SERVER_HOLD)
|
||||||
.build());
|
.build());
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
|
@ -306,11 +319,14 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
// Modify domain so that it is in the sunrush add grace period, has nameservers, but has a
|
// Modify domain so that it is in the sunrush add grace period, has nameservers, but has a
|
||||||
// serverHold on it.
|
// serverHold on it.
|
||||||
persistResource(
|
persistResource(
|
||||||
reloadResourceByForeignKey().asBuilder()
|
reloadResourceByForeignKey()
|
||||||
.setNameservers(ImmutableSet.of(Key.create(
|
.asBuilder()
|
||||||
|
.setNameservers(
|
||||||
|
ImmutableSet.of(
|
||||||
|
Key.create(
|
||||||
loadByForeignKey(HostResource.class, "ns2.example.foo", clock.nowUtc()))))
|
loadByForeignKey(HostResource.class, "ns2.example.foo", clock.nowUtc()))))
|
||||||
.addGracePeriod(GracePeriod.forBillingEvent(
|
.addGracePeriod(
|
||||||
GracePeriodStatus.SUNRUSH_ADD, sunrushAddBillingEvent))
|
GracePeriod.forBillingEvent(GracePeriodStatus.SUNRUSH_ADD, sunrushAddBillingEvent))
|
||||||
.addStatusValue(StatusValue.CLIENT_HOLD)
|
.addStatusValue(StatusValue.CLIENT_HOLD)
|
||||||
.build());
|
.build());
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
|
@ -331,10 +347,11 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
// Modify domain so it has no nameservers and is in the sunrush add grace period, but also has a
|
// Modify domain so it has no nameservers and is in the sunrush add grace period, but also has a
|
||||||
// server hold on it that will prevent the sunrush add grace period from being removed.
|
// server hold on it that will prevent the sunrush add grace period from being removed.
|
||||||
persistResource(
|
persistResource(
|
||||||
reloadResourceByForeignKey().asBuilder()
|
reloadResourceByForeignKey()
|
||||||
|
.asBuilder()
|
||||||
.setNameservers(null)
|
.setNameservers(null)
|
||||||
.addGracePeriod(GracePeriod.forBillingEvent(
|
.addGracePeriod(
|
||||||
GracePeriodStatus.SUNRUSH_ADD, sunrushAddBillingEvent))
|
GracePeriod.forBillingEvent(GracePeriodStatus.SUNRUSH_ADD, sunrushAddBillingEvent))
|
||||||
.addStatusValue(StatusValue.SERVER_HOLD)
|
.addStatusValue(StatusValue.SERVER_HOLD)
|
||||||
.build());
|
.build());
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
|
@ -353,14 +370,14 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
ImmutableSet.Builder<Key<HostResource>> nameservers = new ImmutableSet.Builder<>();
|
ImmutableSet.Builder<Key<HostResource>> nameservers = new ImmutableSet.Builder<>();
|
||||||
for (int i = 1; i < 15; i++) {
|
for (int i = 1; i < 15; i++) {
|
||||||
if (i != 2) { // Skip 2 since that's the one that the tests will add.
|
if (i != 2) { // Skip 2 since that's the one that the tests will add.
|
||||||
nameservers.add(Key.create(loadByForeignKey(
|
nameservers.add(
|
||||||
|
Key.create(
|
||||||
|
loadByForeignKey(
|
||||||
HostResource.class, String.format("ns%d.example.foo", i), clock.nowUtc())));
|
HostResource.class, String.format("ns%d.example.foo", i), clock.nowUtc())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
persistResource(
|
persistResource(
|
||||||
reloadResourceByForeignKey().asBuilder()
|
reloadResourceByForeignKey().asBuilder().setNameservers(nameservers.build()).build());
|
||||||
.setNameservers(nameservers.build())
|
|
||||||
.build());
|
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -395,7 +412,8 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
}
|
}
|
||||||
ImmutableList<DesignatedContact> contacts = contactsBuilder.build();
|
ImmutableList<DesignatedContact> contacts = contactsBuilder.build();
|
||||||
persistResource(
|
persistResource(
|
||||||
reloadResourceByForeignKey().asBuilder()
|
reloadResourceByForeignKey()
|
||||||
|
.asBuilder()
|
||||||
.setNameservers(nameservers.build())
|
.setNameservers(nameservers.build())
|
||||||
.setContacts(ImmutableSet.copyOf(contacts.subList(0, 3)))
|
.setContacts(ImmutableSet.copyOf(contacts.subList(0, 3)))
|
||||||
.setRegistrant(contacts.get(3).getContactKey())
|
.setRegistrant(contacts.get(3).getContactKey())
|
||||||
|
@ -404,10 +422,10 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
assertTransactionalFlow(true);
|
assertTransactionalFlow(true);
|
||||||
runFlowAssertResponse(loadFile("domain_update_response.xml"));
|
runFlowAssertResponse(loadFile("domain_update_response.xml"));
|
||||||
DomainResource domain = reloadResourceByForeignKey();
|
DomainResource domain = reloadResourceByForeignKey();
|
||||||
assertAboutDomains().that(domain)
|
assertAboutDomains()
|
||||||
|
.that(domain)
|
||||||
.hasOneHistoryEntryEachOfTypes(
|
.hasOneHistoryEntryEachOfTypes(
|
||||||
HistoryEntry.Type.DOMAIN_CREATE,
|
HistoryEntry.Type.DOMAIN_CREATE, HistoryEntry.Type.DOMAIN_UPDATE);
|
||||||
HistoryEntry.Type.DOMAIN_UPDATE);
|
|
||||||
assertThat(domain.getNameservers()).hasSize(13);
|
assertThat(domain.getNameservers()).hasSize(13);
|
||||||
// getContacts does not return contacts of type REGISTRANT, so check these separately.
|
// getContacts does not return contacts of type REGISTRANT, so check these separately.
|
||||||
assertThat(domain.getContacts()).hasSize(3);
|
assertThat(domain.getContacts()).hasSize(3);
|
||||||
|
@ -425,13 +443,14 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
persistDomain();
|
persistDomain();
|
||||||
runFlow();
|
runFlow();
|
||||||
DomainResource domain = reloadResourceByForeignKey();
|
DomainResource domain = reloadResourceByForeignKey();
|
||||||
assertAboutDomains().that(domain)
|
assertAboutDomains()
|
||||||
|
.that(domain)
|
||||||
.hasOneHistoryEntryEachOfTypes(
|
.hasOneHistoryEntryEachOfTypes(
|
||||||
HistoryEntry.Type.DOMAIN_CREATE,
|
HistoryEntry.Type.DOMAIN_CREATE, HistoryEntry.Type.DOMAIN_UPDATE);
|
||||||
HistoryEntry.Type.DOMAIN_UPDATE);
|
|
||||||
assertAboutHistoryEntries()
|
assertAboutHistoryEntries()
|
||||||
.that(getOnlyHistoryEntryOfType(domain, HistoryEntry.Type.DOMAIN_UPDATE))
|
.that(getOnlyHistoryEntryOfType(domain, HistoryEntry.Type.DOMAIN_UPDATE))
|
||||||
.hasMetadataReason("domain-update-test").and()
|
.hasMetadataReason("domain-update-test")
|
||||||
|
.and()
|
||||||
.hasMetadataRequestedByRegistrar(true);
|
.hasMetadataRequestedByRegistrar(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -440,7 +459,8 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
setEppInput("domain_update_metadata.xml");
|
setEppInput("domain_update_metadata.xml");
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
persistDomain();
|
persistDomain();
|
||||||
assertThrows(OnlyToolCanPassMetadataException.class, this::runFlow);
|
EppException thrown = expectThrows(OnlyToolCanPassMetadataException.class, this::runFlow);
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -460,11 +480,17 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
DomainResource domain = persistDomain();
|
DomainResource domain = persistDomain();
|
||||||
HostResource existingHost = persistActiveSubordinateHost("ns1.example.tld", domain);
|
HostResource existingHost = persistActiveSubordinateHost("ns1.example.tld", domain);
|
||||||
HostResource addedHost = persistActiveSubordinateHost("ns2.example.tld", domain);
|
HostResource addedHost = persistActiveSubordinateHost("ns2.example.tld", domain);
|
||||||
domain = persistResource(domain.asBuilder()
|
domain =
|
||||||
|
persistResource(
|
||||||
|
domain
|
||||||
|
.asBuilder()
|
||||||
.addSubordinateHost("ns1.example.tld")
|
.addSubordinateHost("ns1.example.tld")
|
||||||
.addSubordinateHost("ns2.example.tld")
|
.addSubordinateHost("ns2.example.tld")
|
||||||
.setNameservers(ImmutableSet.of(Key.create(
|
.setNameservers(
|
||||||
loadByForeignKey(HostResource.class, "ns1.example.tld", clock.nowUtc()))))
|
ImmutableSet.of(
|
||||||
|
Key.create(
|
||||||
|
loadByForeignKey(
|
||||||
|
HostResource.class, "ns1.example.tld", clock.nowUtc()))))
|
||||||
.build());
|
.build());
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
assertTransactionalFlow(true);
|
assertTransactionalFlow(true);
|
||||||
|
@ -484,7 +510,8 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
ContactResource sh8013 = loadByForeignKey(ContactResource.class, "sh8013", clock.nowUtc());
|
ContactResource sh8013 = loadByForeignKey(ContactResource.class, "sh8013", clock.nowUtc());
|
||||||
persistResource(
|
persistResource(
|
||||||
newDomainResource(getUniqueIdFromCommand()).asBuilder()
|
newDomainResource(getUniqueIdFromCommand())
|
||||||
|
.asBuilder()
|
||||||
.setRegistrant(Key.create(sh8013))
|
.setRegistrant(Key.create(sh8013))
|
||||||
.build());
|
.build());
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
|
@ -498,9 +525,11 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
ContactResource sh8013 = loadByForeignKey(ContactResource.class, "sh8013", clock.nowUtc());
|
ContactResource sh8013 = loadByForeignKey(ContactResource.class, "sh8013", clock.nowUtc());
|
||||||
Key<ContactResource> sh8013Key = Key.create(sh8013);
|
Key<ContactResource> sh8013Key = Key.create(sh8013);
|
||||||
persistResource(
|
persistResource(
|
||||||
newDomainResource(getUniqueIdFromCommand()).asBuilder()
|
newDomainResource(getUniqueIdFromCommand())
|
||||||
|
.asBuilder()
|
||||||
.setRegistrant(sh8013Key)
|
.setRegistrant(sh8013Key)
|
||||||
.setContacts(ImmutableSet.of(
|
.setContacts(
|
||||||
|
ImmutableSet.of(
|
||||||
DesignatedContact.create(Type.ADMIN, sh8013Key),
|
DesignatedContact.create(Type.ADMIN, sh8013Key),
|
||||||
DesignatedContact.create(Type.BILLING, sh8013Key),
|
DesignatedContact.create(Type.BILLING, sh8013Key),
|
||||||
DesignatedContact.create(Type.TECH, sh8013Key)))
|
DesignatedContact.create(Type.TECH, sh8013Key)))
|
||||||
|
@ -513,12 +542,14 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
public void testSuccess_removeClientUpdateProhibited() throws Exception {
|
public void testSuccess_removeClientUpdateProhibited() throws Exception {
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
persistResource(
|
persistResource(
|
||||||
persistDomain().asBuilder()
|
persistDomain()
|
||||||
|
.asBuilder()
|
||||||
.setStatusValues(ImmutableSet.of(StatusValue.CLIENT_UPDATE_PROHIBITED))
|
.setStatusValues(ImmutableSet.of(StatusValue.CLIENT_UPDATE_PROHIBITED))
|
||||||
.build());
|
.build());
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
runFlow();
|
runFlow();
|
||||||
assertAboutDomains().that(reloadResourceByForeignKey())
|
assertAboutDomains()
|
||||||
|
.that(reloadResourceByForeignKey())
|
||||||
.doesNotHaveStatusValue(StatusValue.CLIENT_UPDATE_PROHIBITED);
|
.doesNotHaveStatusValue(StatusValue.CLIENT_UPDATE_PROHIBITED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -529,14 +560,13 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
throws Exception {
|
throws Exception {
|
||||||
setEppInput(xmlFilename);
|
setEppInput(xmlFilename);
|
||||||
persistResource(
|
persistResource(
|
||||||
newDomainResource(getUniqueIdFromCommand()).asBuilder()
|
newDomainResource(getUniqueIdFromCommand()).asBuilder().setDsData(originalDsData).build());
|
||||||
.setDsData(originalDsData)
|
|
||||||
.build());
|
|
||||||
assertTransactionalFlow(true);
|
assertTransactionalFlow(true);
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
runFlowAssertResponse(loadFile("domain_update_response.xml"));
|
runFlowAssertResponse(loadFile("domain_update_response.xml"));
|
||||||
DomainResource resource = reloadResourceByForeignKey();
|
DomainResource resource = reloadResourceByForeignKey();
|
||||||
assertAboutDomains().that(resource)
|
assertAboutDomains()
|
||||||
|
.that(resource)
|
||||||
.hasOnlyOneHistoryEntryWhich()
|
.hasOnlyOneHistoryEntryWhich()
|
||||||
.hasType(HistoryEntry.Type.DOMAIN_UPDATE);
|
.hasType(HistoryEntry.Type.DOMAIN_UPDATE);
|
||||||
assertThat(resource.getDsData()).isEqualTo(expectedDsData);
|
assertThat(resource.getDsData()).isEqualTo(expectedDsData);
|
||||||
|
@ -548,8 +578,8 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
doSecDnsSuccessfulTest(
|
doSecDnsSuccessfulTest(
|
||||||
"domain_update_dsdata_add.xml",
|
"domain_update_dsdata_add.xml",
|
||||||
null,
|
null,
|
||||||
ImmutableSet.of(DelegationSignerData.create(
|
ImmutableSet.of(
|
||||||
12346, 3, 1, base16().decode("38EC35D5B3A34B44C39B"))));
|
DelegationSignerData.create(12346, 3, 1, base16().decode("38EC35D5B3A34B44C39B"))));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -557,8 +587,9 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
doSecDnsSuccessfulTest(
|
doSecDnsSuccessfulTest(
|
||||||
"domain_update_dsdata_add.xml",
|
"domain_update_dsdata_add.xml",
|
||||||
ImmutableSet.of(SOME_DSDATA),
|
ImmutableSet.of(SOME_DSDATA),
|
||||||
ImmutableSet.of(SOME_DSDATA, DelegationSignerData.create(
|
ImmutableSet.of(
|
||||||
12346, 3, 1, base16().decode("38EC35D5B3A34B44C39B"))));
|
SOME_DSDATA,
|
||||||
|
DelegationSignerData.create(12346, 3, 1, base16().decode("38EC35D5B3A34B44C39B"))));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -573,7 +604,10 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
"domain_update_dsdata_add.xml",
|
"domain_update_dsdata_add.xml",
|
||||||
commonDsData,
|
commonDsData,
|
||||||
ImmutableSet.copyOf(
|
ImmutableSet.copyOf(
|
||||||
union(commonDsData, ImmutableSet.of(DelegationSignerData.create(
|
union(
|
||||||
|
commonDsData,
|
||||||
|
ImmutableSet.of(
|
||||||
|
DelegationSignerData.create(
|
||||||
12346, 3, 1, base16().decode("38EC35D5B3A34B44C39B"))))));
|
12346, 3, 1, base16().decode("38EC35D5B3A34B44C39B"))))));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -581,8 +615,9 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
public void testSuccess_secDnsRemove() throws Exception {
|
public void testSuccess_secDnsRemove() throws Exception {
|
||||||
doSecDnsSuccessfulTest(
|
doSecDnsSuccessfulTest(
|
||||||
"domain_update_dsdata_rem.xml",
|
"domain_update_dsdata_rem.xml",
|
||||||
ImmutableSet.of(SOME_DSDATA, DelegationSignerData.create(
|
ImmutableSet.of(
|
||||||
12346, 3, 1, base16().decode("38EC35D5B3A34B44C39B"))),
|
SOME_DSDATA,
|
||||||
|
DelegationSignerData.create(12346, 3, 1, base16().decode("38EC35D5B3A34B44C39B"))),
|
||||||
ImmutableSet.of(SOME_DSDATA));
|
ImmutableSet.of(SOME_DSDATA));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -591,8 +626,9 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
// As an aside, this test also validates that it's ok to set the 'urgent' attribute to false.
|
// As an aside, this test also validates that it's ok to set the 'urgent' attribute to false.
|
||||||
doSecDnsSuccessfulTest(
|
doSecDnsSuccessfulTest(
|
||||||
"domain_update_dsdata_rem_all.xml",
|
"domain_update_dsdata_rem_all.xml",
|
||||||
ImmutableSet.of(SOME_DSDATA, DelegationSignerData.create(
|
ImmutableSet.of(
|
||||||
12346, 3, 1, base16().decode("38EC35D5B3A34B44C39B"))),
|
SOME_DSDATA,
|
||||||
|
DelegationSignerData.create(12346, 3, 1, base16().decode("38EC35D5B3A34B44C39B"))),
|
||||||
ImmutableSet.of());
|
ImmutableSet.of());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -600,10 +636,12 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
public void testSuccess_secDnsAddRemove() throws Exception {
|
public void testSuccess_secDnsAddRemove() throws Exception {
|
||||||
doSecDnsSuccessfulTest(
|
doSecDnsSuccessfulTest(
|
||||||
"domain_update_dsdata_add_rem.xml",
|
"domain_update_dsdata_add_rem.xml",
|
||||||
ImmutableSet.of(SOME_DSDATA, DelegationSignerData.create(
|
ImmutableSet.of(
|
||||||
12345, 3, 1, base16().decode("38EC35D5B3A34B33C99B"))),
|
SOME_DSDATA,
|
||||||
ImmutableSet.of(SOME_DSDATA, DelegationSignerData.create(
|
DelegationSignerData.create(12345, 3, 1, base16().decode("38EC35D5B3A34B33C99B"))),
|
||||||
12346, 3, 1, base16().decode("38EC35D5B3A34B44C39B"))));
|
ImmutableSet.of(
|
||||||
|
SOME_DSDATA,
|
||||||
|
DelegationSignerData.create(12346, 3, 1, base16().decode("38EC35D5B3A34B44C39B"))));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -617,10 +655,16 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
doSecDnsSuccessfulTest(
|
doSecDnsSuccessfulTest(
|
||||||
"domain_update_dsdata_add_rem.xml",
|
"domain_update_dsdata_add_rem.xml",
|
||||||
ImmutableSet.copyOf(
|
ImmutableSet.copyOf(
|
||||||
union(commonDsData, ImmutableSet.of(DelegationSignerData.create(
|
union(
|
||||||
|
commonDsData,
|
||||||
|
ImmutableSet.of(
|
||||||
|
DelegationSignerData.create(
|
||||||
12345, 3, 1, base16().decode("38EC35D5B3A34B33C99B"))))),
|
12345, 3, 1, base16().decode("38EC35D5B3A34B33C99B"))))),
|
||||||
ImmutableSet.copyOf(
|
ImmutableSet.copyOf(
|
||||||
union(commonDsData, ImmutableSet.of(DelegationSignerData.create(
|
union(
|
||||||
|
commonDsData,
|
||||||
|
ImmutableSet.of(
|
||||||
|
DelegationSignerData.create(
|
||||||
12346, 3, 1, base16().decode("38EC35D5B3A34B44C39B"))))));
|
12346, 3, 1, base16().decode("38EC35D5B3A34B44C39B"))))));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -629,28 +673,26 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
// Adding and removing the same dsData is a no-op because removes are processed first.
|
// Adding and removing the same dsData is a no-op because removes are processed first.
|
||||||
doSecDnsSuccessfulTest(
|
doSecDnsSuccessfulTest(
|
||||||
"domain_update_dsdata_add_rem_same.xml",
|
"domain_update_dsdata_add_rem_same.xml",
|
||||||
ImmutableSet.of(SOME_DSDATA, DelegationSignerData.create(
|
ImmutableSet.of(
|
||||||
12345, 3, 1, base16().decode("38EC35D5B3A34B33C99B"))),
|
SOME_DSDATA,
|
||||||
ImmutableSet.of(SOME_DSDATA, DelegationSignerData.create(
|
DelegationSignerData.create(12345, 3, 1, base16().decode("38EC35D5B3A34B33C99B"))),
|
||||||
12345, 3, 1, base16().decode("38EC35D5B3A34B33C99B"))));
|
ImmutableSet.of(
|
||||||
|
SOME_DSDATA,
|
||||||
|
DelegationSignerData.create(12345, 3, 1, base16().decode("38EC35D5B3A34B33C99B"))));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_secDnsRemoveAlreadyNotThere() throws Exception {
|
public void testSuccess_secDnsRemoveAlreadyNotThere() throws Exception {
|
||||||
// Removing a dsData that isn't there is a no-op.
|
// Removing a dsData that isn't there is a no-op.
|
||||||
doSecDnsSuccessfulTest(
|
doSecDnsSuccessfulTest(
|
||||||
"domain_update_dsdata_rem.xml",
|
"domain_update_dsdata_rem.xml", ImmutableSet.of(SOME_DSDATA), ImmutableSet.of(SOME_DSDATA));
|
||||||
ImmutableSet.of(SOME_DSDATA),
|
|
||||||
ImmutableSet.of(SOME_DSDATA));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void doServerStatusBillingTest(String xmlFilename, boolean isBillable) throws Exception {
|
public void doServerStatusBillingTest(String xmlFilename, boolean isBillable) throws Exception {
|
||||||
setEppInput(xmlFilename);
|
setEppInput(xmlFilename);
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
runFlowAssertResponse(
|
runFlowAssertResponse(
|
||||||
CommitMode.LIVE,
|
CommitMode.LIVE, UserPrivileges.SUPERUSER, loadFile("domain_update_response.xml"));
|
||||||
UserPrivileges.SUPERUSER,
|
|
||||||
loadFile("domain_update_response.xml"));
|
|
||||||
|
|
||||||
if (isBillable) {
|
if (isBillable) {
|
||||||
assertBillingEvents(
|
assertBillingEvents(
|
||||||
|
@ -661,7 +703,8 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
.setCost(Money.of(USD, 19))
|
.setCost(Money.of(USD, 19))
|
||||||
.setEventTime(clock.nowUtc())
|
.setEventTime(clock.nowUtc())
|
||||||
.setBillingTime(clock.nowUtc())
|
.setBillingTime(clock.nowUtc())
|
||||||
.setParent(getOnlyHistoryEntryOfType(
|
.setParent(
|
||||||
|
getOnlyHistoryEntryOfType(
|
||||||
reloadResourceByForeignKey(), HistoryEntry.Type.DOMAIN_UPDATE))
|
reloadResourceByForeignKey(), HistoryEntry.Type.DOMAIN_UPDATE))
|
||||||
.build());
|
.build());
|
||||||
} else {
|
} else {
|
||||||
|
@ -682,9 +725,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
eppRequestSource = EppRequestSource.TOOL;
|
eppRequestSource = EppRequestSource.TOOL;
|
||||||
DomainResource addStatusDomain = persistActiveDomain(getUniqueIdFromCommand());
|
DomainResource addStatusDomain = persistActiveDomain(getUniqueIdFromCommand());
|
||||||
persistResource(
|
persistResource(
|
||||||
addStatusDomain.asBuilder()
|
addStatusDomain.asBuilder().addStatusValue(StatusValue.SERVER_RENEW_PROHIBITED).build());
|
||||||
.addStatusValue(StatusValue.SERVER_RENEW_PROHIBITED)
|
|
||||||
.build());
|
|
||||||
doServerStatusBillingTest("domain_update_add_server_status.xml", false);
|
doServerStatusBillingTest("domain_update_add_server_status.xml", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -694,9 +735,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
DomainResource removeStatusDomain = persistDomain();
|
DomainResource removeStatusDomain = persistDomain();
|
||||||
persistResource(
|
persistResource(
|
||||||
removeStatusDomain.asBuilder()
|
removeStatusDomain.asBuilder().addStatusValue(StatusValue.SERVER_RENEW_PROHIBITED).build());
|
||||||
.addStatusValue(StatusValue.SERVER_RENEW_PROHIBITED)
|
|
||||||
.build());
|
|
||||||
doServerStatusBillingTest("domain_update_remove_server_status.xml", true);
|
doServerStatusBillingTest("domain_update_remove_server_status.xml", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -706,9 +745,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
DomainResource changeStatusDomain = persistDomain();
|
DomainResource changeStatusDomain = persistDomain();
|
||||||
persistResource(
|
persistResource(
|
||||||
changeStatusDomain.asBuilder()
|
changeStatusDomain.asBuilder().addStatusValue(StatusValue.SERVER_RENEW_PROHIBITED).build());
|
||||||
.addStatusValue(StatusValue.SERVER_RENEW_PROHIBITED)
|
|
||||||
.build());
|
|
||||||
doServerStatusBillingTest("domain_update_change_server_status.xml", true);
|
doServerStatusBillingTest("domain_update_change_server_status.xml", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -736,31 +773,32 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
setEppInput("domain_update_add_server_hold_status.xml");
|
setEppInput("domain_update_add_server_hold_status.xml");
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
persistResource(
|
persistResource(
|
||||||
persistActiveDomain(getUniqueIdFromCommand()).asBuilder()
|
persistActiveDomain(getUniqueIdFromCommand())
|
||||||
|
.asBuilder()
|
||||||
.setStatusValues(ImmutableSet.of(StatusValue.CLIENT_UPDATE_PROHIBITED))
|
.setStatusValues(ImmutableSet.of(StatusValue.CLIENT_UPDATE_PROHIBITED))
|
||||||
.build());
|
.build());
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
runFlowAssertResponse(
|
runFlowAssertResponse(
|
||||||
CommitMode.LIVE,
|
CommitMode.LIVE, UserPrivileges.SUPERUSER, loadFile("domain_update_response.xml"));
|
||||||
UserPrivileges.SUPERUSER,
|
assertAboutDomains()
|
||||||
loadFile("domain_update_response.xml"));
|
.that(reloadResourceByForeignKey())
|
||||||
assertAboutDomains().that(reloadResourceByForeignKey())
|
.hasStatusValue(StatusValue.CLIENT_UPDATE_PROHIBITED)
|
||||||
.hasStatusValue(StatusValue.CLIENT_UPDATE_PROHIBITED).and()
|
.and()
|
||||||
.hasStatusValue(StatusValue.SERVER_HOLD);
|
.hasStatusValue(StatusValue.SERVER_HOLD);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doSecDnsFailingTest(Class<? extends Exception> expectedException, String xmlFilename)
|
private void doSecDnsFailingTest(
|
||||||
throws Exception {
|
Class<? extends EppException> expectedException, String xmlFilename) throws Exception {
|
||||||
setEppInput(xmlFilename);
|
setEppInput(xmlFilename);
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
persistActiveDomain(getUniqueIdFromCommand());
|
persistActiveDomain(getUniqueIdFromCommand());
|
||||||
assertThrows(expectedException, this::runFlow);
|
EppException thrown = expectThrows(expectedException, this::runFlow);
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_secDnsAllCannotBeFalse() throws Exception {
|
public void testFailure_secDnsAllCannotBeFalse() throws Exception {
|
||||||
doSecDnsFailingTest(
|
doSecDnsFailingTest(SecDnsAllUsageException.class, "domain_update_dsdata_rem_all_false.xml");
|
||||||
SecDnsAllUsageException.class, "domain_update_dsdata_rem_all_false.xml");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -771,15 +809,13 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_secDnsUrgentNotSupported() throws Exception {
|
public void testFailure_secDnsUrgentNotSupported() throws Exception {
|
||||||
doSecDnsFailingTest(
|
doSecDnsFailingTest(
|
||||||
UrgentAttributeNotSupportedException.class,
|
UrgentAttributeNotSupportedException.class, "domain_update_dsdata_urgent.xml");
|
||||||
"domain_update_dsdata_urgent.xml");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_secDnsChangeNotSupported() throws Exception {
|
public void testFailure_secDnsChangeNotSupported() throws Exception {
|
||||||
doSecDnsFailingTest(
|
doSecDnsFailingTest(
|
||||||
MaxSigLifeChangeNotSupportedException.class,
|
MaxSigLifeChangeNotSupportedException.class, "domain_update_maxsiglife.xml");
|
||||||
"domain_update_maxsiglife.xml");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -791,10 +827,9 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
|
|
||||||
setEppInput("domain_update_dsdata_add.xml");
|
setEppInput("domain_update_dsdata_add.xml");
|
||||||
persistResource(
|
persistResource(
|
||||||
newDomainResource(getUniqueIdFromCommand()).asBuilder()
|
newDomainResource(getUniqueIdFromCommand()).asBuilder().setDsData(builder.build()).build());
|
||||||
.setDsData(builder.build())
|
EppException thrown = expectThrows(TooManyDsRecordsException.class, this::runFlow);
|
||||||
.build());
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
assertThrows(TooManyDsRecordsException.class, this::runFlow);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -804,7 +839,8 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
persistDomain();
|
persistDomain();
|
||||||
// Modify domain so it has 13 nameservers. We will then try to add one in the test.
|
// Modify domain so it has 13 nameservers. We will then try to add one in the test.
|
||||||
modifyDomainToHave13Nameservers();
|
modifyDomainToHave13Nameservers();
|
||||||
assertThrows(TooManyNameserversException.class, this::runFlow);
|
EppException thrown = expectThrows(TooManyNameserversException.class, this::runFlow);
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -812,7 +848,8 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
setEppInput("domain_update_wrong_extension.xml");
|
setEppInput("domain_update_wrong_extension.xml");
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
persistDomain();
|
persistDomain();
|
||||||
assertThrows(UnimplementedExtensionException.class, this::runFlow);
|
EppException thrown = expectThrows(UnimplementedExtensionException.class, this::runFlow);
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -862,12 +899,17 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
// Add a tech contact to the persisted entity, which should cause the flow to fail when it tries
|
// Add a tech contact to the persisted entity, which should cause the flow to fail when it tries
|
||||||
// to add "mak21" as a second tech contact.
|
// to add "mak21" as a second tech contact.
|
||||||
persistResource(
|
persistResource(
|
||||||
reloadResourceByForeignKey().asBuilder()
|
reloadResourceByForeignKey()
|
||||||
.setContacts(ImmutableSet.of(
|
.asBuilder()
|
||||||
DesignatedContact.create(Type.TECH, Key.create(
|
.setContacts(
|
||||||
|
ImmutableSet.of(
|
||||||
|
DesignatedContact.create(
|
||||||
|
Type.TECH,
|
||||||
|
Key.create(
|
||||||
loadByForeignKey(ContactResource.class, "foo", clock.nowUtc())))))
|
loadByForeignKey(ContactResource.class, "foo", clock.nowUtc())))))
|
||||||
.build());
|
.build());
|
||||||
assertThrows(DuplicateContactForRoleException.class, this::runFlow);
|
EppException thrown = expectThrows(DuplicateContactForRoleException.class, this::runFlow);
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -875,7 +917,8 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
setEppInput("domain_update_prohibited_status.xml");
|
setEppInput("domain_update_prohibited_status.xml");
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
persistDomain();
|
persistDomain();
|
||||||
assertThrows(StatusNotClientSettableException.class, this::runFlow);
|
EppException thrown = expectThrows(StatusNotClientSettableException.class, this::runFlow);
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -932,17 +975,21 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
setEppInput("domain_update_authinfo.xml");
|
setEppInput("domain_update_authinfo.xml");
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
persistResource(
|
persistResource(
|
||||||
newDomainResource(getUniqueIdFromCommand()).asBuilder()
|
newDomainResource(getUniqueIdFromCommand())
|
||||||
|
.asBuilder()
|
||||||
.setStatusValues(ImmutableSet.of(StatusValue.CLIENT_UPDATE_PROHIBITED))
|
.setStatusValues(ImmutableSet.of(StatusValue.CLIENT_UPDATE_PROHIBITED))
|
||||||
.build());
|
.build());
|
||||||
assertThrows(ResourceHasClientUpdateProhibitedException.class, this::runFlow);
|
EppException thrown =
|
||||||
|
expectThrows(ResourceHasClientUpdateProhibitedException.class, this::runFlow);
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_serverUpdateProhibited() throws Exception {
|
public void testFailure_serverUpdateProhibited() throws Exception {
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
persistResource(
|
persistResource(
|
||||||
newDomainResource(getUniqueIdFromCommand()).asBuilder()
|
newDomainResource(getUniqueIdFromCommand())
|
||||||
|
.asBuilder()
|
||||||
.setStatusValues(ImmutableSet.of(SERVER_UPDATE_PROHIBITED))
|
.setStatusValues(ImmutableSet.of(SERVER_UPDATE_PROHIBITED))
|
||||||
.build());
|
.build());
|
||||||
ResourceStatusProhibitsOperationException thrown =
|
ResourceStatusProhibitsOperationException thrown =
|
||||||
|
@ -954,7 +1001,8 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
public void testFailure_pendingDelete() throws Exception {
|
public void testFailure_pendingDelete() throws Exception {
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
persistResource(
|
persistResource(
|
||||||
newDomainResource(getUniqueIdFromCommand()).asBuilder()
|
newDomainResource(getUniqueIdFromCommand())
|
||||||
|
.asBuilder()
|
||||||
.setDeletionTime(clock.nowUtc().plusDays(1))
|
.setDeletionTime(clock.nowUtc().plusDays(1))
|
||||||
.addStatusValue(StatusValue.PENDING_DELETE)
|
.addStatusValue(StatusValue.PENDING_DELETE)
|
||||||
.build());
|
.build());
|
||||||
|
@ -968,7 +1016,8 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
setEppInput("domain_update_duplicate_contact.xml");
|
setEppInput("domain_update_duplicate_contact.xml");
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
persistDomain();
|
persistDomain();
|
||||||
assertThrows(DuplicateContactForRoleException.class, this::runFlow);
|
EppException thrown = expectThrows(DuplicateContactForRoleException.class, this::runFlow);
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -977,7 +1026,8 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
setEppInput("domain_update_missing_contact_type.xml");
|
setEppInput("domain_update_missing_contact_type.xml");
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
persistDomain();
|
persistDomain();
|
||||||
assertThrows(MissingContactTypeException.class, this::runFlow);
|
EppException thrown = expectThrows(MissingContactTypeException.class, this::runFlow);
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -985,7 +1035,8 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
sessionMetadata.setClientId("NewRegistrar");
|
sessionMetadata.setClientId("NewRegistrar");
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
persistDomain();
|
persistDomain();
|
||||||
assertThrows(ResourceNotOwnedException.class, this::runFlow);
|
EppException thrown = expectThrows(ResourceNotOwnedException.class, this::runFlow);
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -1004,7 +1055,8 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
|
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
persistDomain();
|
persistDomain();
|
||||||
assertThrows(NotAuthorizedForTldException.class, this::runFlow);
|
EppException thrown = expectThrows(NotAuthorizedForTldException.class, this::runFlow);
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -1023,11 +1075,15 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
setEppInput("domain_update_add_remove_same_host.xml");
|
setEppInput("domain_update_add_remove_same_host.xml");
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
persistResource(
|
persistResource(
|
||||||
newDomainResource(getUniqueIdFromCommand()).asBuilder()
|
newDomainResource(getUniqueIdFromCommand())
|
||||||
.setNameservers(ImmutableSet.of(Key.create(
|
.asBuilder()
|
||||||
|
.setNameservers(
|
||||||
|
ImmutableSet.of(
|
||||||
|
Key.create(
|
||||||
loadByForeignKey(HostResource.class, "ns1.example.foo", clock.nowUtc()))))
|
loadByForeignKey(HostResource.class, "ns1.example.foo", clock.nowUtc()))))
|
||||||
.build());
|
.build());
|
||||||
assertThrows(AddRemoveSameValueException.class, this::runFlow);
|
EppException thrown = expectThrows(AddRemoveSameValueException.class, this::runFlow);
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -1035,13 +1091,17 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
setEppInput("domain_update_add_remove_same_contact.xml");
|
setEppInput("domain_update_add_remove_same_contact.xml");
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
persistResource(
|
persistResource(
|
||||||
newDomainResource(getUniqueIdFromCommand()).asBuilder()
|
newDomainResource(getUniqueIdFromCommand())
|
||||||
.setContacts(ImmutableSet.of(DesignatedContact.create(
|
.asBuilder()
|
||||||
|
.setContacts(
|
||||||
|
ImmutableSet.of(
|
||||||
|
DesignatedContact.create(
|
||||||
Type.TECH,
|
Type.TECH,
|
||||||
Key.create(
|
Key.create(
|
||||||
loadByForeignKey(ContactResource.class, "sh8013", clock.nowUtc())))))
|
loadByForeignKey(ContactResource.class, "sh8013", clock.nowUtc())))))
|
||||||
.build());
|
.build());
|
||||||
assertThrows(AddRemoveSameValueException.class, this::runFlow);
|
EppException thrown = expectThrows(AddRemoveSameValueException.class, this::runFlow);
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -1049,12 +1109,15 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
setEppInput("domain_update_remove_admin.xml");
|
setEppInput("domain_update_remove_admin.xml");
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
persistResource(
|
persistResource(
|
||||||
newDomainResource(getUniqueIdFromCommand()).asBuilder()
|
newDomainResource(getUniqueIdFromCommand())
|
||||||
.setContacts(ImmutableSet.of(
|
.asBuilder()
|
||||||
|
.setContacts(
|
||||||
|
ImmutableSet.of(
|
||||||
DesignatedContact.create(Type.ADMIN, Key.create(sh8013Contact)),
|
DesignatedContact.create(Type.ADMIN, Key.create(sh8013Contact)),
|
||||||
DesignatedContact.create(Type.TECH, Key.create(sh8013Contact))))
|
DesignatedContact.create(Type.TECH, Key.create(sh8013Contact))))
|
||||||
.build());
|
.build());
|
||||||
assertThrows(MissingAdminContactException.class, this::runFlow);
|
EppException thrown = expectThrows(MissingAdminContactException.class, this::runFlow);
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -1062,12 +1125,15 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
setEppInput("domain_update_remove_tech.xml");
|
setEppInput("domain_update_remove_tech.xml");
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
persistResource(
|
persistResource(
|
||||||
newDomainResource(getUniqueIdFromCommand()).asBuilder()
|
newDomainResource(getUniqueIdFromCommand())
|
||||||
.setContacts(ImmutableSet.of(
|
.asBuilder()
|
||||||
|
.setContacts(
|
||||||
|
ImmutableSet.of(
|
||||||
DesignatedContact.create(Type.ADMIN, Key.create(sh8013Contact)),
|
DesignatedContact.create(Type.ADMIN, Key.create(sh8013Contact)),
|
||||||
DesignatedContact.create(Type.TECH, Key.create(sh8013Contact))))
|
DesignatedContact.create(Type.TECH, Key.create(sh8013Contact))))
|
||||||
.build());
|
.build());
|
||||||
assertThrows(MissingTechnicalContactException.class, this::runFlow);
|
EppException thrown = expectThrows(MissingTechnicalContactException.class, this::runFlow);
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -1077,13 +1143,14 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
persistActiveHost("ns1.example.foo");
|
persistActiveHost("ns1.example.foo");
|
||||||
persistActiveHost("ns2.example.foo");
|
persistActiveHost("ns2.example.foo");
|
||||||
persistActiveContact("sh8013");
|
persistActiveContact("sh8013");
|
||||||
persistResource(loadByForeignKey(ContactResource.class, "mak21", clock.nowUtc()).asBuilder()
|
persistResource(
|
||||||
|
loadByForeignKey(ContactResource.class, "mak21", clock.nowUtc())
|
||||||
|
.asBuilder()
|
||||||
.addStatusValue(StatusValue.PENDING_DELETE)
|
.addStatusValue(StatusValue.PENDING_DELETE)
|
||||||
.build());
|
.build());
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
LinkedResourceInPendingDeleteProhibitsOperationException thrown =
|
LinkedResourceInPendingDeleteProhibitsOperationException thrown =
|
||||||
expectThrows(
|
expectThrows(LinkedResourceInPendingDeleteProhibitsOperationException.class, this::runFlow);
|
||||||
LinkedResourceInPendingDeleteProhibitsOperationException.class, this::runFlow);
|
|
||||||
assertThat(thrown).hasMessageThat().contains("mak21");
|
assertThat(thrown).hasMessageThat().contains("mak21");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1095,13 +1162,13 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
persistActiveContact("mak21");
|
persistActiveContact("mak21");
|
||||||
persistActiveContact("sh8013");
|
persistActiveContact("sh8013");
|
||||||
persistResource(
|
persistResource(
|
||||||
loadByForeignKey(HostResource.class, "ns2.example.foo", clock.nowUtc()).asBuilder()
|
loadByForeignKey(HostResource.class, "ns2.example.foo", clock.nowUtc())
|
||||||
|
.asBuilder()
|
||||||
.addStatusValue(StatusValue.PENDING_DELETE)
|
.addStatusValue(StatusValue.PENDING_DELETE)
|
||||||
.build());
|
.build());
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
LinkedResourceInPendingDeleteProhibitsOperationException thrown =
|
LinkedResourceInPendingDeleteProhibitsOperationException thrown =
|
||||||
expectThrows(
|
expectThrows(LinkedResourceInPendingDeleteProhibitsOperationException.class, this::runFlow);
|
||||||
LinkedResourceInPendingDeleteProhibitsOperationException.class, this::runFlow);
|
|
||||||
assertThat(thrown).hasMessageThat().contains("ns2.example.foo");
|
assertThat(thrown).hasMessageThat().contains("ns2.example.foo");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1110,11 +1177,13 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
persistDomain();
|
persistDomain();
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld").asBuilder()
|
Registry.get("tld")
|
||||||
|
.asBuilder()
|
||||||
.setAllowedRegistrantContactIds(ImmutableSet.of("contact1234"))
|
.setAllowedRegistrantContactIds(ImmutableSet.of("contact1234"))
|
||||||
.build());
|
.build());
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
assertThrows(RegistrantNotAllowedException.class, this::runFlow);
|
EppException thrown = expectThrows(RegistrantNotAllowedException.class, this::runFlow);
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -1122,11 +1191,13 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
persistDomain();
|
persistDomain();
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld").asBuilder()
|
Registry.get("tld")
|
||||||
|
.asBuilder()
|
||||||
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns1.example.foo"))
|
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns1.example.foo"))
|
||||||
.build());
|
.build());
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
assertThrows(NameserversNotAllowedForTldException.class, this::runFlow);
|
EppException thrown = expectThrows(NameserversNotAllowedForTldException.class, this::runFlow);
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -1136,15 +1207,18 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
persistDomain();
|
persistDomain();
|
||||||
// No registrant is given but both nameserver and registrant whitelist exist.
|
// No registrant is given but both nameserver and registrant whitelist exist.
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld").asBuilder()
|
Registry.get("tld")
|
||||||
|
.asBuilder()
|
||||||
.setAllowedRegistrantContactIds(ImmutableSet.of("sh8013"))
|
.setAllowedRegistrantContactIds(ImmutableSet.of("sh8013"))
|
||||||
.setAllowedFullyQualifiedHostNames(
|
.setAllowedFullyQualifiedHostNames(
|
||||||
ImmutableSet.of("ns1.example.foo", "ns2.example.foo"))
|
ImmutableSet.of("ns1.example.foo", "ns2.example.foo"))
|
||||||
.build());
|
.build());
|
||||||
assertThat(reloadResourceByForeignKey().getNameservers()).doesNotContain(
|
assertThat(reloadResourceByForeignKey().getNameservers())
|
||||||
|
.doesNotContain(
|
||||||
Key.create(loadByForeignKey(HostResource.class, "ns2.example.foo", clock.nowUtc())));
|
Key.create(loadByForeignKey(HostResource.class, "ns2.example.foo", clock.nowUtc())));
|
||||||
runFlow();
|
runFlow();
|
||||||
assertThat(reloadResourceByForeignKey().getNameservers()).contains(
|
assertThat(reloadResourceByForeignKey().getNameservers())
|
||||||
|
.contains(
|
||||||
Key.create(loadByForeignKey(HostResource.class, "ns2.example.foo", clock.nowUtc())));
|
Key.create(loadByForeignKey(HostResource.class, "ns2.example.foo", clock.nowUtc())));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1155,7 +1229,8 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
persistDomain();
|
persistDomain();
|
||||||
// Only changes registrant, with both nameserver and registrant whitelist on the TLD.
|
// Only changes registrant, with both nameserver and registrant whitelist on the TLD.
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld").asBuilder()
|
Registry.get("tld")
|
||||||
|
.asBuilder()
|
||||||
.setAllowedRegistrantContactIds(ImmutableSet.of("sh8013"))
|
.setAllowedRegistrantContactIds(ImmutableSet.of("sh8013"))
|
||||||
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns1.example.foo"))
|
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns1.example.foo"))
|
||||||
.build());
|
.build());
|
||||||
|
@ -1169,7 +1244,8 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
persistDomain();
|
persistDomain();
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld").asBuilder()
|
Registry.get("tld")
|
||||||
|
.asBuilder()
|
||||||
.setAllowedRegistrantContactIds(ImmutableSet.of("sh8013"))
|
.setAllowedRegistrantContactIds(ImmutableSet.of("sh8013"))
|
||||||
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns2.example.foo"))
|
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns2.example.foo"))
|
||||||
.build());
|
.build());
|
||||||
|
@ -1182,20 +1258,26 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
persistDomain();
|
persistDomain();
|
||||||
persistResource(
|
persistResource(
|
||||||
reloadResourceByForeignKey().asBuilder()
|
reloadResourceByForeignKey()
|
||||||
.addNameservers(ImmutableSet.of(Key.create(
|
.asBuilder()
|
||||||
|
.addNameservers(
|
||||||
|
ImmutableSet.of(
|
||||||
|
Key.create(
|
||||||
loadByForeignKey(HostResource.class, "ns2.example.foo", clock.nowUtc()))))
|
loadByForeignKey(HostResource.class, "ns2.example.foo", clock.nowUtc()))))
|
||||||
.build());
|
.build());
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld").asBuilder()
|
Registry.get("tld")
|
||||||
|
.asBuilder()
|
||||||
.setAllowedFullyQualifiedHostNames(
|
.setAllowedFullyQualifiedHostNames(
|
||||||
ImmutableSet.of("ns1.example.foo", "ns2.example.foo"))
|
ImmutableSet.of("ns1.example.foo", "ns2.example.foo"))
|
||||||
.build());
|
.build());
|
||||||
assertThat(reloadResourceByForeignKey().getNameservers()).contains(
|
assertThat(reloadResourceByForeignKey().getNameservers())
|
||||||
|
.contains(
|
||||||
Key.create(loadByForeignKey(HostResource.class, "ns1.example.foo", clock.nowUtc())));
|
Key.create(loadByForeignKey(HostResource.class, "ns1.example.foo", clock.nowUtc())));
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
runFlow();
|
runFlow();
|
||||||
assertThat(reloadResourceByForeignKey().getNameservers()).doesNotContain(
|
assertThat(reloadResourceByForeignKey().getNameservers())
|
||||||
|
.doesNotContain(
|
||||||
Key.create(loadByForeignKey(HostResource.class, "ns1.example.foo", clock.nowUtc())));
|
Key.create(loadByForeignKey(HostResource.class, "ns1.example.foo", clock.nowUtc())));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1205,11 +1287,14 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
persistDomain();
|
persistDomain();
|
||||||
setEppInput("domain_update_remove_nameserver.xml");
|
setEppInput("domain_update_remove_nameserver.xml");
|
||||||
persistResource(
|
persistResource(
|
||||||
Registry.get("tld").asBuilder()
|
Registry.get("tld")
|
||||||
|
.asBuilder()
|
||||||
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns1.example.foo"))
|
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns1.example.foo"))
|
||||||
.build());
|
.build());
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
NameserversNotSpecifiedForTldWithNameserverWhitelistException.class, this::runFlow);
|
NameserversNotSpecifiedForTldWithNameserverWhitelistException.class, this::runFlow);
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -1254,8 +1339,10 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
persistReservedList(
|
persistReservedList(
|
||||||
"reserved", "example,NAMESERVER_RESTRICTED,ns1.example.foo:ns2.example.foo"))
|
"reserved", "example,NAMESERVER_RESTRICTED,ns1.example.foo:ns2.example.foo"))
|
||||||
.build());
|
.build());
|
||||||
assertThrows(
|
EppException thrown =
|
||||||
|
expectThrows(
|
||||||
NameserversNotSpecifiedForNameserverRestrictedDomainException.class, this::runFlow);
|
NameserversNotSpecifiedForNameserverRestrictedDomainException.class, this::runFlow);
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -1372,7 +1459,9 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
persistReservedList(
|
persistReservedList(
|
||||||
"reserved", "lol,NAMESERVER_RESTRICTED,ns1.example.foo:ns2.example.foo"))
|
"reserved", "lol,NAMESERVER_RESTRICTED,ns1.example.foo:ns2.example.foo"))
|
||||||
.build());
|
.build());
|
||||||
assertThrows(DomainNotAllowedForTldWithCreateRestrictionException.class, this::runFlow);
|
EppException thrown =
|
||||||
|
expectThrows(DomainNotAllowedForTldWithCreateRestrictionException.class, this::runFlow);
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -1387,7 +1476,9 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
persistReservedList(
|
persistReservedList(
|
||||||
"reserved", "lol,NAMESERVER_RESTRICTED,ns1.example.foo:ns2.example.foo"))
|
"reserved", "lol,NAMESERVER_RESTRICTED,ns1.example.foo:ns2.example.foo"))
|
||||||
.build());
|
.build());
|
||||||
assertThrows(DomainNotAllowedForTldWithCreateRestrictionException.class, this::runFlow);
|
EppException thrown =
|
||||||
|
expectThrows(DomainNotAllowedForTldWithCreateRestrictionException.class, this::runFlow);
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -1441,7 +1532,8 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
setEppInput("domain_update_fee.xml", ImmutableMap.of("FEE_VERSION", "0.11"));
|
setEppInput("domain_update_fee.xml", ImmutableMap.of("FEE_VERSION", "0.11"));
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
persistDomain();
|
persistDomain();
|
||||||
assertThrows(FeesMismatchException.class, this::runFlow);
|
EppException thrown = expectThrows(FeesMismatchException.class, this::runFlow);
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
// This test should throw an exception, because the fee extension is required when the fee is not
|
// This test should throw an exception, because the fee extension is required when the fee is not
|
||||||
|
@ -1451,7 +1543,9 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
setEppInput("domain_update_wildcard.xml", ImmutableMap.of("DOMAIN", "non-free-update.tld"));
|
setEppInput("domain_update_wildcard.xml", ImmutableMap.of("DOMAIN", "non-free-update.tld"));
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
persistDomain();
|
persistDomain();
|
||||||
assertThrows(FeesRequiredForNonFreeOperationException.class, this::runFlow);
|
EppException thrown =
|
||||||
|
expectThrows(FeesRequiredForNonFreeOperationException.class, this::runFlow);
|
||||||
|
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue