Add extra logic for all relevant flows

This CL enhances various domain flows (check, create, delete, renew, restore, transfer, update) so that they invoke the appropriate methods on the object implementing the TLD's RegistryExtraFlowLogic (if any). TldSpecificLogicProxy is also updated to invoke RegistryExtraFlowLogic proxy (if any) to fetch the appropriate price. The tests use a made-up extra flow logic object which can be attached to a test TLD to make sure that the proper routines are being invoked.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=132486734
This commit is contained in:
mountford 2016-09-07 15:23:50 -07:00 committed by Ben McIlwain
parent a6db24c8bb
commit 95cc7ab3d8
46 changed files with 1173 additions and 394 deletions

View file

@ -21,6 +21,7 @@ import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.pricing.PricingEngineProxy.getPricesForDomainName;
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.deleteTld;
import static google.registry.testing.DatastoreHelper.getHistoryEntries;
import static google.registry.testing.DatastoreHelper.newContactResource;
@ -104,6 +105,7 @@ import google.registry.model.billing.BillingEvent.Reason;
import google.registry.model.domain.DomainResource;
import google.registry.model.domain.GracePeriod;
import google.registry.model.domain.LrpToken;
import google.registry.model.domain.TestExtraLogicManager;
import google.registry.model.domain.launch.ApplicationStatus;
import google.registry.model.domain.launch.LaunchNotice;
import google.registry.model.domain.rgp.GracePeriodStatus;
@ -134,7 +136,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
@Before
public void initCreateTest() throws Exception {
createTld("tld");
createTlds("tld", "flags");
persistResource(Registry.get("tld").asBuilder()
.setReservedLists(persistReservedList(
"tld-reserved",
@ -142,6 +144,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
"anchor,RESERVED_FOR_ANCHOR_TENANT,2fooBAR"))
.build());
persistClaimsList(ImmutableMap.of("example-one", CLAIMS_KEY));
RegistryExtraFlowLogicProxy.setOverride("flags", TestExtraLogicManager.class);
}
/**
@ -1604,4 +1607,20 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
.build());
doSuccessfulTest("tld", "domain_create_response.xml");
}
@Test
public void testFailure_flags_feeMismatch() throws Exception {
persistContactsAndHosts();
setEppInput("domain_create_flags.xml", ImmutableMap.of("FEE", "12"));
thrown.expect(FeesMismatchException.class);
runFlow();
}
@Test
public void testSuccess_flags() throws Exception {
persistContactsAndHosts();
setEppInput("domain_create_flags.xml", ImmutableMap.of("FEE", "42"));
thrown.expect(IllegalArgumentException.class, "flag1,flag2");
runFlow();
}
}