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/11/15 00:11:55 UTC
[4/8] tinkerpop git commit: TINKERPOP-1538 Fixed handling of
pass-thru configs for DriverRemoteConnection
TINKERPOP-1538 Fixed handling of pass-thru configs for DriverRemoteConnection
Used non-standard port for tests.
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/70570bdd
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/70570bdd
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/70570bdd
Branch: refs/heads/TINKERPOP-1538-tp32
Commit: 70570bdd746c2b2498adf1686a9358ffc401c9b0
Parents: 83ac683
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Sun Nov 13 19:40:19 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Nov 14 18:49:28 2016 -0500
----------------------------------------------------------------------
CHANGELOG.asciidoc | 1 +
.../gremlin/driver/remote/DriverRemoteConnection.java | 6 ++++--
gremlin-python/pom.xml | 7 ++++---
.../tests/driver/test_driver_remote_connection.py | 12 ++++++------
.../python/driver/gremlin-server-modern-secure-py.yaml | 4 +---
.../gremlin/driver/remote/RemoteGraphProvider.java | 5 ++++-
.../gremlin/server/GremlinResultSetIntegrateTest.java | 2 +-
.../gremlin/server/GremlinServerHttpIntegrateTest.java | 2 +-
.../gremlin/server/GremlinServerIntegrateTest.java | 6 +++---
.../server/GremlinServerSessionIntegrateTest.java | 5 ++---
.../tinkerpop/gremlin/server/TestClientFactory.java | 2 +-
.../driver/remote/gremlin-server-integration.yaml | 2 +-
12 files changed, 29 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/70570bdd/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 7041489..3d963c9 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -41,6 +41,7 @@ TinkerPop 3.2.4 (Release Date: NOT OFFICIALLY RELEASED YET)
* Added `choose(predicate,traversal)` and `choose(traversal,traversal)` to effect if/then-semantics (no else). Equivalent to `choose(x,y,identity())`.
* Removed `ImmutablePath.TailPath` as it is no longer required with new recursion model.
* Removed call stack recursion in `ImmutablePath`.
+* Fixed the handling of the `DriverRemoteConnection` pass-through configurations to the driver.
* `IncidentToAdjacentStrategy` now uses a hidden label marker model to avoid repeated recursion for invalidating steps.
* `PathProcessorStrategy` can inline certain `where(traversal)`-steps in order to increase the likelihood of star-local children.
* `SparkGraphComputer` no longer starts a worker iteration if the worker's partition is empty.
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/70570bdd/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 c1eba34..bb2d33d 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
@@ -33,6 +33,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
import org.apache.tinkerpop.gremlin.structure.Graph;
import org.apache.tinkerpop.gremlin.structure.util.GraphFactory;
+import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
import java.util.Iterator;
import java.util.Optional;
@@ -59,14 +60,15 @@ public class DriverRemoteConnection implements RemoteConnection {
private static final boolean attachElements = Boolean.valueOf(System.getProperty("is.testing", "false"));
public DriverRemoteConnection(final Configuration conf) {
- if (conf.containsKey(GREMLIN_REMOTE_DRIVER_CLUSTERFILE) && conf.containsKey("clusterConfiguration"))
+ final boolean hasClusterConf = IteratorUtils.anyMatch(conf.getKeys(), k -> k.startsWith("clusterConfiguration"));
+ if (conf.containsKey(GREMLIN_REMOTE_DRIVER_CLUSTERFILE) && hasClusterConf)
throw new IllegalStateException(String.format("A configuration should not contain both '%s' and 'clusterConfiguration'", GREMLIN_REMOTE_DRIVER_CLUSTERFILE));
remoteTraversalSourceName = conf.getString(GREMLIN_REMOTE_DRIVER_SOURCENAME, DEFAULT_TRAVERSAL_SOURCE);
try {
final Cluster cluster;
- if (!conf.containsKey(GREMLIN_REMOTE_DRIVER_CLUSTERFILE) && !conf.containsKey("clusterConfiguration"))
+ if (!conf.containsKey(GREMLIN_REMOTE_DRIVER_CLUSTERFILE) && !hasClusterConf)
cluster = Cluster.open();
else
cluster = conf.containsKey(GREMLIN_REMOTE_DRIVER_CLUSTERFILE) ?
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/70570bdd/gremlin-python/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-python/pom.xml b/gremlin-python/pom.xml
index 923380d..aa7d088 100644
--- a/gremlin-python/pom.xml
+++ b/gremlin-python/pom.xml
@@ -488,17 +488,18 @@ log.info("Starting Gremlin Server instances for native testing of gremlin-python
def settings = Settings.read("${gremlin.server.dir}/conf/gremlin-server-modern-py.yaml")
settings.graphs.graph = "${gremlin.server.dir}/conf/tinkergraph-empty.properties"
settings.scriptEngines["gremlin-groovy"].scripts = ["${gremlin.server.dir}/scripts/generate-modern.groovy"]
+settings.port = 45940
def server = new GremlinServer(settings)
server.start().join()
project.setContextValue("gremlin.py.server", server)
-log.info("Gremlin Server with no authentication started on port 8182")
+log.info("Gremlin Server with no authentication started on port 45940")
def settingsSecure = Settings.read("${gremlin.server.dir}/conf/gremlin-server-modern-py.yaml")
settingsSecure.graphs.graph = "${gremlin.server.dir}/conf/tinkergraph-empty.properties"
settingsSecure.scriptEngines["gremlin-groovy"].scripts = ["${gremlin.server.dir}/scripts/generate-modern.groovy"]
-settingsSecure.port = 8183
+settingsSecure.port = 45941
settingsSecure.authentication.className = "org.apache.tinkerpop.gremlin.server.auth.SimpleAuthenticator"
settingsSecure.authentication.config = [credentialsDb: "${gremlin.server.dir}/conf/tinkergraph-credentials.properties"]
@@ -506,7 +507,7 @@ def serverSecure = new GremlinServer(settingsSecure)
serverSecure.start().join()
project.setContextValue("gremlin.py.server.secure", serverSecure)
-log.info("Gremlin Server with authentication started on port 8183")
+log.info("Gremlin Server with authentication started on port 45941")
]]>
</script>
</scripts>
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/70570bdd/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py b/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
index 6921837..9f3e466 100644
--- a/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
+++ b/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
@@ -38,8 +38,8 @@ from gremlin_python.process.strategies import SubgraphStrategy
class TestDriverRemoteConnection(TestCase):
def test_traversals(self):
statics.load_statics(globals())
- connection = DriverRemoteConnection('ws://localhost:8182/gremlin', 'g')
- assert "remoteconnection[ws://localhost:8182/gremlin,g]" == str(connection)
+ connection = DriverRemoteConnection('ws://localhost:45940/gremlin', 'g')
+ assert "remoteconnection[ws://localhost:45940/gremlin,g]" == str(connection)
g = Graph().traversal().withRemote(connection)
assert long(6) == g.V().count().toList()[0]
@@ -66,7 +66,7 @@ class TestDriverRemoteConnection(TestCase):
def test_strategies(self):
statics.load_statics(globals())
- connection = DriverRemoteConnection('ws://localhost:8182/gremlin', 'g')
+ connection = DriverRemoteConnection('ws://localhost:45940/gremlin', 'g')
#
g = Graph().traversal().withRemote(connection). \
withStrategies(TraversalStrategy("SubgraphStrategy",
@@ -98,7 +98,7 @@ class TestDriverRemoteConnection(TestCase):
def test_side_effects(self):
statics.load_statics(globals())
- connection = DriverRemoteConnection('ws://localhost:8182/gremlin', 'g')
+ connection = DriverRemoteConnection('ws://localhost:45940/gremlin', 'g')
#
g = Graph().traversal().withRemote(connection)
###
@@ -155,7 +155,7 @@ class TestDriverRemoteConnection(TestCase):
connection.close()
def test_side_effect_close(self):
- connection = DriverRemoteConnection('ws://localhost:8182/gremlin', 'g')
+ connection = DriverRemoteConnection('ws://localhost:45940/gremlin', 'g')
g = Graph().traversal().withRemote(connection)
t = g.V().aggregate('a').aggregate('b')
t.toList()
@@ -192,7 +192,7 @@ class TestDriverRemoteConnection(TestCase):
if __name__ == '__main__':
test = False
try:
- connection = DriverRemoteConnection('ws://localhost:8182/gremlin', 'g')
+ connection = DriverRemoteConnection('ws://localhost:45940/gremlin', 'g')
test = True
connection.close()
except:
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/70570bdd/gremlin-python/src/test/resources/org/apache/tinkerpop/gremlin/python/driver/gremlin-server-modern-secure-py.yaml
----------------------------------------------------------------------
diff --git a/gremlin-python/src/test/resources/org/apache/tinkerpop/gremlin/python/driver/gremlin-server-modern-secure-py.yaml b/gremlin-python/src/test/resources/org/apache/tinkerpop/gremlin/python/driver/gremlin-server-modern-secure-py.yaml
index a1b28a9..a5b3480 100644
--- a/gremlin-python/src/test/resources/org/apache/tinkerpop/gremlin/python/driver/gremlin-server-modern-secure-py.yaml
+++ b/gremlin-python/src/test/resources/org/apache/tinkerpop/gremlin/python/driver/gremlin-server-modern-secure-py.yaml
@@ -26,9 +26,7 @@
# is the addition of "gremlin-jython" to the "scriptEngines" field.
host: localhost
-port: 8182
-threadPoolWorker: 1
-gremlinPool: 8
+port: 45940
scriptEvaluationTimeout: 30000
graphs: {
graph: src/test/resources/org/apache/tinkerpop/gremlin/python/driver/tinkergraph-empty.properties}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/70570bdd/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 f071671..a19ecc8 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
@@ -29,6 +29,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSo
import org.apache.tinkerpop.gremlin.server.GremlinServer;
import org.apache.tinkerpop.gremlin.server.ServerTestHelper;
import org.apache.tinkerpop.gremlin.server.Settings;
+import org.apache.tinkerpop.gremlin.server.TestClientFactory;
import org.apache.tinkerpop.gremlin.structure.Graph;
import java.io.InputStream;
@@ -49,7 +50,7 @@ public class RemoteGraphProvider extends AbstractGraphProvider implements AutoCl
private static GremlinServer server;
private final Map<String, RemoteGraph> remoteCache = new HashMap<>();
- private final Cluster cluster = Cluster.open();
+ private final Cluster cluster = TestClientFactory.open();
//private final Cluster cluster = Cluster.build().maxContentLength(1024000).serializer(Serializers.GRAPHSON_V2D0).create();
private final Client client = cluster.connect();
@@ -87,6 +88,8 @@ public class RemoteGraphProvider extends AbstractGraphProvider implements AutoCl
put(Graph.GRAPH, RemoteGraph.class.getName());
put(RemoteGraph.GREMLIN_REMOTE_GRAPH_REMOTE_CONNECTION_CLASS, DriverRemoteConnection.class.getName());
put(DriverRemoteConnection.GREMLIN_REMOTE_DRIVER_SOURCENAME, "g" + serverGraphName);
+ put("clusterConfiguration.port", TestClientFactory.PORT);
+ put("clusterConfiguration.hosts", "localhost");
put("hidden.for.testing.only", graphGetter);
}};
}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/70570bdd/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinResultSetIntegrateTest.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinResultSetIntegrateTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinResultSetIntegrateTest.java
index 9916f73..ec39dec 100644
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinResultSetIntegrateTest.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinResultSetIntegrateTest.java
@@ -141,7 +141,7 @@ public class GremlinResultSetIntegrateTest extends AbstractGremlinServerIntegrat
@Test
public void shouldHandleVertexResultWithLiteSerialization() throws Exception {
- final Cluster cluster = Cluster.build().serializer(Serializers.GRYO_LITE_V1D0).create();
+ final Cluster cluster = TestClientFactory.build().serializer(Serializers.GRYO_LITE_V1D0).create();
final Client clientLite = cluster.connect();
final ResultSet results = clientLite.submit("g.V(1).next()");
final Vertex v = results.all().get().get(0).getVertex();
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/70570bdd/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerHttpIntegrateTest.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerHttpIntegrateTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerHttpIntegrateTest.java
index cefe0df..78109e6 100644
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerHttpIntegrateTest.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerHttpIntegrateTest.java
@@ -805,7 +805,7 @@ public class GremlinServerHttpIntegrateTest extends AbstractGremlinServerIntegra
@Test
public void should200OnPOSTWithGraphSON2d0AcceptHeaderDefaultResultToJson() throws Exception {
final CloseableHttpClient httpclient = HttpClients.createDefault();
- final HttpPost httppost = new HttpPost("http://localhost:8182");
+ final HttpPost httppost = new HttpPost(TestClientFactory.createURLString());
httppost.setEntity(new StringEntity("{\"gremlin\":\"1-1\"}", Consts.UTF_8));
try (final CloseableHttpResponse response = httpclient.execute(httppost)) {
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/70570bdd/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
index 7240509..b3dbe29 100644
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
@@ -38,7 +38,6 @@ import org.apache.tinkerpop.gremlin.driver.message.ResponseStatusCode;
import org.apache.tinkerpop.gremlin.driver.remote.DriverRemoteConnection;
import org.apache.tinkerpop.gremlin.driver.remote.DriverRemoteTraversalSideEffects;
import org.apache.tinkerpop.gremlin.driver.ser.Serializers;
-import org.apache.tinkerpop.gremlin.driver.simple.NioClient;
import org.apache.tinkerpop.gremlin.driver.simple.SimpleClient;
import org.apache.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine;
import org.apache.tinkerpop.gremlin.groovy.jsr223.customizer.CompileStaticCustomizerProvider;
@@ -59,7 +58,6 @@ import org.apache.tinkerpop.gremlin.util.Log4jRecordingAppender;
import org.apache.tinkerpop.gremlin.util.function.Lambda;
import org.hamcrest.CoreMatchers;
import org.junit.After;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -110,6 +108,8 @@ public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegration
setProperty(GREMLIN_REMOTE_CONNECTION_CLASS, DriverRemoteConnection.class.getName());
setProperty(DriverRemoteConnection.GREMLIN_REMOTE_DRIVER_SOURCENAME, "g");
setProperty("hidden.for.testing.only", graphGetter);
+ setProperty("clusterConfiguration.port", TestClientFactory.PORT);
+ setProperty("clusterConfiguration.hosts", "localhost");
}};
@Before
@@ -883,7 +883,7 @@ public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegration
assertThat(localSideEffects.isEmpty(), is(false));
// Try to get side effect from server
- final Cluster cluster = Cluster.build("localhost").create();
+ final Cluster cluster = TestClientFactory.open();
final Client client = cluster.connect();
final Field field = DriverRemoteTraversalSideEffects.class.getDeclaredField("serverSideEffect");
field.setAccessible(true);
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/70570bdd/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerSessionIntegrateTest.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerSessionIntegrateTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerSessionIntegrateTest.java
index 4042b28..434bda8 100644
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerSessionIntegrateTest.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerSessionIntegrateTest.java
@@ -157,10 +157,10 @@ public class GremlinServerSessionIntegrateTest extends AbstractGremlinServerInt
// basically, we need one to submit the long run job and one to do the close operation that will cancel the
// long run job. it is probably possible to do this with some low-level message manipulation but that's
// probably not necessary
- final Cluster cluster1 = Cluster.build().create();
+ final Cluster cluster1 = TestClientFactory.open();
final Client client1 = cluster1.connect(name.getMethodName());
client1.submit("graph.addVertex()").all().join();
- final Cluster cluster2 = Cluster.build().create();
+ final Cluster cluster2 = TestClientFactory.open();
final Client.SessionSettings sessionSettings = Client.SessionSettings.build()
.sessionId(name.getMethodName())
.forceClosed(true).create();
@@ -188,7 +188,6 @@ public class GremlinServerSessionIntegrateTest extends AbstractGremlinServerInt
cluster2.close();
}
-
@Test
public void shouldRollbackOnEvalExceptionForManagedTransaction() throws Exception {
assumeNeo4jIsPresent();
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/70570bdd/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/TestClientFactory.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/TestClientFactory.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/TestClientFactory.java
index bfbb40b..a2ee492 100644
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/TestClientFactory.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/TestClientFactory.java
@@ -30,7 +30,7 @@ import java.net.URI;
public final class TestClientFactory {
public static final int PORT = 45940;
- public static final URI WEBSOCKET_URI = URI.create("ws://localhost:" + PORT);
+ public static final URI WEBSOCKET_URI = URI.create("ws://localhost:" + PORT + "/gremlin");
public static final URI NIO_URI = URI.create("gs://localhost:" + PORT);
public static final String HTTP = "http://localhost:" + PORT;
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/70570bdd/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/driver/remote/gremlin-server-integration.yaml
----------------------------------------------------------------------
diff --git a/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/driver/remote/gremlin-server-integration.yaml b/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/driver/remote/gremlin-server-integration.yaml
index 552b2ea..a25c6b1 100644
--- a/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/driver/remote/gremlin-server-integration.yaml
+++ b/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/driver/remote/gremlin-server-integration.yaml
@@ -16,7 +16,7 @@
# under the License.
host: localhost
-port: 8182
+port: 45940
scriptEvaluationTimeout: 30000
graphs: {
graph: conf/tinkergraph-empty.properties,