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 15:39:58 UTC
[16/50] incubator-tinkerpop git commit: Basics of the ServerStrategy
are in place at ths point.
Basics of the ServerStrategy are in place at ths point.
Traversals are getting sent to the server and results are returning. Have a basic test that demonstrates operations. Still needs considerably work.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/511c0963
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/511c0963
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/511c0963
Branch: refs/heads/TINKERPOP-575
Commit: 511c096362d4cfd00107431e0acf1c1af0edfbfe
Parents: ea889d9
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Mar 10 16:07:36 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Mar 16 09:49:10 2016 -0400
----------------------------------------------------------------------
.../process/server/ServerConnection.java | 34 ++++++++
.../server/ServerConnectionException.java | 41 +++++++++
.../traversal/step/map/ServerResultStep.java | 88 +++++++++++++++++++
.../traversal/strategy/ServerStrategy.java | 72 ++++++++++++++++
.../process/traversal/TraversalSource.java | 7 ++
.../dsl/graph/GraphTraversalSource.java | 7 ++
.../driver/strategy/DriverServerConnection.java | 91 ++++++++++++++++++++
.../op/traversal/TraversalOpProcessor.java | 6 +-
.../server/WithServerIntegrationTest.java | 48 +++++++++++
9 files changed, 391 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/511c0963/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/server/ServerConnection.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/server/ServerConnection.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/server/ServerConnection.java
new file mode 100644
index 0000000..d7abc1a
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/server/ServerConnection.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 org.apache.tinkerpop.gremlin.process.server;
+
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
+
+import java.util.Iterator;
+
+/**
+ * A simple abstraction of a "connection" to a "server" that is capable of processing a {@link Traversal} and
+ * returning an {@link Iterator} of {@link Traverser} results.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public interface ServerConnection extends AutoCloseable {
+ public Iterator<Traverser> submit(final Traversal t) throws ServerConnectionException;
+}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/511c0963/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/server/ServerConnectionException.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/server/ServerConnectionException.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/server/ServerConnectionException.java
new file mode 100644
index 0000000..901cc54
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/server/ServerConnectionException.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 org.apache.tinkerpop.gremlin.process.server;
+
+/**
+ * A generalized exception for any errors related to {@link ServerConnection}.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class ServerConnectionException extends Exception {
+ public ServerConnectionException() {
+ }
+
+ public ServerConnectionException(String message) {
+ super(message);
+ }
+
+ public ServerConnectionException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ServerConnectionException(Throwable cause) {
+ super(cause);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/511c0963/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/server/traversal/step/map/ServerResultStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/server/traversal/step/map/ServerResultStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/server/traversal/step/map/ServerResultStep.java
new file mode 100644
index 0000000..9943507
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/server/traversal/step/map/ServerResultStep.java
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 org.apache.tinkerpop.gremlin.process.server.traversal.step.map;
+
+import org.apache.tinkerpop.gremlin.process.server.ServerConnection;
+import org.apache.tinkerpop.gremlin.process.server.ServerConnectionException;
+import org.apache.tinkerpop.gremlin.process.server.traversal.strategy.ServerStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
+import org.apache.tinkerpop.gremlin.process.traversal.step.TraversalParent;
+import org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep;
+import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep;
+import org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException;
+import org.apache.tinkerpop.gremlin.process.traversal.util.PureTraversal;
+import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
+import org.apache.tinkerpop.gremlin.util.iterator.EmptyIterator;
+
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.NoSuchElementException;
+
+/**
+ * Takes a {@link Traversal}
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class ServerResultStep<S,E> extends AbstractStep<S, E> implements TraversalParent {
+ private transient ServerConnection serverConnection;
+ private PureTraversal pureTraversal;
+ private Iterator<Traverser> currentIterator;
+
+ public ServerResultStep(final Traversal.Admin<S,E> traversal, final Traversal overTheWireTraversal,
+ final ServerConnection serverConnection) {
+ super(traversal);
+ this.serverConnection = serverConnection;
+ pureTraversal = new PureTraversal<>(overTheWireTraversal.asAdmin());
+ this.integrateChild(pureTraversal.get());
+ }
+
+ @Override
+ public List<Traversal.Admin<S, E>> getGlobalChildren() {
+ return Collections.singletonList(pureTraversal.get());
+ }
+
+ @Override
+ public String toString() {
+ return StringFactory.stepString(this, pureTraversal.get());
+ }
+
+ @Override
+ public void setTraversal(final Traversal.Admin<?, ?> parentTraversal) {
+ super.setTraversal(parentTraversal);
+ this.integrateChild(pureTraversal.get());
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ protected Traverser processNextStart() throws NoSuchElementException {
+
+ if (null == currentIterator) {
+ try {
+ final Traversal.Admin temp = pureTraversal.getPure();
+ temp.setStrategies(this.getTraversal().getStrategies());
+ currentIterator = serverConnection.submit(temp);
+ } catch (ServerConnectionException sce) {
+ throw new IllegalStateException(sce);
+ }
+ }
+
+ return this.currentIterator.next();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/511c0963/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/server/traversal/strategy/ServerStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/server/traversal/strategy/ServerStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/server/traversal/strategy/ServerStrategy.java
new file mode 100644
index 0000000..eda831f
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/server/traversal/strategy/ServerStrategy.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 org.apache.tinkerpop.gremlin.process.server.traversal.strategy;
+
+import org.apache.tinkerpop.gremlin.process.server.ServerConnection;
+import org.apache.tinkerpop.gremlin.process.server.traversal.step.map.ServerResultStep;
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
+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;
+import org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversal;
+import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;
+
+import java.util.Collections;
+import java.util.Set;
+
+/**
+ * Reconstructs a {@link Traversal} by appending a {@link ServerResultStep} to its end. That step will submit the
+ * {@link Traversal} to a {@link ServerConnection} instance which will typically send it to a remote server for
+ * execution and return results.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class ServerStrategy extends AbstractTraversalStrategy<TraversalStrategy.DecorationStrategy>
+ implements TraversalStrategy.DecorationStrategy {
+ private transient ServerConnection serverConnection;
+
+ public ServerStrategy(final ServerConnection serverConnection) {
+ if (null == serverConnection) throw new IllegalArgumentException("ServerConnection cannot be null");
+ this.serverConnection = serverConnection;
+ }
+
+ @Override
+ public Set<Class<? extends DecorationStrategy>> applyPost() {
+ return Collections.singleton(VertexProgramStrategy.class);
+ }
+
+ @Override
+ public void apply(final Traversal.Admin<?, ?> traversal) {
+ if (null == serverConnection )
+ return;
+
+ if (!(traversal.getParent() instanceof EmptyStep))
+ return;
+
+ final Traversal.Admin<?, ?> serverTraversal = new DefaultTraversal<>();
+ TraversalHelper.removeToTraversal(traversal.getStartStep(), EmptyStep.instance(), (Traversal.Admin) serverTraversal);
+ final ServerResultStep serverStep = new ServerResultStep(traversal, serverTraversal, serverConnection);
+ traversal.addStep(serverStep);
+
+ assert traversal.getStartStep().equals(serverStep);
+ assert traversal.getSteps().size() == 1;
+ assert traversal.getEndStep() == serverStep;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/511c0963/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalSource.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalSource.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalSource.java
index a1a39b6..b083994 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalSource.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalSource.java
@@ -18,7 +18,10 @@
*/
package org.apache.tinkerpop.gremlin.process.traversal;
+import org.apache.commons.configuration.Configuration;
import org.apache.tinkerpop.gremlin.process.computer.GraphComputer;
+import org.apache.tinkerpop.gremlin.process.server.ServerConnection;
+import org.apache.tinkerpop.gremlin.process.server.traversal.strategy.ServerStrategy;
import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SackStrategy;
import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SideEffectStrategy;
import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.VertexProgramStrategy;
@@ -121,6 +124,10 @@ public interface TraversalSource extends Cloneable {
return this.withComputer(Graph::compute);
}
+ public default TraversalSource withServer(final ServerConnection server) {
+ return this.withStrategies(new ServerStrategy(server));
+ }
+
/**
* Add a sideEffect to be used throughout the life of a spawned {@link Traversal}.
* This adds a {@link org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SideEffectStrategy} to the strategies.
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/511c0963/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSource.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSource.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSource.java
index d06dfac..9ae9627 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSource.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSource.java
@@ -19,6 +19,8 @@
package org.apache.tinkerpop.gremlin.process.traversal.dsl.graph;
import org.apache.tinkerpop.gremlin.process.computer.GraphComputer;
+import org.apache.tinkerpop.gremlin.process.server.ServerConnection;
+import org.apache.tinkerpop.gremlin.process.server.traversal.strategy.ServerStrategy;
import org.apache.tinkerpop.gremlin.process.traversal.TraversalEngine;
import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies;
@@ -178,6 +180,11 @@ public class GraphTraversalSource implements TraversalSource {
return (GraphTraversalSource) TraversalSource.super.withSack(initialValue, mergeOperator);
}
+ @Override
+ public GraphTraversalSource withServer(final ServerConnection serverConnection) {
+ return (GraphTraversalSource) TraversalSource.super.withServer(serverConnection);
+ }
+
public GraphTraversalSource withBulk(final boolean useBulk) {
if (!useBulk) {
final GraphTraversalSource clone = this.clone();
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/511c0963/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/strategy/DriverServerConnection.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/strategy/DriverServerConnection.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/strategy/DriverServerConnection.java
new file mode 100644
index 0000000..aa42cd6
--- /dev/null
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/strategy/DriverServerConnection.java
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 org.apache.tinkerpop.gremlin.driver.strategy;
+
+import org.apache.tinkerpop.gremlin.driver.Client;
+import org.apache.tinkerpop.gremlin.driver.Cluster;
+import org.apache.tinkerpop.gremlin.driver.Result;
+import org.apache.tinkerpop.gremlin.process.server.ServerConnection;
+import org.apache.tinkerpop.gremlin.process.server.ServerConnectionException;
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
+
+import java.util.Iterator;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class DriverServerConnection implements ServerConnection {
+
+ private Client client;
+
+ private DriverServerConnection(final Cluster cluster){
+ client = cluster.connect(Client.Settings.build().unrollTraversers(false).create()).alias("graph");
+ }
+
+ public static DriverServerConnection using(final Cluster cluster) {
+ return new DriverServerConnection(cluster);
+ }
+
+ public static DriverServerConnection using(final String conf) {
+ try {
+ return new DriverServerConnection(Cluster.open(conf));
+ } catch (Exception ex) {
+ throw new IllegalStateException(ex);
+ }
+ }
+
+ @Override
+ public Iterator<Traverser> submit(final Traversal t) throws ServerConnectionException {
+ try {
+ return new TraverserIterator(client.submit(t).all().get().iterator());
+ } catch (Exception ex) {
+ throw new ServerConnectionException(ex);
+ }
+ }
+
+ @Override
+ public void close() throws Exception {
+ try {
+ client.close();
+ } catch (Exception ex) {
+ throw new ServerConnectionException(ex);
+ }
+ }
+
+ static class TraverserIterator implements Iterator<Traverser> {
+
+ private Iterator<Result> inner;
+
+ public TraverserIterator(final Iterator<Result> resultIterator) {
+ inner = resultIterator;
+ }
+
+ @Override
+ public boolean hasNext() {
+ return inner.hasNext();
+ }
+
+ @Override
+ public Traverser next() {
+ final Object o = inner.next().getObject();
+ return (Traverser) o;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/511c0963/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 4036d55..d915ce7 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
@@ -25,6 +25,8 @@ import org.apache.tinkerpop.gremlin.driver.message.ResponseMessage;
import org.apache.tinkerpop.gremlin.driver.message.ResponseStatusCode;
import org.apache.tinkerpop.gremlin.process.computer.util.VertexProgramHelper;
import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies;
+import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
import org.apache.tinkerpop.gremlin.server.Context;
import org.apache.tinkerpop.gremlin.server.GraphManager;
@@ -146,9 +148,7 @@ public class TraversalOpProcessor extends AbstractOpProcessor {
try {
// compile the traversal - without it getEndStep() has nothing in it
traversal.hasNext();
-
- final Iterator<Traverser> itty = new DetachingIterator(traversal.asAdmin().getEndStep());
- handleIterator(context, itty);
+ handleIterator(context, new DetachingIterator(traversal.asAdmin().getEndStep()));
} catch (TimeoutException ex) {
final String errorMessage = String.format("Response iteration exceeded the configured threshold for request [%s] - %s", msg.getRequestId(), ex.getMessage());
logger.warn(errorMessage);
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/511c0963/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/WithServerIntegrationTest.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/WithServerIntegrationTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/WithServerIntegrationTest.java
new file mode 100644
index 0000000..a8e1cb8
--- /dev/null
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/WithServerIntegrationTest.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 org.apache.tinkerpop.gremlin.server;
+
+import org.apache.tinkerpop.gremlin.driver.Cluster;
+import org.apache.tinkerpop.gremlin.driver.strategy.DriverServerConnection;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
+import org.junit.Test;
+
+import java.util.Collections;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class WithServerIntegrationTest extends AbstractGremlinServerIntegrationTest {
+ @Override
+ public Settings overrideSettings(final Settings settings) {
+ settings.scriptEngines.get("gremlin-groovy").scripts = Collections.singletonList("scripts/generate-modern.groovy");
+ return settings;
+ }
+
+ @Test
+ public void shouldDoTraversalReturningVertices() {
+ final Graph graph = TinkerGraph.open();
+ final Cluster cluster = Cluster.open();
+ final GraphTraversalSource g = graph.traversal().withServer(DriverServerConnection.using(cluster));
+ g.V().forEachRemaining(v -> System.out.println("TEST: " + v.toString()));
+ cluster.close();
+ }
+}