mirror of
https://github.com/google/nomulus.git
synced 2025-05-14 00:17:20 +02:00
Re-add EppException marshalling assertions in domain flow tests
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=179238852
This commit is contained in:
parent
34699465d5
commit
d538dca2e0
7 changed files with 1296 additions and 869 deletions
|
@ -24,7 +24,8 @@ import static google.registry.testing.DatastoreHelper.persistDeletedDomain;
|
|||
import static google.registry.testing.DatastoreHelper.persistPremiumList;
|
||||
import static google.registry.testing.DatastoreHelper.persistReservedList;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
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.util.DateTimeUtils.START_OF_TIME;
|
||||
import static org.joda.money.CurrencyUnit.USD;
|
||||
|
||||
|
@ -32,6 +33,8 @@ import com.google.common.base.Strings;
|
|||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.ImmutableSortedMap;
|
||||
import com.google.common.collect.Ordering;
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.ResourceCheckFlowTestCase;
|
||||
import google.registry.flows.domain.DomainCheckFlow.OnlyCheckedNamesCanBeFeeCheckedException;
|
||||
import google.registry.flows.domain.DomainFlowUtils.BadCommandForRegistryPhaseException;
|
||||
|
@ -148,7 +151,8 @@ public class DomainCheckFlowTest
|
|||
persistResource(
|
||||
Registry.get("tld.foo")
|
||||
.asBuilder()
|
||||
.setReservedLists(persistReservedList(
|
||||
.setReservedLists(
|
||||
persistReservedList(
|
||||
"tld.foo", "reserved,FULLY_BLOCKED", "allowedinsunrise,ALLOWED_IN_SUNRISE"))
|
||||
.build());
|
||||
setEppInput("domain_check_one_multipart_tld_reserved.xml");
|
||||
|
@ -171,9 +175,7 @@ public class DomainCheckFlowTest
|
|||
@Test
|
||||
public void testSuccess_duplicatesAllowed() throws Exception {
|
||||
setEppInput("domain_check_duplicates.xml");
|
||||
doCheckTest(
|
||||
create(true, "example1.tld", null),
|
||||
create(true, "example1.tld", null));
|
||||
doCheckTest(create(true, "example1.tld", null), create(true, "example1.tld", null));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -192,8 +194,7 @@ public class DomainCheckFlowTest
|
|||
@Test
|
||||
public void testSuccess_pendingSunriseApplicationInGeneralAvailability() throws Exception {
|
||||
createTld("tld", TldState.GENERAL_AVAILABILITY);
|
||||
persistResource(newDomainApplication("example2.tld").asBuilder()
|
||||
.build());
|
||||
persistResource(newDomainApplication("example2.tld").asBuilder().build());
|
||||
doCheckTest(
|
||||
create(true, "example1.tld", null),
|
||||
create(false, "example2.tld", "Pending allocation"),
|
||||
|
@ -203,9 +204,8 @@ public class DomainCheckFlowTest
|
|||
@Test
|
||||
public void testSuccess_pendingLandrushApplicationInGeneralAvailability() throws Exception {
|
||||
createTld("tld", TldState.GENERAL_AVAILABILITY);
|
||||
persistResource(newDomainApplication("example2.tld").asBuilder()
|
||||
.setPhase(LaunchPhase.LANDRUSH)
|
||||
.build());
|
||||
persistResource(
|
||||
newDomainApplication("example2.tld").asBuilder().setPhase(LaunchPhase.LANDRUSH).build());
|
||||
doCheckTest(
|
||||
create(true, "example1.tld", null),
|
||||
create(false, "example2.tld", "Pending allocation"),
|
||||
|
@ -215,8 +215,7 @@ public class DomainCheckFlowTest
|
|||
@Test
|
||||
public void testSuccess_pendingSunriseApplicationInQuietPeriod() throws Exception {
|
||||
createTld("tld", TldState.QUIET_PERIOD);
|
||||
persistResource(newDomainApplication("example2.tld").asBuilder()
|
||||
.build());
|
||||
persistResource(newDomainApplication("example2.tld").asBuilder().build());
|
||||
doCheckTest(
|
||||
create(true, "example1.tld", null),
|
||||
create(false, "example2.tld", "Pending allocation"),
|
||||
|
@ -226,9 +225,8 @@ public class DomainCheckFlowTest
|
|||
@Test
|
||||
public void testSuccess_pendingLandrushApplicationInQuietPeriod() throws Exception {
|
||||
createTld("tld", TldState.QUIET_PERIOD);
|
||||
persistResource(newDomainApplication("example2.tld").asBuilder()
|
||||
.setPhase(LaunchPhase.LANDRUSH)
|
||||
.build());
|
||||
persistResource(
|
||||
newDomainApplication("example2.tld").asBuilder().setPhase(LaunchPhase.LANDRUSH).build());
|
||||
doCheckTest(
|
||||
create(true, "example1.tld", null),
|
||||
create(false, "example2.tld", "Pending allocation"),
|
||||
|
@ -238,8 +236,7 @@ public class DomainCheckFlowTest
|
|||
@Test
|
||||
public void testSuccess_pendingSunriseApplicationInSunrise() throws Exception {
|
||||
createTld("tld", TldState.SUNRISE);
|
||||
persistResource(newDomainApplication("example2.tld").asBuilder()
|
||||
.build());
|
||||
persistResource(newDomainApplication("example2.tld").asBuilder().build());
|
||||
doCheckTest(
|
||||
create(true, "example1.tld", null),
|
||||
create(true, "example2.tld", null),
|
||||
|
@ -249,9 +246,8 @@ public class DomainCheckFlowTest
|
|||
@Test
|
||||
public void testSuccess_pendingLandrushApplicationInLandrush() throws Exception {
|
||||
createTld("tld", TldState.LANDRUSH);
|
||||
persistResource(newDomainApplication("example2.tld").asBuilder()
|
||||
.setPhase(LaunchPhase.LANDRUSH)
|
||||
.build());
|
||||
persistResource(
|
||||
newDomainApplication("example2.tld").asBuilder().setPhase(LaunchPhase.LANDRUSH).build());
|
||||
doCheckTest(
|
||||
create(true, "example1.tld", null),
|
||||
create(true, "example2.tld", null),
|
||||
|
@ -261,7 +257,9 @@ public class DomainCheckFlowTest
|
|||
@Test
|
||||
public void testSuccess_rejectedApplication() throws Exception {
|
||||
createTld("tld", TldState.LANDRUSH);
|
||||
persistResource(newDomainApplication("example2.tld").asBuilder()
|
||||
persistResource(
|
||||
newDomainApplication("example2.tld")
|
||||
.asBuilder()
|
||||
.setPhase(LaunchPhase.LANDRUSH)
|
||||
.setApplicationStatus(ApplicationStatus.REJECTED)
|
||||
.build());
|
||||
|
@ -274,20 +272,23 @@ public class DomainCheckFlowTest
|
|||
@Test
|
||||
public void testFailure_tooManyIds() throws Exception {
|
||||
setEppInput("domain_check_51.xml");
|
||||
assertThrows(TooManyResourceChecksException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(TooManyResourceChecksException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_wrongTld() throws Exception {
|
||||
setEppInput("domain_check.xml");
|
||||
assertThrows(TldDoesNotExistException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(TldDoesNotExistException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_notAuthorizedForTld() throws Exception {
|
||||
persistResource(
|
||||
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
|
||||
assertThrows(NotAuthorizedForTldException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(NotAuthorizedForTldException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -299,10 +300,11 @@ public class DomainCheckFlowTest
|
|||
CommitMode.LIVE, UserPrivileges.SUPERUSER, loadFile("domain_check_one_tld_response.xml"));
|
||||
}
|
||||
|
||||
private void doFailingBadLabelTest(String label, Class<? extends Exception> expectedException)
|
||||
private void doFailingBadLabelTest(String label, Class<? extends EppException> expectedException)
|
||||
throws Exception {
|
||||
setEppInput("domain_check_template.xml", ImmutableMap.of("LABEL", label));
|
||||
assertThrows(expectedException, this::runFlow);
|
||||
EppException thrown = expectThrows(expectedException, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -386,7 +388,8 @@ public class DomainCheckFlowTest
|
|||
@Test
|
||||
public void testFailure_predelegation() throws Exception {
|
||||
createTld("tld", TldState.PREDELEGATION);
|
||||
assertThrows(BadCommandForRegistryPhaseException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(BadCommandForRegistryPhaseException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -461,7 +464,8 @@ public class DomainCheckFlowTest
|
|||
|
||||
/**
|
||||
* Test commands for create, renew, transfer, restore and update with implicit period and
|
||||
* currency. */
|
||||
* currency.
|
||||
*/
|
||||
@Test
|
||||
public void testFeeExtension_multipleCommands_v06() throws Exception {
|
||||
setEppInput("domain_check_fee_multiple_commands_v06.xml");
|
||||
|
@ -531,7 +535,9 @@ public class DomainCheckFlowTest
|
|||
// Note that the response xml expects to see "11.10" with two digits after the decimal point.
|
||||
// This works because Money.getAmount(), used in the flow, returns a BigDecimal that is set to
|
||||
// display the number of digits that is conventional for the given currency.
|
||||
persistResource(Registry.get("tld").asBuilder()
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
.asBuilder()
|
||||
.setCreateBillingCost(Money.of(CurrencyUnit.USD, 11.1))
|
||||
.build());
|
||||
setEppInput("domain_check_fee_fractional.xml");
|
||||
|
@ -541,7 +547,9 @@ public class DomainCheckFlowTest
|
|||
/** Test that create fees are properly omitted/classed on names on reserved lists. */
|
||||
@Test
|
||||
public void testFeeExtension_reservedName_v06() throws Exception {
|
||||
persistResource(Registry.get("tld").asBuilder()
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
.asBuilder()
|
||||
.setReservedLists(createReservedList())
|
||||
.setPremiumList(persistPremiumList("tld", "premiumcollision,USD 70"))
|
||||
.build());
|
||||
|
@ -552,7 +560,9 @@ public class DomainCheckFlowTest
|
|||
/** The tests must be split up for version 11, which allows only one command at a time. */
|
||||
@Test
|
||||
public void testFeeExtension_reservedName_v11_create() throws Exception {
|
||||
persistResource(Registry.get("tld").asBuilder()
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
.asBuilder()
|
||||
.setReservedLists(createReservedList())
|
||||
.setPremiumList(persistPremiumList("tld", "premiumcollision,USD 70"))
|
||||
.build());
|
||||
|
@ -562,7 +572,9 @@ public class DomainCheckFlowTest
|
|||
|
||||
@Test
|
||||
public void testFeeExtension_reservedName_v11_renew() throws Exception {
|
||||
persistResource(Registry.get("tld").asBuilder()
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
.asBuilder()
|
||||
.setReservedLists(createReservedList())
|
||||
.setPremiumList(persistPremiumList("tld", "premiumcollision,USD 70"))
|
||||
.build());
|
||||
|
@ -572,7 +584,9 @@ public class DomainCheckFlowTest
|
|||
|
||||
@Test
|
||||
public void testFeeExtension_reservedName_v11_transfer() throws Exception {
|
||||
persistResource(Registry.get("tld").asBuilder()
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
.asBuilder()
|
||||
.setReservedLists(createReservedList())
|
||||
.setPremiumList(persistPremiumList("tld", "premiumcollision,USD 70"))
|
||||
.build());
|
||||
|
@ -582,7 +596,9 @@ public class DomainCheckFlowTest
|
|||
|
||||
@Test
|
||||
public void testFeeExtension_reservedName_v11_restore() throws Exception {
|
||||
persistResource(Registry.get("tld").asBuilder()
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
.asBuilder()
|
||||
.setReservedLists(createReservedList())
|
||||
.setPremiumList(persistPremiumList("tld", "premiumcollision,USD 70"))
|
||||
.build());
|
||||
|
@ -592,7 +608,9 @@ public class DomainCheckFlowTest
|
|||
|
||||
@Test
|
||||
public void testFeeExtension_reservedName_v12() throws Exception {
|
||||
persistResource(Registry.get("tld").asBuilder()
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
.asBuilder()
|
||||
.setReservedLists(createReservedList())
|
||||
.setPremiumList(persistPremiumList("tld", "premiumcollision,USD 70"))
|
||||
.build());
|
||||
|
@ -603,7 +621,9 @@ public class DomainCheckFlowTest
|
|||
@Test
|
||||
public void testFeeExtension_feesNotOmittedOnReservedNamesInSunrise_v06() throws Exception {
|
||||
createTld("tld", TldState.SUNRISE);
|
||||
persistResource(Registry.get("tld").asBuilder()
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
.asBuilder()
|
||||
.setReservedLists(createReservedList())
|
||||
.setPremiumList(persistPremiumList("tld", "premiumcollision,USD 70"))
|
||||
.build());
|
||||
|
@ -612,10 +632,12 @@ public class DomainCheckFlowTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void
|
||||
testFeeExtension_feesNotOmittedOnReservedNamesInSunrise_v11_create() throws Exception {
|
||||
public void testFeeExtension_feesNotOmittedOnReservedNamesInSunrise_v11_create()
|
||||
throws Exception {
|
||||
createTld("tld", TldState.SUNRISE);
|
||||
persistResource(Registry.get("tld").asBuilder()
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
.asBuilder()
|
||||
.setReservedLists(createReservedList())
|
||||
.setPremiumList(persistPremiumList("tld", "premiumcollision,USD 70"))
|
||||
.build());
|
||||
|
@ -624,10 +646,11 @@ public class DomainCheckFlowTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void
|
||||
testFeeExtension_feesNotOmittedOnReservedNamesInSunrise_v11_renew() throws Exception {
|
||||
public void testFeeExtension_feesNotOmittedOnReservedNamesInSunrise_v11_renew() throws Exception {
|
||||
createTld("tld", TldState.SUNRISE);
|
||||
persistResource(Registry.get("tld").asBuilder()
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
.asBuilder()
|
||||
.setReservedLists(createReservedList())
|
||||
.setPremiumList(persistPremiumList("tld", "premiumcollision,USD 70"))
|
||||
.build());
|
||||
|
@ -636,10 +659,12 @@ public class DomainCheckFlowTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void
|
||||
testFeeExtension_feesNotOmittedOnReservedNamesInSunrise_v11_transfer() throws Exception {
|
||||
public void testFeeExtension_feesNotOmittedOnReservedNamesInSunrise_v11_transfer()
|
||||
throws Exception {
|
||||
createTld("tld", TldState.SUNRISE);
|
||||
persistResource(Registry.get("tld").asBuilder()
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
.asBuilder()
|
||||
.setReservedLists(createReservedList())
|
||||
.setPremiumList(persistPremiumList("tld", "premiumcollision,USD 70"))
|
||||
.build());
|
||||
|
@ -648,10 +673,12 @@ public class DomainCheckFlowTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void
|
||||
testFeeExtension_feesNotOmittedOnReservedNamesInSunrise_v11_restore() throws Exception {
|
||||
public void testFeeExtension_feesNotOmittedOnReservedNamesInSunrise_v11_restore()
|
||||
throws Exception {
|
||||
createTld("tld", TldState.SUNRISE);
|
||||
persistResource(Registry.get("tld").asBuilder()
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
.asBuilder()
|
||||
.setReservedLists(createReservedList())
|
||||
.setPremiumList(persistPremiumList("tld", "premiumcollision,USD 70"))
|
||||
.build());
|
||||
|
@ -662,7 +689,9 @@ public class DomainCheckFlowTest
|
|||
@Test
|
||||
public void testFeeExtension_feesNotOmittedOnReservedNamesInSunrise_v12() throws Exception {
|
||||
createTld("tld", TldState.SUNRISE);
|
||||
persistResource(Registry.get("tld").asBuilder()
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
.asBuilder()
|
||||
.setReservedLists(createReservedList())
|
||||
.setPremiumList(persistPremiumList("tld", "premiumcollision,USD 70"))
|
||||
.build());
|
||||
|
@ -673,163 +702,193 @@ public class DomainCheckFlowTest
|
|||
@Test
|
||||
public void testFeeExtension_wrongCurrency_v06() throws Exception {
|
||||
setEppInput("domain_check_fee_euro_v06.xml");
|
||||
assertThrows(CurrencyUnitMismatchException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(CurrencyUnitMismatchException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFeeExtension_wrongCurrency_v11() throws Exception {
|
||||
setEppInput("domain_check_fee_euro_v11.xml");
|
||||
assertThrows(CurrencyUnitMismatchException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(CurrencyUnitMismatchException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFeeExtension_wrongCurrency_v12() throws Exception {
|
||||
setEppInput("domain_check_fee_euro_v12.xml");
|
||||
assertThrows(CurrencyUnitMismatchException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(CurrencyUnitMismatchException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFeeExtension_periodNotInYears_v06() throws Exception {
|
||||
setEppInput("domain_check_fee_bad_period_v06.xml");
|
||||
assertThrows(BadPeriodUnitException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(BadPeriodUnitException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFeeExtension_periodNotInYears_v11() throws Exception {
|
||||
setEppInput("domain_check_fee_bad_period_v11.xml");
|
||||
assertThrows(BadPeriodUnitException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(BadPeriodUnitException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFeeExtension_periodNotInYears_v12() throws Exception {
|
||||
setEppInput("domain_check_fee_bad_period_v12.xml");
|
||||
assertThrows(BadPeriodUnitException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(BadPeriodUnitException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFeeExtension_commandWithPhase_v06() throws Exception {
|
||||
setEppInput("domain_check_fee_command_phase_v06.xml");
|
||||
assertThrows(FeeChecksDontSupportPhasesException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(FeeChecksDontSupportPhasesException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFeeExtension_commandWithPhase_v11() throws Exception {
|
||||
setEppInput("domain_check_fee_command_phase_v11.xml");
|
||||
assertThrows(FeeChecksDontSupportPhasesException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(FeeChecksDontSupportPhasesException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFeeExtension_commandWithPhase_v12() throws Exception {
|
||||
setEppInput("domain_check_fee_command_phase_v12.xml");
|
||||
assertThrows(FeeChecksDontSupportPhasesException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(FeeChecksDontSupportPhasesException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFeeExtension_commandSubphase_v06() throws Exception {
|
||||
setEppInput("domain_check_fee_command_subphase_v06.xml");
|
||||
assertThrows(FeeChecksDontSupportPhasesException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(FeeChecksDontSupportPhasesException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFeeExtension_commandSubphase_v11() throws Exception {
|
||||
setEppInput("domain_check_fee_command_subphase_v11.xml");
|
||||
assertThrows(FeeChecksDontSupportPhasesException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(FeeChecksDontSupportPhasesException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFeeExtension_commandSubphase_v12() throws Exception {
|
||||
setEppInput("domain_check_fee_command_subphase_v12.xml");
|
||||
assertThrows(FeeChecksDontSupportPhasesException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(FeeChecksDontSupportPhasesException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
// This test is only relevant for v06, since domain names are not specified in v11 or v12.
|
||||
@Test
|
||||
public void testFeeExtension_feeCheckNotInAvailabilityCheck() throws Exception {
|
||||
setEppInput("domain_check_fee_not_in_avail.xml");
|
||||
assertThrows(OnlyCheckedNamesCanBeFeeCheckedException.class, this::runFlow);
|
||||
EppException thrown =
|
||||
expectThrows(OnlyCheckedNamesCanBeFeeCheckedException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFeeExtension_multiyearRestore_v06() throws Exception {
|
||||
setEppInput("domain_check_fee_multiyear_restore_v06.xml");
|
||||
assertThrows(RestoresAreAlwaysForOneYearException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(RestoresAreAlwaysForOneYearException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFeeExtension_multiyearRestore_v11() throws Exception {
|
||||
setEppInput("domain_check_fee_multiyear_restore_v11.xml");
|
||||
assertThrows(RestoresAreAlwaysForOneYearException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(RestoresAreAlwaysForOneYearException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFeeExtension_multiyearRestore_v12() throws Exception {
|
||||
setEppInput("domain_check_fee_multiyear_restore_v12.xml");
|
||||
assertThrows(RestoresAreAlwaysForOneYearException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(RestoresAreAlwaysForOneYearException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFeeExtension_multiyearTransfer_v06() throws Exception {
|
||||
setEppInput("domain_check_fee_multiyear_transfer_v06.xml");
|
||||
assertThrows(TransfersAreAlwaysForOneYearException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(TransfersAreAlwaysForOneYearException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFeeExtension_multiyearTransfer_v11() throws Exception {
|
||||
setEppInput("domain_check_fee_multiyear_transfer_v11.xml");
|
||||
assertThrows(TransfersAreAlwaysForOneYearException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(TransfersAreAlwaysForOneYearException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFeeExtension_multiyearTransfer_v12() throws Exception {
|
||||
setEppInput("domain_check_fee_multiyear_transfer_v12.xml");
|
||||
assertThrows(TransfersAreAlwaysForOneYearException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(TransfersAreAlwaysForOneYearException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFeeExtension_unknownCommand_v06() throws Exception {
|
||||
setEppInput("domain_check_fee_unknown_command_v06.xml");
|
||||
assertThrows(UnknownFeeCommandException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(UnknownFeeCommandException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFeeExtension_unknownCommand_v11() throws Exception {
|
||||
setEppInput("domain_check_fee_unknown_command_v11.xml");
|
||||
assertThrows(UnknownFeeCommandException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(UnknownFeeCommandException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFeeExtension_unknownCommand_v12() throws Exception {
|
||||
setEppInput("domain_check_fee_unknown_command_v12.xml");
|
||||
assertThrows(UnknownFeeCommandException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(UnknownFeeCommandException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFeeExtension_invalidCommand_v06() throws Exception {
|
||||
setEppInput("domain_check_fee_invalid_command_v06.xml");
|
||||
assertThrows(UnknownFeeCommandException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(UnknownFeeCommandException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFeeExtension_invalidCommand_v11() throws Exception {
|
||||
setEppInput("domain_check_fee_invalid_command_v11.xml");
|
||||
assertThrows(UnknownFeeCommandException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(UnknownFeeCommandException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFeeExtension_invalidCommand_v12() throws Exception {
|
||||
setEppInput("domain_check_fee_invalid_command_v12.xml");
|
||||
assertThrows(UnknownFeeCommandException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(UnknownFeeCommandException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
private void runEapFeeCheckTest(String inputFile, String outputFile) throws Exception {
|
||||
clock.setTo(DateTime.parse("2010-01-01T10:00:00Z"));
|
||||
persistActiveDomain("example1.tld");
|
||||
persistResource(Registry.get("tld").asBuilder()
|
||||
.setEapFeeSchedule(ImmutableSortedMap.of(
|
||||
START_OF_TIME, Money.of(USD, 0),
|
||||
clock.nowUtc().minusDays(1), Money.of(USD, 100),
|
||||
clock.nowUtc().plusDays(1), Money.of(USD, 50),
|
||||
clock.nowUtc().plusDays(2), Money.of(USD, 0)))
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
.asBuilder()
|
||||
.setEapFeeSchedule(
|
||||
new ImmutableSortedMap.Builder<DateTime, Money>(Ordering.natural())
|
||||
.put(START_OF_TIME, Money.of(USD, 0))
|
||||
.put(clock.nowUtc().minusDays(1), Money.of(USD, 100))
|
||||
.put(clock.nowUtc().plusDays(1), Money.of(USD, 50))
|
||||
.put(clock.nowUtc().plusDays(2), Money.of(USD, 0))
|
||||
.build())
|
||||
.build());
|
||||
setEppInput(inputFile);
|
||||
runFlowAssertResponse(loadFile(outputFile));
|
||||
|
@ -852,8 +911,8 @@ public class DomainCheckFlowTest
|
|||
|
||||
@Test
|
||||
public void testSuccess_eapFeeCheck_date_v12() throws Exception {
|
||||
runEapFeeCheckTest("domain_check_fee_date_v12.xml",
|
||||
"domain_check_eap_fee_response_date_v12.xml");
|
||||
runEapFeeCheckTest(
|
||||
"domain_check_fee_date_v12.xml", "domain_check_eap_fee_response_date_v12.xml");
|
||||
}
|
||||
|
||||
@Ignore
|
||||
|
|
|
@ -18,10 +18,12 @@ import static google.registry.testing.DatastoreHelper.assertNoBillingEvents;
|
|||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
import static google.registry.testing.DatastoreHelper.loadRegistrar;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.ResourceFlowTestCase;
|
||||
import google.registry.flows.domain.DomainClaimsCheckFlow.DomainClaimsCheckNotAllowedInSunrise;
|
||||
import google.registry.flows.domain.DomainFlowUtils.BadCommandForRegistryPhaseException;
|
||||
|
@ -102,20 +104,23 @@ public class DomainClaimsCheckFlowTest
|
|||
@Test
|
||||
public void testFailure_TooManyIds() throws Exception {
|
||||
setEppInput("domain_check_claims_51.xml");
|
||||
assertThrows(TooManyResourceChecksException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(TooManyResourceChecksException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_tldDoesntExist() throws Exception {
|
||||
setEppInput("domain_check_claims_bad_tld.xml");
|
||||
assertThrows(TldDoesNotExistException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(TldDoesNotExistException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_notAuthorizedForTld() throws Exception {
|
||||
persistResource(
|
||||
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
|
||||
assertThrows(NotAuthorizedForTldException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(NotAuthorizedForTldException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -136,7 +141,8 @@ public class DomainClaimsCheckFlowTest
|
|||
createTld("tld", TldState.PREDELEGATION);
|
||||
persistResource(Registry.get("tld").asBuilder().build());
|
||||
setEppInput("domain_check_claims.xml");
|
||||
assertThrows(BadCommandForRegistryPhaseException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(BadCommandForRegistryPhaseException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -144,7 +150,8 @@ public class DomainClaimsCheckFlowTest
|
|||
createTld("tld", TldState.SUNRISE);
|
||||
persistResource(Registry.get("tld").asBuilder().build());
|
||||
setEppInput("domain_check_claims.xml");
|
||||
assertThrows(DomainClaimsCheckNotAllowedInSunrise.class, this::runFlow);
|
||||
EppException thrown = expectThrows(DomainClaimsCheckNotAllowedInSunrise.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -154,7 +161,8 @@ public class DomainClaimsCheckFlowTest
|
|||
persistResource(
|
||||
Registry.get("tld2").asBuilder().setClaimsPeriodEnd(clock.nowUtc().minusMillis(1)).build());
|
||||
setEppInput("domain_check_claims_multiple_tlds.xml");
|
||||
assertThrows(ClaimsPeriodEndedException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(ClaimsPeriodEndedException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -41,8 +41,8 @@ import static google.registry.testing.DatastoreHelper.persistActiveDomain;
|
|||
import static google.registry.testing.DatastoreHelper.persistDeletedDomain;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
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.JUnitBackports.assertThrows;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.testing.TaskQueueHelper.assertDnsTasksEnqueued;
|
||||
import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
||||
|
@ -53,6 +53,7 @@ import com.google.common.collect.ImmutableMap;
|
|||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.ImmutableSortedMap;
|
||||
import com.googlecode.objectify.Key;
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.EppRequestSource;
|
||||
import google.registry.flows.ResourceFlowTestCase;
|
||||
import google.registry.flows.ResourceFlowUtils.ResourceDoesNotExistException;
|
||||
|
@ -120,11 +121,14 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
|
|||
|
||||
private void setUpSuccessfulTest() throws Exception {
|
||||
createReferencedEntities(A_MONTH_FROM_NOW);
|
||||
BillingEvent.Recurring autorenewBillingEvent = persistResource(
|
||||
createAutorenewBillingEvent("TheRegistrar").build());
|
||||
PollMessage.Autorenew autorenewPollMessage = persistResource(
|
||||
createAutorenewPollMessage("TheRegistrar").build());
|
||||
domain = persistResource(domain.asBuilder()
|
||||
BillingEvent.Recurring autorenewBillingEvent =
|
||||
persistResource(createAutorenewBillingEvent("TheRegistrar").build());
|
||||
PollMessage.Autorenew autorenewPollMessage =
|
||||
persistResource(createAutorenewPollMessage("TheRegistrar").build());
|
||||
domain =
|
||||
persistResource(
|
||||
domain
|
||||
.asBuilder()
|
||||
.setAutorenewBillingEvent(Key.create(autorenewBillingEvent))
|
||||
.setAutorenewPollMessage(Key.create(autorenewPollMessage))
|
||||
.build());
|
||||
|
@ -134,20 +138,21 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
|
|||
private void createReferencedEntities(DateTime expirationTime) throws Exception {
|
||||
// Persist a linked contact.
|
||||
ContactResource contact = persistActiveContact("sh8013");
|
||||
domain = newDomainResource(getUniqueIdFromCommand()).asBuilder()
|
||||
domain =
|
||||
newDomainResource(getUniqueIdFromCommand())
|
||||
.asBuilder()
|
||||
.setCreationTimeForTest(TIME_BEFORE_FLOW)
|
||||
.setRegistrant(Key.create(contact))
|
||||
.setRegistrationExpirationTime(expirationTime)
|
||||
.build();
|
||||
earlierHistoryEntry = persistResource(
|
||||
new HistoryEntry.Builder()
|
||||
.setType(DOMAIN_CREATE)
|
||||
.setParent(domain)
|
||||
.build());
|
||||
earlierHistoryEntry =
|
||||
persistResource(
|
||||
new HistoryEntry.Builder().setType(DOMAIN_CREATE).setParent(domain).build());
|
||||
}
|
||||
|
||||
private void setUpGracePeriods(GracePeriod... gracePeriods) throws Exception {
|
||||
domain = persistResource(
|
||||
domain =
|
||||
persistResource(
|
||||
domain.asBuilder().setGracePeriods(ImmutableSet.copyOf(gracePeriods)).build());
|
||||
}
|
||||
|
||||
|
@ -165,17 +170,19 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
|
|||
|
||||
private void setUpAutorenewGracePeriod() throws Exception {
|
||||
createReferencedEntities(A_MONTH_AGO.plusYears(1));
|
||||
BillingEvent.Recurring autorenewBillingEvent = persistResource(
|
||||
createAutorenewBillingEvent("TheRegistrar")
|
||||
.setEventTime(A_MONTH_AGO)
|
||||
.build());
|
||||
PollMessage.Autorenew autorenewPollMessage = persistResource(
|
||||
createAutorenewPollMessage("TheRegistrar")
|
||||
.setEventTime(A_MONTH_AGO)
|
||||
.build());
|
||||
domain = persistResource(
|
||||
domain.asBuilder()
|
||||
.setGracePeriods(ImmutableSet.of(GracePeriod.createForRecurring(
|
||||
BillingEvent.Recurring autorenewBillingEvent =
|
||||
persistResource(
|
||||
createAutorenewBillingEvent("TheRegistrar").setEventTime(A_MONTH_AGO).build());
|
||||
PollMessage.Autorenew autorenewPollMessage =
|
||||
persistResource(
|
||||
createAutorenewPollMessage("TheRegistrar").setEventTime(A_MONTH_AGO).build());
|
||||
domain =
|
||||
persistResource(
|
||||
domain
|
||||
.asBuilder()
|
||||
.setGracePeriods(
|
||||
ImmutableSet.of(
|
||||
GracePeriod.createForRecurring(
|
||||
GracePeriodStatus.AUTO_RENEW,
|
||||
A_MONTH_AGO.plusDays(45),
|
||||
"TheRegistrar",
|
||||
|
@ -187,13 +194,11 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
|
|||
}
|
||||
|
||||
private void assertAutorenewClosedAndCancellationCreatedFor(
|
||||
BillingEvent.OneTime graceBillingEvent,
|
||||
HistoryEntry historyEntryDomainDelete) throws Exception {
|
||||
BillingEvent.OneTime graceBillingEvent, HistoryEntry historyEntryDomainDelete)
|
||||
throws Exception {
|
||||
DateTime eventTime = clock.nowUtc();
|
||||
assertBillingEvents(
|
||||
createAutorenewBillingEvent("TheRegistrar")
|
||||
.setRecurrenceEndTime(eventTime)
|
||||
.build(),
|
||||
createAutorenewBillingEvent("TheRegistrar").setRecurrenceEndTime(eventTime).build(),
|
||||
graceBillingEvent,
|
||||
new BillingEvent.Cancellation.Builder()
|
||||
.setReason(graceBillingEvent.getReason())
|
||||
|
@ -249,8 +254,8 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
|
|||
@Test
|
||||
public void testDryRun() throws Exception {
|
||||
setUpSuccessfulTest();
|
||||
setUpGracePeriods(GracePeriod.create(
|
||||
GracePeriodStatus.ADD, TIME_BEFORE_FLOW.plusDays(1), "foo", null));
|
||||
setUpGracePeriods(
|
||||
GracePeriod.create(GracePeriodStatus.ADD, TIME_BEFORE_FLOW.plusDays(1), "foo", null));
|
||||
dryRunFlowAssertResponse(loadFile("domain_delete_response.xml"));
|
||||
}
|
||||
|
||||
|
@ -268,7 +273,8 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
|
|||
private void doImmediateDeleteTest(
|
||||
GracePeriodStatus gracePeriodStatus,
|
||||
String responseFilename,
|
||||
Map<String, String> substitutions) throws Exception {
|
||||
Map<String, String> substitutions)
|
||||
throws Exception {
|
||||
// Persist the billing event so it can be retrieved for cancellation generation and checking.
|
||||
setUpSuccessfulTest();
|
||||
BillingEvent.OneTime graceBillingEvent =
|
||||
|
@ -339,12 +345,20 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
|
|||
runFlowAssertResponse(loadFile(responseFilename, substitutions));
|
||||
DomainResource resource = reloadResourceByForeignKey();
|
||||
// Check that the domain is in the pending delete state.
|
||||
assertAboutDomains().that(resource)
|
||||
.hasStatusValue(StatusValue.PENDING_DELETE).and()
|
||||
.hasDeletionTime(clock.nowUtc().plus(Registry.get("tld").getRedemptionGracePeriodLength())
|
||||
.plus(Registry.get("tld").getPendingDeleteLength())).and()
|
||||
.hasDeletePollMessage().and()
|
||||
.hasExactlyStatusValues(StatusValue.INACTIVE, StatusValue.PENDING_DELETE).and()
|
||||
assertAboutDomains()
|
||||
.that(resource)
|
||||
.hasStatusValue(StatusValue.PENDING_DELETE)
|
||||
.and()
|
||||
.hasDeletionTime(
|
||||
clock
|
||||
.nowUtc()
|
||||
.plus(Registry.get("tld").getRedemptionGracePeriodLength())
|
||||
.plus(Registry.get("tld").getPendingDeleteLength()))
|
||||
.and()
|
||||
.hasDeletePollMessage()
|
||||
.and()
|
||||
.hasExactlyStatusValues(StatusValue.INACTIVE, StatusValue.PENDING_DELETE)
|
||||
.and()
|
||||
.hasOneHistoryEntryEachOfTypes(DOMAIN_CREATE, DOMAIN_DELETE);
|
||||
// We leave the original expiration time unchanged; if the expiration time is before the
|
||||
// deletion time, that means once it passes the domain will experience a "phantom autorenew"
|
||||
|
@ -355,7 +369,8 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
|
|||
assertAutorenewClosedAndCancellationCreatedFor(
|
||||
renewBillingEvent, getOnlyHistoryEntryOfType(resource, DOMAIN_DELETE));
|
||||
// All existing grace periods should be gone, and a new REDEMPTION one should be added.
|
||||
assertThat(resource.getGracePeriods()).containsExactly(
|
||||
assertThat(resource.getGracePeriods())
|
||||
.containsExactly(
|
||||
GracePeriod.create(
|
||||
GracePeriodStatus.REDEMPTION,
|
||||
clock.nowUtc().plus(Registry.get("tld").getRedemptionGracePeriodLength()),
|
||||
|
@ -364,8 +379,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
|
|||
// There should be a future poll message at the deletion time. The previous autorenew poll
|
||||
// message should now be deleted.
|
||||
DateTime deletionTime = resource.getDeletionTime();
|
||||
assertThat(getPollMessages("TheRegistrar", deletionTime.minusMinutes(1)))
|
||||
.isEmpty();
|
||||
assertThat(getPollMessages("TheRegistrar", deletionTime.minusMinutes(1))).isEmpty();
|
||||
assertThat(getPollMessages("TheRegistrar", deletionTime)).hasSize(1);
|
||||
assertThat(resource.getDeletePollMessage())
|
||||
.isEqualTo(Key.create(getOnlyPollMessage("TheRegistrar")));
|
||||
|
@ -401,7 +415,11 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
|
|||
// Modify the autorenew poll message so that it has unacked messages in the past. This should
|
||||
// prevent it from being deleted when the domain is deleted.
|
||||
persistResource(
|
||||
ofy().load().key(reloadResourceByForeignKey().getAutorenewPollMessage()).now().asBuilder()
|
||||
ofy()
|
||||
.load()
|
||||
.key(reloadResourceByForeignKey().getAutorenewPollMessage())
|
||||
.now()
|
||||
.asBuilder()
|
||||
.setEventTime(A_MONTH_FROM_NOW.minusYears(3))
|
||||
.build());
|
||||
clock.advanceOneMilli();
|
||||
|
@ -409,8 +427,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
|
|||
// There should now be two poll messages; one for the delete of the domain (in the future), and
|
||||
// another for the unacked autorenew messages.
|
||||
DateTime deletionTime = reloadResourceByForeignKey().getDeletionTime();
|
||||
assertThat(getPollMessages("TheRegistrar", deletionTime.minusMinutes(1)))
|
||||
.hasSize(1);
|
||||
assertThat(getPollMessages("TheRegistrar", deletionTime.minusMinutes(1))).hasSize(1);
|
||||
assertThat(getPollMessages("TheRegistrar", deletionTime)).hasSize(2);
|
||||
}
|
||||
|
||||
|
@ -467,8 +484,12 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
|
|||
persistResource(
|
||||
Registry.get("tld")
|
||||
.asBuilder()
|
||||
.setRenewBillingCostTransitions(ImmutableSortedMap.of(
|
||||
START_OF_TIME, Money.of(USD, 11), TIME_BEFORE_FLOW.minusDays(5), Money.of(USD, 20)))
|
||||
.setRenewBillingCostTransitions(
|
||||
ImmutableSortedMap.of(
|
||||
START_OF_TIME,
|
||||
Money.of(USD, 11),
|
||||
TIME_BEFORE_FLOW.minusDays(5),
|
||||
Money.of(USD, 20)))
|
||||
.build());
|
||||
setUpAutorenewGracePeriod();
|
||||
clock.advanceOneMilli();
|
||||
|
@ -481,8 +502,12 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
|
|||
persistResource(
|
||||
Registry.get("tld")
|
||||
.asBuilder()
|
||||
.setRenewBillingCostTransitions(ImmutableSortedMap.of(
|
||||
START_OF_TIME, Money.of(USD, 11), TIME_BEFORE_FLOW.minusDays(5), Money.of(USD, 20)))
|
||||
.setRenewBillingCostTransitions(
|
||||
ImmutableSortedMap.of(
|
||||
START_OF_TIME,
|
||||
Money.of(USD, 11),
|
||||
TIME_BEFORE_FLOW.minusDays(5),
|
||||
Money.of(USD, 20)))
|
||||
.build());
|
||||
setUpAutorenewGracePeriod();
|
||||
clock.advanceOneMilli();
|
||||
|
@ -494,8 +519,12 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
|
|||
persistResource(
|
||||
Registry.get("tld")
|
||||
.asBuilder()
|
||||
.setRenewBillingCostTransitions(ImmutableSortedMap.of(
|
||||
START_OF_TIME, Money.of(USD, 11), TIME_BEFORE_FLOW.minusDays(5), Money.of(USD, 20)))
|
||||
.setRenewBillingCostTransitions(
|
||||
ImmutableSortedMap.of(
|
||||
START_OF_TIME,
|
||||
Money.of(USD, 11),
|
||||
TIME_BEFORE_FLOW.minusDays(5),
|
||||
Money.of(USD, 20)))
|
||||
.build());
|
||||
setUpAutorenewGracePeriod();
|
||||
clock.advanceOneMilli();
|
||||
|
@ -524,21 +553,27 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
|
|||
DomainResource domain = reloadResourceByForeignKey();
|
||||
// Check that the domain is in the pending delete state.
|
||||
// The PENDING_TRANSFER status should be gone.
|
||||
assertAboutDomains().that(domain)
|
||||
.hasExactlyStatusValues(StatusValue.INACTIVE, StatusValue.PENDING_DELETE).and()
|
||||
.hasDeletionTime(clock.nowUtc().plus(Registry.get("tld").getRedemptionGracePeriodLength())
|
||||
.plus(Registry.get("tld").getPendingDeleteLength())).and()
|
||||
assertAboutDomains()
|
||||
.that(domain)
|
||||
.hasExactlyStatusValues(StatusValue.INACTIVE, StatusValue.PENDING_DELETE)
|
||||
.and()
|
||||
.hasDeletionTime(
|
||||
clock
|
||||
.nowUtc()
|
||||
.plus(Registry.get("tld").getRedemptionGracePeriodLength())
|
||||
.plus(Registry.get("tld").getPendingDeleteLength()))
|
||||
.and()
|
||||
.hasOneHistoryEntryEachOfTypes(DOMAIN_CREATE, DOMAIN_TRANSFER_REQUEST, DOMAIN_DELETE);
|
||||
// All existing grace periods should be gone, and a new REDEMPTION one should be added.
|
||||
assertThat(domain.getGracePeriods()).containsExactly(
|
||||
assertThat(domain.getGracePeriods())
|
||||
.containsExactly(
|
||||
GracePeriod.create(
|
||||
GracePeriodStatus.REDEMPTION,
|
||||
clock.nowUtc().plus(Registry.get("tld").getRedemptionGracePeriodLength()),
|
||||
"TheRegistrar",
|
||||
null));
|
||||
// The poll message (in the future) to the losing registrar for implicit ack should be gone.
|
||||
assertThat(getPollMessages("TheRegistrar", clock.nowUtc().plusMonths(1)))
|
||||
.isEmpty();
|
||||
assertThat(getPollMessages("TheRegistrar", clock.nowUtc().plusMonths(1))).isEmpty();
|
||||
// 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.
|
||||
PollMessage gainingPollMessage = getOnlyPollMessage("NewRegistrar");
|
||||
|
@ -564,15 +599,15 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
|
|||
assertThat(panData.getActionResult()).isFalse();
|
||||
// There should be a future poll message to the losing registrar at the deletion time.
|
||||
DateTime deletionTime = domain.getDeletionTime();
|
||||
assertThat(getPollMessages("TheRegistrar", deletionTime.minusMinutes(1)))
|
||||
.isEmpty();
|
||||
assertThat(getPollMessages("TheRegistrar", deletionTime.minusMinutes(1))).isEmpty();
|
||||
assertThat(getPollMessages("TheRegistrar", deletionTime)).hasSize(1);
|
||||
assertOnlyBillingEventIsClosedAutorenew("TheRegistrar");
|
||||
// The domain TransferData should reflect the cancelled transfer as we expect, with
|
||||
// all the speculative server-approve fields nulled out.
|
||||
assertThat(domain.getTransferData())
|
||||
.isEqualTo(
|
||||
oldTransferData.copyConstantFieldsToBuilder()
|
||||
oldTransferData
|
||||
.copyConstantFieldsToBuilder()
|
||||
.setTransferStatus(TransferStatus.SERVER_CANCELLED)
|
||||
.setPendingTransferExpirationTime(clock.nowUtc())
|
||||
.build());
|
||||
|
@ -582,8 +617,8 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
|
|||
assertThat(ofy().load().key(oldTransferData.getServerApproveAutorenewPollMessage()).now())
|
||||
.isNull();
|
||||
assertThat(oldTransferData.getServerApproveEntities()).isNotEmpty(); // Just a sanity check.
|
||||
assertThat(ofy().load()
|
||||
.keys(oldTransferData.getServerApproveEntities().toArray(new Key<?>[]{})))
|
||||
assertThat(
|
||||
ofy().load().keys(oldTransferData.getServerApproveEntities().toArray(new Key<?>[] {})))
|
||||
.isEmpty();
|
||||
}
|
||||
|
||||
|
@ -616,15 +651,15 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
|
|||
runFlowAssertResponse(loadFile("domain_delete_response.xml"));
|
||||
assertDnsTasksEnqueued("example.tld");
|
||||
assertAutorenewClosedAndCancellationCreatedFor(
|
||||
graceBillingEvent,
|
||||
getOnlyHistoryEntryOfType(domain, DOMAIN_DELETE));
|
||||
graceBillingEvent, getOnlyHistoryEntryOfType(domain, DOMAIN_DELETE));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSuccess_deletedSubordinateDomain() throws Exception {
|
||||
setUpSuccessfulTest();
|
||||
persistResource(
|
||||
newHostResource("ns1." + getUniqueIdFromCommand()).asBuilder()
|
||||
newHostResource("ns1." + getUniqueIdFromCommand())
|
||||
.asBuilder()
|
||||
.setSuperordinateDomain(Key.create(reloadResourceByForeignKey()))
|
||||
.setDeletionTime(clock.nowUtc().minusDays(1))
|
||||
.build());
|
||||
|
@ -638,7 +673,8 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
|
|||
public void testFailure_predelegation() throws Exception {
|
||||
createTld("tld", TldState.PREDELEGATION);
|
||||
setUpSuccessfulTest();
|
||||
assertThrows(BadCommandForRegistryPhaseException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(BadCommandForRegistryPhaseException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -668,21 +704,28 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
|
|||
@Test
|
||||
public void testFailure_hasSubordinateHosts() throws Exception {
|
||||
DomainResource domain = persistActiveDomain(getUniqueIdFromCommand());
|
||||
HostResource subordinateHost = persistResource(
|
||||
newHostResource("ns1." + getUniqueIdFromCommand()).asBuilder()
|
||||
HostResource subordinateHost =
|
||||
persistResource(
|
||||
newHostResource("ns1." + getUniqueIdFromCommand())
|
||||
.asBuilder()
|
||||
.setSuperordinateDomain(Key.create(reloadResourceByForeignKey()))
|
||||
.build());
|
||||
domain = persistResource(domain.asBuilder()
|
||||
domain =
|
||||
persistResource(
|
||||
domain
|
||||
.asBuilder()
|
||||
.addSubordinateHost(subordinateHost.getFullyQualifiedHostName())
|
||||
.build());
|
||||
assertThrows(DomainToDeleteHasHostsException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(DomainToDeleteHasHostsException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_unauthorizedClient() throws Exception {
|
||||
sessionMetadata.setClientId("NewRegistrar");
|
||||
persistActiveDomain(getUniqueIdFromCommand());
|
||||
assertThrows(ResourceNotOwnedException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(ResourceNotOwnedException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -699,7 +742,8 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
|
|||
setUpSuccessfulTest();
|
||||
persistResource(
|
||||
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
|
||||
assertThrows(NotAuthorizedForTldException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(NotAuthorizedForTldException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -714,7 +758,9 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
|
|||
|
||||
@Test
|
||||
public void testFailure_clientDeleteProhibited() throws Exception {
|
||||
persistResource(newDomainResource(getUniqueIdFromCommand()).asBuilder()
|
||||
persistResource(
|
||||
newDomainResource(getUniqueIdFromCommand())
|
||||
.asBuilder()
|
||||
.addStatusValue(StatusValue.CLIENT_DELETE_PROHIBITED)
|
||||
.build());
|
||||
ResourceStatusProhibitsOperationException thrown =
|
||||
|
@ -724,7 +770,9 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
|
|||
|
||||
@Test
|
||||
public void testFailure_serverDeleteProhibited() throws Exception {
|
||||
persistResource(newDomainResource(getUniqueIdFromCommand()).asBuilder()
|
||||
persistResource(
|
||||
newDomainResource(getUniqueIdFromCommand())
|
||||
.asBuilder()
|
||||
.addStatusValue(StatusValue.SERVER_DELETE_PROHIBITED)
|
||||
.build());
|
||||
ResourceStatusProhibitsOperationException thrown =
|
||||
|
@ -734,7 +782,9 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
|
|||
|
||||
@Test
|
||||
public void testFailure_pendingDelete() throws Exception {
|
||||
persistResource(newDomainResource(getUniqueIdFromCommand()).asBuilder()
|
||||
persistResource(
|
||||
newDomainResource(getUniqueIdFromCommand())
|
||||
.asBuilder()
|
||||
.addStatusValue(StatusValue.PENDING_DELETE)
|
||||
.build());
|
||||
ResourceStatusProhibitsOperationException thrown =
|
||||
|
@ -749,12 +799,15 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
|
|||
setUpSuccessfulTest();
|
||||
clock.advanceOneMilli();
|
||||
runFlow();
|
||||
assertAboutDomains().that(reloadResourceByForeignKey())
|
||||
assertAboutDomains()
|
||||
.that(reloadResourceByForeignKey())
|
||||
.hasOneHistoryEntryEachOfTypes(DOMAIN_CREATE, DOMAIN_DELETE);
|
||||
assertAboutHistoryEntries()
|
||||
.that(getOnlyHistoryEntryOfType(domain, DOMAIN_DELETE))
|
||||
.hasType(DOMAIN_DELETE).and()
|
||||
.hasMetadataReason("domain-delete-test").and()
|
||||
.hasType(DOMAIN_DELETE)
|
||||
.and()
|
||||
.hasMetadataReason("domain-delete-test")
|
||||
.and()
|
||||
.hasMetadataRequestedByRegistrar(false);
|
||||
}
|
||||
|
||||
|
@ -762,7 +815,8 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
|
|||
public void testFailure_metadataNotFromTool() throws Exception {
|
||||
setEppInput("domain_delete_metadata.xml");
|
||||
persistResource(newDomainResource(getUniqueIdFromCommand()));
|
||||
assertThrows(OnlyToolCanPassMetadataException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(OnlyToolCanPassMetadataException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -23,13 +23,14 @@ import static google.registry.testing.DatastoreHelper.newDomainResource;
|
|||
import static google.registry.testing.DatastoreHelper.persistActiveContact;
|
||||
import static google.registry.testing.DatastoreHelper.persistActiveHost;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
|
||||
import com.google.common.base.Predicates;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.googlecode.objectify.Key;
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.ResourceFlowTestCase;
|
||||
import google.registry.flows.ResourceFlowUtils.BadAuthInfoForResourceException;
|
||||
import google.registry.flows.ResourceFlowUtils.ResourceDoesNotExistException;
|
||||
|
@ -73,8 +74,7 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
|
|||
sessionMetadata.setClientId("NewRegistrar");
|
||||
clock.setTo(DateTime.parse("2005-03-03T22:00:00.000Z"));
|
||||
createTld("tld");
|
||||
persistResource(
|
||||
AppEngineRule.makeRegistrar1().asBuilder().setClientId("ClientZ").build());
|
||||
persistResource(AppEngineRule.makeRegistrar1().asBuilder().setClientId("ClientZ").build());
|
||||
}
|
||||
|
||||
private void persistTestEntities(String domainName, boolean inactive) {
|
||||
|
@ -82,7 +82,9 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
|
|||
contact = persistActiveContact("sh8013");
|
||||
host1 = persistActiveHost("ns1.example.tld");
|
||||
host2 = persistActiveHost("ns1.example.net");
|
||||
domain = persistResource(new DomainResource.Builder()
|
||||
domain =
|
||||
persistResource(
|
||||
new DomainResource.Builder()
|
||||
.setFullyQualifiedDomainName(domainName)
|
||||
.setRepoId("2FF-TLD")
|
||||
.setPersistedCurrentSponsorClientId("NewRegistrar")
|
||||
|
@ -93,28 +95,33 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
|
|||
.setLastTransferTime(DateTime.parse("2000-04-08T09:00:00.0Z"))
|
||||
.setRegistrationExpirationTime(DateTime.parse("2005-04-03T22:00:00.0Z"))
|
||||
.setRegistrant(Key.create(registrant))
|
||||
.setContacts(ImmutableSet.of(
|
||||
.setContacts(
|
||||
ImmutableSet.of(
|
||||
DesignatedContact.create(Type.ADMIN, Key.create(contact)),
|
||||
DesignatedContact.create(Type.TECH, Key.create(contact))))
|
||||
.setNameservers(inactive ? null : ImmutableSet.of(Key.create(host1), Key.create(host2)))
|
||||
.setNameservers(
|
||||
inactive ? null : ImmutableSet.of(Key.create(host1), Key.create(host2)))
|
||||
.setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("2fooBAR")))
|
||||
.build());
|
||||
// Set the superordinate domain of ns1.example.com to example.com. In reality, this would have
|
||||
// happened in the flow that created it, but here we just overwrite it in Datastore.
|
||||
host1 = persistResource(
|
||||
host1.asBuilder().setSuperordinateDomain(Key.create(domain)).build());
|
||||
host1 = persistResource(host1.asBuilder().setSuperordinateDomain(Key.create(domain)).build());
|
||||
// Create a subordinate host that is not delegated to by anyone.
|
||||
host3 = persistResource(
|
||||
host3 =
|
||||
persistResource(
|
||||
new HostResource.Builder()
|
||||
.setFullyQualifiedHostName("ns2.example.tld")
|
||||
.setRepoId("3FF-TLD")
|
||||
.setSuperordinateDomain(Key.create(domain))
|
||||
.build());
|
||||
// Add the subordinate host keys to the existing domain.
|
||||
domain = persistResource(domain.asBuilder()
|
||||
.setSubordinateHosts(ImmutableSet.of(
|
||||
host1.getFullyQualifiedHostName(),
|
||||
host3.getFullyQualifiedHostName()))
|
||||
domain =
|
||||
persistResource(
|
||||
domain
|
||||
.asBuilder()
|
||||
.setSubordinateHosts(
|
||||
ImmutableSet.of(
|
||||
host1.getFullyQualifiedHostName(), host3.getFullyQualifiedHostName()))
|
||||
.build());
|
||||
}
|
||||
|
||||
|
@ -239,8 +246,12 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
|
|||
public void testSuccess_secDns() throws Exception {
|
||||
persistTestEntities(false);
|
||||
// Add the dsData to the saved resource and change the nameservers to match the sample xml.
|
||||
persistResource(domain.asBuilder()
|
||||
.setDsData(ImmutableSet.of(DelegationSignerData.create(
|
||||
persistResource(
|
||||
domain
|
||||
.asBuilder()
|
||||
.setDsData(
|
||||
ImmutableSet.of(
|
||||
DelegationSignerData.create(
|
||||
12345, 3, 1, base16().decode("49FD46E6C4B45C55D4AC"))))
|
||||
.setNameservers(ImmutableSet.of(Key.create(host1), Key.create(host3)))
|
||||
.build());
|
||||
|
@ -251,7 +262,9 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
|
|||
persistTestEntities(false);
|
||||
// Add the grace period to the saved resource, and change a few other fields to match the sample
|
||||
// xml.
|
||||
persistResource(domain.asBuilder()
|
||||
persistResource(
|
||||
domain
|
||||
.asBuilder()
|
||||
.addGracePeriod(
|
||||
GracePeriod.create(gracePeriodStatus, clock.nowUtc().plusDays(1), "foo", null))
|
||||
.setCreationClientId("NewRegistrar")
|
||||
|
@ -278,8 +291,11 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
|
|||
public void testSuccess_autoRenewGracePeriod() throws Exception {
|
||||
persistTestEntities(false);
|
||||
// Add an AUTO_RENEW grace period to the saved resource.
|
||||
persistResource(domain.asBuilder()
|
||||
.addGracePeriod(GracePeriod.createForRecurring(
|
||||
persistResource(
|
||||
domain
|
||||
.asBuilder()
|
||||
.addGracePeriod(
|
||||
GracePeriod.createForRecurring(
|
||||
GracePeriodStatus.AUTO_RENEW,
|
||||
clock.nowUtc().plusDays(1),
|
||||
"foo",
|
||||
|
@ -293,8 +309,11 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
|
|||
persistTestEntities(false);
|
||||
// Add an REDEMPTION grace period to the saved resource, and change a few other fields to match
|
||||
// the sample xml.
|
||||
persistResource(domain.asBuilder()
|
||||
.addGracePeriod(GracePeriod.create(
|
||||
persistResource(
|
||||
domain
|
||||
.asBuilder()
|
||||
.addGracePeriod(
|
||||
GracePeriod.create(
|
||||
GracePeriodStatus.REDEMPTION, clock.nowUtc().plusDays(1), "foo", null))
|
||||
.setStatusValues(ImmutableSet.of(StatusValue.PENDING_DELETE))
|
||||
.build());
|
||||
|
@ -305,9 +324,12 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
|
|||
public void testSuccess_renewGracePeriod() throws Exception {
|
||||
persistTestEntities(false);
|
||||
// Add an RENEW grace period to the saved resource.
|
||||
persistResource(domain.asBuilder()
|
||||
persistResource(
|
||||
domain
|
||||
.asBuilder()
|
||||
.addGracePeriod(
|
||||
GracePeriod.create(GracePeriodStatus.RENEW, clock.nowUtc().plusDays(1), "foo", null))
|
||||
GracePeriod.create(
|
||||
GracePeriodStatus.RENEW, clock.nowUtc().plusDays(1), "foo", null))
|
||||
.build());
|
||||
doSuccessfulTest("domain_info_response_renewperiod.xml", false);
|
||||
}
|
||||
|
@ -316,11 +338,15 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
|
|||
public void testSuccess_multipleRenewGracePeriods() throws Exception {
|
||||
persistTestEntities(false);
|
||||
// Add multiple RENEW grace periods to the saved resource.
|
||||
persistResource(domain.asBuilder()
|
||||
persistResource(
|
||||
domain
|
||||
.asBuilder()
|
||||
.addGracePeriod(
|
||||
GracePeriod.create(GracePeriodStatus.RENEW, clock.nowUtc().plusDays(1), "foo", null))
|
||||
GracePeriod.create(
|
||||
GracePeriodStatus.RENEW, clock.nowUtc().plusDays(1), "foo", null))
|
||||
.addGracePeriod(
|
||||
GracePeriod.create(GracePeriodStatus.RENEW, clock.nowUtc().plusDays(2), "foo", null))
|
||||
GracePeriod.create(
|
||||
GracePeriodStatus.RENEW, clock.nowUtc().plusDays(2), "foo", null))
|
||||
.build());
|
||||
doSuccessfulTest("domain_info_response_renewperiod.xml", false);
|
||||
}
|
||||
|
@ -329,8 +355,11 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
|
|||
public void testSuccess_transferGracePeriod() throws Exception {
|
||||
persistTestEntities(false);
|
||||
// Add an TRANSFER grace period to the saved resource.
|
||||
persistResource(domain.asBuilder()
|
||||
.addGracePeriod(GracePeriod.create(
|
||||
persistResource(
|
||||
domain
|
||||
.asBuilder()
|
||||
.addGracePeriod(
|
||||
GracePeriod.create(
|
||||
GracePeriodStatus.TRANSFER, clock.nowUtc().plusDays(1), "foo", null))
|
||||
.build());
|
||||
doSuccessfulTest("domain_info_response_transferperiod.xml", false);
|
||||
|
@ -341,9 +370,8 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
|
|||
persistTestEntities(false);
|
||||
// Set the domain to be pending delete with no grace period, which will cause an RGP status of
|
||||
// pending delete to show up, too.
|
||||
persistResource(domain.asBuilder()
|
||||
.setStatusValues(ImmutableSet.of(StatusValue.PENDING_DELETE))
|
||||
.build());
|
||||
persistResource(
|
||||
domain.asBuilder().setStatusValues(ImmutableSet.of(StatusValue.PENDING_DELETE)).build());
|
||||
doSuccessfulTest("domain_info_response_pendingdelete.xml", false);
|
||||
}
|
||||
|
||||
|
@ -351,11 +379,14 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
|
|||
public void testSuccess_stackedAddRenewGracePeriods() throws Exception {
|
||||
persistTestEntities(false);
|
||||
// Add both an ADD and RENEW grace period, both which should show up in the RGP status.
|
||||
persistResource(domain.asBuilder()
|
||||
persistResource(
|
||||
domain
|
||||
.asBuilder()
|
||||
.addGracePeriod(
|
||||
GracePeriod.create(GracePeriodStatus.ADD, clock.nowUtc().plusDays(1), "foo", null))
|
||||
.addGracePeriod(
|
||||
GracePeriod.create(GracePeriodStatus.RENEW, clock.nowUtc().plusDays(2), "foo", null))
|
||||
GracePeriod.create(
|
||||
GracePeriodStatus.RENEW, clock.nowUtc().plusDays(2), "foo", null))
|
||||
.build());
|
||||
doSuccessfulTest("domain_info_response_stackedaddrenewperiod.xml", false);
|
||||
}
|
||||
|
@ -364,10 +395,14 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
|
|||
public void testSuccess_secDnsAndAddGracePeriod() throws Exception {
|
||||
persistTestEntities(false);
|
||||
// Add both an ADD grace period and SecDNS data.
|
||||
persistResource(domain.asBuilder()
|
||||
persistResource(
|
||||
domain
|
||||
.asBuilder()
|
||||
.addGracePeriod(
|
||||
GracePeriod.create(GracePeriodStatus.ADD, clock.nowUtc().plusDays(1), "foo", null))
|
||||
.setDsData(ImmutableSet.of(DelegationSignerData.create(
|
||||
.setDsData(
|
||||
ImmutableSet.of(
|
||||
DelegationSignerData.create(
|
||||
12345, 3, 1, base16().decode("49FD46E6C4B45C55D4AC"))))
|
||||
.build());
|
||||
doSuccessfulTest("domain_info_response_dsdata_addperiod.xml", false);
|
||||
|
@ -382,7 +417,9 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
|
|||
|
||||
@Test
|
||||
public void testFailure_existedButWasDeleted() throws Exception {
|
||||
persistResource(newDomainResource("example.tld").asBuilder()
|
||||
persistResource(
|
||||
newDomainResource("example.tld")
|
||||
.asBuilder()
|
||||
.setDeletionTime(clock.nowUtc().minusDays(1))
|
||||
.build());
|
||||
ResourceDoesNotExistException thrown =
|
||||
|
@ -394,81 +431,99 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
|
|||
public void testFailure_differentRegistrarWrongAuthInfo() throws Exception {
|
||||
persistTestEntities(false);
|
||||
// Change the password of the domain so that it does not match the file.
|
||||
persistResource(domain.asBuilder()
|
||||
persistResource(
|
||||
domain
|
||||
.asBuilder()
|
||||
.setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("diffpw")))
|
||||
.build());
|
||||
sessionMetadata.setClientId("ClientZ");
|
||||
setEppInput("domain_info_with_auth.xml");
|
||||
assertThrows(BadAuthInfoForResourceException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(BadAuthInfoForResourceException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_wrongAuthInfo() throws Exception {
|
||||
persistTestEntities(false);
|
||||
// Change the password of the domain so that it does not match the file.
|
||||
persistResource(domain.asBuilder()
|
||||
persistResource(
|
||||
domain
|
||||
.asBuilder()
|
||||
.setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("diffpw")))
|
||||
.build());
|
||||
setEppInput("domain_info_with_auth.xml");
|
||||
assertThrows(BadAuthInfoForResourceException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(BadAuthInfoForResourceException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_differentRegistrarWrongRegistrantAuthInfo() throws Exception {
|
||||
persistTestEntities(false);
|
||||
// Change the password of the registrant so that it does not match the file.
|
||||
registrant = persistResource(
|
||||
registrant.asBuilder()
|
||||
registrant =
|
||||
persistResource(
|
||||
registrant
|
||||
.asBuilder()
|
||||
.setAuthInfo(ContactAuthInfo.create(PasswordAuth.create("diffpw")))
|
||||
.build());
|
||||
sessionMetadata.setClientId("ClientZ");
|
||||
setEppInput("domain_info_with_contact_auth.xml");
|
||||
// Replace the ROID in the xml file with the one for our registrant.
|
||||
eppLoader.replaceAll("JD1234-REP", registrant.getRepoId());
|
||||
assertThrows(BadAuthInfoForResourceException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(BadAuthInfoForResourceException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_wrongRegistrantAuthInfo() throws Exception {
|
||||
persistTestEntities(false);
|
||||
// Change the password of the registrant so that it does not match the file.
|
||||
registrant = persistResource(
|
||||
registrant.asBuilder()
|
||||
registrant =
|
||||
persistResource(
|
||||
registrant
|
||||
.asBuilder()
|
||||
.setAuthInfo(ContactAuthInfo.create(PasswordAuth.create("diffpw")))
|
||||
.build());
|
||||
setEppInput("domain_info_with_contact_auth.xml");
|
||||
// Replace the ROID in the xml file with the one for our registrant.
|
||||
eppLoader.replaceAll("JD1234-REP", registrant.getRepoId());
|
||||
assertThrows(BadAuthInfoForResourceException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(BadAuthInfoForResourceException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_differentRegistrarWrongContactAuthInfo() throws Exception {
|
||||
persistTestEntities(false);
|
||||
// Change the password of the contact so that it does not match the file.
|
||||
contact = persistResource(
|
||||
contact.asBuilder()
|
||||
contact =
|
||||
persistResource(
|
||||
contact
|
||||
.asBuilder()
|
||||
.setAuthInfo(ContactAuthInfo.create(PasswordAuth.create("diffpw")))
|
||||
.build());
|
||||
sessionMetadata.setClientId("ClientZ");
|
||||
setEppInput("domain_info_with_contact_auth.xml");
|
||||
// Replace the ROID in the xml file with the one for our contact.
|
||||
eppLoader.replaceAll("JD1234-REP", contact.getRepoId());
|
||||
assertThrows(BadAuthInfoForResourceException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(BadAuthInfoForResourceException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_wrongContactAuthInfo() throws Exception {
|
||||
persistTestEntities(false);
|
||||
// Change the password of the contact so that it does not match the file.
|
||||
contact = persistResource(
|
||||
contact.asBuilder()
|
||||
contact =
|
||||
persistResource(
|
||||
contact
|
||||
.asBuilder()
|
||||
.setAuthInfo(ContactAuthInfo.create(PasswordAuth.create("diffpw")))
|
||||
.build());
|
||||
setEppInput("domain_info_with_contact_auth.xml");
|
||||
// Replace the ROID in the xml file with the one for our contact.
|
||||
eppLoader.replaceAll("JD1234-REP", contact.getRepoId());
|
||||
assertThrows(BadAuthInfoForResourceException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(BadAuthInfoForResourceException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -479,7 +534,8 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
|
|||
setEppInput("domain_info_with_contact_auth.xml");
|
||||
// Replace the ROID in the xml file with the one for our unrelated contact.
|
||||
eppLoader.replaceAll("JD1234-REP", unrelatedContact.getRepoId());
|
||||
assertThrows(BadAuthInfoForResourceException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(BadAuthInfoForResourceException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -489,12 +545,13 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
|
|||
setEppInput("domain_info_with_contact_auth.xml");
|
||||
// Replace the ROID in the xml file with the one for our unrelated contact.
|
||||
eppLoader.replaceAll("JD1234-REP", unrelatedContact.getRepoId());
|
||||
assertThrows(BadAuthInfoForResourceException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(BadAuthInfoForResourceException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test create command. Fee extension version 6 is the only one which supports fee extensions
|
||||
* on info commands and responses, so we don't need to test the other versions.
|
||||
* Test create command. Fee extension version 6 is the only one which supports fee extensions on
|
||||
* info commands and responses, so we don't need to test the other versions.
|
||||
*/
|
||||
@Test
|
||||
public void testFeeExtension_createCommand() throws Exception {
|
||||
|
@ -568,7 +625,8 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
|
|||
public void testFeeExtension_wrongCurrency() throws Exception {
|
||||
setEppInput("domain_info_fee_create_euro.xml");
|
||||
persistTestEntities(false);
|
||||
assertThrows(CurrencyUnitMismatchException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(CurrencyUnitMismatchException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
/** Test requesting a period that isn't in years. */
|
||||
|
@ -576,7 +634,8 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
|
|||
public void testFeeExtension_periodNotInYears() throws Exception {
|
||||
setEppInput("domain_info_fee_bad_period.xml");
|
||||
persistTestEntities(false);
|
||||
assertThrows(BadPeriodUnitException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(BadPeriodUnitException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
/** Test a command that specifies a phase. */
|
||||
|
@ -584,7 +643,8 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
|
|||
public void testFeeExtension_commandPhase() throws Exception {
|
||||
setEppInput("domain_info_fee_command_phase.xml");
|
||||
persistTestEntities(false);
|
||||
assertThrows(FeeChecksDontSupportPhasesException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(FeeChecksDontSupportPhasesException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
/** Test a command that specifies a subphase. */
|
||||
|
@ -592,7 +652,8 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
|
|||
public void testFeeExtension_commandSubphase() throws Exception {
|
||||
setEppInput("domain_info_fee_command_subphase.xml");
|
||||
persistTestEntities(false);
|
||||
assertThrows(FeeChecksDontSupportPhasesException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(FeeChecksDontSupportPhasesException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
/** Test a restore for more than one year. */
|
||||
|
@ -600,7 +661,8 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
|
|||
public void testFeeExtension_multiyearRestore() throws Exception {
|
||||
setEppInput("domain_info_fee_multiyear_restore.xml");
|
||||
persistTestEntities(false);
|
||||
assertThrows(RestoresAreAlwaysForOneYearException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(RestoresAreAlwaysForOneYearException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
/** Test a transfer for more than one year. */
|
||||
|
@ -608,7 +670,8 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
|
|||
public void testFeeExtension_multiyearTransfer() throws Exception {
|
||||
setEppInput("domain_info_fee_multiyear_transfer.xml");
|
||||
persistTestEntities(false);
|
||||
assertThrows(TransfersAreAlwaysForOneYearException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(TransfersAreAlwaysForOneYearException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
/** Test that we load contacts and hosts as a batch rather than individually. */
|
||||
|
|
|
@ -26,8 +26,8 @@ import static google.registry.testing.DatastoreHelper.persistActiveDomain;
|
|||
import static google.registry.testing.DatastoreHelper.persistDeletedDomain;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
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.JUnitBackports.assertThrows;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
||||
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||
|
@ -38,6 +38,7 @@ import com.google.common.collect.ImmutableMap;
|
|||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.ImmutableSortedMap;
|
||||
import com.googlecode.objectify.Key;
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.ResourceFlowTestCase;
|
||||
import google.registry.flows.ResourceFlowUtils.ResourceDoesNotExistException;
|
||||
import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException;
|
||||
|
@ -94,12 +95,14 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
|
|||
|
||||
private void persistDomain(StatusValue... statusValues) throws Exception {
|
||||
DomainResource domain = newDomainResource(getUniqueIdFromCommand());
|
||||
HistoryEntry historyEntryDomainCreate = persistResource(
|
||||
HistoryEntry historyEntryDomainCreate =
|
||||
persistResource(
|
||||
new HistoryEntry.Builder()
|
||||
.setParent(domain)
|
||||
.setType(HistoryEntry.Type.DOMAIN_CREATE)
|
||||
.build());
|
||||
BillingEvent.Recurring autorenewEvent = persistResource(
|
||||
BillingEvent.Recurring autorenewEvent =
|
||||
persistResource(
|
||||
new BillingEvent.Recurring.Builder()
|
||||
.setReason(Reason.RENEW)
|
||||
.setFlags(ImmutableSet.of(Flag.AUTO_RENEW))
|
||||
|
@ -109,7 +112,8 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
|
|||
.setRecurrenceEndTime(END_OF_TIME)
|
||||
.setParent(historyEntryDomainCreate)
|
||||
.build());
|
||||
PollMessage.Autorenew autorenewPollMessage = persistResource(
|
||||
PollMessage.Autorenew autorenewPollMessage =
|
||||
persistResource(
|
||||
new PollMessage.Autorenew.Builder()
|
||||
.setTargetId(getUniqueIdFromCommand())
|
||||
.setClientId("TheRegistrar")
|
||||
|
@ -118,7 +122,10 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
|
|||
.setMsg("Domain was auto-renewed.")
|
||||
.setParent(historyEntryDomainCreate)
|
||||
.build());
|
||||
domain = persistResource(domain.asBuilder()
|
||||
domain =
|
||||
persistResource(
|
||||
domain
|
||||
.asBuilder()
|
||||
.setRegistrationExpirationTime(expirationTime)
|
||||
.setStatusValues(ImmutableSet.copyOf(statusValues))
|
||||
.setAutorenewBillingEvent(Key.create(autorenewEvent))
|
||||
|
@ -145,7 +152,8 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
|
|||
String responseFilename,
|
||||
int renewalYears,
|
||||
Map<String, String> substitutions,
|
||||
Money totalRenewCost) throws Exception {
|
||||
Money totalRenewCost)
|
||||
throws Exception {
|
||||
assertTransactionalFlow(true);
|
||||
DateTime currentExpiration = reloadResourceByForeignKey().getRegistrationExpirationTime();
|
||||
DateTime newExpiration = currentExpiration.plusYears(renewalYears);
|
||||
|
@ -155,14 +163,17 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
|
|||
getOnlyHistoryEntryOfType(domain, HistoryEntry.Type.DOMAIN_RENEW);
|
||||
assertThat(ofy().load().key(domain.getAutorenewBillingEvent()).now().getEventTime())
|
||||
.isEqualTo(newExpiration);
|
||||
assertAboutDomains().that(domain)
|
||||
.isActiveAt(clock.nowUtc()).and()
|
||||
.hasRegistrationExpirationTime(newExpiration).and()
|
||||
assertAboutDomains()
|
||||
.that(domain)
|
||||
.isActiveAt(clock.nowUtc())
|
||||
.and()
|
||||
.hasRegistrationExpirationTime(newExpiration)
|
||||
.and()
|
||||
.hasOneHistoryEntryEachOfTypes(
|
||||
HistoryEntry.Type.DOMAIN_CREATE,
|
||||
HistoryEntry.Type.DOMAIN_RENEW);
|
||||
HistoryEntry.Type.DOMAIN_CREATE, HistoryEntry.Type.DOMAIN_RENEW);
|
||||
assertAboutHistoryEntries().that(historyEntryDomainRenew).hasPeriodYears(renewalYears);
|
||||
BillingEvent.OneTime renewBillingEvent = new BillingEvent.OneTime.Builder()
|
||||
BillingEvent.OneTime renewBillingEvent =
|
||||
new BillingEvent.OneTime.Builder()
|
||||
.setReason(Reason.RENEW)
|
||||
.setTargetId(getUniqueIdFromCommand())
|
||||
.setClientId("TheRegistrar")
|
||||
|
@ -293,63 +304,72 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
|
|||
public void testFailure_refundableFee_v06() throws Exception {
|
||||
setEppInput("domain_renew_fee_refundable.xml", FEE_06_MAP);
|
||||
persistDomain();
|
||||
assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_refundableFee_v11() throws Exception {
|
||||
setEppInput("domain_renew_fee_refundable.xml", FEE_11_MAP);
|
||||
persistDomain();
|
||||
assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_refundableFee_v12() throws Exception {
|
||||
setEppInput("domain_renew_fee_refundable.xml", FEE_12_MAP);
|
||||
persistDomain();
|
||||
assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_gracePeriodFee_v06() throws Exception {
|
||||
setEppInput("domain_renew_fee_grace_period.xml", FEE_06_MAP);
|
||||
persistDomain();
|
||||
assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_gracePeriodFee_v11() throws Exception {
|
||||
setEppInput("domain_renew_fee_grace_period.xml", FEE_11_MAP);
|
||||
persistDomain();
|
||||
assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_gracePeriodFee_v12() throws Exception {
|
||||
setEppInput("domain_renew_fee_grace_period.xml", FEE_12_MAP);
|
||||
persistDomain();
|
||||
assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_appliedFee_v06() throws Exception {
|
||||
setEppInput("domain_renew_fee_applied.xml", FEE_06_MAP);
|
||||
persistDomain();
|
||||
assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_appliedFee_v11() throws Exception {
|
||||
setEppInput("domain_renew_fee_applied.xml", FEE_11_MAP);
|
||||
persistDomain();
|
||||
assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_appliedFee_v12() throws Exception {
|
||||
setEppInput("domain_renew_fee_applied.xml", FEE_12_MAP);
|
||||
persistDomain();
|
||||
assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -375,7 +395,11 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
|
|||
persistDomain();
|
||||
// Modify the autorenew poll message so that it has an undelivered message in the past.
|
||||
persistResource(
|
||||
ofy().load().key(reloadResourceByForeignKey().getAutorenewPollMessage()).now().asBuilder()
|
||||
ofy()
|
||||
.load()
|
||||
.key(reloadResourceByForeignKey().getAutorenewPollMessage())
|
||||
.now()
|
||||
.asBuilder()
|
||||
.setEventTime(expirationTime.minusYears(1))
|
||||
.build());
|
||||
runFlowAssertResponse(loadFile("domain_renew_response.xml"));
|
||||
|
@ -388,7 +412,8 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
|
|||
.setEventTime(expirationTime.minusYears(1))
|
||||
.setAutorenewEndTime(clock.nowUtc())
|
||||
.setMsg("Domain was auto-renewed.")
|
||||
.setParent(getOnlyHistoryEntryOfType(
|
||||
.setParent(
|
||||
getOnlyHistoryEntryOfType(
|
||||
reloadResourceByForeignKey(), HistoryEntry.Type.DOMAIN_CREATE))
|
||||
.build(),
|
||||
new PollMessage.Autorenew.Builder()
|
||||
|
@ -434,7 +459,9 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
|
|||
|
||||
@Test
|
||||
public void testFailure_pendingDelete() throws Exception {
|
||||
persistResource(newDomainResource(getUniqueIdFromCommand()).asBuilder()
|
||||
persistResource(
|
||||
newDomainResource(getUniqueIdFromCommand())
|
||||
.asBuilder()
|
||||
.setRegistrationExpirationTime(expirationTime)
|
||||
.setDeletionTime(clock.nowUtc().plusDays(1))
|
||||
.addStatusValue(StatusValue.PENDING_DELETE)
|
||||
|
@ -453,7 +480,8 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
|
|||
.setRenewBillingCostTransitions(ImmutableSortedMap.of(START_OF_TIME, Money.of(USD, 20)))
|
||||
.build());
|
||||
persistDomain();
|
||||
assertThrows(FeesMismatchException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(FeesMismatchException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -465,7 +493,8 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
|
|||
.setRenewBillingCostTransitions(ImmutableSortedMap.of(START_OF_TIME, Money.of(USD, 20)))
|
||||
.build());
|
||||
persistDomain();
|
||||
assertThrows(FeesMismatchException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(FeesMismatchException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -477,7 +506,8 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
|
|||
.setRenewBillingCostTransitions(ImmutableSortedMap.of(START_OF_TIME, Money.of(USD, 20)))
|
||||
.build());
|
||||
persistDomain();
|
||||
assertThrows(FeesMismatchException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(FeesMismatchException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -494,7 +524,8 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
|
|||
.setServerStatusChangeBillingCost(Money.of(EUR, 19))
|
||||
.build());
|
||||
persistDomain();
|
||||
assertThrows(CurrencyUnitMismatchException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(CurrencyUnitMismatchException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -511,7 +542,8 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
|
|||
.setServerStatusChangeBillingCost(Money.of(EUR, 19))
|
||||
.build());
|
||||
persistDomain();
|
||||
assertThrows(CurrencyUnitMismatchException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(CurrencyUnitMismatchException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -528,34 +560,39 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
|
|||
.setServerStatusChangeBillingCost(Money.of(EUR, 19))
|
||||
.build());
|
||||
persistDomain();
|
||||
assertThrows(CurrencyUnitMismatchException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(CurrencyUnitMismatchException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_feeGivenInWrongScale_v06() throws Exception {
|
||||
setEppInput("domain_renew_fee_bad_scale.xml", FEE_06_MAP);
|
||||
persistDomain();
|
||||
assertThrows(CurrencyValueScaleException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(CurrencyValueScaleException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_feeGivenInWrongScale_v11() throws Exception {
|
||||
setEppInput("domain_renew_fee_bad_scale.xml", FEE_11_MAP);
|
||||
persistDomain();
|
||||
assertThrows(CurrencyValueScaleException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(CurrencyValueScaleException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_feeGivenInWrongScale_v12() throws Exception {
|
||||
setEppInput("domain_renew_fee_bad_scale.xml", FEE_12_MAP);
|
||||
persistDomain();
|
||||
assertThrows(CurrencyValueScaleException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(CurrencyValueScaleException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_pendingTransfer() throws Exception {
|
||||
persistDomain();
|
||||
persistWithPendingTransfer(reloadResourceByForeignKey()
|
||||
persistWithPendingTransfer(
|
||||
reloadResourceByForeignKey()
|
||||
.asBuilder()
|
||||
.setRegistrationExpirationTime(DateTime.parse("2001-09-08T22:00:00.0Z"))
|
||||
.build());
|
||||
|
@ -568,31 +605,38 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
|
|||
public void testFailure_periodInMonths() throws Exception {
|
||||
setEppInput("domain_renew_months.xml");
|
||||
persistDomain();
|
||||
assertThrows(BadPeriodUnitException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(BadPeriodUnitException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_max10Years() throws Exception {
|
||||
setEppInput("domain_renew_11_years.xml");
|
||||
persistDomain();
|
||||
assertThrows(ExceedsMaxRegistrationYearsException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(ExceedsMaxRegistrationYearsException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_curExpDateMustMatch() throws Exception {
|
||||
persistDomain();
|
||||
// Note expiration time is off by one day.
|
||||
persistResource(reloadResourceByForeignKey().asBuilder()
|
||||
persistResource(
|
||||
reloadResourceByForeignKey()
|
||||
.asBuilder()
|
||||
.setRegistrationExpirationTime(DateTime.parse("2000-04-04T22:00:00.0Z"))
|
||||
.build());
|
||||
assertThrows(IncorrectCurrentExpirationDateException.class, this::runFlow);
|
||||
EppException thrown =
|
||||
expectThrows(IncorrectCurrentExpirationDateException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_unauthorizedClient() throws Exception {
|
||||
sessionMetadata.setClientId("NewRegistrar");
|
||||
persistActiveDomain(getUniqueIdFromCommand());
|
||||
assertThrows(ResourceNotOwnedException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(ResourceNotOwnedException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -608,7 +652,8 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
|
|||
persistResource(
|
||||
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
|
||||
persistDomain();
|
||||
assertThrows(NotAuthorizedForTldException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(NotAuthorizedForTldException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -626,7 +671,8 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
|
|||
persistResource(Registry.get("example").asBuilder().setPremiumPriceAckRequired(true).build());
|
||||
setEppInput("domain_renew_premium.xml");
|
||||
persistDomain();
|
||||
assertThrows(FeesRequiredForPremiumNameException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(FeesRequiredForPremiumNameException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -648,9 +694,9 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
|
|||
.build());
|
||||
runFlow();
|
||||
DomainResource domain = reloadResourceByForeignKey();
|
||||
HistoryEntry historyEntry =
|
||||
getOnlyHistoryEntryOfType(domain, HistoryEntry.Type.DOMAIN_RENEW);
|
||||
assertThat(historyEntry.getDomainTransactionRecords()).containsExactly(
|
||||
HistoryEntry historyEntry = getOnlyHistoryEntryOfType(domain, HistoryEntry.Type.DOMAIN_RENEW);
|
||||
assertThat(historyEntry.getDomainTransactionRecords())
|
||||
.containsExactly(
|
||||
DomainTransactionRecord.create(
|
||||
"tld",
|
||||
historyEntry.getModificationTime().plusMinutes(9),
|
||||
|
|
|
@ -27,7 +27,7 @@ import static google.registry.testing.DatastoreHelper.persistDeletedDomain;
|
|||
import static google.registry.testing.DatastoreHelper.persistReservedList;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
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.TaskQueueHelper.assertDnsTasksEnqueued;
|
||||
import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
||||
|
@ -39,6 +39,7 @@ import com.google.common.collect.ImmutableMap;
|
|||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.ImmutableSortedMap;
|
||||
import com.googlecode.objectify.Key;
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.EppException.UnimplementedExtensionException;
|
||||
import google.registry.flows.ResourceFlowTestCase;
|
||||
import google.registry.flows.ResourceFlowUtils.ResourceDoesNotExistException;
|
||||
|
@ -71,8 +72,8 @@ import org.junit.Before;
|
|||
import org.junit.Test;
|
||||
|
||||
/** Unit tests for {@link DomainRestoreRequestFlow}. */
|
||||
public class DomainRestoreRequestFlowTest extends
|
||||
ResourceFlowTestCase<DomainRestoreRequestFlow, DomainResource> {
|
||||
public class DomainRestoreRequestFlowTest
|
||||
extends ResourceFlowTestCase<DomainRestoreRequestFlow, DomainResource> {
|
||||
|
||||
private static final ImmutableMap<String, String> FEE_06_MAP =
|
||||
ImmutableMap.of("FEE_VERSION", "0.6", "FEE_NS", "fee");
|
||||
|
@ -92,18 +93,25 @@ public class DomainRestoreRequestFlowTest extends
|
|||
|
||||
void persistPendingDeleteDomain() throws Exception {
|
||||
DomainResource domain = newDomainResource(getUniqueIdFromCommand());
|
||||
HistoryEntry historyEntry = persistResource(
|
||||
HistoryEntry historyEntry =
|
||||
persistResource(
|
||||
new HistoryEntry.Builder()
|
||||
.setType(HistoryEntry.Type.DOMAIN_DELETE)
|
||||
.setParent(domain)
|
||||
.build());
|
||||
domain = persistResource(domain.asBuilder()
|
||||
domain =
|
||||
persistResource(
|
||||
domain
|
||||
.asBuilder()
|
||||
.setRegistrationExpirationTime(clock.nowUtc().plusYears(5).plusDays(45))
|
||||
.setDeletionTime(clock.nowUtc().plusDays(35))
|
||||
.addGracePeriod(GracePeriod.create(
|
||||
.addGracePeriod(
|
||||
GracePeriod.create(
|
||||
GracePeriodStatus.REDEMPTION, clock.nowUtc().plusDays(1), "foo", null))
|
||||
.setStatusValues(ImmutableSet.of(StatusValue.PENDING_DELETE))
|
||||
.setDeletePollMessage(Key.create(persistResource(
|
||||
.setDeletePollMessage(
|
||||
Key.create(
|
||||
persistResource(
|
||||
new PollMessage.OneTime.Builder()
|
||||
.setClientId("TheRegistrar")
|
||||
.setEventTime(clock.nowUtc().plusDays(5))
|
||||
|
@ -126,22 +134,24 @@ public class DomainRestoreRequestFlowTest extends
|
|||
persistPendingDeleteDomain();
|
||||
assertTransactionalFlow(true);
|
||||
// Double check that we see a poll message in the future for when the delete happens.
|
||||
assertThat(getPollMessages("TheRegistrar", clock.nowUtc().plusMonths(1)))
|
||||
.hasSize(1);
|
||||
assertThat(getPollMessages("TheRegistrar", clock.nowUtc().plusMonths(1))).hasSize(1);
|
||||
runFlowAssertResponse(loadFile("domain_update_response.xml"));
|
||||
DomainResource domain = reloadResourceByForeignKey();
|
||||
HistoryEntry historyEntryDomainRestore =
|
||||
getOnlyHistoryEntryOfType(domain, HistoryEntry.Type.DOMAIN_RESTORE);
|
||||
assertThat(ofy().load().key(domain.getAutorenewBillingEvent()).now().getEventTime())
|
||||
.isEqualTo(clock.nowUtc().plusYears(1));
|
||||
assertAboutDomains().that(domain)
|
||||
assertAboutDomains()
|
||||
.that(domain)
|
||||
// New expiration time should be exactly a year from now.
|
||||
.hasRegistrationExpirationTime(clock.nowUtc().plusYears(1)).and()
|
||||
.doesNotHaveStatusValue(StatusValue.PENDING_DELETE).and()
|
||||
.hasDeletionTime(END_OF_TIME).and()
|
||||
.hasRegistrationExpirationTime(clock.nowUtc().plusYears(1))
|
||||
.and()
|
||||
.doesNotHaveStatusValue(StatusValue.PENDING_DELETE)
|
||||
.and()
|
||||
.hasDeletionTime(END_OF_TIME)
|
||||
.and()
|
||||
.hasOneHistoryEntryEachOfTypes(
|
||||
HistoryEntry.Type.DOMAIN_DELETE,
|
||||
HistoryEntry.Type.DOMAIN_RESTORE);
|
||||
HistoryEntry.Type.DOMAIN_DELETE, HistoryEntry.Type.DOMAIN_RESTORE);
|
||||
assertThat(domain.getGracePeriods()).isEmpty();
|
||||
assertDnsTasksEnqueued("example.tld");
|
||||
// The poll message for the delete should now be gone. The only poll message should be the new
|
||||
|
@ -209,6 +219,7 @@ public class DomainRestoreRequestFlowTest extends
|
|||
persistPendingDeleteDomain();
|
||||
runFlowAssertResponse(loadFile("domain_update_restore_request_response_fee.xml", FEE_12_MAP));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSuccess_fee_withDefaultAttributes_v06() throws Exception {
|
||||
setEppInput("domain_update_restore_request_fee_defaults.xml", FEE_06_MAP);
|
||||
|
@ -234,63 +245,72 @@ public class DomainRestoreRequestFlowTest extends
|
|||
public void testFailure_refundableFee_v06() throws Exception {
|
||||
setEppInput("domain_update_restore_request_fee_refundable.xml", FEE_06_MAP);
|
||||
persistPendingDeleteDomain();
|
||||
assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_refundableFee_v11() throws Exception {
|
||||
setEppInput("domain_update_restore_request_fee_refundable.xml", FEE_11_MAP);
|
||||
persistPendingDeleteDomain();
|
||||
assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_refundableFee_v12() throws Exception {
|
||||
setEppInput("domain_update_restore_request_fee_refundable.xml", FEE_12_MAP);
|
||||
persistPendingDeleteDomain();
|
||||
assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_gracePeriodFee_v06() throws Exception {
|
||||
setEppInput("domain_update_restore_request_fee_grace_period.xml", FEE_06_MAP);
|
||||
persistPendingDeleteDomain();
|
||||
assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_gracePeriodFee_v11() throws Exception {
|
||||
setEppInput("domain_update_restore_request_fee_grace_period.xml", FEE_11_MAP);
|
||||
persistPendingDeleteDomain();
|
||||
assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_gracePeriodFee_v12() throws Exception {
|
||||
setEppInput("domain_update_restore_request_fee_grace_period.xml", FEE_12_MAP);
|
||||
persistPendingDeleteDomain();
|
||||
assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_appliedFee_v06() throws Exception {
|
||||
setEppInput("domain_update_restore_request_fee_applied.xml", FEE_06_MAP);
|
||||
persistPendingDeleteDomain();
|
||||
assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_appliedFee_v11() throws Exception {
|
||||
setEppInput("domain_update_restore_request_fee_applied.xml", FEE_11_MAP);
|
||||
persistPendingDeleteDomain();
|
||||
assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_appliedFee_v12() throws Exception {
|
||||
setEppInput("domain_update_restore_request_fee_applied.xml", FEE_12_MAP);
|
||||
persistPendingDeleteDomain();
|
||||
assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -311,9 +331,7 @@ public class DomainRestoreRequestFlowTest extends
|
|||
.build());
|
||||
persistPendingDeleteDomain();
|
||||
runFlowAssertResponse(
|
||||
CommitMode.LIVE,
|
||||
UserPrivileges.SUPERUSER,
|
||||
loadFile("domain_update_response.xml"));
|
||||
CommitMode.LIVE, UserPrivileges.SUPERUSER, loadFile("domain_update_response.xml"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -323,12 +341,9 @@ public class DomainRestoreRequestFlowTest extends
|
|||
setEppInput("domain_update_restore_request_premium.xml");
|
||||
persistPendingDeleteDomain();
|
||||
// Modify the Registrar to block premium names.
|
||||
persistResource(
|
||||
loadRegistrar("TheRegistrar").asBuilder().setBlockPremiumNames(true).build());
|
||||
persistResource(loadRegistrar("TheRegistrar").asBuilder().setBlockPremiumNames(true).build());
|
||||
runFlowAssertResponse(
|
||||
CommitMode.LIVE,
|
||||
UserPrivileges.SUPERUSER,
|
||||
loadFile("domain_update_response.xml"));
|
||||
CommitMode.LIVE, UserPrivileges.SUPERUSER, loadFile("domain_update_response.xml"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -344,7 +359,8 @@ public class DomainRestoreRequestFlowTest extends
|
|||
persistPendingDeleteDomain();
|
||||
persistResource(
|
||||
Registry.get("tld").asBuilder().setRestoreBillingCost(Money.of(USD, 100)).build());
|
||||
assertThrows(FeesMismatchException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(FeesMismatchException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -353,7 +369,8 @@ public class DomainRestoreRequestFlowTest extends
|
|||
persistPendingDeleteDomain();
|
||||
persistResource(
|
||||
Registry.get("tld").asBuilder().setRestoreBillingCost(Money.of(USD, 100)).build());
|
||||
assertThrows(FeesMismatchException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(FeesMismatchException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -362,7 +379,8 @@ public class DomainRestoreRequestFlowTest extends
|
|||
persistPendingDeleteDomain();
|
||||
persistResource(
|
||||
Registry.get("tld").asBuilder().setRestoreBillingCost(Money.of(USD, 100)).build());
|
||||
assertThrows(FeesMismatchException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(FeesMismatchException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
private void runWrongCurrencyTest(Map<String, String> substitutions) throws Exception {
|
||||
|
@ -378,7 +396,8 @@ public class DomainRestoreRequestFlowTest extends
|
|||
.setEapFeeSchedule(ImmutableSortedMap.of(START_OF_TIME, Money.zero(EUR)))
|
||||
.setServerStatusChangeBillingCost(Money.of(EUR, 19))
|
||||
.build());
|
||||
assertThrows(CurrencyUnitMismatchException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(CurrencyUnitMismatchException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -400,21 +419,24 @@ public class DomainRestoreRequestFlowTest extends
|
|||
public void testFailure_feeGivenInWrongScale_v06() throws Exception {
|
||||
setEppInput("domain_update_restore_request_fee_bad_scale.xml", FEE_06_MAP);
|
||||
persistPendingDeleteDomain();
|
||||
assertThrows(CurrencyValueScaleException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(CurrencyValueScaleException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_feeGivenInWrongScale_v11() throws Exception {
|
||||
setEppInput("domain_update_restore_request_fee_bad_scale.xml", FEE_11_MAP);
|
||||
persistPendingDeleteDomain();
|
||||
assertThrows(CurrencyValueScaleException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(CurrencyValueScaleException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_feeGivenInWrongScale_v12() throws Exception {
|
||||
setEppInput("domain_update_restore_request_fee_bad_scale.xml", FEE_12_MAP);
|
||||
persistPendingDeleteDomain();
|
||||
assertThrows(CurrencyValueScaleException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(CurrencyValueScaleException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -425,63 +447,73 @@ public class DomainRestoreRequestFlowTest extends
|
|||
.setDeletionTime(clock.nowUtc().plusDays(4))
|
||||
.setStatusValues(ImmutableSet.of(StatusValue.PENDING_DELETE))
|
||||
.build());
|
||||
assertThrows(DomainNotEligibleForRestoreException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(DomainNotEligibleForRestoreException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_notDeleted() throws Exception {
|
||||
persistActiveDomain(getUniqueIdFromCommand());
|
||||
assertThrows(DomainNotEligibleForRestoreException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(DomainNotEligibleForRestoreException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_fullyDeleted() throws Exception {
|
||||
persistDeletedDomain(getUniqueIdFromCommand(), clock.nowUtc().minusDays(1));
|
||||
assertThrows(ResourceDoesNotExistException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(ResourceDoesNotExistException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_withChange() throws Exception {
|
||||
persistPendingDeleteDomain();
|
||||
setEppInput("domain_update_restore_request_with_change.xml");
|
||||
assertThrows(RestoreCommandIncludesChangesException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(RestoreCommandIncludesChangesException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_withAdd() throws Exception {
|
||||
persistPendingDeleteDomain();
|
||||
setEppInput("domain_update_restore_request_with_add.xml");
|
||||
assertThrows(RestoreCommandIncludesChangesException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(RestoreCommandIncludesChangesException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_withRemove() throws Exception {
|
||||
persistPendingDeleteDomain();
|
||||
setEppInput("domain_update_restore_request_with_remove.xml");
|
||||
assertThrows(RestoreCommandIncludesChangesException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(RestoreCommandIncludesChangesException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_withSecDnsExtension() throws Exception {
|
||||
persistPendingDeleteDomain();
|
||||
setEppInput("domain_update_restore_request_with_secdns.xml");
|
||||
assertThrows(UnimplementedExtensionException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(UnimplementedExtensionException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_unauthorizedClient() throws Exception {
|
||||
sessionMetadata.setClientId("NewRegistrar");
|
||||
persistPendingDeleteDomain();
|
||||
assertThrows(ResourceNotOwnedException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(ResourceNotOwnedException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSuccess_superuserUnauthorizedClient() throws Exception {
|
||||
sessionMetadata.setClientId("NewRegistrar");
|
||||
persistPendingDeleteDomain();
|
||||
assertThrows(
|
||||
EppException thrown =
|
||||
expectThrows(
|
||||
ResourceNotOwnedException.class,
|
||||
() -> runFlowAssertResponse(loadFile("domain_update_response.xml")));
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -489,7 +521,8 @@ public class DomainRestoreRequestFlowTest extends
|
|||
persistResource(
|
||||
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
|
||||
persistPendingDeleteDomain();
|
||||
assertThrows(NotAuthorizedForTldException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(NotAuthorizedForTldException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -508,7 +541,8 @@ public class DomainRestoreRequestFlowTest extends
|
|||
persistPendingDeleteDomain();
|
||||
// Modify the Registrar to block premium names.
|
||||
persistResource(loadRegistrar("TheRegistrar").asBuilder().setBlockPremiumNames(true).build());
|
||||
assertThrows(PremiumNameBlockedException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(PremiumNameBlockedException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -520,7 +554,8 @@ public class DomainRestoreRequestFlowTest extends
|
|||
.setReservedLists(persistReservedList("tld-reserved", "example,FULLY_BLOCKED"))
|
||||
.build());
|
||||
persistPendingDeleteDomain();
|
||||
assertThrows(DomainReservedException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(DomainReservedException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -528,7 +563,8 @@ public class DomainRestoreRequestFlowTest extends
|
|||
createTld("example");
|
||||
setEppInput("domain_update_restore_request_premium.xml");
|
||||
persistPendingDeleteDomain();
|
||||
assertThrows(FeesRequiredForPremiumNameException.class, this::runFlow);
|
||||
EppException thrown = expectThrows(FeesRequiredForPremiumNameException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue