mirror of
https://github.com/google/nomulus.git
synced 2025-05-27 22:50:08 +02:00
Remove deprecated extra flow logic and TLD-specific pricing proxy
This also adds a domain update pricing hook to DomainPricingCustomLogic. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=142286755
This commit is contained in:
parent
348cea9d8d
commit
f44557f34f
41 changed files with 494 additions and 1744 deletions
|
@ -15,6 +15,8 @@
|
|||
package google.registry.flows.custom;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.collect.Iterables.toArray;
|
||||
import static java.math.BigDecimal.TEN;
|
||||
|
||||
import com.google.common.base.Ascii;
|
||||
import com.google.common.base.Splitter;
|
||||
|
@ -61,13 +63,12 @@ public class TestDomainPricingCustomLogic extends DomainPricingCustomLogic {
|
|||
}
|
||||
}
|
||||
|
||||
/** A hook that customizes create price. */
|
||||
@Override
|
||||
public FeesAndCredits customizeCreatePrice(CreatePriceParameters createPriceParameters)
|
||||
public FeesAndCredits customizeCreatePrice(CreatePriceParameters priceParameters)
|
||||
throws EppException {
|
||||
InternetDomainName domainName = createPriceParameters.domainName();
|
||||
InternetDomainName domainName = priceParameters.domainName();
|
||||
if (domainName.parent().toString().equals("flags")) {
|
||||
FeesAndCredits feesAndCredits = createPriceParameters.feesAndCredits();
|
||||
FeesAndCredits feesAndCredits = priceParameters.feesAndCredits();
|
||||
ImmutableList.Builder<BaseFee> baseFeeBuilder = new ImmutableList.Builder<>();
|
||||
baseFeeBuilder.addAll(feesAndCredits.getCredits());
|
||||
for (BaseFee fee : feesAndCredits.getFees()) {
|
||||
|
@ -77,7 +78,40 @@ public class TestDomainPricingCustomLogic extends DomainPricingCustomLogic {
|
|||
return new FeesAndCredits(
|
||||
feesAndCredits.getCurrency(), Iterables.toArray(baseFeeBuilder.build(), BaseFee.class));
|
||||
} else {
|
||||
return createPriceParameters.feesAndCredits();
|
||||
return priceParameters.feesAndCredits();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public FeesAndCredits customizeRenewPrice(RenewPriceParameters priceParameters)
|
||||
throws EppException {
|
||||
if (priceParameters.domainName().toString().startsWith("costly-renew")) {
|
||||
FeesAndCredits feesAndCredits = priceParameters.feesAndCredits();
|
||||
List<BaseFee> newFeesAndCredits =
|
||||
new ImmutableList.Builder<BaseFee>()
|
||||
.addAll(feesAndCredits.getFeesAndCredits())
|
||||
.add(Fee.create(BigDecimal.valueOf(100), FeeType.RENEW))
|
||||
.build();
|
||||
return new FeesAndCredits(
|
||||
feesAndCredits.getCurrency(), toArray(newFeesAndCredits, BaseFee.class));
|
||||
} else {
|
||||
return priceParameters.feesAndCredits();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public FeesAndCredits customizeUpdatePrice(UpdatePriceParameters priceParameters) {
|
||||
if (priceParameters.domainName().toString().startsWith("non-free-update")) {
|
||||
FeesAndCredits feesAndCredits = priceParameters.feesAndCredits();
|
||||
List<BaseFee> newFeesAndCredits =
|
||||
new ImmutableList.Builder<BaseFee>()
|
||||
.addAll(feesAndCredits.getFeesAndCredits())
|
||||
.add(Fee.create(TEN, FeeType.UPDATE))
|
||||
.build();
|
||||
return new FeesAndCredits(
|
||||
feesAndCredits.getCurrency(), toArray(newFeesAndCredits, BaseFee.class));
|
||||
} else {
|
||||
return priceParameters.feesAndCredits();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,8 +52,6 @@ import google.registry.model.billing.BillingEvent.Reason;
|
|||
import google.registry.model.domain.DomainApplication;
|
||||
import google.registry.model.domain.DomainResource;
|
||||
import google.registry.model.domain.GracePeriod;
|
||||
import google.registry.model.domain.TestExtraLogicManager;
|
||||
import google.registry.model.domain.TestExtraLogicManager.TestExtraLogicManagerSuccessException;
|
||||
import google.registry.model.domain.launch.ApplicationStatus;
|
||||
import google.registry.model.domain.launch.LaunchInfoResponseExtension;
|
||||
import google.registry.model.domain.launch.LaunchNotice;
|
||||
|
@ -491,15 +489,4 @@ public class DomainAllocateFlowTest
|
|||
thrown.expect(OnlySuperuserCanAllocateException.class);
|
||||
runFlow(CommitMode.LIVE, UserPrivileges.NORMAL);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSuccess_extra() throws Exception {
|
||||
setEppInput(
|
||||
"domain_allocate.xml",
|
||||
ImmutableMap.of("APPLICATIONID", "2-EXTRA", "DOMAIN", "domain.extra"));
|
||||
setupDomainApplication("extra", TldState.QUIET_PERIOD);
|
||||
RegistryExtraFlowLogicProxy.setOverride("extra", TestExtraLogicManager.class);
|
||||
thrown.expect(TestExtraLogicManagerSuccessException.class, "allocated");
|
||||
runFlowAsSuperuser();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,8 +40,6 @@ import google.registry.flows.domain.DomainFlowUtils.NotAuthorizedForTldException
|
|||
import google.registry.model.EppResource;
|
||||
import google.registry.model.contact.ContactResource;
|
||||
import google.registry.model.domain.DomainApplication;
|
||||
import google.registry.model.domain.TestExtraLogicManager;
|
||||
import google.registry.model.domain.TestExtraLogicManager.TestExtraLogicManagerSuccessException;
|
||||
import google.registry.model.domain.launch.LaunchPhase;
|
||||
import google.registry.model.eppcommon.StatusValue;
|
||||
import google.registry.model.host.HostResource;
|
||||
|
@ -62,7 +60,6 @@ public class DomainApplicationDeleteFlowTest
|
|||
public void setUp() {
|
||||
createTld("tld", TldState.SUNRUSH);
|
||||
createTld("extra", TldState.LANDRUSH);
|
||||
RegistryExtraFlowLogicProxy.setOverride("extra", TestExtraLogicManager.class);
|
||||
}
|
||||
|
||||
public void doSuccessfulTest() throws Exception {
|
||||
|
@ -306,17 +303,4 @@ public class DomainApplicationDeleteFlowTest
|
|||
thrown.expect(ApplicationDomainNameMismatchException.class);
|
||||
runFlow();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSuccess_extraLogic() throws Exception {
|
||||
persistResource(newDomainApplication("example.extra")
|
||||
.asBuilder()
|
||||
.setRepoId("1-TLD")
|
||||
.setPhase(LaunchPhase.LANDRUSH)
|
||||
.build());
|
||||
setEppInput(
|
||||
"domain_delete_application_landrush.xml", ImmutableMap.of("DOMAIN", "example.extra"));
|
||||
thrown.expect(TestExtraLogicManagerSuccessException.class, "application deleted");
|
||||
runFlow();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,6 @@ import google.registry.model.domain.DesignatedContact;
|
|||
import google.registry.model.domain.DesignatedContact.Type;
|
||||
import google.registry.model.domain.DomainApplication;
|
||||
import google.registry.model.domain.DomainAuthInfo;
|
||||
import google.registry.model.domain.TestExtraLogicManager;
|
||||
import google.registry.model.domain.launch.ApplicationStatus;
|
||||
import google.registry.model.domain.launch.LaunchCreateExtension;
|
||||
import google.registry.model.domain.launch.LaunchPhase;
|
||||
|
@ -71,9 +70,6 @@ public class DomainApplicationInfoFlowTest
|
|||
setEppInput("domain_info_sunrise.xml");
|
||||
sessionMetadata.setClientId("NewRegistrar");
|
||||
createTld("tld", TldState.SUNRUSH);
|
||||
createTld("flags", TldState.SUNRUSH);
|
||||
// For flags extension tests.
|
||||
RegistryExtraFlowLogicProxy.setOverride("flags", TestExtraLogicManager.class);
|
||||
}
|
||||
|
||||
private void persistTestEntities(HostsState hostsState, MarksState marksState) throws Exception {
|
||||
|
@ -110,33 +106,6 @@ public class DomainApplicationInfoFlowTest
|
|||
.build());
|
||||
}
|
||||
|
||||
private void persistFlagsTestEntities(String domainName, HostsState hostsState) throws Exception {
|
||||
registrant = persistActiveContact("jd1234");
|
||||
contact = persistActiveContact("sh8013");
|
||||
host1 = persistActiveHost("ns1.example.net");
|
||||
host2 = persistActiveHost("ns1.example.tld");
|
||||
application = persistResource(new DomainApplication.Builder()
|
||||
.setRepoId("123-TLD")
|
||||
.setFullyQualifiedDomainName(domainName)
|
||||
.setPhase(LaunchPhase.SUNRUSH)
|
||||
.setCurrentSponsorClientId("NewRegistrar")
|
||||
.setCreationClientId("TheRegistrar")
|
||||
.setLastEppUpdateClientId("NewRegistrar")
|
||||
.setCreationTimeForTest(DateTime.parse("1999-04-03T22:00:00.0Z"))
|
||||
.setLastEppUpdateTime(DateTime.parse("1999-12-03T09:00:00.0Z"))
|
||||
.setRegistrant(Key.create(registrant))
|
||||
.setContacts(ImmutableSet.of(
|
||||
DesignatedContact.create(Type.ADMIN, Key.create(contact)),
|
||||
DesignatedContact.create(Type.TECH, Key.create(contact))))
|
||||
.setNameservers(hostsState.equals(HostsState.HOSTS_EXIST) ? ImmutableSet.of(
|
||||
Key.create(host1), Key.create(host2)) : null)
|
||||
.setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("2fooBAR")))
|
||||
.addStatusValue(StatusValue.PENDING_CREATE)
|
||||
.setApplicationStatus(ApplicationStatus.PENDING_VALIDATION)
|
||||
.setEncodedSignedMarks(null)
|
||||
.build());
|
||||
}
|
||||
|
||||
private void doSuccessfulTest(String expectedXmlFilename, HostsState hostsState)
|
||||
throws Exception {
|
||||
assertTransactionalFlow(false);
|
||||
|
@ -348,21 +317,4 @@ public class DomainApplicationInfoFlowTest
|
|||
thrown.expect(ApplicationLaunchPhaseMismatchException.class);
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
||||
/** Test registry extra logic manager with no flags. */
|
||||
@Test
|
||||
public void testExtraLogicManager_noFlags() throws Exception {
|
||||
setEppInput("domain_info_sunrise_flags_none.xml");
|
||||
persistFlagsTestEntities("domain.flags", HostsState.NO_HOSTS_EXIST);
|
||||
doSuccessfulTest("domain_info_response_sunrise_flags_none.xml", HostsState.NO_HOSTS_EXIST);
|
||||
}
|
||||
|
||||
/** Test registry extra logic manager with two flags. */
|
||||
@Test
|
||||
public void testExtraLogicManager_twoFlags() throws Exception {
|
||||
setEppInput("domain_info_sunrise_flags_two.xml");
|
||||
persistFlagsTestEntities("domain-flag1-flag2.flags", HostsState.NO_HOSTS_EXIST);
|
||||
doSuccessfulTest("domain_info_response_sunrise_flags_two.xml", HostsState.NO_HOSTS_EXIST);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,8 +61,6 @@ import google.registry.model.domain.DesignatedContact;
|
|||
import google.registry.model.domain.DesignatedContact.Type;
|
||||
import google.registry.model.domain.DomainApplication;
|
||||
import google.registry.model.domain.DomainApplication.Builder;
|
||||
import google.registry.model.domain.TestExtraLogicManager;
|
||||
import google.registry.model.domain.TestExtraLogicManager.TestExtraLogicManagerSuccessException;
|
||||
import google.registry.model.domain.launch.ApplicationStatus;
|
||||
import google.registry.model.domain.secdns.DelegationSignerData;
|
||||
import google.registry.model.eppcommon.StatusValue;
|
||||
|
@ -94,7 +92,6 @@ public class DomainApplicationUpdateFlowTest
|
|||
public void setUp() {
|
||||
createTld("tld", TldState.SUNRUSH);
|
||||
createTld("flags", TldState.SUNRISE);
|
||||
RegistryExtraFlowLogicProxy.setOverride("flags", TestExtraLogicManager.class);
|
||||
}
|
||||
|
||||
private void persistReferencedEntities() {
|
||||
|
@ -685,15 +682,4 @@ public class DomainApplicationUpdateFlowTest
|
|||
thrown.expect(FeesMismatchException.class);
|
||||
runFlow();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSuccess_flags() throws Exception {
|
||||
persistReferencedEntities();
|
||||
persistResource(
|
||||
newDomainApplication("update-42.flags").asBuilder().setRepoId("1-ROID").build());
|
||||
setEppInput("domain_update_sunrise_flags.xml", ImmutableMap.of("FEE", "42"));
|
||||
clock.advanceOneMilli();
|
||||
thrown.expect(TestExtraLogicManagerSuccessException.class, "add:flag1;remove:flag2");
|
||||
runFlow();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,8 +58,6 @@ import google.registry.model.billing.BillingEvent.Reason;
|
|||
import google.registry.model.contact.ContactResource;
|
||||
import google.registry.model.domain.DomainResource;
|
||||
import google.registry.model.domain.GracePeriod;
|
||||
import google.registry.model.domain.TestExtraLogicManager;
|
||||
import google.registry.model.domain.TestExtraLogicManager.TestExtraLogicManagerSuccessException;
|
||||
import google.registry.model.domain.rgp.GracePeriodStatus;
|
||||
import google.registry.model.eppcommon.ProtocolDefinition.ServiceExtension;
|
||||
import google.registry.model.eppcommon.StatusValue;
|
||||
|
@ -107,7 +105,6 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
|
|||
public void initDomainTest() throws Exception {
|
||||
createTlds("tld", "flags");
|
||||
// For flags extension tests.
|
||||
RegistryExtraFlowLogicProxy.setOverride("flags", TestExtraLogicManager.class);
|
||||
}
|
||||
|
||||
private void setupSuccessfulTest() throws Exception {
|
||||
|
@ -735,12 +732,4 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
|
|||
thrown.expect(OnlyToolCanPassMetadataException.class);
|
||||
runFlow();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSuccess_flags() throws Exception {
|
||||
setEppInput("domain_delete_flags.xml");
|
||||
setupSuccessfulTest();
|
||||
thrown.expect(TestExtraLogicManagerSuccessException.class, "deleted");
|
||||
runFlow();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@ package google.registry.flows.domain;
|
|||
import static com.google.common.io.BaseEncoding.base16;
|
||||
import static google.registry.testing.DatastoreHelper.assertNoBillingEvents;
|
||||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
import static google.registry.testing.DatastoreHelper.createTlds;
|
||||
import static google.registry.testing.DatastoreHelper.newDomainResource;
|
||||
import static google.registry.testing.DatastoreHelper.persistActiveContact;
|
||||
import static google.registry.testing.DatastoreHelper.persistActiveHost;
|
||||
|
@ -42,7 +41,6 @@ import google.registry.model.domain.DesignatedContact.Type;
|
|||
import google.registry.model.domain.DomainAuthInfo;
|
||||
import google.registry.model.domain.DomainResource;
|
||||
import google.registry.model.domain.GracePeriod;
|
||||
import google.registry.model.domain.TestExtraLogicManager;
|
||||
import google.registry.model.domain.rgp.GracePeriodStatus;
|
||||
import google.registry.model.domain.secdns.DelegationSignerData;
|
||||
import google.registry.model.eppcommon.AuthInfo.PasswordAuth;
|
||||
|
@ -68,11 +66,9 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
|
|||
setEppInput("domain_info.xml");
|
||||
sessionMetadata.setClientId("NewRegistrar");
|
||||
clock.setTo(DateTime.parse("2005-03-03T22:00:00.000Z"));
|
||||
createTlds("tld", "flags");
|
||||
createTld("tld");
|
||||
persistResource(
|
||||
AppEngineRule.makeRegistrar1().asBuilder().setClientId("ClientZ").build());
|
||||
// For flags extension tests.
|
||||
RegistryExtraFlowLogicProxy.setOverride("flags", TestExtraLogicManager.class);
|
||||
}
|
||||
|
||||
private void persistTestEntities(String domainName, boolean inactive) {
|
||||
|
@ -616,20 +612,4 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
|
|||
thrown.expect(RestoresAreAlwaysForOneYearException.class);
|
||||
runFlow();
|
||||
}
|
||||
|
||||
/** Test registry extra logic manager with no flags. */
|
||||
@Test
|
||||
public void testExtraLogicManager_noFlags() throws Exception {
|
||||
setEppInput("domain_info_flags_none.xml");
|
||||
persistTestEntities("domain.flags", false);
|
||||
doSuccessfulTest("domain_info_response_flags_none.xml", false);
|
||||
}
|
||||
|
||||
/** Test registry extra logic manager with two flags. */
|
||||
@Test
|
||||
public void testExtraLogicManager_twoFlags() throws Exception {
|
||||
setEppInput("domain_info_flags_two.xml");
|
||||
persistTestEntities("domain-flag1-flag2.flags", false);
|
||||
doSuccessfulTest("domain_info_response_flags_two.xml", false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@ import static google.registry.flows.domain.DomainTransferFlowTestCase.persistWit
|
|||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||
import static google.registry.testing.DatastoreHelper.assertBillingEvents;
|
||||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
import static google.registry.testing.DatastoreHelper.createTlds;
|
||||
import static google.registry.testing.DatastoreHelper.getOnlyHistoryEntryOfType;
|
||||
import static google.registry.testing.DatastoreHelper.newDomainResource;
|
||||
import static google.registry.testing.DatastoreHelper.persistActiveDomain;
|
||||
|
@ -54,8 +53,6 @@ import google.registry.model.billing.BillingEvent.Flag;
|
|||
import google.registry.model.billing.BillingEvent.Reason;
|
||||
import google.registry.model.domain.DomainResource;
|
||||
import google.registry.model.domain.GracePeriod;
|
||||
import google.registry.model.domain.TestExtraLogicManager;
|
||||
import google.registry.model.domain.TestExtraLogicManager.TestExtraLogicManagerSuccessException;
|
||||
import google.registry.model.domain.rgp.GracePeriodStatus;
|
||||
import google.registry.model.eppcommon.StatusValue;
|
||||
import google.registry.model.poll.PollMessage;
|
||||
|
@ -88,9 +85,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
|
|||
|
||||
@Before
|
||||
public void initDomainTest() {
|
||||
createTlds("tld", "flags");
|
||||
// For flags extension tests.
|
||||
RegistryExtraFlowLogicProxy.setOverride("flags", TestExtraLogicManager.class);
|
||||
createTld("tld");
|
||||
}
|
||||
|
||||
private void persistDomain(StatusValue... statusValues) throws Exception {
|
||||
|
@ -131,10 +126,22 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
|
|||
private void doSuccessfulTest(String responseFilename, int renewalYears) throws Exception {
|
||||
doSuccessfulTest(responseFilename, renewalYears, ImmutableMap.<String, String>of());
|
||||
}
|
||||
|
||||
private void doSuccessfulTest(
|
||||
String responseFilename, int renewalYears, Map<String, String> substitutions)
|
||||
throws Exception {
|
||||
doSuccessfulTest(
|
||||
responseFilename,
|
||||
renewalYears,
|
||||
substitutions,
|
||||
Money.of(USD, 11).multipliedBy(renewalYears));
|
||||
}
|
||||
|
||||
private void doSuccessfulTest(
|
||||
String responseFilename,
|
||||
int renewalYears,
|
||||
Map<String, String> substitutions) throws Exception {
|
||||
Map<String, String> substitutions,
|
||||
Money totalRenewCost) throws Exception {
|
||||
assertTransactionalFlow(true);
|
||||
DateTime currentExpiration = reloadResourceByForeignKey().getRegistrationExpirationTime();
|
||||
DateTime newExpiration = currentExpiration.plusYears(renewalYears);
|
||||
|
@ -155,7 +162,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
|
|||
.setReason(Reason.RENEW)
|
||||
.setTargetId(getUniqueIdFromCommand())
|
||||
.setClientId("TheRegistrar")
|
||||
.setCost(Money.of(USD, 11).multipliedBy(renewalYears))
|
||||
.setCost(totalRenewCost)
|
||||
.setPeriodYears(renewalYears)
|
||||
.setEventTime(clock.nowUtc())
|
||||
.setBillingTime(clock.nowUtc().plus(Registry.get("tld").getRenewGracePeriodLength()))
|
||||
|
@ -215,6 +222,27 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
|
|||
doSuccessfulTest("domain_renew_response.xml", 5);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSuccess_customLogicFee() throws Exception {
|
||||
// The "costly-renew" domain has an additional RENEW fee of 100 from custom logic on top of the
|
||||
// normal $11 standard renew price for this TLD.
|
||||
setEppInput(
|
||||
"domain_renew_fee_wildcard.xml",
|
||||
ImmutableMap.of("DOMAIN", "costly-renew.tld", "FEE_VERSION", "0.6", "AMOUNT", "111.00"));
|
||||
persistDomain();
|
||||
doSuccessfulTest(
|
||||
"domain_renew_response_fee_wildcard.xml",
|
||||
1,
|
||||
new ImmutableMap.Builder<String, String>()
|
||||
.put("DOMAIN", "costly-renew.tld")
|
||||
.put("FEE_VERSION", "0.6")
|
||||
.put("FEE_NS", "fee")
|
||||
.put("AMOUNT", "111.00")
|
||||
.put("EX_DATE", "2001-04-03T22:00:00.000Z")
|
||||
.build(),
|
||||
Money.of(USD, 111));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSuccess_fee_v06() throws Exception {
|
||||
setEppInput("domain_renew_fee.xml", FEE_06_MAP);
|
||||
|
@ -612,23 +640,4 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
|
|||
thrown.expect(FeesRequiredForPremiumNameException.class);
|
||||
runFlow();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_flags_feeMismatch() throws Exception {
|
||||
setEppInput(
|
||||
"domain_renew_flags.xml", ImmutableMap.of("DOMAIN", "renew-42.flags", "FEE", "11"));
|
||||
persistDomain();
|
||||
thrown.expect(FeesMismatchException.class);
|
||||
runFlow();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSuccess_flags() throws Exception {
|
||||
setEppInput(
|
||||
"domain_renew_flags.xml", ImmutableMap.of("DOMAIN", "renew-42.flags", "FEE", "42"));
|
||||
persistDomain();
|
||||
thrown.expect(TestExtraLogicManagerSuccessException.class, "renewed");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -56,8 +56,6 @@ import google.registry.model.billing.BillingEvent.Flag;
|
|||
import google.registry.model.billing.BillingEvent.Reason;
|
||||
import google.registry.model.domain.DomainResource;
|
||||
import google.registry.model.domain.GracePeriod;
|
||||
import google.registry.model.domain.TestExtraLogicManager;
|
||||
import google.registry.model.domain.TestExtraLogicManager.TestExtraLogicManagerSuccessException;
|
||||
import google.registry.model.domain.rgp.GracePeriodStatus;
|
||||
import google.registry.model.eppcommon.StatusValue;
|
||||
import google.registry.model.poll.PollMessage;
|
||||
|
@ -87,8 +85,6 @@ public class DomainRestoreRequestFlowTest extends
|
|||
@Before
|
||||
public void initDomainTest() {
|
||||
createTlds("tld", "flags");
|
||||
// For flags extension tests.
|
||||
RegistryExtraFlowLogicProxy.setOverride("flags", TestExtraLogicManager.class);
|
||||
}
|
||||
|
||||
void persistPendingDeleteDomain() throws Exception {
|
||||
|
@ -562,16 +558,4 @@ public class DomainRestoreRequestFlowTest extends
|
|||
thrown.expect(FeesMismatchException.class);
|
||||
runFlow();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSuccess_flagsWithCorrectFee() throws Exception {
|
||||
// The total cost should be the renewal cost of 42 (set in the XML file) plus the restore cost
|
||||
// of 17 (set in the test registry).
|
||||
setEppInput(
|
||||
"domain_update_restore_request_flags.xml",
|
||||
ImmutableMap.of("DOMAIN", "renew-42.flags", "FEE", "59"));
|
||||
persistPendingDeleteDomain();
|
||||
thrown.expect(TestExtraLogicManagerSuccessException.class, "restored");
|
||||
runFlow();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,8 +51,6 @@ import google.registry.model.contact.ContactAuthInfo;
|
|||
import google.registry.model.domain.DomainAuthInfo;
|
||||
import google.registry.model.domain.DomainResource;
|
||||
import google.registry.model.domain.GracePeriod;
|
||||
import google.registry.model.domain.TestExtraLogicManager;
|
||||
import google.registry.model.domain.TestExtraLogicManager.TestExtraLogicManagerSuccessException;
|
||||
import google.registry.model.domain.rgp.GracePeriodStatus;
|
||||
import google.registry.model.eppcommon.AuthInfo.PasswordAuth;
|
||||
import google.registry.model.eppcommon.StatusValue;
|
||||
|
@ -96,7 +94,6 @@ public class DomainTransferApproveFlowTest
|
|||
.build());
|
||||
setClientIdForFlow("TheRegistrar");
|
||||
createTld("extra");
|
||||
RegistryExtraFlowLogicProxy.setOverride("extra", TestExtraLogicManager.class);
|
||||
setupDomainWithPendingTransfer();
|
||||
clock.advanceOneMilli();
|
||||
}
|
||||
|
@ -494,12 +491,4 @@ public class DomainTransferApproveFlowTest
|
|||
|
||||
// NB: No need to test pending delete status since pending transfers will get cancelled upon
|
||||
// entering pending delete phase. So it's already handled in that test case.
|
||||
|
||||
@Test
|
||||
public void testSuccess_extra() throws Exception {
|
||||
setupDomainWithPendingTransfer("extra");
|
||||
clock.advanceOneMilli();
|
||||
thrown.expect(TestExtraLogicManagerSuccessException.class, "transfer approved");
|
||||
doFailingTest("domain_transfer_approve_extra.xml");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,8 +35,6 @@ import google.registry.model.contact.ContactAuthInfo;
|
|||
import google.registry.model.domain.DomainAuthInfo;
|
||||
import google.registry.model.domain.DomainResource;
|
||||
import google.registry.model.domain.GracePeriod;
|
||||
import google.registry.model.domain.TestExtraLogicManager;
|
||||
import google.registry.model.domain.TestExtraLogicManager.TestExtraLogicManagerSuccessException;
|
||||
import google.registry.model.eppcommon.AuthInfo.PasswordAuth;
|
||||
import google.registry.model.poll.PollMessage;
|
||||
import google.registry.model.registrar.Registrar;
|
||||
|
@ -299,13 +297,4 @@ public class DomainTransferCancelFlowTest
|
|||
|
||||
// NB: No need to test pending delete status since pending transfers will get cancelled upon
|
||||
// entering pending delete phase. So it's already handled in that test case.
|
||||
|
||||
@Test
|
||||
public void testSuccess_extra() throws Exception {
|
||||
setupDomainWithPendingTransfer("extra");
|
||||
clock.advanceOneMilli();
|
||||
RegistryExtraFlowLogicProxy.setOverride("extra", TestExtraLogicManager.class);
|
||||
thrown.expect(TestExtraLogicManagerSuccessException.class, "transfer cancelled");
|
||||
doFailingTest("domain_transfer_cancel_extra.xml");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,8 +35,6 @@ import google.registry.model.contact.ContactAuthInfo;
|
|||
import google.registry.model.domain.DomainAuthInfo;
|
||||
import google.registry.model.domain.DomainResource;
|
||||
import google.registry.model.domain.GracePeriod;
|
||||
import google.registry.model.domain.TestExtraLogicManager;
|
||||
import google.registry.model.domain.TestExtraLogicManager.TestExtraLogicManagerSuccessException;
|
||||
import google.registry.model.eppcommon.AuthInfo.PasswordAuth;
|
||||
import google.registry.model.eppcommon.Trid;
|
||||
import google.registry.model.poll.PendingActionNotificationResponse;
|
||||
|
@ -261,13 +259,4 @@ public class DomainTransferRejectFlowTest
|
|||
|
||||
// NB: No need to test pending delete status since pending transfers will get cancelled upon
|
||||
// entering pending delete phase. So it's already handled in that test case.
|
||||
|
||||
@Test
|
||||
public void testSuccess_extra() throws Exception {
|
||||
setupDomainWithPendingTransfer("extra");
|
||||
clock.advanceOneMilli();
|
||||
RegistryExtraFlowLogicProxy.setOverride("extra", TestExtraLogicManager.class);
|
||||
thrown.expect(TestExtraLogicManagerSuccessException.class, "transfer rejected");
|
||||
doFailingTest("domain_transfer_reject_extra.xml");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,8 +61,6 @@ import google.registry.model.contact.ContactAuthInfo;
|
|||
import google.registry.model.domain.DomainAuthInfo;
|
||||
import google.registry.model.domain.DomainResource;
|
||||
import google.registry.model.domain.GracePeriod;
|
||||
import google.registry.model.domain.TestExtraLogicManager;
|
||||
import google.registry.model.domain.TestExtraLogicManager.TestExtraLogicManagerSuccessException;
|
||||
import google.registry.model.domain.rgp.GracePeriodStatus;
|
||||
import google.registry.model.eppcommon.AuthInfo.PasswordAuth;
|
||||
import google.registry.model.eppcommon.StatusValue;
|
||||
|
@ -99,7 +97,6 @@ public class DomainTransferRequestFlowTest
|
|||
setClientIdForFlow("NewRegistrar");
|
||||
setupDomain("tld");
|
||||
createTld("flags");
|
||||
RegistryExtraFlowLogicProxy.setOverride("flags", TestExtraLogicManager.class);
|
||||
}
|
||||
|
||||
private void assertTransferRequested(DomainResource domain) throws Exception {
|
||||
|
@ -778,14 +775,4 @@ public class DomainTransferRequestFlowTest
|
|||
thrown.expect(ResourceStatusProhibitsOperationException.class);
|
||||
doFailingTest("domain_transfer_request.xml");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSuccess_flags() throws Exception {
|
||||
setEppInput("domain_transfer_request_flags.xml");
|
||||
setupDomain("example", "flags");
|
||||
eppLoader.replaceAll("JD1234-REP", contact.getRepoId());
|
||||
thrown.expect(
|
||||
TestExtraLogicManagerSuccessException.class, "add:flag1,flag2;remove:flag3,flag4");
|
||||
runFlow();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ import static google.registry.model.ofy.ObjectifyService.ofy;
|
|||
import static google.registry.testing.DatastoreHelper.assertBillingEvents;
|
||||
import static google.registry.testing.DatastoreHelper.assertNoBillingEvents;
|
||||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
import static google.registry.testing.DatastoreHelper.createTlds;
|
||||
import static google.registry.testing.DatastoreHelper.getOnlyHistoryEntryOfType;
|
||||
import static google.registry.testing.DatastoreHelper.newDomainResource;
|
||||
import static google.registry.testing.DatastoreHelper.persistActiveContact;
|
||||
|
@ -30,7 +29,6 @@ import static google.registry.testing.DatastoreHelper.persistActiveDomain;
|
|||
import static google.registry.testing.DatastoreHelper.persistActiveHost;
|
||||
import static google.registry.testing.DatastoreHelper.persistActiveSubordinateHost;
|
||||
import static google.registry.testing.DatastoreHelper.persistDeletedDomain;
|
||||
import static google.registry.testing.DatastoreHelper.persistPremiumList;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.DomainResourceSubject.assertAboutDomains;
|
||||
import static google.registry.testing.HistoryEntrySubject.assertAboutHistoryEntries;
|
||||
|
@ -76,8 +74,6 @@ import google.registry.model.domain.DesignatedContact;
|
|||
import google.registry.model.domain.DesignatedContact.Type;
|
||||
import google.registry.model.domain.DomainResource;
|
||||
import google.registry.model.domain.GracePeriod;
|
||||
import google.registry.model.domain.TestExtraLogicManager;
|
||||
import google.registry.model.domain.TestExtraLogicManager.TestExtraLogicManagerSuccessException;
|
||||
import google.registry.model.domain.rgp.GracePeriodStatus;
|
||||
import google.registry.model.domain.secdns.DelegationSignerData;
|
||||
import google.registry.model.eppcommon.StatusValue;
|
||||
|
@ -108,17 +104,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
|||
|
||||
@Before
|
||||
public void initDomainTest() {
|
||||
createTlds("tld", "flags");
|
||||
// Super-hack premium list: The domain name has to be of the form feetype-amount for the
|
||||
// test extra logic manager to be happy. So we use domain name "renew-0" to designate a premium
|
||||
// name with a zero-cost update. This has nothing to do with renewals -- we just need to use a
|
||||
// valid fee type.
|
||||
persistResource(
|
||||
Registry.get("flags").asBuilder()
|
||||
.setPremiumList(persistPremiumList("flags", "renew-0,USD 100"))
|
||||
.build());
|
||||
// For flags extension tests.
|
||||
RegistryExtraFlowLogicProxy.setOverride("flags", TestExtraLogicManager.class);
|
||||
createTld("tld");
|
||||
}
|
||||
|
||||
private void persistReferencedEntities() {
|
||||
|
@ -1194,105 +1180,23 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
|||
runFlow();
|
||||
}
|
||||
|
||||
// This test should work, because the fee extension is not required when the fee is zero.
|
||||
@Test
|
||||
public void testAddAndRemoveFlags_free_noFee() throws Exception {
|
||||
setEppInput("domain_update_addremove_flags.xml", ImmutableMap.of("DOMAIN", "update-0"));
|
||||
persistReferencedEntities();
|
||||
persistDomain();
|
||||
thrown.expect(
|
||||
TestExtraLogicManagerSuccessException.class, "add:flag1,flag2;remove:flag3,flag4");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddAndRemoveFlags_free_wrongFee() throws Exception {
|
||||
setEppInput(
|
||||
"domain_update_addremove_flags_fee.xml",
|
||||
ImmutableMap.of("DOMAIN", "update-0", "FEE", "1.00"));
|
||||
public void testFailure_freePremium_wrongFee() throws Exception {
|
||||
setEppInput("domain_update_fee.xml", ImmutableMap.of("FEE_VERSION", "0.11"));
|
||||
persistReferencedEntities();
|
||||
persistDomain();
|
||||
thrown.expect(FeesMismatchException.class);
|
||||
runFlow();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddAndRemoveFlags_free_correctFee() throws Exception {
|
||||
setEppInput(
|
||||
"domain_update_addremove_flags_fee.xml",
|
||||
ImmutableMap.of("DOMAIN", "update-0", "FEE", "0.00"));
|
||||
persistReferencedEntities();
|
||||
persistDomain();
|
||||
thrown.expect(
|
||||
TestExtraLogicManagerSuccessException.class, "add:flag1,flag2;remove:flag3,flag4");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
// This should also work, even though the domain is premium (previously, a bug caused it to fail).
|
||||
@Test
|
||||
public void testAddAndRemoveFlags_freePremium_noFee() throws Exception {
|
||||
setEppInput("domain_update_addremove_flags.xml", ImmutableMap.of("DOMAIN", "renew-0"));
|
||||
persistReferencedEntities();
|
||||
persistDomain();
|
||||
thrown.expect(
|
||||
TestExtraLogicManagerSuccessException.class, "add:flag1,flag2;remove:flag3,flag4");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddAndRemoveFlags_freePremium_wrongFee() throws Exception {
|
||||
setEppInput(
|
||||
"domain_update_addremove_flags_fee.xml",
|
||||
ImmutableMap.of("DOMAIN", "renew-0", "FEE", "1.00"));
|
||||
persistReferencedEntities();
|
||||
persistDomain();
|
||||
thrown.expect(FeesMismatchException.class);
|
||||
runFlow();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddAndRemoveFlags_freePremium_correctFee() throws Exception {
|
||||
setEppInput(
|
||||
"domain_update_addremove_flags_fee.xml",
|
||||
ImmutableMap.of("DOMAIN", "renew-0", "FEE", "0.00"));
|
||||
persistReferencedEntities();
|
||||
persistDomain();
|
||||
thrown.expect(
|
||||
TestExtraLogicManagerSuccessException.class, "add:flag1,flag2;remove:flag3,flag4");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
// This test should throw an exception, because the fee extension is required when the fee is not
|
||||
// zero.
|
||||
@Test
|
||||
public void testAddAndRemoveFlags_paid_noFee() throws Exception {
|
||||
setEppInput("domain_update_addremove_flags.xml", ImmutableMap.of("DOMAIN", "update-13"));
|
||||
public void testFailure_missingFeeOnNonFreeUpdate() throws Exception {
|
||||
setEppInput("domain_update_wildcard.xml", ImmutableMap.of("DOMAIN", "non-free-update.tld"));
|
||||
persistReferencedEntities();
|
||||
persistDomain();
|
||||
thrown.expect(FeesRequiredForNonFreeUpdateException.class);
|
||||
runFlow();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddAndRemoveFlags_paid_wrongFee() throws Exception {
|
||||
setEppInput(
|
||||
"domain_update_addremove_flags_fee.xml",
|
||||
ImmutableMap.of("DOMAIN", "update-13", "FEE", "11.00"));
|
||||
persistReferencedEntities();
|
||||
persistDomain();
|
||||
thrown.expect(FeesMismatchException.class);
|
||||
runFlow();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddAndRemoveFlags_paid_correctFee() throws Exception {
|
||||
setEppInput(
|
||||
"domain_update_addremove_flags_fee.xml",
|
||||
ImmutableMap.of("DOMAIN", "update-13", "FEE", "13.00"));
|
||||
persistReferencedEntities();
|
||||
persistDomain();
|
||||
thrown.expect(
|
||||
TestExtraLogicManagerSuccessException.class, "add:flag1,flag2;remove:flag3,flag4");
|
||||
runFlow();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,235 +0,0 @@
|
|||
// Copyright 2016 The Nomulus Authors. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package google.registry.flows.domain;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.testing.DatastoreHelper.createTlds;
|
||||
import static google.registry.testing.DatastoreHelper.newDomainResource;
|
||||
import static google.registry.testing.DatastoreHelper.persistActiveDomain;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||
import static org.joda.money.CurrencyUnit.USD;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.ImmutableSortedMap;
|
||||
import com.google.common.collect.Range;
|
||||
import com.googlecode.objectify.Key;
|
||||
import google.registry.flows.ResourceFlowUtils.ResourceDoesNotExistException;
|
||||
import google.registry.model.domain.DomainResource;
|
||||
import google.registry.model.domain.GracePeriod;
|
||||
import google.registry.model.domain.TestExtraLogicManager;
|
||||
import google.registry.model.domain.fee.BaseFee.FeeType;
|
||||
import google.registry.model.domain.fee.Fee;
|
||||
import google.registry.model.domain.rgp.GracePeriodStatus;
|
||||
import google.registry.model.eppcommon.StatusValue;
|
||||
import google.registry.model.ofy.Ofy;
|
||||
import google.registry.model.poll.PollMessage;
|
||||
import google.registry.model.registry.Registry;
|
||||
import google.registry.model.reporting.HistoryEntry;
|
||||
import google.registry.pricing.PricingEngineProxy;
|
||||
import google.registry.testing.AppEngineRule;
|
||||
import google.registry.testing.ExceptionRule;
|
||||
import google.registry.testing.FakeClock;
|
||||
import google.registry.testing.InjectRule;
|
||||
import google.registry.testing.ShardableTestCase;
|
||||
import java.math.BigDecimal;
|
||||
import org.joda.money.CurrencyUnit;
|
||||
import org.joda.money.Money;
|
||||
import org.joda.time.DateTime;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.JUnit4;
|
||||
|
||||
@RunWith(JUnit4.class)
|
||||
public class TldSpecificLogicProxyTest extends ShardableTestCase {
|
||||
|
||||
@Rule public final InjectRule inject = new InjectRule();
|
||||
|
||||
@Rule public final ExceptionRule thrown = new ExceptionRule();
|
||||
|
||||
@Rule public final AppEngineRule appEngine = AppEngineRule.builder().withDatastore().build();
|
||||
|
||||
final FakeClock clock = new FakeClock(DateTime.parse("2010-01-01T10:00:00Z"));
|
||||
|
||||
Money basicCreateCost;
|
||||
|
||||
@Before
|
||||
public void before() throws Exception {
|
||||
inject.setStaticField(Ofy.class, "clock", clock);
|
||||
createTlds("tld", "eap", "test");
|
||||
RegistryExtraFlowLogicProxy.setOverride("test", TestExtraLogicManager.class);
|
||||
DateTime a = clock.nowUtc().minusDays(1);
|
||||
DateTime b = clock.nowUtc().plusDays(1);
|
||||
persistResource(
|
||||
Registry.get("eap")
|
||||
.asBuilder()
|
||||
.setEapFeeSchedule(
|
||||
ImmutableSortedMap.of(
|
||||
START_OF_TIME, Money.of(USD, 0),
|
||||
a, Money.of(USD, 100),
|
||||
b, Money.of(USD, 50)))
|
||||
.build());
|
||||
basicCreateCost =
|
||||
PricingEngineProxy.getDomainCreateCost("example.tld", clock.nowUtc(), 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_basicCreatePrice() throws Exception {
|
||||
TldSpecificLogicProxy.EppCommandOperations createPrice =
|
||||
TldSpecificLogicProxy.getCreatePrice(
|
||||
Registry.get("tld"), "example.tld", "clientIdentifer", clock.nowUtc(), 1, null);
|
||||
assertThat(createPrice.getTotalCost()).isEqualTo(basicCreateCost);
|
||||
assertThat(createPrice.getFees()).hasSize(1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_eap() throws Exception {
|
||||
TldSpecificLogicProxy.EppCommandOperations createPrice =
|
||||
TldSpecificLogicProxy.getCreatePrice(
|
||||
Registry.get("eap"), "example.eap", "clientId", clock.nowUtc(), 1, null);
|
||||
Range<DateTime> eapValidPeriod =
|
||||
Range.closedOpen(clock.nowUtc().minusDays(1), clock.nowUtc().plusDays(1));
|
||||
assertThat(createPrice.getTotalCost()).isEqualTo(basicCreateCost.plus(Money.of(USD, 100)));
|
||||
assertThat(createPrice.getCurrency()).isEqualTo(USD);
|
||||
assertThat(createPrice.getFees().get(0))
|
||||
.isEqualTo(Fee.create(basicCreateCost.getAmount(), FeeType.CREATE));
|
||||
assertThat(createPrice.getFees().get(1))
|
||||
.isEqualTo(
|
||||
Fee.create(
|
||||
new BigDecimal("100.00"),
|
||||
FeeType.EAP,
|
||||
eapValidPeriod,
|
||||
clock.nowUtc().plusDays(1)));
|
||||
assertThat(createPrice.getFees())
|
||||
.containsExactly(
|
||||
Fee.create(basicCreateCost.getAmount(), FeeType.CREATE),
|
||||
Fee.create(
|
||||
new BigDecimal("100.00"),
|
||||
FeeType.EAP,
|
||||
eapValidPeriod,
|
||||
clock.nowUtc().plusDays(1)))
|
||||
.inOrder();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_extraLogic_createPrice() throws Exception {
|
||||
TldSpecificLogicProxy.EppCommandOperations price =
|
||||
TldSpecificLogicProxy.getCreatePrice(
|
||||
Registry.get("test"), "create-54.test", "clientId", clock.nowUtc(), 3, null);
|
||||
assertThat(price.getCurrency()).isEqualTo(CurrencyUnit.USD);
|
||||
assertThat(price.getFees()).hasSize(1);
|
||||
assertThat(price.getFees().get(0).getCost()).isEqualTo(new BigDecimal(54));
|
||||
assertThat(price.getFees().get(0).getDescription()).isEqualTo("create");
|
||||
assertThat(price.getCredits()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_extraLogic_renewPrice() throws Exception {
|
||||
persistActiveDomain("renew--13.test");
|
||||
TldSpecificLogicProxy.EppCommandOperations price =
|
||||
TldSpecificLogicProxy.getRenewPrice(
|
||||
Registry.get("test"), "renew--13.test", "clientId", clock.nowUtc(), 1, null);
|
||||
assertThat(price.getCurrency()).isEqualTo(CurrencyUnit.USD);
|
||||
assertThat(price.getFees()).isEmpty();
|
||||
assertThat(price.getCredits()).hasSize(1);
|
||||
assertThat(price.getCredits().get(0).getCost()).isEqualTo(new BigDecimal(-13));
|
||||
assertThat(price.getCredits().get(0).getDescription()).isEqualTo("renew");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_extraLogic_renewPrice_noDomain() throws Exception {
|
||||
thrown.expect(ResourceDoesNotExistException.class);
|
||||
TldSpecificLogicProxy.getRenewPrice(
|
||||
Registry.get("test"), "renew--13.test", "clientId", clock.nowUtc(), 1, null);
|
||||
}
|
||||
|
||||
void persistPendingDeleteDomain(String domainName, DateTime now) throws Exception {
|
||||
DomainResource domain = newDomainResource(domainName);
|
||||
HistoryEntry historyEntry =
|
||||
persistResource(
|
||||
new HistoryEntry.Builder()
|
||||
.setType(HistoryEntry.Type.DOMAIN_DELETE)
|
||||
.setParent(domain)
|
||||
.build());
|
||||
domain =
|
||||
persistResource(
|
||||
domain
|
||||
.asBuilder()
|
||||
.setRegistrationExpirationTime(now.plusYears(5).plusDays(45))
|
||||
.setDeletionTime(now.plusDays(35))
|
||||
.addGracePeriod(
|
||||
GracePeriod.create(GracePeriodStatus.REDEMPTION, now.plusDays(1), "foo", null))
|
||||
.setStatusValues(ImmutableSet.of(StatusValue.PENDING_DELETE))
|
||||
.setDeletePollMessage(
|
||||
Key.create(
|
||||
persistResource(
|
||||
new PollMessage.OneTime.Builder()
|
||||
.setClientId("TheRegistrar")
|
||||
.setEventTime(now.plusDays(5))
|
||||
.setParent(historyEntry)
|
||||
.build())))
|
||||
.build());
|
||||
clock.advanceOneMilli();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_extraLogic_restorePrice() throws Exception {
|
||||
persistPendingDeleteDomain("renew-13.test", clock.nowUtc());
|
||||
TldSpecificLogicProxy.EppCommandOperations price =
|
||||
TldSpecificLogicProxy.getRestorePrice(
|
||||
Registry.get("test"), "renew-13.test", "clientId", clock.nowUtc(), null);
|
||||
assertThat(price.getCurrency()).isEqualTo(CurrencyUnit.USD);
|
||||
assertThat(price.getFees()).hasSize(2);
|
||||
assertThat(price.getFees().get(0).getCost()).isEqualTo(new BigDecimal(13));
|
||||
assertThat(price.getFees().get(0).getDescription()).isEqualTo("renew");
|
||||
assertThat(price.getFees().get(1).getDescription()).isEqualTo("restore");
|
||||
assertThat(price.getCredits()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_extraLogic_restorePrice_noDomain() throws Exception {
|
||||
thrown.expect(ResourceDoesNotExistException.class);
|
||||
TldSpecificLogicProxy.getRestorePrice(
|
||||
Registry.get("test"), "renew-13.test", "clientId", clock.nowUtc(), null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_extraLogic_transferPrice() throws Exception {
|
||||
persistActiveDomain("renew-26.test");
|
||||
TldSpecificLogicProxy.EppCommandOperations price =
|
||||
TldSpecificLogicProxy.getTransferPrice(
|
||||
Registry.get("test"), "renew-26.test", "clientId", clock.nowUtc(), 2, null);
|
||||
assertThat(price.getCurrency()).isEqualTo(CurrencyUnit.USD);
|
||||
assertThat(price.getFees()).hasSize(1);
|
||||
assertThat(price.getFees().get(0).getCost()).isEqualTo(new BigDecimal(26));
|
||||
assertThat(price.getFees().get(0).getDescription()).isEqualTo("renew");
|
||||
assertThat(price.getCredits()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_extraLogic_updatePrice() throws Exception {
|
||||
persistActiveDomain("update-13.test");
|
||||
TldSpecificLogicProxy.EppCommandOperations price =
|
||||
TldSpecificLogicProxy.getUpdatePrice(
|
||||
Registry.get("test"), "update-13.test", "clientId", clock.nowUtc(), null);
|
||||
assertThat(price.getCurrency()).isEqualTo(CurrencyUnit.USD);
|
||||
assertThat(price.getFees()).hasSize(1);
|
||||
assertThat(price.getFees().get(0).getCost()).isEqualTo(new BigDecimal(13));
|
||||
assertThat(price.getFees().get(0).getDescription()).isEqualTo("update");
|
||||
assertThat(price.getCredits()).isEmpty();
|
||||
}
|
||||
}
|
19
javatests/google/registry/flows/domain/testdata/domain_renew_fee_wildcard.xml
vendored
Normal file
19
javatests/google/registry/flows/domain/testdata/domain_renew_fee_wildcard.xml
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
||||
<command>
|
||||
<renew>
|
||||
<domain:renew
|
||||
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
|
||||
<domain:name>%DOMAIN%</domain:name>
|
||||
<domain:curExpDate>2000-04-03</domain:curExpDate>
|
||||
<domain:period unit="y">1</domain:period>
|
||||
</domain:renew>
|
||||
</renew>
|
||||
<extension>
|
||||
<fee:renew xmlns:fee="urn:ietf:params:xml:ns:fee-%FEE_VERSION%">
|
||||
<fee:currency>USD</fee:currency>
|
||||
<fee:fee>%AMOUNT%</fee:fee>
|
||||
</fee:renew>
|
||||
</extension>
|
||||
<clTRID>ABC-12345</clTRID>
|
||||
</command>
|
||||
</epp>
|
24
javatests/google/registry/flows/domain/testdata/domain_renew_response_fee_wildcard.xml
vendored
Normal file
24
javatests/google/registry/flows/domain/testdata/domain_renew_response_fee_wildcard.xml
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
||||
<response>
|
||||
<result code="1000">
|
||||
<msg>Command completed successfully</msg>
|
||||
</result>
|
||||
<resData>
|
||||
<domain:renData
|
||||
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
|
||||
<domain:name>%DOMAIN%</domain:name>
|
||||
<domain:exDate>%EX_DATE%</domain:exDate>
|
||||
</domain:renData>
|
||||
</resData>
|
||||
<extension>
|
||||
<%FEE_NS%:renData xmlns:%FEE_NS%="urn:ietf:params:xml:ns:fee-%FEE_VERSION%">
|
||||
<%FEE_NS%:currency>USD</%FEE_NS%:currency>
|
||||
<%FEE_NS%:fee description="renew">%AMOUNT%</%FEE_NS%:fee>
|
||||
</%FEE_NS%:renData>
|
||||
</extension>
|
||||
<trID>
|
||||
<clTRID>ABC-12345</clTRID>
|
||||
<svTRID>server-trid</svTRID>
|
||||
</trID>
|
||||
</response>
|
||||
</epp>
|
25
javatests/google/registry/flows/domain/testdata/domain_update_fee.xml
vendored
Normal file
25
javatests/google/registry/flows/domain/testdata/domain_update_fee.xml
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
||||
<command>
|
||||
<update>
|
||||
<domain:update
|
||||
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
|
||||
<domain:name>example.tld</domain:name>
|
||||
<domain:add/>
|
||||
<domain:rem/>
|
||||
<domain:chg>
|
||||
<domain:registrant>sh8013</domain:registrant>
|
||||
<domain:authInfo>
|
||||
<domain:pw>2BARfoo</domain:pw>
|
||||
</domain:authInfo>
|
||||
</domain:chg>
|
||||
</domain:update>
|
||||
</update>
|
||||
<extension>
|
||||
<fee:update xmlns:fee="urn:ietf:params:xml:ns:fee-%FEE_VERSION%">
|
||||
<fee:currency>USD</fee:currency>
|
||||
<fee:fee>5.00</fee:fee>
|
||||
</fee:update>
|
||||
</extension>
|
||||
<clTRID>ABC-12345</clTRID>
|
||||
</command>
|
||||
</epp>
|
32
javatests/google/registry/flows/domain/testdata/domain_update_wildcard.xml
vendored
Normal file
32
javatests/google/registry/flows/domain/testdata/domain_update_wildcard.xml
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
||||
<command>
|
||||
<update>
|
||||
<domain:update
|
||||
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
|
||||
<domain:name>%DOMAIN%</domain:name>
|
||||
<domain:add>
|
||||
<domain:ns>
|
||||
<domain:hostObj>ns2.example.foo</domain:hostObj>
|
||||
</domain:ns>
|
||||
<domain:contact type="tech">mak21</domain:contact>
|
||||
<domain:status s="clientHold"
|
||||
lang="en">Payment overdue.</domain:status>
|
||||
</domain:add>
|
||||
<domain:rem>
|
||||
<domain:ns>
|
||||
<domain:hostObj>ns1.example.foo</domain:hostObj>
|
||||
</domain:ns>
|
||||
<domain:contact type="tech">sh8013</domain:contact>
|
||||
<domain:status s="clientUpdateProhibited"/>
|
||||
</domain:rem>
|
||||
<domain:chg>
|
||||
<domain:registrant>sh8013</domain:registrant>
|
||||
<domain:authInfo>
|
||||
<domain:pw>2BARfoo</domain:pw>
|
||||
</domain:authInfo>
|
||||
</domain:chg>
|
||||
</domain:update>
|
||||
</update>
|
||||
<clTRID>ABC-12345</clTRID>
|
||||
</command>
|
||||
</epp>
|
|
@ -1,328 +0,0 @@
|
|||
// Copyright 2016 The Nomulus Authors. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package google.registry.model.domain;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
|
||||
import com.google.common.base.Ascii;
|
||||
import com.google.common.base.Joiner;
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Iterables;
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.domain.RegistryExtraFlowLogic;
|
||||
import google.registry.model.domain.fee.BaseFee;
|
||||
import google.registry.model.domain.fee.BaseFee.FeeType;
|
||||
import google.registry.model.domain.fee.Credit;
|
||||
import google.registry.model.domain.fee.Fee;
|
||||
import google.registry.model.domain.flags.FlagsCreateCommandExtension;
|
||||
import google.registry.model.domain.flags.FlagsTransferCommandExtension;
|
||||
import google.registry.model.domain.flags.FlagsUpdateCommandExtension;
|
||||
import google.registry.model.eppinput.EppInput;
|
||||
import google.registry.model.reporting.HistoryEntry;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
/**
|
||||
* Fake extra logic manager which synthesizes information from the domain name for testing purposes.
|
||||
*/
|
||||
public class TestExtraLogicManager implements RegistryExtraFlowLogic {
|
||||
|
||||
/**
|
||||
* Dummy exception used to signal success. This is thrown by the performAdditionalXXXLogic()
|
||||
* methods to indicate to the test that everything worked properly, because the
|
||||
* TestExtraLogicManager instance used by the flow will have been created deep in the flow and is
|
||||
* not accessible to the test code directly. We should fix this when we make the extra flow logic
|
||||
* injected.
|
||||
*/
|
||||
public static class TestExtraLogicManagerSuccessException extends RuntimeException {
|
||||
TestExtraLogicManagerSuccessException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the flags to be used in the EPP flags extension for info commands.
|
||||
*
|
||||
* <p>The test extra logic manager uses domain names differently for info commands than for other
|
||||
* flows. In other flows, the test logic needs returns (via the success exception) the flags found
|
||||
* in the incoming message. But for info commands, there aren't any incoming flags, only outgoing
|
||||
* ones. So we need to specify the flags using a dummy domain name; those flags can then be
|
||||
* inserted into the outgoing info response.
|
||||
*/
|
||||
@Override
|
||||
public Set<String> getExtensionFlags(
|
||||
DomainResource domain, String clientId, DateTime asOfDate) {
|
||||
// Take the part before the period, split by dashes, and treat each part after the first as
|
||||
// a flag.
|
||||
List<String> components =
|
||||
Splitter.on('-').splitToList(
|
||||
Iterables.getFirst(
|
||||
Splitter.on('.').split(domain.getFullyQualifiedDomainName()), ""));
|
||||
return ImmutableSet.copyOf(components.subList(1, components.size()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the flags to be used in the EPP flags extension for application info commands.
|
||||
*
|
||||
* <p>This method works the same way as getExtensionFlags().
|
||||
*/
|
||||
@Override
|
||||
public Set<String> getApplicationExtensionFlags(
|
||||
DomainApplication application, String clientId, DateTime asOfDate) {
|
||||
// Take the part before the period, split by dashes, and treat each part after the first as
|
||||
// a flag.
|
||||
List<String> components =
|
||||
Splitter.on('-').splitToList(
|
||||
Iterables.getFirst(
|
||||
Splitter.on('.').split(application.getFullyQualifiedDomainName()), ""));
|
||||
return ImmutableSet.copyOf(components.subList(1, components.size()));
|
||||
}
|
||||
|
||||
BaseFee domainNameToFeeOrCredit(String domainName) {
|
||||
// The second-level domain should be of the form "description-price", where description is the
|
||||
// description string of the fee or credit, and price is the price (credit if negative, fee
|
||||
// otherwise). To make sure this is a valid domain name, don't use any spaces, and limit prices
|
||||
// to integers. Don't use a two-character description for credits, since it is illegal to have
|
||||
// both the third and fourth characters of a domain name label be hyphens.
|
||||
List<String> components =
|
||||
Splitter.on('-').limit(2).splitToList(
|
||||
Iterables.getFirst(Splitter.on('.').split(domainName), ""));
|
||||
checkArgument(components.size() == 2, "Domain name must be of the form description-price.tld");
|
||||
int price = Integer.parseInt(components.get(1));
|
||||
if (price < 0) {
|
||||
return Credit.create(
|
||||
new BigDecimal(price), FeeType.valueOf(Ascii.toUpperCase(components.get(0))));
|
||||
} else {
|
||||
return Fee.create(
|
||||
new BigDecimal(price), FeeType.valueOf(Ascii.toUpperCase(components.get(0))));
|
||||
}
|
||||
}
|
||||
|
||||
/** Performs additional tasks required for an application create command. */
|
||||
@Override
|
||||
public void performAdditionalApplicationCreateLogic(
|
||||
DomainApplication application,
|
||||
String clientId,
|
||||
int years,
|
||||
EppInput eppInput,
|
||||
HistoryEntry historyEntry) throws EppException {
|
||||
FlagsCreateCommandExtension flags =
|
||||
eppInput.getSingleExtension(FlagsCreateCommandExtension.class);
|
||||
if (flags == null) {
|
||||
return;
|
||||
}
|
||||
throw new TestExtraLogicManagerSuccessException(Joiner.on(',').join(flags.getFlags()));
|
||||
}
|
||||
|
||||
/** Performs additional tasks required for an application create command. */
|
||||
@Override
|
||||
public void performAdditionalApplicationDeleteLogic(
|
||||
DomainApplication application,
|
||||
String clientId,
|
||||
DateTime asOfDate,
|
||||
EppInput eppInput,
|
||||
HistoryEntry historyEntry) throws EppException {
|
||||
throw new TestExtraLogicManagerSuccessException("application deleted");
|
||||
}
|
||||
|
||||
/** Computes the expected application update cost, for use in fee challenges and the like. */
|
||||
@Override
|
||||
public BaseFee getApplicationUpdateFeeOrCredit(
|
||||
DomainApplication application,
|
||||
String clientId,
|
||||
DateTime asOfDate,
|
||||
EppInput eppInput) throws EppException {
|
||||
return domainNameToFeeOrCredit(application.getFullyQualifiedDomainName());
|
||||
}
|
||||
|
||||
/** Performs additional tasks required for an application update command. */
|
||||
@Override
|
||||
public void performAdditionalApplicationUpdateLogic(
|
||||
DomainApplication application,
|
||||
String clientId,
|
||||
DateTime asOfDate,
|
||||
EppInput eppInput,
|
||||
HistoryEntry historyEntry) throws EppException {
|
||||
FlagsUpdateCommandExtension flags =
|
||||
eppInput.getSingleExtension(FlagsUpdateCommandExtension.class);
|
||||
if (flags == null) {
|
||||
return;
|
||||
}
|
||||
throw new TestExtraLogicManagerSuccessException(
|
||||
"add:"
|
||||
+ Joiner.on(',').join(flags.getAddFlags().getFlags())
|
||||
+ ";remove:"
|
||||
+ Joiner.on(',').join(flags.getRemoveFlags().getFlags()));
|
||||
}
|
||||
|
||||
/** Computes the expected create cost, for use in fee challenges and the like. */
|
||||
@Override
|
||||
public BaseFee getCreateFeeOrCredit(
|
||||
String domainName,
|
||||
String clientId,
|
||||
DateTime asOfDate,
|
||||
int years,
|
||||
EppInput eppInput) throws EppException {
|
||||
return domainNameToFeeOrCredit(domainName);
|
||||
}
|
||||
|
||||
/** Performs additional tasks required for an allocate command. */
|
||||
@Override
|
||||
public void performAdditionalDomainAllocateLogic(
|
||||
DomainResource domain,
|
||||
String clientId,
|
||||
DateTime asOfDate,
|
||||
int years,
|
||||
EppInput eppInput,
|
||||
HistoryEntry historyEntry) throws EppException {
|
||||
throw new TestExtraLogicManagerSuccessException("allocated");
|
||||
}
|
||||
|
||||
/** Performs additional tasks required for a create command. */
|
||||
@Override
|
||||
public void performAdditionalDomainCreateLogic(
|
||||
DomainResource domain,
|
||||
String clientId,
|
||||
int years,
|
||||
EppInput eppInput,
|
||||
HistoryEntry historyEntry) throws EppException {
|
||||
FlagsCreateCommandExtension flags =
|
||||
eppInput.getSingleExtension(FlagsCreateCommandExtension.class);
|
||||
if (flags == null) {
|
||||
return;
|
||||
}
|
||||
throw new TestExtraLogicManagerSuccessException(Joiner.on(',').join(flags.getFlags()));
|
||||
}
|
||||
|
||||
/** Performs additional tasks required for a delete command. */
|
||||
@Override
|
||||
public void performAdditionalDomainDeleteLogic(
|
||||
DomainResource domainResource,
|
||||
String clientId,
|
||||
DateTime asOfDate,
|
||||
EppInput eppInput,
|
||||
HistoryEntry historyEntry) throws EppException {
|
||||
throw new TestExtraLogicManagerSuccessException("deleted");
|
||||
}
|
||||
|
||||
/** Computes the expected renewal cost, for use in fee challenges and the like. */
|
||||
@Override
|
||||
public BaseFee getRenewFeeOrCredit(
|
||||
DomainResource domain,
|
||||
String clientId,
|
||||
DateTime asOfDate,
|
||||
int years,
|
||||
EppInput eppInput) throws EppException {
|
||||
return domainNameToFeeOrCredit(domain.getFullyQualifiedDomainName());
|
||||
}
|
||||
|
||||
/** Performs additional tasks required for a renew command. */
|
||||
@Override
|
||||
public void performAdditionalDomainRenewLogic(
|
||||
DomainResource domainResource,
|
||||
String clientId,
|
||||
DateTime asOfDate,
|
||||
int years,
|
||||
EppInput eppInput,
|
||||
HistoryEntry historyEntry) throws EppException {
|
||||
throw new TestExtraLogicManagerSuccessException("renewed");
|
||||
}
|
||||
|
||||
/** Performs additional tasks required for a restore command. */
|
||||
@Override
|
||||
public void performAdditionalDomainRestoreLogic(
|
||||
DomainResource domainResource,
|
||||
String clientId,
|
||||
DateTime asOfDate,
|
||||
EppInput eppInput,
|
||||
HistoryEntry historyEntry) throws EppException {
|
||||
throw new TestExtraLogicManagerSuccessException("restored");
|
||||
}
|
||||
|
||||
/** Performs additional tasks required for a transfer approve command. */
|
||||
@Override
|
||||
public void performAdditionalDomainTransferApproveLogic(
|
||||
DomainResource domain, String clientId, HistoryEntry historyEntry) throws EppException {
|
||||
throw new TestExtraLogicManagerSuccessException("transfer approved");
|
||||
}
|
||||
|
||||
/** Performs additional tasks required for a transfer cancel command. */
|
||||
@Override
|
||||
public void performAdditionalDomainTransferCancelLogic(
|
||||
DomainResource domain, String clientId, HistoryEntry historyEntry) throws EppException {
|
||||
throw new TestExtraLogicManagerSuccessException("transfer cancelled");
|
||||
}
|
||||
|
||||
/** Performs additional tasks required for a transfer reject command. */
|
||||
@Override
|
||||
public void performAdditionalDomainTransferRejectLogic(
|
||||
DomainResource domain, String clientId, HistoryEntry historyEntry) throws EppException {
|
||||
throw new TestExtraLogicManagerSuccessException("transfer rejected");
|
||||
}
|
||||
|
||||
/** Performs additional tasks required for a transfer request command. */
|
||||
@Override
|
||||
public void performAdditionalDomainTransferRequestLogic(
|
||||
DomainResource domainResource,
|
||||
String clientId,
|
||||
DateTime asOfDate,
|
||||
int years,
|
||||
EppInput eppInput,
|
||||
HistoryEntry historyEntry) throws EppException {
|
||||
FlagsTransferCommandExtension flags =
|
||||
eppInput.getSingleExtension(FlagsTransferCommandExtension.class);
|
||||
if (flags == null) {
|
||||
return;
|
||||
}
|
||||
throw new TestExtraLogicManagerSuccessException(
|
||||
"add:"
|
||||
+ Joiner.on(',').join(flags.getAddFlags().getFlags())
|
||||
+ ";remove:"
|
||||
+ Joiner.on(',').join(flags.getRemoveFlags().getFlags()));
|
||||
}
|
||||
|
||||
/** Computes the expected update cost, for use in fee challenges and the like. */
|
||||
@Override
|
||||
public BaseFee getUpdateFeeOrCredit(
|
||||
DomainResource domain,
|
||||
String clientId,
|
||||
DateTime asOfDate,
|
||||
EppInput eppInput) throws EppException {
|
||||
return domainNameToFeeOrCredit(domain.getFullyQualifiedDomainName());
|
||||
}
|
||||
|
||||
/** Performs additional tasks required for an update command. */
|
||||
@Override
|
||||
public void performAdditionalDomainUpdateLogic(
|
||||
DomainResource domainResource,
|
||||
String clientId,
|
||||
DateTime asOfDate,
|
||||
EppInput eppInput,
|
||||
HistoryEntry historyEntry) throws EppException {
|
||||
FlagsUpdateCommandExtension flags =
|
||||
eppInput.getSingleExtension(FlagsUpdateCommandExtension.class);
|
||||
if (flags == null) {
|
||||
return;
|
||||
}
|
||||
throw new TestExtraLogicManagerSuccessException(
|
||||
"add:"
|
||||
+ Joiner.on(',').join(flags.getAddFlags().getFlags())
|
||||
+ ";remove:"
|
||||
+ Joiner.on(',').join(flags.getRemoveFlags().getFlags()));
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue