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