mirror of
https://github.com/google/nomulus.git
synced 2025-05-15 08:57:12 +02:00
Break SessionSource out of SessionMetadata and rename it EppRequestSource.
The "SessionSource" has nothing to do with sessions (and it's often used in sessionless contexts). What it does indicate is the endpoint used to make the request. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=125295224
This commit is contained in:
parent
fd6c4888db
commit
2a3a3fbc30
25 changed files with 94 additions and 95 deletions
|
@ -43,6 +43,7 @@ public class EppConsoleAction implements Runnable {
|
||||||
eppRequestHandler.executeEpp(
|
eppRequestHandler.executeEpp(
|
||||||
new HttpSessionMetadata(session),
|
new HttpSessionMetadata(session),
|
||||||
new GaeUserCredentials(getUserService().getCurrentUser()),
|
new GaeUserCredentials(getUserService().getCurrentUser()),
|
||||||
|
EppRequestSource.CONSOLE,
|
||||||
false, // This endpoint is never a dry run.
|
false, // This endpoint is never a dry run.
|
||||||
false, // This endpoint is never a superuser.
|
false, // This endpoint is never a superuser.
|
||||||
inputXmlBytes);
|
inputXmlBytes);
|
||||||
|
|
|
@ -54,6 +54,7 @@ public final class EppController {
|
||||||
public byte[] handleEppCommand(
|
public byte[] handleEppCommand(
|
||||||
SessionMetadata sessionMetadata,
|
SessionMetadata sessionMetadata,
|
||||||
TransportCredentials credentials,
|
TransportCredentials credentials,
|
||||||
|
EppRequestSource eppRequestSource,
|
||||||
boolean isDryRun,
|
boolean isDryRun,
|
||||||
boolean isSuperuser,
|
boolean isSuperuser,
|
||||||
byte[] inputXmlBytes) {
|
byte[] inputXmlBytes) {
|
||||||
|
@ -74,6 +75,7 @@ public final class EppController {
|
||||||
trid,
|
trid,
|
||||||
sessionMetadata,
|
sessionMetadata,
|
||||||
credentials,
|
credentials,
|
||||||
|
eppRequestSource,
|
||||||
isDryRun,
|
isDryRun,
|
||||||
isSuperuser,
|
isSuperuser,
|
||||||
inputXmlBytes,
|
inputXmlBytes,
|
||||||
|
|
|
@ -42,13 +42,19 @@ public class EppRequestHandler {
|
||||||
public void executeEpp(
|
public void executeEpp(
|
||||||
SessionMetadata sessionMetadata,
|
SessionMetadata sessionMetadata,
|
||||||
TransportCredentials credentials,
|
TransportCredentials credentials,
|
||||||
|
EppRequestSource eppRequestSource,
|
||||||
boolean isDryRun,
|
boolean isDryRun,
|
||||||
boolean isSuperuser,
|
boolean isSuperuser,
|
||||||
byte[] inputXmlBytes) {
|
byte[] inputXmlBytes) {
|
||||||
try {
|
try {
|
||||||
response.setPayload(new String(
|
response.setPayload(new String(
|
||||||
eppController.handleEppCommand(
|
eppController.handleEppCommand(
|
||||||
sessionMetadata, credentials, isDryRun, isSuperuser, inputXmlBytes), UTF_8));
|
sessionMetadata,
|
||||||
|
credentials,
|
||||||
|
eppRequestSource,
|
||||||
|
isDryRun,
|
||||||
|
isSuperuser,
|
||||||
|
inputXmlBytes), UTF_8));
|
||||||
response.setContentType(APPLICATION_EPP_XML);
|
response.setContentType(APPLICATION_EPP_XML);
|
||||||
// Note that we always return 200 (OK) even if the EppController returns an error response.
|
// Note that we always return 200 (OK) even if the EppController returns an error response.
|
||||||
// This is because returning an non-OK HTTP status code will cause the proxy server to
|
// This is because returning an non-OK HTTP status code will cause the proxy server to
|
||||||
|
|
26
java/google/registry/flows/EppRequestSource.java
Normal file
26
java/google/registry/flows/EppRequestSource.java
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
// Copyright 2016 The Domain Registry Authors. All Rights Reserved.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
package google.registry.flows;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An enum that identifies the origin of the session.
|
||||||
|
*/
|
||||||
|
public enum EppRequestSource {
|
||||||
|
CONSOLE,
|
||||||
|
TLS,
|
||||||
|
TOOL,
|
||||||
|
CHECK_API,
|
||||||
|
UNIT_TEST
|
||||||
|
}
|
|
@ -49,6 +49,7 @@ public class EppTlsAction implements Runnable {
|
||||||
eppRequestHandler.executeEpp(
|
eppRequestHandler.executeEpp(
|
||||||
new HttpSessionMetadata(session),
|
new HttpSessionMetadata(session),
|
||||||
tlsCredentials,
|
tlsCredentials,
|
||||||
|
EppRequestSource.TLS,
|
||||||
false, // This endpoint is never a dry run.
|
false, // This endpoint is never a dry run.
|
||||||
false, // This endpoint is never a superuser.
|
false, // This endpoint is never a superuser.
|
||||||
inputXmlBytes);
|
inputXmlBytes);
|
||||||
|
|
|
@ -21,7 +21,6 @@ import static java.nio.charset.StandardCharsets.UTF_8;
|
||||||
import dagger.Module;
|
import dagger.Module;
|
||||||
import dagger.Provides;
|
import dagger.Provides;
|
||||||
|
|
||||||
import google.registry.flows.SessionMetadata.SessionSource;
|
|
||||||
import google.registry.model.eppcommon.ProtocolDefinition;
|
import google.registry.model.eppcommon.ProtocolDefinition;
|
||||||
import google.registry.request.Action;
|
import google.registry.request.Action;
|
||||||
import google.registry.request.Action.Method;
|
import google.registry.request.Action.Method;
|
||||||
|
@ -50,9 +49,9 @@ public class EppToolAction implements Runnable {
|
||||||
eppRequestHandler.executeEpp(
|
eppRequestHandler.executeEpp(
|
||||||
new StatelessRequestSessionMetadata(
|
new StatelessRequestSessionMetadata(
|
||||||
clientIdentifier,
|
clientIdentifier,
|
||||||
ProtocolDefinition.getVisibleServiceExtensionUris(),
|
ProtocolDefinition.getVisibleServiceExtensionUris()),
|
||||||
SessionSource.TOOL),
|
|
||||||
new PasswordOnlyTransportCredentials(),
|
new PasswordOnlyTransportCredentials(),
|
||||||
|
EppRequestSource.TOOL,
|
||||||
isDryRun,
|
isDryRun,
|
||||||
isSuperuser,
|
isSuperuser,
|
||||||
xml.getBytes(UTF_8));
|
xml.getBytes(UTF_8));
|
||||||
|
|
|
@ -43,6 +43,7 @@ public abstract class Flow {
|
||||||
protected EppInput eppInput;
|
protected EppInput eppInput;
|
||||||
protected SessionMetadata sessionMetadata;
|
protected SessionMetadata sessionMetadata;
|
||||||
protected TransportCredentials credentials;
|
protected TransportCredentials credentials;
|
||||||
|
protected EppRequestSource eppRequestSource;
|
||||||
protected Trid trid;
|
protected Trid trid;
|
||||||
protected DateTime now;
|
protected DateTime now;
|
||||||
protected byte[] inputXmlBytes;
|
protected byte[] inputXmlBytes;
|
||||||
|
@ -103,6 +104,7 @@ public abstract class Flow {
|
||||||
Trid trid,
|
Trid trid,
|
||||||
SessionMetadata sessionMetadata,
|
SessionMetadata sessionMetadata,
|
||||||
TransportCredentials credentials,
|
TransportCredentials credentials,
|
||||||
|
EppRequestSource eppRequestSource,
|
||||||
boolean isSuperuser,
|
boolean isSuperuser,
|
||||||
DateTime now,
|
DateTime now,
|
||||||
byte[] inputXmlBytes) throws EppException {
|
byte[] inputXmlBytes) throws EppException {
|
||||||
|
@ -110,6 +112,7 @@ public abstract class Flow {
|
||||||
this.trid = trid;
|
this.trid = trid;
|
||||||
this.sessionMetadata = sessionMetadata;
|
this.sessionMetadata = sessionMetadata;
|
||||||
this.credentials = credentials;
|
this.credentials = credentials;
|
||||||
|
this.eppRequestSource = eppRequestSource;
|
||||||
this.now = now;
|
this.now = now;
|
||||||
this.isSuperuser = isSuperuser;
|
this.isSuperuser = isSuperuser;
|
||||||
this.inputXmlBytes = inputXmlBytes;
|
this.inputXmlBytes = inputXmlBytes;
|
||||||
|
|
|
@ -44,30 +44,33 @@ public class FlowRunner {
|
||||||
private final EppInput eppInput;
|
private final EppInput eppInput;
|
||||||
private final Trid trid;
|
private final Trid trid;
|
||||||
private final SessionMetadata sessionMetadata;
|
private final SessionMetadata sessionMetadata;
|
||||||
|
private final TransportCredentials credentials;
|
||||||
|
private final EppRequestSource eppRequestSource;
|
||||||
private final boolean isDryRun;
|
private final boolean isDryRun;
|
||||||
private final boolean isSuperuser;
|
private final boolean isSuperuser;
|
||||||
private final TransportCredentials credentials;
|
|
||||||
private final byte[] inputXmlBytes;
|
private final byte[] inputXmlBytes;
|
||||||
private final EppMetrics metrics;
|
private final EppMetrics metrics;
|
||||||
private final Clock clock;
|
private final Clock clock;
|
||||||
|
|
||||||
|
|
||||||
public FlowRunner(
|
public FlowRunner(
|
||||||
Class<? extends Flow> flowClass,
|
Class<? extends Flow> flowClass,
|
||||||
EppInput eppInput,
|
EppInput eppInput,
|
||||||
Trid trid,
|
Trid trid,
|
||||||
SessionMetadata sessionMetadata,
|
SessionMetadata sessionMetadata,
|
||||||
TransportCredentials credentials,
|
TransportCredentials credentials,
|
||||||
|
EppRequestSource eppRequestSource,
|
||||||
boolean isDryRun,
|
boolean isDryRun,
|
||||||
boolean isSuperuser,
|
boolean isSuperuser,
|
||||||
byte[] inputXmlBytes,
|
byte[] inputXmlBytes,
|
||||||
final EppMetrics metrics,
|
final EppMetrics metrics,
|
||||||
Clock clock) {
|
Clock clock) {
|
||||||
credentials.toString();
|
|
||||||
this.flowClass = flowClass;
|
this.flowClass = flowClass;
|
||||||
this.eppInput = eppInput;
|
this.eppInput = eppInput;
|
||||||
this.trid = trid;
|
this.trid = trid;
|
||||||
this.sessionMetadata = sessionMetadata;
|
this.sessionMetadata = sessionMetadata;
|
||||||
this.credentials = credentials;
|
this.credentials = credentials;
|
||||||
|
this.eppRequestSource = eppRequestSource;
|
||||||
this.isDryRun = isDryRun;
|
this.isDryRun = isDryRun;
|
||||||
this.isSuperuser = isSuperuser;
|
this.isSuperuser = isSuperuser;
|
||||||
this.inputXmlBytes = inputXmlBytes;
|
this.inputXmlBytes = inputXmlBytes;
|
||||||
|
@ -84,6 +87,7 @@ public class FlowRunner {
|
||||||
sessionMetadata,
|
sessionMetadata,
|
||||||
prettyPrint(inputXmlBytes).replaceAll("\n", "\n\t"),
|
prettyPrint(inputXmlBytes).replaceAll("\n", "\n\t"),
|
||||||
credentials,
|
credentials,
|
||||||
|
eppRequestSource,
|
||||||
isDryRun ? "DRY_RUN" : "LIVE",
|
isDryRun ? "DRY_RUN" : "LIVE",
|
||||||
isSuperuser ? "SUPERUSER" : "NORMAL");
|
isSuperuser ? "SUPERUSER" : "NORMAL");
|
||||||
if (!isTransactional()) {
|
if (!isTransactional()) {
|
||||||
|
@ -138,6 +142,7 @@ public class FlowRunner {
|
||||||
trid,
|
trid,
|
||||||
sessionMetadata,
|
sessionMetadata,
|
||||||
credentials,
|
credentials,
|
||||||
|
eppRequestSource,
|
||||||
isSuperuser,
|
isSuperuser,
|
||||||
now,
|
now,
|
||||||
inputXmlBytes);
|
inputXmlBytes);
|
||||||
|
|
|
@ -52,9 +52,4 @@ public class HttpSessionMetadata extends SessionMetadata {
|
||||||
protected Object getProperty(String key) {
|
protected Object getProperty(String key) {
|
||||||
return session.getAttribute(key);
|
return session.getAttribute(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public SessionSource getSessionSource() {
|
|
||||||
return SessionSource.HTTP;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,6 @@ import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||||
import com.googlecode.objectify.Key;
|
import com.googlecode.objectify.Key;
|
||||||
|
|
||||||
import google.registry.flows.EppException.AuthorizationErrorException;
|
import google.registry.flows.EppException.AuthorizationErrorException;
|
||||||
import google.registry.flows.SessionMetadata.SessionSource;
|
|
||||||
import google.registry.model.EppResource;
|
import google.registry.model.EppResource;
|
||||||
import google.registry.model.domain.Period;
|
import google.registry.model.domain.Period;
|
||||||
import google.registry.model.domain.metadata.MetadataExtension;
|
import google.registry.model.domain.metadata.MetadataExtension;
|
||||||
|
@ -124,8 +123,7 @@ public abstract class ResourceCreateOrMutateFlow
|
||||||
|
|
||||||
/** Ensure that, if a metadata command exists, it is being passed from a tool-created session. */
|
/** Ensure that, if a metadata command exists, it is being passed from a tool-created session. */
|
||||||
void validateMetadataExtension() throws EppException {
|
void validateMetadataExtension() throws EppException {
|
||||||
if (!(metadataExtension == null
|
if (!(metadataExtension == null || eppRequestSource.equals(EppRequestSource.TOOL))) {
|
||||||
|| sessionMetadata.getSessionSource().equals(SessionSource.TOOL))) {
|
|
||||||
throw new OnlyToolCanPassMetadataException();
|
throw new OnlyToolCanPassMetadataException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,26 +26,6 @@ import java.util.Set;
|
||||||
/** Class to allow setting and retrieving session information in flows. */
|
/** Class to allow setting and retrieving session information in flows. */
|
||||||
public abstract class SessionMetadata {
|
public abstract class SessionMetadata {
|
||||||
|
|
||||||
/**
|
|
||||||
* An enum that identifies the origin of the session.
|
|
||||||
*/
|
|
||||||
public enum SessionSource {
|
|
||||||
/** e.g. {@code EppConsoleServlet} */
|
|
||||||
CONSOLE,
|
|
||||||
|
|
||||||
/** e.g. {@code EppTlsServlet} */
|
|
||||||
HTTP,
|
|
||||||
|
|
||||||
/** e.g. {@code EppToolServlet} */
|
|
||||||
TOOL,
|
|
||||||
|
|
||||||
/** e.g. {@code LoadTestAction} */
|
|
||||||
LOADTEST,
|
|
||||||
|
|
||||||
/** Direct flow runs (default for e.g. testing) */
|
|
||||||
NONE
|
|
||||||
}
|
|
||||||
|
|
||||||
/** The key used for looking up the current client id on the session object. */
|
/** The key used for looking up the current client id on the session object. */
|
||||||
protected static final String CLIENT_ID_KEY = "CLIENT_ID";
|
protected static final String CLIENT_ID_KEY = "CLIENT_ID";
|
||||||
|
|
||||||
|
@ -95,16 +75,6 @@ public abstract class SessionMetadata {
|
||||||
return getProperty(Set.class, SERVICE_EXTENSIONS_KEY);
|
return getProperty(Set.class, SERVICE_EXTENSIONS_KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract SessionSource getSessionSource();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Subclasses can override if they present a need to change the session
|
|
||||||
* source at runtime (e.g. anonymous classes created for testing)
|
|
||||||
*/
|
|
||||||
public void setSessionSource(@SuppressWarnings("unused") SessionSource source) {
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setClientId(String clientId) {
|
public void setClientId(String clientId) {
|
||||||
setPropertyChecked(CLIENT_ID_KEY, clientId);
|
setPropertyChecked(CLIENT_ID_KEY, clientId);
|
||||||
}
|
}
|
||||||
|
@ -132,7 +102,6 @@ public abstract class SessionMetadata {
|
||||||
.add("system hash code", System.identityHashCode(this))
|
.add("system hash code", System.identityHashCode(this))
|
||||||
.add("clientId", getClientId())
|
.add("clientId", getClientId())
|
||||||
.add("failedLoginAttempts", getFailedLoginAttempts())
|
.add("failedLoginAttempts", getFailedLoginAttempts())
|
||||||
.add("sessionSource", getSessionSource())
|
|
||||||
.add("serviceExtensionUris", Joiner.on('.').join(nullToEmpty(getServiceExtensionUris())))
|
.add("serviceExtensionUris", Joiner.on('.').join(nullToEmpty(getServiceExtensionUris())))
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,15 +21,12 @@ public class StatelessRequestSessionMetadata extends SessionMetadata {
|
||||||
|
|
||||||
private final String clientId;
|
private final String clientId;
|
||||||
private final Set<String> serviceExtensionUris;
|
private final Set<String> serviceExtensionUris;
|
||||||
private final SessionSource sessionSource;
|
|
||||||
|
|
||||||
public StatelessRequestSessionMetadata(
|
public StatelessRequestSessionMetadata(
|
||||||
String clientId,
|
String clientId,
|
||||||
Set<String> serviceExtensionUris,
|
Set<String> serviceExtensionUris) {
|
||||||
SessionSource source) {
|
|
||||||
this.clientId = clientId;
|
this.clientId = clientId;
|
||||||
this.serviceExtensionUris = serviceExtensionUris;
|
this.serviceExtensionUris = serviceExtensionUris;
|
||||||
this.sessionSource = source;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -42,11 +39,6 @@ public class StatelessRequestSessionMetadata extends SessionMetadata {
|
||||||
return serviceExtensionUris;
|
return serviceExtensionUris;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public SessionSource getSessionSource() {
|
|
||||||
return sessionSource;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void invalidate() {
|
public void invalidate() {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
|
|
|
@ -31,6 +31,7 @@ import com.google.template.soy.data.SoyMapData;
|
||||||
import com.beust.jcommander.Parameter;
|
import com.beust.jcommander.Parameter;
|
||||||
import com.beust.jcommander.Parameters;
|
import com.beust.jcommander.Parameters;
|
||||||
|
|
||||||
|
import google.registry.flows.EppRequestSource;
|
||||||
import google.registry.flows.FlowRunner;
|
import google.registry.flows.FlowRunner;
|
||||||
import google.registry.flows.HttpSessionMetadata;
|
import google.registry.flows.HttpSessionMetadata;
|
||||||
import google.registry.flows.TlsCredentials;
|
import google.registry.flows.TlsCredentials;
|
||||||
|
@ -109,6 +110,7 @@ final class ValidateLoginCredentialsCommand implements RemoteApiCommand, GtechCo
|
||||||
clientCertificateHash,
|
clientCertificateHash,
|
||||||
Optional.of(clientIpAddress),
|
Optional.of(clientIpAddress),
|
||||||
"placeholder"), // behave as if we have SNI on, since we're validating a cert
|
"placeholder"), // behave as if we have SNI on, since we're validating a cert
|
||||||
|
EppRequestSource.TOOL,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
inputXmlBytes,
|
inputXmlBytes,
|
||||||
|
|
|
@ -37,9 +37,9 @@ 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.EppRequestSource;
|
||||||
import google.registry.flows.FlowRunner;
|
import google.registry.flows.FlowRunner;
|
||||||
import google.registry.flows.PasswordOnlyTransportCredentials;
|
import google.registry.flows.PasswordOnlyTransportCredentials;
|
||||||
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;
|
||||||
import google.registry.model.domain.fee.FeeCheckResponseExtension;
|
import google.registry.model.domain.fee.FeeCheckResponseExtension;
|
||||||
|
@ -80,8 +80,7 @@ public class CheckApiAction implements Runnable {
|
||||||
private final StatelessRequestSessionMetadata sessionMetadata =
|
private final StatelessRequestSessionMetadata sessionMetadata =
|
||||||
new StatelessRequestSessionMetadata(
|
new StatelessRequestSessionMetadata(
|
||||||
RegistryEnvironment.get().config().getCheckApiServletRegistrarClientId(),
|
RegistryEnvironment.get().config().getCheckApiServletRegistrarClientId(),
|
||||||
ImmutableSet.of(FEE_0_6.getUri()),
|
ImmutableSet.of(FEE_0_6.getUri()));
|
||||||
SessionSource.HTTP);
|
|
||||||
|
|
||||||
@Inject @Parameter("domain") String domain;
|
@Inject @Parameter("domain") String domain;
|
||||||
@Inject Response response;
|
@Inject Response response;
|
||||||
|
@ -119,6 +118,7 @@ public class CheckApiAction implements Runnable {
|
||||||
Trid.create(getClass().getSimpleName()),
|
Trid.create(getClass().getSimpleName()),
|
||||||
sessionMetadata,
|
sessionMetadata,
|
||||||
new PasswordOnlyTransportCredentials(),
|
new PasswordOnlyTransportCredentials(),
|
||||||
|
EppRequestSource.CHECK_API,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
inputXmlBytes,
|
inputXmlBytes,
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class EppConsoleActionTest extends ShardableTestCase {
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPassesArgumentsThrough() {
|
public void doTest() {
|
||||||
EppConsoleAction action = new EppConsoleAction();
|
EppConsoleAction action = new EppConsoleAction();
|
||||||
action.inputXmlBytes = INPUT_XML_BYTES;
|
action.inputXmlBytes = INPUT_XML_BYTES;
|
||||||
action.session = new BasicHttpSession();
|
action.session = new BasicHttpSession();
|
||||||
|
@ -57,6 +57,7 @@ public class EppConsoleActionTest extends ShardableTestCase {
|
||||||
verify(action.eppRequestHandler).executeEpp(
|
verify(action.eppRequestHandler).executeEpp(
|
||||||
metadataCaptor.capture(),
|
metadataCaptor.capture(),
|
||||||
credentialsCaptor.capture(),
|
credentialsCaptor.capture(),
|
||||||
|
eq(EppRequestSource.CONSOLE),
|
||||||
eq(false),
|
eq(false),
|
||||||
eq(false),
|
eq(false),
|
||||||
eq(INPUT_XML_BYTES));
|
eq(INPUT_XML_BYTES));
|
||||||
|
|
|
@ -117,7 +117,13 @@ public class EppTestCase extends ShardableTestCase {
|
||||||
handler.eppController = new EppController();
|
handler.eppController = new EppController();
|
||||||
handler.eppController.clock = clock;
|
handler.eppController.clock = clock;
|
||||||
handler.eppController.metrics = mock(EppMetrics.class);
|
handler.eppController.metrics = mock(EppMetrics.class);
|
||||||
handler.executeEpp(sessionMetadata, credentials, false, isSuperuser, inputXml.getBytes(UTF_8));
|
handler.executeEpp(
|
||||||
|
sessionMetadata,
|
||||||
|
credentials,
|
||||||
|
EppRequestSource.UNIT_TEST,
|
||||||
|
false,
|
||||||
|
isSuperuser,
|
||||||
|
inputXml.getBytes(UTF_8));
|
||||||
assertThat(response.getStatus()).isEqualTo(SC_OK);
|
assertThat(response.getStatus()).isEqualTo(SC_OK);
|
||||||
assertThat(response.getContentType()).isEqualTo(APPLICATION_EPP_XML_UTF8);
|
assertThat(response.getContentType()).isEqualTo(APPLICATION_EPP_XML_UTF8);
|
||||||
String result = response.getPayload();
|
String result = response.getPayload();
|
||||||
|
|
|
@ -51,6 +51,7 @@ public class EppTlsActionTest extends ShardableTestCase {
|
||||||
verify(action.eppRequestHandler).executeEpp(
|
verify(action.eppRequestHandler).executeEpp(
|
||||||
captor.capture(),
|
captor.capture(),
|
||||||
same(action.tlsCredentials),
|
same(action.tlsCredentials),
|
||||||
|
eq(EppRequestSource.TLS),
|
||||||
eq(false),
|
eq(false),
|
||||||
eq(false),
|
eq(false),
|
||||||
eq(INPUT_XML_BYTES));
|
eq(INPUT_XML_BYTES));
|
||||||
|
|
|
@ -42,6 +42,7 @@ public class EppToolActionTest {
|
||||||
verify(action.eppRequestHandler).executeEpp(
|
verify(action.eppRequestHandler).executeEpp(
|
||||||
captor.capture(),
|
captor.capture(),
|
||||||
isA(PasswordOnlyTransportCredentials.class),
|
isA(PasswordOnlyTransportCredentials.class),
|
||||||
|
eq(EppRequestSource.TOOL),
|
||||||
eq(isDryRun),
|
eq(isDryRun),
|
||||||
eq(isSuperuser),
|
eq(isSuperuser),
|
||||||
eq(action.xml.getBytes(UTF_8)));
|
eq(action.xml.getBytes(UTF_8)));
|
||||||
|
|
|
@ -34,7 +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.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;
|
||||||
import google.registry.model.domain.GracePeriod;
|
import google.registry.model.domain.GracePeriod;
|
||||||
|
@ -92,13 +91,13 @@ public abstract class FlowTestCase<F extends Flow> {
|
||||||
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();
|
||||||
|
protected EppRequestSource eppRequestSource = EppRequestSource.UNIT_TEST;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void init() throws Exception {
|
public void init() throws Exception {
|
||||||
sessionMetadata = new TestSessionMetadata();
|
sessionMetadata = new TestSessionMetadata();
|
||||||
sessionMetadata.setClientId("TheRegistrar");
|
sessionMetadata.setClientId("TheRegistrar");
|
||||||
sessionMetadata.setServiceExtensionUris(ProtocolDefinition.getVisibleServiceExtensionUris());
|
sessionMetadata.setServiceExtensionUris(ProtocolDefinition.getVisibleServiceExtensionUris());
|
||||||
sessionMetadata.setSessionSource(SessionSource.NONE);
|
|
||||||
ofy().saveWithoutBackup().entity(new ClaimsListSingleton()).now();
|
ofy().saveWithoutBackup().entity(new ClaimsListSingleton()).now();
|
||||||
inject.setStaticField(Ofy.class, "clock", clock); // For transactional flows.
|
inject.setStaticField(Ofy.class, "clock", clock); // For transactional flows.
|
||||||
}
|
}
|
||||||
|
@ -133,6 +132,7 @@ public abstract class FlowTestCase<F extends Flow> {
|
||||||
getTrid(),
|
getTrid(),
|
||||||
sessionMetadata,
|
sessionMetadata,
|
||||||
credentials,
|
credentials,
|
||||||
|
eppRequestSource,
|
||||||
commitMode.equals(CommitMode.DRY_RUN),
|
commitMode.equals(CommitMode.DRY_RUN),
|
||||||
userPrivileges.equals(UserPrivileges.SUPERUSER),
|
userPrivileges.equals(UserPrivileges.SUPERUSER),
|
||||||
"<xml></xml>".getBytes(),
|
"<xml></xml>".getBytes(),
|
||||||
|
|
|
@ -47,12 +47,12 @@ 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.EppRequestSource;
|
||||||
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;
|
||||||
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.SessionMetadata.SessionSource;
|
|
||||||
import google.registry.flows.domain.BaseDomainCreateFlow.AcceptedTooLongAgoException;
|
import google.registry.flows.domain.BaseDomainCreateFlow.AcceptedTooLongAgoException;
|
||||||
import google.registry.flows.domain.BaseDomainCreateFlow.ClaimsPeriodEndedException;
|
import google.registry.flows.domain.BaseDomainCreateFlow.ClaimsPeriodEndedException;
|
||||||
import google.registry.flows.domain.BaseDomainCreateFlow.ExpiredClaimException;
|
import google.registry.flows.domain.BaseDomainCreateFlow.ExpiredClaimException;
|
||||||
|
@ -287,7 +287,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_anchorTenantViaExtension() throws Exception {
|
public void testSuccess_anchorTenantViaExtension() throws Exception {
|
||||||
sessionMetadata.setSessionSource(SessionSource.TOOL);
|
eppRequestSource = EppRequestSource.TOOL;
|
||||||
setEppInput("domain_create_anchor_tenant.xml");
|
setEppInput("domain_create_anchor_tenant.xml");
|
||||||
persistContactsAndHosts();
|
persistContactsAndHosts();
|
||||||
runFlowAssertResponse(readFile("domain_create_response.xml"));
|
runFlowAssertResponse(readFile("domain_create_response.xml"));
|
||||||
|
@ -335,7 +335,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_metadata() throws Exception {
|
public void testSuccess_metadata() throws Exception {
|
||||||
sessionMetadata.setSessionSource(SessionSource.TOOL);
|
eppRequestSource = EppRequestSource.TOOL;
|
||||||
setEppInput("domain_create_metadata.xml");
|
setEppInput("domain_create_metadata.xml");
|
||||||
persistContactsAndHosts();
|
persistContactsAndHosts();
|
||||||
doSuccessfulTest();
|
doSuccessfulTest();
|
||||||
|
@ -1086,7 +1086,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
|
||||||
public void testSuccess_qlpSunriseRegistration() throws Exception {
|
public void testSuccess_qlpSunriseRegistration() throws Exception {
|
||||||
createTld("tld", TldState.SUNRISE);
|
createTld("tld", TldState.SUNRISE);
|
||||||
setEppInput("domain_create_registration_qlp_sunrise.xml");
|
setEppInput("domain_create_registration_qlp_sunrise.xml");
|
||||||
sessionMetadata.setSessionSource(SessionSource.TOOL); // Only tools can pass in metadata.
|
eppRequestSource = EppRequestSource.TOOL; // Only tools can pass in metadata.
|
||||||
persistContactsAndHosts();
|
persistContactsAndHosts();
|
||||||
runFlowAssertResponse(readFile("domain_create_response.xml"));
|
runFlowAssertResponse(readFile("domain_create_response.xml"));
|
||||||
assertSuccessfulCreate("tld", true);
|
assertSuccessfulCreate("tld", true);
|
||||||
|
@ -1098,7 +1098,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
|
||||||
createTld("tld", TldState.SUNRISE);
|
createTld("tld", TldState.SUNRISE);
|
||||||
clock.setTo(DateTime.parse("2014-09-09T09:09:09Z"));
|
clock.setTo(DateTime.parse("2014-09-09T09:09:09Z"));
|
||||||
setEppInput("domain_create_registration_qlp_sunrise_encoded_signed_mark.xml");
|
setEppInput("domain_create_registration_qlp_sunrise_encoded_signed_mark.xml");
|
||||||
sessionMetadata.setSessionSource(SessionSource.TOOL); // Only tools can pass in metadata.
|
eppRequestSource = EppRequestSource.TOOL; // Only tools can pass in metadata.
|
||||||
persistContactsAndHosts();
|
persistContactsAndHosts();
|
||||||
runFlowAssertResponse(readFile("domain_create_response_encoded_signed_mark_name.xml"));
|
runFlowAssertResponse(readFile("domain_create_response_encoded_signed_mark_name.xml"));
|
||||||
assertSuccessfulCreate("tld", true);
|
assertSuccessfulCreate("tld", true);
|
||||||
|
@ -1110,7 +1110,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
|
||||||
createTld("tld", TldState.SUNRISE);
|
createTld("tld", TldState.SUNRISE);
|
||||||
clock.setTo(DateTime.parse("2009-08-16T09:00:00.0Z"));
|
clock.setTo(DateTime.parse("2009-08-16T09:00:00.0Z"));
|
||||||
setEppInput("domain_create_registration_qlp_sunrise_claims_notice.xml");
|
setEppInput("domain_create_registration_qlp_sunrise_claims_notice.xml");
|
||||||
sessionMetadata.setSessionSource(SessionSource.TOOL); // Only tools can pass in metadata.
|
eppRequestSource = EppRequestSource.TOOL; // Only tools can pass in metadata.
|
||||||
persistContactsAndHosts();
|
persistContactsAndHosts();
|
||||||
runFlowAssertResponse(readFile("domain_create_response_claims.xml"));
|
runFlowAssertResponse(readFile("domain_create_response_claims.xml"));
|
||||||
assertSuccessfulCreate("tld", true);
|
assertSuccessfulCreate("tld", true);
|
||||||
|
@ -1151,7 +1151,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
|
||||||
public void testSuccess_qlpSunrushRegistration() throws Exception {
|
public void testSuccess_qlpSunrushRegistration() throws Exception {
|
||||||
createTld("tld", TldState.SUNRUSH);
|
createTld("tld", TldState.SUNRUSH);
|
||||||
setEppInput("domain_create_registration_qlp_sunrush.xml");
|
setEppInput("domain_create_registration_qlp_sunrush.xml");
|
||||||
sessionMetadata.setSessionSource(SessionSource.TOOL); // Only tools can pass in metadata.
|
eppRequestSource = EppRequestSource.TOOL; // Only tools can pass in metadata.
|
||||||
persistContactsAndHosts();
|
persistContactsAndHosts();
|
||||||
runFlowAssertResponse(readFile("domain_create_response.xml"));
|
runFlowAssertResponse(readFile("domain_create_response.xml"));
|
||||||
assertSuccessfulCreate("tld", true);
|
assertSuccessfulCreate("tld", true);
|
||||||
|
@ -1163,7 +1163,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
|
||||||
createTld("tld", TldState.SUNRUSH);
|
createTld("tld", TldState.SUNRUSH);
|
||||||
clock.setTo(DateTime.parse("2014-09-09T09:09:09Z"));
|
clock.setTo(DateTime.parse("2014-09-09T09:09:09Z"));
|
||||||
setEppInput("domain_create_registration_qlp_sunrush_encoded_signed_mark.xml");
|
setEppInput("domain_create_registration_qlp_sunrush_encoded_signed_mark.xml");
|
||||||
sessionMetadata.setSessionSource(SessionSource.TOOL); // Only tools can pass in metadata.
|
eppRequestSource = EppRequestSource.TOOL; // Only tools can pass in metadata.
|
||||||
persistContactsAndHosts();
|
persistContactsAndHosts();
|
||||||
runFlowAssertResponse(readFile("domain_create_response_encoded_signed_mark_name.xml"));
|
runFlowAssertResponse(readFile("domain_create_response_encoded_signed_mark_name.xml"));
|
||||||
assertSuccessfulCreate("tld", true);
|
assertSuccessfulCreate("tld", true);
|
||||||
|
@ -1175,7 +1175,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
|
||||||
createTld("tld", TldState.SUNRUSH);
|
createTld("tld", TldState.SUNRUSH);
|
||||||
clock.setTo(DateTime.parse("2009-08-16T09:00:00.0Z"));
|
clock.setTo(DateTime.parse("2009-08-16T09:00:00.0Z"));
|
||||||
setEppInput("domain_create_registration_qlp_sunrush_claims_notice.xml");
|
setEppInput("domain_create_registration_qlp_sunrush_claims_notice.xml");
|
||||||
sessionMetadata.setSessionSource(SessionSource.TOOL); // Only tools can pass in metadata.
|
eppRequestSource = EppRequestSource.TOOL; // Only tools can pass in metadata.
|
||||||
persistContactsAndHosts();
|
persistContactsAndHosts();
|
||||||
runFlowAssertResponse(readFile("domain_create_response_claims.xml"));
|
runFlowAssertResponse(readFile("domain_create_response_claims.xml"));
|
||||||
assertSuccessfulCreate("tld", true);
|
assertSuccessfulCreate("tld", true);
|
||||||
|
@ -1203,7 +1203,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
|
||||||
public void testSuccess_qlpLandrushRegistration() throws Exception {
|
public void testSuccess_qlpLandrushRegistration() throws Exception {
|
||||||
createTld("tld", TldState.LANDRUSH);
|
createTld("tld", TldState.LANDRUSH);
|
||||||
setEppInput("domain_create_registration_qlp_landrush.xml");
|
setEppInput("domain_create_registration_qlp_landrush.xml");
|
||||||
sessionMetadata.setSessionSource(SessionSource.TOOL); // Only tools can pass in metadata.
|
eppRequestSource = EppRequestSource.TOOL; // Only tools can pass in metadata.
|
||||||
persistContactsAndHosts();
|
persistContactsAndHosts();
|
||||||
runFlowAssertResponse(readFile("domain_create_response.xml"));
|
runFlowAssertResponse(readFile("domain_create_response.xml"));
|
||||||
assertSuccessfulCreate("tld", true);
|
assertSuccessfulCreate("tld", true);
|
||||||
|
@ -1216,7 +1216,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
|
||||||
createTld("tld", TldState.LANDRUSH);
|
createTld("tld", TldState.LANDRUSH);
|
||||||
clock.setTo(DateTime.parse("2014-09-09T09:09:09Z"));
|
clock.setTo(DateTime.parse("2014-09-09T09:09:09Z"));
|
||||||
setEppInput("domain_create_registration_qlp_landrush_encoded_signed_mark.xml");
|
setEppInput("domain_create_registration_qlp_landrush_encoded_signed_mark.xml");
|
||||||
sessionMetadata.setSessionSource(SessionSource.TOOL); // Only tools can pass in metadata.
|
eppRequestSource = EppRequestSource.TOOL; // Only tools can pass in metadata.
|
||||||
persistContactsAndHosts();
|
persistContactsAndHosts();
|
||||||
runFlow();
|
runFlow();
|
||||||
}
|
}
|
||||||
|
@ -1226,7 +1226,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
|
||||||
createTld("tld", TldState.LANDRUSH);
|
createTld("tld", TldState.LANDRUSH);
|
||||||
clock.setTo(DateTime.parse("2009-08-16T09:00:00.0Z"));
|
clock.setTo(DateTime.parse("2009-08-16T09:00:00.0Z"));
|
||||||
setEppInput("domain_create_registration_qlp_landrush_claims_notice.xml");
|
setEppInput("domain_create_registration_qlp_landrush_claims_notice.xml");
|
||||||
sessionMetadata.setSessionSource(SessionSource.TOOL); // Only tools can pass in metadata.
|
eppRequestSource = EppRequestSource.TOOL; // Only tools can pass in metadata.
|
||||||
persistContactsAndHosts();
|
persistContactsAndHosts();
|
||||||
runFlowAssertResponse(readFile("domain_create_response_claims.xml"));
|
runFlowAssertResponse(readFile("domain_create_response_claims.xml"));
|
||||||
assertSuccessfulCreate("tld", true);
|
assertSuccessfulCreate("tld", true);
|
||||||
|
|
|
@ -44,11 +44,11 @@ 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.EppRequestSource;
|
||||||
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;
|
||||||
import google.registry.flows.ResourceMutateFlow.ResourceToMutateDoesNotExistException;
|
import google.registry.flows.ResourceMutateFlow.ResourceToMutateDoesNotExistException;
|
||||||
import google.registry.flows.SessionMetadata.SessionSource;
|
|
||||||
import google.registry.flows.SingleResourceFlow.ResourceStatusProhibitsOperationException;
|
import google.registry.flows.SingleResourceFlow.ResourceStatusProhibitsOperationException;
|
||||||
import google.registry.flows.domain.DomainDeleteFlow.DomainToDeleteHasHostsException;
|
import google.registry.flows.domain.DomainDeleteFlow.DomainToDeleteHasHostsException;
|
||||||
import google.registry.flows.domain.DomainFlowUtils.NotAuthorizedForTldException;
|
import google.registry.flows.domain.DomainFlowUtils.NotAuthorizedForTldException;
|
||||||
|
@ -582,7 +582,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_metadata() throws Exception {
|
public void testSuccess_metadata() throws Exception {
|
||||||
sessionMetadata.setSessionSource(SessionSource.TOOL);
|
eppRequestSource = EppRequestSource.TOOL;
|
||||||
setEppInput("domain_delete_metadata.xml");
|
setEppInput("domain_delete_metadata.xml");
|
||||||
setupSuccessfulTest();
|
setupSuccessfulTest();
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
|
|
|
@ -42,6 +42,7 @@ 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.EppRequestSource;
|
||||||
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;
|
||||||
|
@ -49,7 +50,6 @@ import google.registry.flows.ResourceMutateFlow.ResourceToMutateDoesNotExistExce
|
||||||
import google.registry.flows.ResourceUpdateFlow.AddRemoveSameValueEppException;
|
import google.registry.flows.ResourceUpdateFlow.AddRemoveSameValueEppException;
|
||||||
import google.registry.flows.ResourceUpdateFlow.ResourceHasClientUpdateProhibitedException;
|
import google.registry.flows.ResourceUpdateFlow.ResourceHasClientUpdateProhibitedException;
|
||||||
import google.registry.flows.ResourceUpdateFlow.StatusNotClientSettableException;
|
import google.registry.flows.ResourceUpdateFlow.StatusNotClientSettableException;
|
||||||
import google.registry.flows.SessionMetadata.SessionSource;
|
|
||||||
import google.registry.flows.SingleResourceFlow.ResourceStatusProhibitsOperationException;
|
import google.registry.flows.SingleResourceFlow.ResourceStatusProhibitsOperationException;
|
||||||
import google.registry.flows.domain.BaseDomainUpdateFlow.EmptySecDnsUpdateException;
|
import google.registry.flows.domain.BaseDomainUpdateFlow.EmptySecDnsUpdateException;
|
||||||
import google.registry.flows.domain.BaseDomainUpdateFlow.MaxSigLifeChangeNotSupportedException;
|
import google.registry.flows.domain.BaseDomainUpdateFlow.MaxSigLifeChangeNotSupportedException;
|
||||||
|
@ -411,7 +411,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_metadata() throws Exception {
|
public void testSuccess_metadata() throws Exception {
|
||||||
sessionMetadata.setSessionSource(SessionSource.TOOL);
|
eppRequestSource = EppRequestSource.TOOL;
|
||||||
setEppInput("domain_update_metadata.xml");
|
setEppInput("domain_update_metadata.xml");
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
persistDomain();
|
persistDomain();
|
||||||
|
@ -664,7 +664,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_addServerStatusBillingEvent() throws Exception {
|
public void testSuccess_addServerStatusBillingEvent() throws Exception {
|
||||||
sessionMetadata.setSessionSource(SessionSource.TOOL);
|
eppRequestSource = EppRequestSource.TOOL;
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
persistDomain();
|
persistDomain();
|
||||||
doServerStatusBillingTest("domain_update_add_server_status.xml", true);
|
doServerStatusBillingTest("domain_update_add_server_status.xml", true);
|
||||||
|
@ -672,7 +672,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_noBillingOnPreExistingServerStatus() throws Exception {
|
public void testSuccess_noBillingOnPreExistingServerStatus() throws Exception {
|
||||||
sessionMetadata.setSessionSource(SessionSource.TOOL);
|
eppRequestSource = EppRequestSource.TOOL;
|
||||||
DomainResource addStatusDomain = persistActiveDomain(getUniqueIdFromCommand());
|
DomainResource addStatusDomain = persistActiveDomain(getUniqueIdFromCommand());
|
||||||
persistResource(
|
persistResource(
|
||||||
addStatusDomain.asBuilder()
|
addStatusDomain.asBuilder()
|
||||||
|
@ -683,7 +683,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_removeServerStatusBillingEvent() throws Exception {
|
public void testSuccess_removeServerStatusBillingEvent() throws Exception {
|
||||||
sessionMetadata.setSessionSource(SessionSource.TOOL);
|
eppRequestSource = EppRequestSource.TOOL;
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
DomainResource removeStatusDomain = persistDomain();
|
DomainResource removeStatusDomain = persistDomain();
|
||||||
persistResource(
|
persistResource(
|
||||||
|
@ -695,7 +695,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_changeServerStatusBillingEvent() throws Exception {
|
public void testSuccess_changeServerStatusBillingEvent() throws Exception {
|
||||||
sessionMetadata.setSessionSource(SessionSource.TOOL);
|
eppRequestSource = EppRequestSource.TOOL;
|
||||||
persistReferencedEntities();
|
persistReferencedEntities();
|
||||||
DomainResource changeStatusDomain = persistDomain();
|
DomainResource changeStatusDomain = persistDomain();
|
||||||
persistResource(
|
persistResource(
|
||||||
|
@ -719,7 +719,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_noBillingEventOnServerStatusChangeNotFromRegistrar() throws Exception {
|
public void testSuccess_noBillingEventOnServerStatusChangeNotFromRegistrar() throws Exception {
|
||||||
sessionMetadata.setSessionSource(SessionSource.TOOL);
|
eppRequestSource = EppRequestSource.TOOL;
|
||||||
persistActiveDomain(getUniqueIdFromCommand());
|
persistActiveDomain(getUniqueIdFromCommand());
|
||||||
doServerStatusBillingTest("domain_update_add_server_status_non_registrar.xml", false);
|
doServerStatusBillingTest("domain_update_add_server_status_non_registrar.xml", false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,12 +42,12 @@ 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.EppRequestSource;
|
||||||
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;
|
||||||
import google.registry.flows.ResourceUpdateFlow.ResourceHasClientUpdateProhibitedException;
|
import google.registry.flows.ResourceUpdateFlow.ResourceHasClientUpdateProhibitedException;
|
||||||
import google.registry.flows.ResourceUpdateFlow.StatusNotClientSettableException;
|
import google.registry.flows.ResourceUpdateFlow.StatusNotClientSettableException;
|
||||||
import google.registry.flows.SessionMetadata.SessionSource;
|
|
||||||
import google.registry.flows.SingleResourceFlow.ResourceStatusProhibitsOperationException;
|
import google.registry.flows.SingleResourceFlow.ResourceStatusProhibitsOperationException;
|
||||||
import google.registry.flows.async.DnsRefreshForHostRenameAction;
|
import google.registry.flows.async.DnsRefreshForHostRenameAction;
|
||||||
import google.registry.flows.host.HostFlowUtils.HostNameTooShallowException;
|
import google.registry.flows.host.HostFlowUtils.HostNameTooShallowException;
|
||||||
|
@ -895,7 +895,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
|
||||||
persistActiveHost("ns1.example.tld");
|
persistActiveHost("ns1.example.tld");
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
setEppInput("host_update_metadata.xml");
|
setEppInput("host_update_metadata.xml");
|
||||||
sessionMetadata.setSessionSource(SessionSource.TOOL);
|
eppRequestSource = EppRequestSource.TOOL;
|
||||||
runFlowAssertResponse(readFile("host_update_response.xml"));
|
runFlowAssertResponse(readFile("host_update_response.xml"));
|
||||||
assertAboutHistoryEntries()
|
assertAboutHistoryEntries()
|
||||||
.that(getOnlyHistoryEntryOfType(reloadResourceByUniqueId(), HistoryEntry.Type.HOST_UPDATE))
|
.that(getOnlyHistoryEntryOfType(reloadResourceByUniqueId(), HistoryEntry.Type.HOST_UPDATE))
|
||||||
|
|
|
@ -30,6 +30,7 @@ import static org.joda.time.Duration.standardDays;
|
||||||
|
|
||||||
import com.googlecode.objectify.Key;
|
import com.googlecode.objectify.Key;
|
||||||
|
|
||||||
|
import google.registry.flows.EppRequestSource;
|
||||||
import google.registry.flows.FlowRunner;
|
import google.registry.flows.FlowRunner;
|
||||||
import google.registry.flows.PasswordOnlyTransportCredentials;
|
import google.registry.flows.PasswordOnlyTransportCredentials;
|
||||||
import google.registry.flows.SessionMetadata;
|
import google.registry.flows.SessionMetadata;
|
||||||
|
@ -86,6 +87,7 @@ public class EppResourceUtilsTest {
|
||||||
Trid.create(null, "server-trid"),
|
Trid.create(null, "server-trid"),
|
||||||
sessionMetadata,
|
sessionMetadata,
|
||||||
new PasswordOnlyTransportCredentials(),
|
new PasswordOnlyTransportCredentials(),
|
||||||
|
EppRequestSource.UNIT_TEST,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
"<xml></xml>".getBytes(),
|
"<xml></xml>".getBytes(),
|
||||||
|
|
|
@ -25,7 +25,6 @@ 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 SessionSource sessionSource = SessionSource.NONE;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setProperty(String key, Object value) {
|
protected void setProperty(String key, Object value) {
|
||||||
|
@ -47,16 +46,6 @@ public class TestSessionMetadata extends SessionMetadata {
|
||||||
isValid = false;
|
isValid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public SessionSource getSessionSource() {
|
|
||||||
return sessionSource;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setSessionSource(SessionSource source) {
|
|
||||||
sessionSource = source;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isValid() {
|
public boolean isValid() {
|
||||||
return isValid;
|
return isValid;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue