You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2016/03/16 20:05:45 UTC
[2/2] incubator-tinkerpop git commit: Remove the need for the Graph
instance on the Client side.
Remove the need for the Graph instance on the Client side.
RemoteGraph execution does all strategy application for the specified graph on the server so there is no need to have any reference to it on the Client side. This makes it an more true "remote" graph instance. Got some other tests working thus allowing the removal of some OptOuts.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/d107b7a6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/d107b7a6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/d107b7a6
Branch: refs/heads/TINKERPOP-575
Commit: d107b7a6449aaf5a015104cda9265aac58fddd0f
Parents: bdce8e8
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Mar 16 15:04:13 2016 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Mar 16 15:04:13 2016 -0400
----------------------------------------------------------------------
.../gremlin/process/remote/RemoteGraph.java | 59 +++-----------------
.../traversal/strategy/RemoteStrategy.java | 3 +
.../process/traversal/step/map/GraphStep.java | 4 ++
.../driver/remote/DriverRemoteConnection.java | 3 +-
.../op/traversal/TraversalOpProcessor.java | 19 +++++--
.../driver/remote/RemoteGraphProvider.java | 3 +-
.../gremlin/server/WithServerIntegrateTest.java | 2 +-
.../PartitionStrategyProcessTest.java | 35 +++++++++---
.../ReadOnlyStrategyProcessTest.java | 7 ++-
9 files changed, 61 insertions(+), 74 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/d107b7a6/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/remote/RemoteGraph.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/remote/RemoteGraph.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/remote/RemoteGraph.java
index d1499ba..8df85df 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/remote/RemoteGraph.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/remote/RemoteGraph.java
@@ -66,52 +66,37 @@ import java.util.Optional;
@Graph.OptOut(
test = "org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.ElementIdStrategyProcessTest",
method = "*",
- reason = "RemoteGraph does not support ElementIdStrategy at this time")
-@Graph.OptOut(
- test = "org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategyProcessTest",
- method = "*",
- reason = "RemoteGraph does not support ReadOnlyStrategy at this time")
+ reason = "RemoteGraph does not support ElementIdStrategy at this time - it requires a lambda in construction which is not serializable")
@Graph.OptOut(
test = "org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.EventStrategyProcessTest",
method = "*",
- reason = "RemoteGraph does not support EventStrategy at this time")
+ reason = "RemoteGraph does not support EventStrategy at this time - some of its members are not serializable")
@Graph.OptOut(
test = "org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.PartitionStrategyProcessTest",
method = "*",
reason = "RemoteGraph does not support PartitionStrategy at this time")
@Graph.OptOut(
- test = "org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SubgraphStrategyProcessTest",
- method = "*",
- reason = "RemoteGraph does not support SubgraphStrategy at this time")
-@Graph.OptOut(
test = "org.apache.tinkerpop.gremlin.process.traversal.step.map.ProfileTest",
method = "*",
reason = "RemoteGraph does not support ProfileStep at this time")
public class RemoteGraph implements Graph {
private final RemoteConnection connection;
- private final Optional<Class<? extends Graph>> graphClass;
public static final String GREMLIN_SERVERGRAPH_SERVER_CONNECTION_CLASS = "gremlin.servergraph.serverConnectionClass";
- public static final String GREMLIN_SERVERGRAPH_GRAPH_CLASS = "gremlin.servergraph.graphClass";
private RemoteGraph(final RemoteConnection connection) {
- this(connection, null);
- }
-
- private RemoteGraph(final RemoteConnection connection, final Class<? extends Graph> graphClass) {
this.connection = connection;
- this.graphClass = Optional.ofNullable(graphClass);
TraversalStrategies.GlobalCache.registerStrategies(
RemoteGraph.class, TraversalStrategies.GlobalCache.getStrategies(EmptyGraph.class).clone().addStrategies(RemoteStrategy.instance()));
}
/**
* Creates a new {@link RemoteGraph} instance using the specified configuration, which allows {@link RemoteGraph}
- * to be compliant with {@link GraphFactory}. Expects keys for the {@link #GREMLIN_SERVERGRAPH_GRAPH_CLASS} and
- * {@link #GREMLIN_SERVERGRAPH_SERVER_CONNECTION_CLASS} as well as any configuration required by the underlying
- * {@link RemoteConnection} which will be instantiated. Note that the {@code Configuration} object is passed down
- * without change to the creation of the {@link RemoteConnection} instance.
+ * to be compliant with {@link GraphFactory}. Expects key for {@link #GREMLIN_SERVERGRAPH_SERVER_CONNECTION_CLASS}
+ * as well as any configuration required by the underlying {@link RemoteConnection} which will be instantiated.
+ * Note that the {@code Configuration} object is passed down without change to the creation of the
+ * {@link RemoteConnection} instance.
*/
public static RemoteGraph open(final Configuration conf) {
if (!conf.containsKey(GREMLIN_SERVERGRAPH_SERVER_CONNECTION_CLASS))
@@ -126,33 +111,7 @@ public class RemoteGraph implements Graph {
throw new IllegalStateException(ex);
}
- final RemoteGraph remoteGraph;
- if (conf.containsKey(GREMLIN_SERVERGRAPH_GRAPH_CLASS)) {
- final Class<? extends Graph> graphClazz;
- try {
- graphClazz = Class.forName(conf.getString(GREMLIN_SERVERGRAPH_GRAPH_CLASS)).asSubclass(Graph.class);
- } catch (Exception ex) {
- throw new IllegalStateException(ex);
- }
-
- remoteGraph = new RemoteGraph(remoteConnection, graphClazz);
- } else {
- remoteGraph = new RemoteGraph(remoteConnection);
- }
-
- return remoteGraph;
- }
-
- /**
- * Creates a new {@link RemoteGraph} instance. {@link RemoteGraph} will attempt to call the
- * {@link RemoteConnection#close()} method when the {@link #close()} method is called on this class.
- *
- * @param connection the {@link RemoteConnection} instance to use
- * @param graphClass the {@link Graph} class expected to be executed on the other side of the
- * {@link RemoteConnection}
- */
- public static RemoteGraph open(final RemoteConnection connection, final Class<? extends Graph> graphClass) {
- return new RemoteGraph(connection, graphClass);
+ return new RemoteGraph(remoteConnection);
}
/**
@@ -170,10 +129,6 @@ public class RemoteGraph implements Graph {
return connection;
}
- public Optional<Class<? extends Graph>> getGraphClass() {
- return graphClass;
- }
-
/**
* Closes the underlying {@link RemoteConnection}.
*/
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/d107b7a6/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/remote/traversal/strategy/RemoteStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/remote/traversal/strategy/RemoteStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/remote/traversal/strategy/RemoteStrategy.java
index 6961f05..53eedcd 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/remote/traversal/strategy/RemoteStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/remote/traversal/strategy/RemoteStrategy.java
@@ -23,6 +23,7 @@ import org.apache.tinkerpop.gremlin.process.remote.RemoteGraph;
import org.apache.tinkerpop.gremlin.process.remote.traversal.step.map.RemoteStep;
import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep;
import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep;
import org.apache.tinkerpop.gremlin.process.traversal.strategy.AbstractTraversalStrategy;
import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.VertexProgramStrategy;
@@ -57,6 +58,8 @@ public class RemoteStrategy extends AbstractTraversalStrategy<TraversalStrategy.
@Override
public void apply(final Traversal.Admin<?, ?> traversal) {
+ TraversalHelper.getStepsOfAssignableClass(GraphStep.class, traversal).forEach(GraphStep::convertElementsToIds);
+
if (!(traversal.getParent() instanceof EmptyStep))
return;
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/d107b7a6/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/GraphStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/GraphStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/GraphStep.java
index 4131b83..52b7c87 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/GraphStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/GraphStep.java
@@ -100,6 +100,10 @@ public class GraphStep<S, E extends Element> extends AbstractStep<S, E> implemen
@Override
public void onGraphComputer() {
this.iteratorSupplier = Collections::emptyIterator;
+ convertElementsToIds();
+ }
+
+ public void convertElementsToIds() {
for (int i = 0; i < this.ids.length; i++) { // if this is going to OLAP, convert to ids so you don't serialize elements
if (this.ids[i] instanceof Element)
this.ids[i] = ((Element) this.ids[i]).id();
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/d107b7a6/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/remote/DriverRemoteConnection.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/remote/DriverRemoteConnection.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/remote/DriverRemoteConnection.java
index 50422b3..b8724eb 100644
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/remote/DriverRemoteConnection.java
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/remote/DriverRemoteConnection.java
@@ -199,8 +199,7 @@ public class DriverRemoteConnection implements RemoteConnection {
@Override
public Traverser next() {
- final Object o = inner.next().getObject();
- return (Traverser) o;
+ return (Traverser) inner.next().getObject();
}
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/d107b7a6/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/traversal/TraversalOpProcessor.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/traversal/TraversalOpProcessor.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/traversal/TraversalOpProcessor.java
index 8e4bd5e..a67de1d 100644
--- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/traversal/TraversalOpProcessor.java
+++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/traversal/TraversalOpProcessor.java
@@ -129,6 +129,9 @@ public class TraversalOpProcessor extends AbstractOpProcessor {
final Traversal traversal;
try {
traversal = (Traversal) Serializer.deserializeObject(serializedTraversal);
+
+ // todo: isLocked() server error
+ assert !traversal.asAdmin().isLocked();
} catch (Exception ex) {
throw new OpProcessorException("Could not deserialize the Traversal instance",
ResponseMessage.build(msg).code(ResponseStatusCode.SERVER_ERROR_SERIALIZATION).statusMessage(ex.getMessage()).create());
@@ -141,12 +144,7 @@ public class TraversalOpProcessor extends AbstractOpProcessor {
final Graph graph = graphManager.getGraphs().get(graphName);
final boolean supportsTransactions = graph.features().graph().supportsTransactions();
- traversal.asAdmin().setGraph(graph);
- traversal.asAdmin().getStrategies().removeStrategies(RemoteStrategy.class);
- final List<TraversalStrategy<?>> strategies = TraversalStrategies.GlobalCache.getStrategies(graph.getClass()).toList();
- final TraversalStrategy[] arrayOfStrategies = new TraversalStrategy[strategies.size()];
- strategies.toArray(arrayOfStrategies);
- traversal.asAdmin().getStrategies().addStrategies(arrayOfStrategies);
+ configureTraversal(traversal, graph);
context.getGremlinExecutor().getExecutorService().submit(() -> {
try {
@@ -183,6 +181,15 @@ public class TraversalOpProcessor extends AbstractOpProcessor {
}
}
+ private static void configureTraversal(final Traversal traversal, final Graph graph) {
+ traversal.asAdmin().setGraph(graph);
+ traversal.asAdmin().getStrategies().removeStrategies(RemoteStrategy.class);
+ final List<TraversalStrategy<?>> strategies = TraversalStrategies.GlobalCache.getStrategies(graph.getClass()).toList();
+ final TraversalStrategy[] arrayOfStrategies = new TraversalStrategy[strategies.size()];
+ strategies.toArray(arrayOfStrategies);
+ traversal.asAdmin().getStrategies().addStrategies(arrayOfStrategies);
+ }
+
static class DetachingIterator implements Iterator<Traverser> {
private Iterator<Traverser> inner;
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/d107b7a6/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/driver/remote/RemoteGraphProvider.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/driver/remote/RemoteGraphProvider.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/driver/remote/RemoteGraphProvider.java
index 7592823..abba9e9 100644
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/driver/remote/RemoteGraphProvider.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/driver/remote/RemoteGraphProvider.java
@@ -62,7 +62,7 @@ public class RemoteGraphProvider extends AbstractGraphProvider {
public Graph openTestGraph(final Configuration config) {
final String serverGraphName = config.getString("connectionGraphName");
return remoteCache.computeIfAbsent(serverGraphName,
- k -> RemoteGraph.open(new DriverRemoteConnection(cluster, config), TinkerGraph.class));
+ k -> RemoteGraph.open(new DriverRemoteConnection(cluster, config)));
}
@Override
@@ -73,7 +73,6 @@ public class RemoteGraphProvider extends AbstractGraphProvider {
final Supplier<Graph> graphGetter = () -> server.getServerGremlinExecutor().getGraphManager().getGraphs().get(serverGraphName);
return new HashMap<String, Object>() {{
put(Graph.GRAPH, RemoteGraph.class.getName());
- put(RemoteGraph.GREMLIN_SERVERGRAPH_GRAPH_CLASS, TinkerGraph.class.getName());
put(RemoteGraph.GREMLIN_SERVERGRAPH_SERVER_CONNECTION_CLASS, DriverRemoteConnection.class.getName());
put("connectionGraphName", serverGraphName);
put("hidden.for.testing.only", graphGetter);
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/d107b7a6/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/WithServerIntegrateTest.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/WithServerIntegrateTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/WithServerIntegrateTest.java
index 683a164..35b7cb9 100644
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/WithServerIntegrateTest.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/WithServerIntegrateTest.java
@@ -41,7 +41,7 @@ public class WithServerIntegrateTest extends AbstractGremlinServerIntegrationTes
@Test
public void shouldDoServerGraphReturningVertices() {
final Cluster cluster = Cluster.open();
- final Graph graph = RemoteGraph.open(DriverRemoteConnection.using(cluster), TinkerGraph.class);
+ final Graph graph = RemoteGraph.open(DriverRemoteConnection.using(cluster));
final GraphTraversalSource g = graph.traversal();
g.V().forEachRemaining(v -> System.out.println("TEST: " + v.toString()));
cluster.close();
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/d107b7a6/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategyProcessTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategyProcessTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategyProcessTest.java
index e4cea45..a1b71eb 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategyProcessTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategyProcessTest.java
@@ -18,6 +18,7 @@
*/
package org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration;
+import org.apache.commons.lang.exception.ExceptionUtils;
import org.apache.tinkerpop.gremlin.FeatureRequirement;
import org.apache.tinkerpop.gremlin.FeatureRequirementSet;
import org.apache.tinkerpop.gremlin.process.AbstractGremlinProcessTest;
@@ -31,10 +32,13 @@ import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
import org.junit.Test;
import java.util.List;
+import java.util.NoSuchElementException;
import java.util.stream.Collectors;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.Matchers.containsInAnyOrder;
+import static org.hamcrest.core.IsInstanceOf.instanceOf;
+import static org.hamcrest.core.StringStartsWith.startsWith;
import static org.junit.Assert.*;
/**
@@ -165,7 +169,7 @@ public class PartitionStrategyProcessTest extends AbstractGremlinProcessTest {
assertThat(gOverAB.V(v).valueMap().next().containsKey(partition), is(false));
}
- @Test(expected = IllegalStateException.class)
+ @Test
@FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY)
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_META_PROPERTIES)
public void shouldHidePartitionKeyForValues() {
@@ -174,7 +178,13 @@ public class PartitionStrategyProcessTest extends AbstractGremlinProcessTest {
.partitionKey(partition).writePartition("A").addReadPartition("A").create());
final Vertex v = gOverA.addV().property("any", "thing").next();
- gOverA.V(v).values(partition).next();
+ try {
+ gOverA.V(v).values(partition).next();
+ fail("Should have thrown exception");
+ } catch (Exception ex) {
+ assertThat(ex.getMessage(), startsWith("Cannot explicitly request the partitionKey in the traversal"));
+ }
+
}
@Test
@@ -190,7 +200,7 @@ public class PartitionStrategyProcessTest extends AbstractGremlinProcessTest {
assertEquals("thing", gOverA.V(v).values().next());
}
- @Test(expected = IllegalStateException.class)
+ @Test
@FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY)
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_META_PROPERTIES)
public void shouldHidePartitionKeyForProperties() {
@@ -199,7 +209,12 @@ public class PartitionStrategyProcessTest extends AbstractGremlinProcessTest {
.partitionKey(partition).writePartition("A").addReadPartition("A").create());
final Vertex v = gOverA.addV().property("any", "thing").next();
- gOverA.V(v).properties(partition).next();
+ try {
+ gOverA.V(v).properties(partition).next();
+ fail("Should have thrown exception");
+ } catch (Exception ex) {
+ assertThat(ex.getMessage(), startsWith("Cannot explicitly request the partitionKey in the traversal"));
+ }
}
@Test
@@ -240,7 +255,6 @@ public class PartitionStrategyProcessTest extends AbstractGremlinProcessTest {
assertEquals("thing", ((List<VertexProperty>) gOverA.V(v).propertyMap().next().get("any")).get(0).value());
}
- @Test(expected = IllegalStateException.class)
@FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY)
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_META_PROPERTIES)
public void shouldHidePartitionKeyForValueMap() {
@@ -249,7 +263,13 @@ public class PartitionStrategyProcessTest extends AbstractGremlinProcessTest {
.partitionKey(partition).writePartition("A").addReadPartition("A").create());
final Vertex v = gOverA.addV().property("any", "thing").next();
- gOverA.V(v).valueMap(partition).next();
+ try {
+ gOverA.V(v).valueMap(partition).next();
+ fail("Should have thrown exception");
+ } catch (Exception ex) {
+ final Throwable root = ExceptionUtils.getRootCause(ex);
+ assertThat(root.getMessage(), startsWith("Cannot explicitly request the partitionKey in the traversal"));
+ }
}
@Test
@@ -344,8 +364,7 @@ public class PartitionStrategyProcessTest extends AbstractGremlinProcessTest {
sourceA.V(vA.id()).next();
fail("Vertex should not be in this partition");
} catch (Exception ex) {
- final Exception expected = FastNoSuchElementException.instance();
- assertEquals(expected.getClass(), ex.getClass());
+ assertThat(ex, instanceOf(NoSuchElementException.class));
}
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/d107b7a6/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/ReadOnlyStrategyProcessTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/ReadOnlyStrategyProcessTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/ReadOnlyStrategyProcessTest.java
index 3371a4c..709d564 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/ReadOnlyStrategyProcessTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/ReadOnlyStrategyProcessTest.java
@@ -25,6 +25,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSo
import org.apache.tinkerpop.gremlin.structure.Graph;
import org.junit.Test;
+import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.core.StringStartsWith.startsWith;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.fail;
@@ -100,15 +101,15 @@ public class ReadOnlyStrategyProcessTest extends AbstractGremlinProcessTest {
private void assertTraversal(final Traversal t, final boolean expectMutatingStep) {
try {
- t.asAdmin().applyStrategies();
+ t.hasNext();
if (expectMutatingStep) fail("The strategy should have found a mutating step.");
- } catch (final IllegalStateException ise) {
+ } catch (final Exception ise) {
if (!expectMutatingStep)
fail("The traversal should not have failed as there is no mutating step.");
else {
// TraversalVerificationStrategy fails before this as mutating operations are not allowed in OLAP
if (!(ise instanceof VerificationException))
- assertThat(ise.getMessage(), startsWith("The provided traversal has a mutating step and thus is not read only"));
+ assertThat(ise.getMessage(), containsString("The provided traversal has a mutating step and thus is not read only"));
}
}
}