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
This commit is contained in:
cgoldfeder 2016-06-20 08:27:15 -07:00 committed by Ben McIlwain
parent 757aed2d80
commit 116bf1f4d6
3 changed files with 2 additions and 34 deletions

View file

@ -29,7 +29,6 @@ import com.googlecode.objectify.Ref;
import google.registry.flows.EppException; import google.registry.flows.EppException;
import google.registry.flows.EppException.AuthorizationErrorException; import google.registry.flows.EppException.AuthorizationErrorException;
import google.registry.flows.EppException.ObjectDoesNotExistException; import google.registry.flows.EppException.ObjectDoesNotExistException;
import google.registry.flows.EppException.RequiredParameterMissingException;
import google.registry.flows.EppException.StatusProhibitsOperationException; import google.registry.flows.EppException.StatusProhibitsOperationException;
import google.registry.model.billing.BillingEvent; import google.registry.model.billing.BillingEvent;
import google.registry.model.billing.BillingEvent.Flag; 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. * 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.ResourceCreateFlow.ResourceAlreadyExistsException}
* @error {@link google.registry.flows.domain.DomainFlowUtils.NotAuthorizedForTldException} * @error {@link google.registry.flows.domain.DomainFlowUtils.NotAuthorizedForTldException}
* @error {@link DomainAllocateFlow.HasFinalStatusException} * @error {@link DomainAllocateFlow.HasFinalStatusException}
* @error {@link DomainAllocateFlow.MissingAllocateCreateExtensionException}
* @error {@link DomainAllocateFlow.MissingApplicationException} * @error {@link DomainAllocateFlow.MissingApplicationException}
* @error {@link DomainAllocateFlow.OnlySuperuserCanAllocateException} * @error {@link DomainAllocateFlow.OnlySuperuserCanAllocateException}
*/ */
@ -76,9 +73,6 @@ public class DomainAllocateFlow extends DomainCreateOrAllocateFlow {
if (!isSuperuser) { if (!isSuperuser) {
throw new OnlySuperuserCanAllocateException(); throw new OnlySuperuserCanAllocateException();
} }
if (allocateCreate == null) {
throw new MissingAllocateCreateExtensionException();
}
String applicationRoid = allocateCreate.getApplicationRoid(); String applicationRoid = allocateCreate.getApplicationRoid();
application = loadByUniqueId(DomainApplication.class, applicationRoid, now); application = loadByUniqueId(DomainApplication.class, applicationRoid, now);
if (application == null) { if (application == null) {
@ -199,13 +193,6 @@ public class DomainAllocateFlow extends DomainCreateOrAllocateFlow {
return HistoryEntry.Type.DOMAIN_ALLOCATE; 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. */ /** Domain application with specific ROID does not exist. */
static class MissingApplicationException extends ObjectDoesNotExistException { static class MissingApplicationException extends ObjectDoesNotExistException {
public MissingApplicationException(String applicationRoid) { public MissingApplicationException(String applicationRoid) {

View file

@ -86,8 +86,9 @@ public abstract class FlowTestCase<F extends Flow> {
@Rule @Rule
public final InjectRule inject = new InjectRule(); public final InjectRule inject = new InjectRule();
private Class<? extends Flow> flowClass;
protected EppLoader eppLoader; protected EppLoader eppLoader;
protected Class<? extends Flow> flowClass;
protected SessionMetadata sessionMetadata; protected SessionMetadata sessionMetadata;
protected FakeClock clock = new FakeClock(DateTime.now(UTC)); protected FakeClock clock = new FakeClock(DateTime.now(UTC));
protected TransportCredentials credentials = new PasswordOnlyTransportCredentials(); protected TransportCredentials credentials = new PasswordOnlyTransportCredentials();

View file

@ -42,11 +42,9 @@ import com.google.common.collect.ImmutableSet;
import com.googlecode.objectify.Ref; import com.googlecode.objectify.Ref;
import google.registry.flows.EppException.UnimplementedExtensionException;
import google.registry.flows.ResourceCreateFlow.ResourceAlreadyExistsException; import google.registry.flows.ResourceCreateFlow.ResourceAlreadyExistsException;
import google.registry.flows.ResourceFlowTestCase; import google.registry.flows.ResourceFlowTestCase;
import google.registry.flows.domain.DomainAllocateFlow.HasFinalStatusException; 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.MissingApplicationException;
import google.registry.flows.domain.DomainAllocateFlow.OnlySuperuserCanAllocateException; import google.registry.flows.domain.DomainAllocateFlow.OnlySuperuserCanAllocateException;
import google.registry.flows.domain.DomainFlowUtils.NotAuthorizedForTldException; import google.registry.flows.domain.DomainFlowUtils.NotAuthorizedForTldException;
@ -101,8 +99,6 @@ public class DomainAllocateFlowTest
public void initAllocateTest() throws Exception { public void initAllocateTest() throws Exception {
setEppInput("domain_allocate.xml", ImmutableMap.of("APPLICATIONID", "2-TLD")); setEppInput("domain_allocate.xml", ImmutableMap.of("APPLICATIONID", "2-TLD"));
clock.setTo(APPLICATION_TIME); 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 { private void setupDomainApplication(String tld, TldState tldState) throws Exception {
@ -484,14 +480,6 @@ public class DomainAllocateFlowTest
runFlowAsSuperuser(); 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 @Test
public void testFailure_applicationDoesNotExist() throws Exception { public void testFailure_applicationDoesNotExist() throws Exception {
setupDomainApplication("tld", TldState.QUIET_PERIOD); setupDomainApplication("tld", TldState.QUIET_PERIOD);
@ -500,14 +488,6 @@ public class DomainAllocateFlowTest
runFlowAsSuperuser(); runFlowAsSuperuser();
} }
@Test
public void testFailure_missingAllocateCreateExtension() throws Exception {
setupDomainApplication("tld", TldState.QUIET_PERIOD);
setEppInput("domain_create.xml");
thrown.expect(MissingAllocateCreateExtensionException.class);
runFlowAsSuperuser();
}
@Test @Test
public void testFailure_notAuthorizedForTld() throws Exception { public void testFailure_notAuthorizedForTld() throws Exception {
thrown.expect(NotAuthorizedForTldException.class); thrown.expect(NotAuthorizedForTldException.class);