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:
cgoldfeder 2016-06-16 18:54:40 -07:00 committed by Ben McIlwain
parent 038d3d5031
commit 31ddced437
23 changed files with 37 additions and 86 deletions

View file

@ -22,8 +22,6 @@ import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import google.registry.flows.FlowRunner.CommitMode;
import google.registry.flows.FlowRunner.UserPrivileges;
import google.registry.model.eppcommon.Trid; import google.registry.model.eppcommon.Trid;
import google.registry.model.eppinput.EppInput; import google.registry.model.eppinput.EppInput;
import google.registry.model.eppoutput.EppOutput; import google.registry.model.eppoutput.EppOutput;
@ -61,10 +59,7 @@ public final class EppController {
ImmutableList<String> targetIds = eppInput.getTargetIds(); ImmutableList<String> targetIds = eppInput.getTargetIds();
metrics.setCommandName(eppInput.getCommandName()); metrics.setCommandName(eppInput.getCommandName());
metrics.setClientId(sessionMetadata.getClientId()); metrics.setClientId(sessionMetadata.getClientId());
metrics.setPrivilegeLevel( metrics.setPrivilegeLevel(sessionMetadata.isSuperuser() ? "SUPERUSER" : "NORMAL");
sessionMetadata.isSuperuser()
? UserPrivileges.SUPERUSER.toString()
: UserPrivileges.NORMAL.toString());
if (!targetIds.isEmpty()) { if (!targetIds.isEmpty()) {
metrics.setEppTarget(Joiner.on(",").join(targetIds)); metrics.setEppTarget(Joiner.on(",").join(targetIds));
} }
@ -76,9 +71,7 @@ public final class EppController {
inputXmlBytes, inputXmlBytes,
metrics, metrics,
clock); clock);
EppOutput eppOutput = flowRunner.run( EppOutput eppOutput = flowRunner.run();
sessionMetadata.isDryRun() ? CommitMode.DRY_RUN : CommitMode.LIVE,
sessionMetadata.isSuperuser() ? UserPrivileges.SUPERUSER : UserPrivileges.NORMAL);
if (eppOutput.isResponse()) { if (eppOutput.isResponse()) {
metrics.setEppStatus(eppOutput.getResponse().getResult().getCode()); metrics.setEppStatus(eppOutput.getResponse().getResult().getCode());
} }

View file

@ -101,14 +101,13 @@ public abstract class Flow {
EppInput eppInput, EppInput eppInput,
Trid trid, Trid trid,
SessionMetadata sessionMetadata, SessionMetadata sessionMetadata,
boolean superuser,
DateTime now, DateTime now,
byte[] inputXmlBytes) throws EppException { byte[] inputXmlBytes) throws EppException {
this.eppInput = eppInput; this.eppInput = eppInput;
this.trid = trid; this.trid = trid;
this.sessionMetadata = sessionMetadata; this.sessionMetadata = sessionMetadata;
this.now = now; this.now = now;
this.superuser = superuser; this.superuser = sessionMetadata.isSuperuser();
this.inputXmlBytes = inputXmlBytes; this.inputXmlBytes = inputXmlBytes;
initFlow(); initFlow();
validExtensions = ImmutableSet.copyOf(validExtensions); validExtensions = ImmutableSet.copyOf(validExtensions);

View file

@ -38,12 +38,6 @@ public class FlowRunner {
private static final String COMMAND_LOG_FORMAT = "EPP Command" + Strings.repeat("\n\t%s", 4); private static final String COMMAND_LOG_FORMAT = "EPP Command" + Strings.repeat("\n\t%s", 4);
/** 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 }
private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass(); private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass();
private final Class<? extends Flow> flowClass; private final Class<? extends Flow> flowClass;
@ -71,10 +65,8 @@ public class FlowRunner {
this.clock = clock; this.clock = clock;
} }
public EppOutput run( public EppOutput run() throws EppException {
final CommitMode commitMode, final UserPrivileges userPrivileges) throws EppException {
String clientId = sessionMetadata.getClientId(); String clientId = sessionMetadata.getClientId();
final boolean isSuperuser = UserPrivileges.SUPERUSER.equals(userPrivileges);
logger.infofmt( logger.infofmt(
COMMAND_LOG_FORMAT, COMMAND_LOG_FORMAT,
trid.getServerTransactionId(), trid.getServerTransactionId(),
@ -85,14 +77,14 @@ public class FlowRunner {
if (metrics != null) { if (metrics != null) {
metrics.incrementAttempts(); metrics.incrementAttempts();
} }
return createAndInitFlow(isSuperuser, clock.nowUtc()).run(); return createAndInitFlow(clock.nowUtc()).run();
} }
// We log the command in a structured format. Note that we do this before the transaction; // We log the command in a structured format. Note that we do this before the transaction;
// if we did it after, we might miss a transaction that committed successfully but then crashed // if we did it after, we might miss a transaction that committed successfully but then crashed
// before it could log. // before it could log.
logger.info("EPP_Mutation " + new JsonLogStatement(trid) logger.info("EPP_Mutation " + new JsonLogStatement(trid)
.add("client", clientId) .add("client", clientId)
.add("privileges", userPrivileges.toString()) .add("privileges", sessionMetadata.isSuperuser() ? "SUPERUSER" : "NORMAL")
.add("xmlBytes", base64().encode(inputXmlBytes))); .add("xmlBytes", base64().encode(inputXmlBytes)));
try { try {
EppOutput flowResult = ofy().transact(new Work<EppOutput>() { EppOutput flowResult = ofy().transact(new Work<EppOutput>() {
@ -102,8 +94,8 @@ public class FlowRunner {
metrics.incrementAttempts(); metrics.incrementAttempts();
} }
try { try {
EppOutput output = createAndInitFlow(isSuperuser, ofy().getTransactionTime()).run(); EppOutput output = createAndInitFlow(ofy().getTransactionTime()).run();
if (CommitMode.DRY_RUN.equals(commitMode)) { if (sessionMetadata.isDryRun()) {
throw new DryRunException(output); throw new DryRunException(output);
} }
return output; return output;
@ -127,12 +119,11 @@ public class FlowRunner {
} }
} }
private Flow createAndInitFlow(boolean superuser, DateTime now) throws EppException { private Flow createAndInitFlow(DateTime now) throws EppException {
return TypeUtils.<Flow>instantiate(flowClass).init( return TypeUtils.<Flow>instantiate(flowClass).init(
eppInput, eppInput,
trid, trid,
sessionMetadata, sessionMetadata,
superuser,
now, now,
inputXmlBytes); inputXmlBytes);
} }

View file

@ -14,16 +14,8 @@
package google.registry.tools; package google.registry.tools;
import static google.registry.flows.EppXmlTransformer.marshalWithLenientRetry;
import static java.nio.charset.StandardCharsets.UTF_8;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import google.registry.flows.EppException;
import google.registry.flows.FlowRunner;
import google.registry.flows.FlowRunner.CommitMode;
import google.registry.flows.FlowRunner.UserPrivileges;
/** Container class for static utility methods. */ /** Container class for static utility methods. */
class CommandUtilities { class CommandUtilities {
@ -60,10 +52,4 @@ class CommandUtilities {
System.out.println(text); System.out.println(text);
} }
} }
static String runFlow(
FlowRunner flowRunner, CommitMode commitMode, UserPrivileges userPrivileges)
throws EppException {
return new String(marshalWithLenientRetry(flowRunner.run(commitMode, userPrivileges)), UTF_8);
}
} }

View file

@ -17,8 +17,8 @@ package google.registry.tools;
import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Strings.isNullOrEmpty; import static com.google.common.base.Strings.isNullOrEmpty;
import static com.google.common.io.Resources.getResource; import static com.google.common.io.Resources.getResource;
import static google.registry.flows.EppXmlTransformer.marshalWithLenientRetry;
import static google.registry.flows.EppXmlTransformer.unmarshal; import static google.registry.flows.EppXmlTransformer.unmarshal;
import static google.registry.tools.CommandUtilities.runFlow;
import static google.registry.util.X509Utils.getCertificateHash; import static google.registry.util.X509Utils.getCertificateHash;
import static google.registry.util.X509Utils.loadCertificate; import static google.registry.util.X509Utils.loadCertificate;
import static java.nio.charset.StandardCharsets.US_ASCII; import static java.nio.charset.StandardCharsets.US_ASCII;
@ -32,8 +32,6 @@ import com.beust.jcommander.Parameter;
import com.beust.jcommander.Parameters; import com.beust.jcommander.Parameters;
import google.registry.flows.FlowRunner; import google.registry.flows.FlowRunner;
import google.registry.flows.FlowRunner.CommitMode;
import google.registry.flows.FlowRunner.UserPrivileges;
import google.registry.flows.HttpSessionMetadata; import google.registry.flows.HttpSessionMetadata;
import google.registry.flows.TlsCredentials; import google.registry.flows.TlsCredentials;
import google.registry.flows.session.LoginFlow; import google.registry.flows.session.LoginFlow;
@ -101,7 +99,7 @@ final class ValidateLoginCredentialsCommand implements RemoteApiCommand, GtechCo
.setData(new SoyMapData("clientIdentifier", clientIdentifier, "password", password)) .setData(new SoyMapData("clientIdentifier", clientIdentifier, "password", password))
.render() .render()
.getBytes(UTF_8); .getBytes(UTF_8);
System.out.println(runFlow( System.out.println(new String(marshalWithLenientRetry(
new FlowRunner( new FlowRunner(
LoginFlow.class, LoginFlow.class,
unmarshal(EppInput.class, inputXmlBytes), unmarshal(EppInput.class, inputXmlBytes),
@ -114,8 +112,6 @@ final class ValidateLoginCredentialsCommand implements RemoteApiCommand, GtechCo
new BasicHttpSession()), new BasicHttpSession()),
inputXmlBytes, inputXmlBytes,
null, null,
new SystemClock()), new SystemClock()).run()), UTF_8));
CommitMode.DRY_RUN,
UserPrivileges.NORMAL));
} }
} }

View file

@ -38,8 +38,6 @@ import dagger.Provides;
import google.registry.config.RegistryEnvironment; import google.registry.config.RegistryEnvironment;
import google.registry.flows.EppException; import google.registry.flows.EppException;
import google.registry.flows.FlowRunner; import google.registry.flows.FlowRunner;
import google.registry.flows.FlowRunner.CommitMode;
import google.registry.flows.FlowRunner.UserPrivileges;
import google.registry.flows.SessionMetadata.SessionSource; import google.registry.flows.SessionMetadata.SessionSource;
import google.registry.flows.StatelessRequestSessionMetadata; import google.registry.flows.StatelessRequestSessionMetadata;
import google.registry.flows.domain.DomainCheckFlow; import google.registry.flows.domain.DomainCheckFlow;
@ -124,7 +122,7 @@ public class CheckApiAction implements Runnable {
inputXmlBytes, inputXmlBytes,
null, null,
clock) clock)
.run(CommitMode.LIVE, UserPrivileges.NORMAL) .run()
.getResponse(); .getResponse();
DomainCheckData checkData = (DomainCheckData) response.getResponseData().get(0); DomainCheckData checkData = (DomainCheckData) response.getResponseData().get(0);
DomainCheck check = (DomainCheck) checkData.getChecks().get(0); DomainCheck check = (DomainCheck) checkData.getChecks().get(0);

View file

@ -34,8 +34,6 @@ import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
import com.google.common.collect.Maps; 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.SessionMetadata.SessionSource;
import google.registry.flows.picker.FlowPicker; import google.registry.flows.picker.FlowPicker;
import google.registry.model.billing.BillingEvent; import google.registry.model.billing.BillingEvent;
@ -74,6 +72,12 @@ import java.util.Map;
@RunWith(MockitoJUnitRunner.class) @RunWith(MockitoJUnitRunner.class)
public abstract class FlowTestCase<F extends Flow> { 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 @Rule
public final AppEngineRule appEngine = AppEngineRule.builder() public final AppEngineRule appEngine = AppEngineRule.builder()
.withDatastore() .withDatastore()
@ -87,7 +91,7 @@ public abstract class FlowTestCase<F extends Flow> {
protected EppLoader eppLoader; protected EppLoader eppLoader;
protected Class<? extends Flow> flowClass; protected Class<? extends Flow> flowClass;
protected SessionMetadata sessionMetadata; protected TestSessionMetadata sessionMetadata;
protected FakeClock clock = new FakeClock(DateTime.now(UTC)); protected FakeClock clock = new FakeClock(DateTime.now(UTC));
@Before @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. */ /** 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 { 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); marshal(output, ValidationMode.STRICT);
return output; return output;
} }
@ -287,7 +293,9 @@ public abstract class FlowTestCase<F extends Flow> {
public void runFlowAssertResponse( public void runFlowAssertResponse(
CommitMode commitMode, UserPrivileges userPrivileges, String xml, String... ignoredPaths) CommitMode commitMode, UserPrivileges userPrivileges, String xml, String... ignoredPaths)
throws Exception { 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()) { if (eppOutput.isResponse()) {
assertThat(eppOutput.isSuccess()).isTrue(); assertThat(eppOutput.isSuccess()).isTrue();
} }

View file

@ -30,8 +30,6 @@ import com.google.common.collect.ImmutableSet;
import com.googlecode.objectify.Key; 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.ResourceAsyncDeleteFlow.ResourceToDeleteIsReferencedException;
import google.registry.flows.ResourceFlowTestCase; import google.registry.flows.ResourceFlowTestCase;
import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException; import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException;

View file

@ -24,8 +24,6 @@ import static google.registry.testing.DatastoreHelper.persistResource;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet; 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.ResourceFlowTestCase;
import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException; import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException;
import google.registry.flows.ResourceMutateFlow.ResourceToMutateDoesNotExistException; import google.registry.flows.ResourceMutateFlow.ResourceToMutateDoesNotExistException;

View file

@ -43,8 +43,6 @@ 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.EppException.UnimplementedExtensionException;
import google.registry.flows.FlowRunner.CommitMode;
import google.registry.flows.FlowRunner.UserPrivileges;
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;

View file

@ -41,8 +41,6 @@ import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSortedMap; import com.google.common.collect.ImmutableSortedMap;
import google.registry.flows.EppException.UnimplementedExtensionException; 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.ResourceCreateFlow.ResourceAlreadyExistsException;
import google.registry.flows.ResourceFlow.BadCommandForRegistryPhaseException; import google.registry.flows.ResourceFlow.BadCommandForRegistryPhaseException;
import google.registry.flows.ResourceFlowTestCase; import google.registry.flows.ResourceFlowTestCase;

View file

@ -30,8 +30,6 @@ 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.EppException.UnimplementedExtensionException;
import google.registry.flows.FlowRunner.CommitMode;
import google.registry.flows.FlowRunner.UserPrivileges;
import google.registry.flows.ResourceFlow.BadCommandForRegistryPhaseException; import google.registry.flows.ResourceFlow.BadCommandForRegistryPhaseException;
import google.registry.flows.ResourceFlowTestCase; import google.registry.flows.ResourceFlowTestCase;
import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException; import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException;

View file

@ -33,8 +33,6 @@ 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.EppException.UnimplementedExtensionException;
import google.registry.flows.FlowRunner.CommitMode;
import google.registry.flows.FlowRunner.UserPrivileges;
import google.registry.flows.ResourceFlowTestCase; import google.registry.flows.ResourceFlowTestCase;
import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException; import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException;
import google.registry.flows.ResourceMutateFlow.ResourceToMutateDoesNotExistException; import google.registry.flows.ResourceMutateFlow.ResourceToMutateDoesNotExistException;

View file

@ -47,8 +47,6 @@ import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSortedMap; import com.google.common.collect.ImmutableSortedMap;
import google.registry.flows.EppException.UnimplementedExtensionException; 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.LoggedInFlow.UndeclaredServiceExtensionException;
import google.registry.flows.ResourceCreateFlow.ResourceAlreadyExistsException; import google.registry.flows.ResourceCreateFlow.ResourceAlreadyExistsException;
import google.registry.flows.ResourceCreateOrMutateFlow.OnlyToolCanPassMetadataException; import google.registry.flows.ResourceCreateOrMutateFlow.OnlyToolCanPassMetadataException;

View file

@ -44,8 +44,6 @@ import com.google.common.collect.Iterables;
import com.googlecode.objectify.Key; import com.googlecode.objectify.Key;
import com.googlecode.objectify.Ref; 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.ResourceCreateOrMutateFlow.OnlyToolCanPassMetadataException;
import google.registry.flows.ResourceFlowTestCase; import google.registry.flows.ResourceFlowTestCase;
import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException; import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException;

View file

@ -35,8 +35,6 @@ import com.google.common.collect.ImmutableSortedMap;
import com.googlecode.objectify.Ref; 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.ResourceFlowTestCase;
import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException; import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException;
import google.registry.flows.ResourceMutateFlow.ResourceToMutateDoesNotExistException; import google.registry.flows.ResourceMutateFlow.ResourceToMutateDoesNotExistException;

View file

@ -36,8 +36,6 @@ import com.google.common.collect.ImmutableSortedMap;
import com.googlecode.objectify.Key; import com.googlecode.objectify.Key;
import google.registry.flows.EppException.UnimplementedExtensionException; 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.ResourceFlowTestCase;
import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException; import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException;
import google.registry.flows.ResourceMutateFlow.ResourceToMutateDoesNotExistException; import google.registry.flows.ResourceMutateFlow.ResourceToMutateDoesNotExistException;

View file

@ -38,8 +38,6 @@ import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSortedMap; import com.google.common.collect.ImmutableSortedMap;
import com.google.common.collect.Iterables; 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.ResourceFlowUtils.BadAuthInfoForResourceException;
import google.registry.flows.ResourceMutateFlow.ResourceToMutateDoesNotExistException; import google.registry.flows.ResourceMutateFlow.ResourceToMutateDoesNotExistException;
import google.registry.flows.ResourceTransferRequestFlow.AlreadyPendingTransferException; import google.registry.flows.ResourceTransferRequestFlow.AlreadyPendingTransferException;

View file

@ -42,8 +42,6 @@ import com.googlecode.objectify.Key;
import com.googlecode.objectify.Ref; import com.googlecode.objectify.Ref;
import google.registry.flows.EppException.UnimplementedExtensionException; 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.ResourceCreateOrMutateFlow.OnlyToolCanPassMetadataException;
import google.registry.flows.ResourceFlowTestCase; import google.registry.flows.ResourceFlowTestCase;
import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException; import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException;

View file

@ -33,8 +33,6 @@ import com.google.common.collect.ImmutableSet;
import com.googlecode.objectify.Key; import com.googlecode.objectify.Key;
import com.googlecode.objectify.Ref; 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.ResourceAsyncDeleteFlow.ResourceToDeleteIsReferencedException;
import google.registry.flows.ResourceFlowTestCase; import google.registry.flows.ResourceFlowTestCase;
import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException; import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException;

View file

@ -42,8 +42,6 @@ import com.google.common.collect.ImmutableSet;
import com.googlecode.objectify.Key; import com.googlecode.objectify.Key;
import com.googlecode.objectify.Ref; 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.ResourceFlowTestCase;
import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException; import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException;
import google.registry.flows.ResourceMutateFlow.ResourceToMutateDoesNotExistException; import google.registry.flows.ResourceMutateFlow.ResourceToMutateDoesNotExistException;

View file

@ -31,8 +31,6 @@ import static org.joda.time.Duration.standardDays;
import com.googlecode.objectify.Key; import com.googlecode.objectify.Key;
import google.registry.flows.FlowRunner; import google.registry.flows.FlowRunner;
import google.registry.flows.FlowRunner.CommitMode;
import google.registry.flows.FlowRunner.UserPrivileges;
import google.registry.flows.SessionMetadata; import google.registry.flows.SessionMetadata;
import google.registry.model.domain.DomainResource; import google.registry.model.domain.DomainResource;
import google.registry.model.eppcommon.Trid; import google.registry.model.eppcommon.Trid;
@ -89,7 +87,7 @@ public class EppResourceUtilsTest {
"<xml></xml>".getBytes(), "<xml></xml>".getBytes(),
null, null,
clock) clock)
.run(CommitMode.LIVE, UserPrivileges.NORMAL); .run();
} }
/** Test that update flow creates commit logs needed to reload at any arbitrary time. */ /** Test that update flow creates commit logs needed to reload at any arbitrary time. */

View file

@ -25,6 +25,7 @@ public class TestSessionMetadata extends SessionMetadata {
private final Map<String, Object> properties = new HashMap<>(); private final Map<String, Object> properties = new HashMap<>();
private boolean isValid = true; private boolean isValid = true;
private boolean isDryRun = false;
private SessionSource sessionSource = SessionSource.NONE; private SessionSource sessionSource = SessionSource.NONE;
@Override @Override
@ -57,6 +58,15 @@ public class TestSessionMetadata extends SessionMetadata {
sessionSource = source; sessionSource = source;
} }
public void setIsDryRun(boolean isDryRun) {
this.isDryRun = isDryRun;
}
@Override
public boolean isDryRun() {
return isDryRun;
}
public boolean isValid() { public boolean isValid() {
return isValid; return isValid;
} }