From 116bf1f4d69bf602f544b854668999b1a9d3cd82 Mon Sep 17 00:00:00 2001 From: cgoldfeder Date: Mon, 20 Jun 2016 08:27:15 -0700 Subject: [PATCH] Fix a bad assumption in DomainAllocateFlowTest. Despite the comment, DomainAllocateFlow is absolutely registered in FlowPicker. It gets picked if there's a domain create epp command that also specifies the allocate extension. Remove the explicit setting of flowClass, and remove two tests that now fail because DomainCreateFlow gets loaded - which is the desired behavior. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=125339191 --- .../flows/domain/DomainAllocateFlow.java | 13 ------------ .../google/registry/flows/FlowTestCase.java | 3 ++- .../flows/domain/DomainAllocateFlowTest.java | 20 ------------------- 3 files changed, 2 insertions(+), 34 deletions(-) diff --git a/java/google/registry/flows/domain/DomainAllocateFlow.java b/java/google/registry/flows/domain/DomainAllocateFlow.java index 47b4fc625..452d310de 100644 --- a/java/google/registry/flows/domain/DomainAllocateFlow.java +++ b/java/google/registry/flows/domain/DomainAllocateFlow.java @@ -29,7 +29,6 @@ import com.googlecode.objectify.Ref; import google.registry.flows.EppException; import google.registry.flows.EppException.AuthorizationErrorException; import google.registry.flows.EppException.ObjectDoesNotExistException; -import google.registry.flows.EppException.RequiredParameterMissingException; import google.registry.flows.EppException.StatusProhibitsOperationException; import google.registry.model.billing.BillingEvent; import google.registry.model.billing.BillingEvent.Flag; @@ -52,11 +51,9 @@ import google.registry.tmch.LordnTask; /** * An EPP flow that allocates a new domain resource from a domain application. * - * @error {@link google.registry.flows.EppException.UnimplementedExtensionException} * @error {@link google.registry.flows.ResourceCreateFlow.ResourceAlreadyExistsException} * @error {@link google.registry.flows.domain.DomainFlowUtils.NotAuthorizedForTldException} * @error {@link DomainAllocateFlow.HasFinalStatusException} - * @error {@link DomainAllocateFlow.MissingAllocateCreateExtensionException} * @error {@link DomainAllocateFlow.MissingApplicationException} * @error {@link DomainAllocateFlow.OnlySuperuserCanAllocateException} */ @@ -76,9 +73,6 @@ public class DomainAllocateFlow extends DomainCreateOrAllocateFlow { if (!isSuperuser) { throw new OnlySuperuserCanAllocateException(); } - if (allocateCreate == null) { - throw new MissingAllocateCreateExtensionException(); - } String applicationRoid = allocateCreate.getApplicationRoid(); application = loadByUniqueId(DomainApplication.class, applicationRoid, now); if (application == null) { @@ -199,13 +193,6 @@ public class DomainAllocateFlow extends DomainCreateOrAllocateFlow { return HistoryEntry.Type.DOMAIN_ALLOCATE; } - /** The allocate create extension is required to allocate a domain. */ - static class MissingAllocateCreateExtensionException extends RequiredParameterMissingException { - public MissingAllocateCreateExtensionException() { - super("The allocate create extension is required to allocate a domain"); - } - } - /** Domain application with specific ROID does not exist. */ static class MissingApplicationException extends ObjectDoesNotExistException { public MissingApplicationException(String applicationRoid) { diff --git a/javatests/google/registry/flows/FlowTestCase.java b/javatests/google/registry/flows/FlowTestCase.java index b1f8bb7ec..1bc959a2e 100644 --- a/javatests/google/registry/flows/FlowTestCase.java +++ b/javatests/google/registry/flows/FlowTestCase.java @@ -86,8 +86,9 @@ public abstract class FlowTestCase { @Rule public final InjectRule inject = new InjectRule(); + private Class flowClass; + protected EppLoader eppLoader; - protected Class flowClass; protected SessionMetadata sessionMetadata; protected FakeClock clock = new FakeClock(DateTime.now(UTC)); protected TransportCredentials credentials = new PasswordOnlyTransportCredentials(); diff --git a/javatests/google/registry/flows/domain/DomainAllocateFlowTest.java b/javatests/google/registry/flows/domain/DomainAllocateFlowTest.java index 2b2cff6e9..fc659d656 100644 --- a/javatests/google/registry/flows/domain/DomainAllocateFlowTest.java +++ b/javatests/google/registry/flows/domain/DomainAllocateFlowTest.java @@ -42,11 +42,9 @@ import com.google.common.collect.ImmutableSet; import com.googlecode.objectify.Ref; -import google.registry.flows.EppException.UnimplementedExtensionException; import google.registry.flows.ResourceCreateFlow.ResourceAlreadyExistsException; import google.registry.flows.ResourceFlowTestCase; import google.registry.flows.domain.DomainAllocateFlow.HasFinalStatusException; -import google.registry.flows.domain.DomainAllocateFlow.MissingAllocateCreateExtensionException; import google.registry.flows.domain.DomainAllocateFlow.MissingApplicationException; import google.registry.flows.domain.DomainAllocateFlow.OnlySuperuserCanAllocateException; import google.registry.flows.domain.DomainFlowUtils.NotAuthorizedForTldException; @@ -101,8 +99,6 @@ public class DomainAllocateFlowTest public void initAllocateTest() throws Exception { setEppInput("domain_allocate.xml", ImmutableMap.of("APPLICATIONID", "2-TLD")); clock.setTo(APPLICATION_TIME); - // We must manually set the flow class since this flow is not registered in the flow picker. - flowClass = DomainAllocateFlow.class; } private void setupDomainApplication(String tld, TldState tldState) throws Exception { @@ -484,14 +480,6 @@ public class DomainAllocateFlowTest runFlowAsSuperuser(); } - @Test - public void testFailure_launchExtension() throws Exception { - setupDomainApplication("tld", TldState.QUIET_PERIOD); - setEppInput("domain_create_claim_notice.xml"); - thrown.expect(UnimplementedExtensionException.class); - runFlowAsSuperuser(); - } - @Test public void testFailure_applicationDoesNotExist() throws Exception { setupDomainApplication("tld", TldState.QUIET_PERIOD); @@ -500,14 +488,6 @@ public class DomainAllocateFlowTest runFlowAsSuperuser(); } - @Test - public void testFailure_missingAllocateCreateExtension() throws Exception { - setupDomainApplication("tld", TldState.QUIET_PERIOD); - setEppInput("domain_create.xml"); - thrown.expect(MissingAllocateCreateExtensionException.class); - runFlowAsSuperuser(); - } - @Test public void testFailure_notAuthorizedForTld() throws Exception { thrown.expect(NotAuthorizedForTldException.class);