mirror of
https://github.com/google/nomulus.git
synced 2025-08-05 09:21:49 +02:00
Move two enums from FlowRunner to FlowTestCase.
They are only needed in test code. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=125126550
This commit is contained in:
parent
038d3d5031
commit
31ddced437
23 changed files with 37 additions and 86 deletions
|
@ -34,8 +34,6 @@ import com.google.common.collect.ImmutableSet;
|
|||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import google.registry.flows.FlowRunner.CommitMode;
|
||||
import google.registry.flows.FlowRunner.UserPrivileges;
|
||||
import google.registry.flows.SessionMetadata.SessionSource;
|
||||
import google.registry.flows.picker.FlowPicker;
|
||||
import google.registry.model.billing.BillingEvent;
|
||||
|
@ -74,6 +72,12 @@ import java.util.Map;
|
|||
@RunWith(MockitoJUnitRunner.class)
|
||||
public abstract class FlowTestCase<F extends Flow> {
|
||||
|
||||
/** Whether to actually write to the datastore or just simulate. */
|
||||
public enum CommitMode { LIVE, DRY_RUN }
|
||||
|
||||
/** Whether to run in normal or superuser mode. */
|
||||
public enum UserPrivileges { NORMAL, SUPERUSER }
|
||||
|
||||
@Rule
|
||||
public final AppEngineRule appEngine = AppEngineRule.builder()
|
||||
.withDatastore()
|
||||
|
@ -87,7 +91,7 @@ public abstract class FlowTestCase<F extends Flow> {
|
|||
|
||||
protected EppLoader eppLoader;
|
||||
protected Class<? extends Flow> flowClass;
|
||||
protected SessionMetadata sessionMetadata;
|
||||
protected TestSessionMetadata sessionMetadata;
|
||||
protected FakeClock clock = new FakeClock(DateTime.now(UTC));
|
||||
|
||||
@Before
|
||||
|
@ -275,7 +279,9 @@ public abstract class FlowTestCase<F extends Flow> {
|
|||
|
||||
/** Run a flow, and attempt to marshal the result to EPP or throw if it doesn't validate. */
|
||||
public EppOutput runFlow(CommitMode commitMode, UserPrivileges userPrivileges) throws Exception {
|
||||
EppOutput output = getFlowRunner().run(commitMode, userPrivileges);
|
||||
sessionMetadata.setSuperuser(userPrivileges.equals(UserPrivileges.SUPERUSER));
|
||||
sessionMetadata.setIsDryRun(commitMode.equals(CommitMode.DRY_RUN));
|
||||
EppOutput output = getFlowRunner().run();
|
||||
marshal(output, ValidationMode.STRICT);
|
||||
return output;
|
||||
}
|
||||
|
@ -287,7 +293,9 @@ public abstract class FlowTestCase<F extends Flow> {
|
|||
public void runFlowAssertResponse(
|
||||
CommitMode commitMode, UserPrivileges userPrivileges, String xml, String... ignoredPaths)
|
||||
throws Exception {
|
||||
EppOutput eppOutput = getFlowRunner().run(commitMode, userPrivileges);
|
||||
sessionMetadata.setSuperuser(userPrivileges.equals(UserPrivileges.SUPERUSER));
|
||||
sessionMetadata.setIsDryRun(commitMode.equals(CommitMode.DRY_RUN));
|
||||
EppOutput eppOutput = getFlowRunner().run();
|
||||
if (eppOutput.isResponse()) {
|
||||
assertThat(eppOutput.isSuccess()).isTrue();
|
||||
}
|
||||
|
|
|
@ -30,8 +30,6 @@ import com.google.common.collect.ImmutableSet;
|
|||
|
||||
import com.googlecode.objectify.Key;
|
||||
|
||||
import google.registry.flows.FlowRunner.CommitMode;
|
||||
import google.registry.flows.FlowRunner.UserPrivileges;
|
||||
import google.registry.flows.ResourceAsyncDeleteFlow.ResourceToDeleteIsReferencedException;
|
||||
import google.registry.flows.ResourceFlowTestCase;
|
||||
import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException;
|
||||
|
|
|
@ -24,8 +24,6 @@ import static google.registry.testing.DatastoreHelper.persistResource;
|
|||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import google.registry.flows.FlowRunner.CommitMode;
|
||||
import google.registry.flows.FlowRunner.UserPrivileges;
|
||||
import google.registry.flows.ResourceFlowTestCase;
|
||||
import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException;
|
||||
import google.registry.flows.ResourceMutateFlow.ResourceToMutateDoesNotExistException;
|
||||
|
|
|
@ -43,8 +43,6 @@ import com.google.common.collect.ImmutableSet;
|
|||
import com.googlecode.objectify.Ref;
|
||||
|
||||
import google.registry.flows.EppException.UnimplementedExtensionException;
|
||||
import google.registry.flows.FlowRunner.CommitMode;
|
||||
import google.registry.flows.FlowRunner.UserPrivileges;
|
||||
import google.registry.flows.ResourceCreateFlow.ResourceAlreadyExistsException;
|
||||
import google.registry.flows.ResourceFlowTestCase;
|
||||
import google.registry.flows.domain.DomainAllocateFlow.HasFinalStatusException;
|
||||
|
|
|
@ -41,8 +41,6 @@ import com.google.common.collect.ImmutableSet;
|
|||
import com.google.common.collect.ImmutableSortedMap;
|
||||
|
||||
import google.registry.flows.EppException.UnimplementedExtensionException;
|
||||
import google.registry.flows.FlowRunner.CommitMode;
|
||||
import google.registry.flows.FlowRunner.UserPrivileges;
|
||||
import google.registry.flows.ResourceCreateFlow.ResourceAlreadyExistsException;
|
||||
import google.registry.flows.ResourceFlow.BadCommandForRegistryPhaseException;
|
||||
import google.registry.flows.ResourceFlowTestCase;
|
||||
|
|
|
@ -30,8 +30,6 @@ import com.google.common.collect.ImmutableSet;
|
|||
import com.googlecode.objectify.Ref;
|
||||
|
||||
import google.registry.flows.EppException.UnimplementedExtensionException;
|
||||
import google.registry.flows.FlowRunner.CommitMode;
|
||||
import google.registry.flows.FlowRunner.UserPrivileges;
|
||||
import google.registry.flows.ResourceFlow.BadCommandForRegistryPhaseException;
|
||||
import google.registry.flows.ResourceFlowTestCase;
|
||||
import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException;
|
||||
|
|
|
@ -33,8 +33,6 @@ import com.google.common.collect.ImmutableSet;
|
|||
import com.googlecode.objectify.Ref;
|
||||
|
||||
import google.registry.flows.EppException.UnimplementedExtensionException;
|
||||
import google.registry.flows.FlowRunner.CommitMode;
|
||||
import google.registry.flows.FlowRunner.UserPrivileges;
|
||||
import google.registry.flows.ResourceFlowTestCase;
|
||||
import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException;
|
||||
import google.registry.flows.ResourceMutateFlow.ResourceToMutateDoesNotExistException;
|
||||
|
|
|
@ -47,8 +47,6 @@ import com.google.common.collect.ImmutableSet;
|
|||
import com.google.common.collect.ImmutableSortedMap;
|
||||
|
||||
import google.registry.flows.EppException.UnimplementedExtensionException;
|
||||
import google.registry.flows.FlowRunner.CommitMode;
|
||||
import google.registry.flows.FlowRunner.UserPrivileges;
|
||||
import google.registry.flows.LoggedInFlow.UndeclaredServiceExtensionException;
|
||||
import google.registry.flows.ResourceCreateFlow.ResourceAlreadyExistsException;
|
||||
import google.registry.flows.ResourceCreateOrMutateFlow.OnlyToolCanPassMetadataException;
|
||||
|
|
|
@ -44,8 +44,6 @@ import com.google.common.collect.Iterables;
|
|||
import com.googlecode.objectify.Key;
|
||||
import com.googlecode.objectify.Ref;
|
||||
|
||||
import google.registry.flows.FlowRunner.CommitMode;
|
||||
import google.registry.flows.FlowRunner.UserPrivileges;
|
||||
import google.registry.flows.ResourceCreateOrMutateFlow.OnlyToolCanPassMetadataException;
|
||||
import google.registry.flows.ResourceFlowTestCase;
|
||||
import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException;
|
||||
|
|
|
@ -35,8 +35,6 @@ import com.google.common.collect.ImmutableSortedMap;
|
|||
|
||||
import com.googlecode.objectify.Ref;
|
||||
|
||||
import google.registry.flows.FlowRunner.CommitMode;
|
||||
import google.registry.flows.FlowRunner.UserPrivileges;
|
||||
import google.registry.flows.ResourceFlowTestCase;
|
||||
import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException;
|
||||
import google.registry.flows.ResourceMutateFlow.ResourceToMutateDoesNotExistException;
|
||||
|
|
|
@ -36,8 +36,6 @@ import com.google.common.collect.ImmutableSortedMap;
|
|||
import com.googlecode.objectify.Key;
|
||||
|
||||
import google.registry.flows.EppException.UnimplementedExtensionException;
|
||||
import google.registry.flows.FlowRunner.CommitMode;
|
||||
import google.registry.flows.FlowRunner.UserPrivileges;
|
||||
import google.registry.flows.ResourceFlowTestCase;
|
||||
import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException;
|
||||
import google.registry.flows.ResourceMutateFlow.ResourceToMutateDoesNotExistException;
|
||||
|
|
|
@ -38,8 +38,6 @@ import com.google.common.collect.ImmutableSet;
|
|||
import com.google.common.collect.ImmutableSortedMap;
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
import google.registry.flows.FlowRunner.CommitMode;
|
||||
import google.registry.flows.FlowRunner.UserPrivileges;
|
||||
import google.registry.flows.ResourceFlowUtils.BadAuthInfoForResourceException;
|
||||
import google.registry.flows.ResourceMutateFlow.ResourceToMutateDoesNotExistException;
|
||||
import google.registry.flows.ResourceTransferRequestFlow.AlreadyPendingTransferException;
|
||||
|
|
|
@ -42,8 +42,6 @@ import com.googlecode.objectify.Key;
|
|||
import com.googlecode.objectify.Ref;
|
||||
|
||||
import google.registry.flows.EppException.UnimplementedExtensionException;
|
||||
import google.registry.flows.FlowRunner.CommitMode;
|
||||
import google.registry.flows.FlowRunner.UserPrivileges;
|
||||
import google.registry.flows.ResourceCreateOrMutateFlow.OnlyToolCanPassMetadataException;
|
||||
import google.registry.flows.ResourceFlowTestCase;
|
||||
import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException;
|
||||
|
|
|
@ -33,8 +33,6 @@ import com.google.common.collect.ImmutableSet;
|
|||
import com.googlecode.objectify.Key;
|
||||
import com.googlecode.objectify.Ref;
|
||||
|
||||
import google.registry.flows.FlowRunner.CommitMode;
|
||||
import google.registry.flows.FlowRunner.UserPrivileges;
|
||||
import google.registry.flows.ResourceAsyncDeleteFlow.ResourceToDeleteIsReferencedException;
|
||||
import google.registry.flows.ResourceFlowTestCase;
|
||||
import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException;
|
||||
|
|
|
@ -42,8 +42,6 @@ import com.google.common.collect.ImmutableSet;
|
|||
import com.googlecode.objectify.Key;
|
||||
import com.googlecode.objectify.Ref;
|
||||
|
||||
import google.registry.flows.FlowRunner.CommitMode;
|
||||
import google.registry.flows.FlowRunner.UserPrivileges;
|
||||
import google.registry.flows.ResourceFlowTestCase;
|
||||
import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException;
|
||||
import google.registry.flows.ResourceMutateFlow.ResourceToMutateDoesNotExistException;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue