You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by di...@apache.org on 2020/08/24 21:03:17 UTC
[tinkerpop] 01/01: Merge remote-tracking branch 'upstream/3.4-dev'
This is an automated email from the ASF dual-hosted git repository.
divijv pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
commit 697d5b00bcf143aca09b1f4c2b5b2ff9caa01bee
Merge: 39d9e65 d5d850c
Author: Divij Vaidya <di...@amazon.com>
AuthorDate: Mon Aug 24 14:02:44 2020 -0700
Merge remote-tracking branch 'upstream/3.4-dev'
CHANGELOG.asciidoc | 2 +
.../tinkerpop/gremlin/driver/Channelizer.java | 10 +-
.../tinkerpop/gremlin/driver/Connection.java | 133 ++-
.../tinkerpop/gremlin/driver/ConnectionPool.java | 40 +-
.../gremlin/driver/SimpleWebSocketServer.java | 52 +
.../gremlin/driver/TestWSGremlinInitializer.java | 140 +++
.../driver/TestWebSocketServerInitializer.java | 47 +
.../WebSocketClientBehaviorIntegrateTest.java | 214 ++++
.../gremlin/util/Log4jRecordingAppender.java | 89 ++
.../gremlin/util/Log4jRecordingAppenderTest.java | 84 ++
.../gremlin/server/auth/Krb5Authenticator.java | 5 +-
.../driver/ClientConnectionIntegrateTest.java | 1 -
.../AbstractGremlinServerIntegrationTest.java | 4 +-
.../gremlin/server/GremlinDriverIntegrateTest.java | 1046 +++++++++++---------
.../server/GremlinServerSessionIntegrateTest.java | 21 +-
...tractGremlinServerChannelizerIntegrateTest.java | 38 +-
16 files changed, 1372 insertions(+), 554 deletions(-)
diff --cc gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java
index e221abf,d747913..ae766be
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java
@@@ -471,28 -519,29 +493,28 @@@ public class GremlinDriverIntegrateTes
public void shouldFailWithScriptExecutionException() throws Exception {
final Cluster cluster = TestClientFactory.open();
final Client client = cluster.connect();
-
- final ResultSet results = client.submit("1/0");
-
try {
- results.all().join();
- fail("Should have thrown exception over bad serialization");
- } catch (Exception ex) {
- final Throwable inner = ExceptionUtils.getRootCause(ex);
- assertTrue(inner instanceof ResponseException);
- assertThat(inner.getMessage(), endsWith("Division by zero"));
-
- final ResponseException rex = (ResponseException) inner;
- assertEquals("java.lang.ArithmeticException", rex.getRemoteExceptionHierarchy().get().get(0));
- assertEquals(1, rex.getRemoteExceptionHierarchy().get().size());
- assertThat(rex.getRemoteStackTrace().get(), containsString("Division by zero"));
- }
- final ResultSet results = client.submit("1/0");
--
- // should not die completely just because we had a bad serialization error. that kind of stuff happens
- // from time to time, especially in the console if you're just exploring.
- assertEquals(2, client.submit("1+1").all().get().get(0).getInt());
+ try {
++ final ResultSet results = client.submit("1/0");
+ results.all().join();
+ fail("Should have thrown exception over bad serialization");
+ } catch (Exception ex) {
+ final Throwable inner = ExceptionUtils.getRootCause(ex);
+ assertTrue(inner instanceof ResponseException);
+ assertThat(inner.getMessage(), endsWith("Division by zero"));
+
+ final ResponseException rex = (ResponseException) inner;
+ assertEquals("java.lang.ArithmeticException", rex.getRemoteExceptionHierarchy().get().get(0));
+ assertEquals(1, rex.getRemoteExceptionHierarchy().get().size());
- assertThat(rex.getRemoteStackTrace().get(), startsWith("java.lang.ArithmeticException: Division by zero\n\tat java.math.BigDecimal.divide(BigDecimal.java"));
++ assertThat(rex.getRemoteStackTrace().get(), containsString("Division by zero"));
+ }
- cluster.close();
+ // should not die completely just because we had a bad serialization error. that kind of stuff happens
+ // from time to time, especially in the console if you're just exploring.
+ assertEquals(2, client.submit("1+1").all().get().get(0).getInt());
+ } finally {
+ cluster.close();
+ }
}
@Test
@@@ -902,13 -998,16 +968,15 @@@
final Cluster cluster = TestClientFactory.build().serializer(Serializers.GRAPHSON_V2D0).create();
final Client client = cluster.connect();
- final List<Result> r = client.submit("java.time.Instant.EPOCH").all().join();
- assertEquals(1, r.size());
-
- final Instant then = r.get(0).get(Instant.class);
- assertEquals(Instant.EPOCH, then);
+ try {
- final Instant now = Instant.now();
- final List<Result> r = client.submit("java.time.Instant.ofEpochMilli(" + now.toEpochMilli() + ")").all().join();
++ final List<Result> r = client.submit("java.time.Instant.EPOCH").all().join();
+ assertEquals(1, r.size());
- cluster.close();
+ final Instant then = r.get(0).get(Instant.class);
- assertEquals(now, then);
++ assertEquals(Instant.EPOCH, then);
+ } finally {
+ cluster.close();
+ }
}
@Test
@@@ -935,13 -1036,16 +1005,15 @@@
final Cluster cluster = TestClientFactory.build().serializer(Serializers.GRAPHSON_V3D0).create();
final Client client = cluster.connect();
- final List<Result> r = client.submit("java.time.Instant.EPOCH").all().join();
- assertEquals(1, r.size());
-
- final Instant then = r.get(0).get(Instant.class);
- assertEquals(Instant.EPOCH, then);
+ try {
- final Instant now = Instant.now();
- final List<Result> r = client.submit("java.time.Instant.ofEpochMilli(" + now.toEpochMilli() + ")").all().join();
++ final List<Result> r = client.submit("java.time.Instant.EPOCH").all().join();
+ assertEquals(1, r.size());
- cluster.close();
+ final Instant then = r.get(0).get(Instant.class);
- assertEquals(now, then);
++ assertEquals(Instant.EPOCH, then);
+ } finally {
+ cluster.close();
+ }
}
@Test
@@@ -1123,26 -1229,29 +1197,29 @@@
assumeNeo4jIsPresent();
final Cluster cluster = TestClientFactory.open();
- final Client sessionClient = cluster.connect(name.getMethodName());
- final Client sessionlessClient = cluster.connect();
-
- //open transaction in session, then add vertex and commit
- sessionClient.submit("g.tx().open()").all().get();
- final Vertex vertexBeforeTx = sessionClient.submit("v=g.addV(\"person\").property(\"name\",\"stephen\").next()").all().get().get(0).getVertex();
- assertEquals("person", vertexBeforeTx.label());
- sessionClient.submit("g.tx().commit()").all().get();
+ try {
+ final Client sessionClient = cluster.connect(name.getMethodName());
+ final Client sessionlessClient = cluster.connect();
- // check that session transaction is closed
- final boolean isOpen = sessionClient.submit("g.tx().isOpen()").all().get().get(0).getBoolean();
- assertTrue("Transaction should be closed", !isOpen);
+ //open transaction in session, then add vertex and commit
- sessionClient.submit("graph.tx().open()").all().get();
- final Vertex vertexBeforeTx = sessionClient.submit("v=graph.addVertex(\"name\",\"stephen\")").all().get().get(0).getVertex();
- assertEquals("stephen", vertexBeforeTx.values("name").next());
- sessionClient.submit("graph.tx().commit()").all().get();
++ sessionClient.submit("g.tx().open()").all().get();
++ final Vertex vertexBeforeTx = sessionClient.submit("v=g.addV(\"person\").property(\"name\",\"stephen\").next()").all().get().get(0).getVertex();
++ assertEquals("person", vertexBeforeTx.label());
++ sessionClient.submit("g.tx().commit()").all().get();
- //run a sessionless read
- sessionlessClient.submit("g.V()").all().get();
+ // check that session transaction is closed
- final boolean isOpen = sessionClient.submit("graph.tx().isOpen()").all().get().get(0).getBoolean();
++ final boolean isOpen = sessionClient.submit("g.tx().isOpen()").all().get().get(0).getBoolean();
+ assertTrue("Transaction should be closed", !isOpen);
- // check that session transaction is still closed
- final boolean isOpenAfterSessionless = sessionClient.submit("g.tx().isOpen()").all().get().get(0).getBoolean();
- assertTrue("Transaction should stil be closed", !isOpenAfterSessionless);
+ //run a sessionless read
- sessionlessClient.submit("graph.traversal().V()").all().get();
++ sessionlessClient.submit("g.V()").all().get();
+ // check that session transaction is still closed
- final boolean isOpenAfterSessionless = sessionClient.submit("graph.tx().isOpen()").all().get().get(0).getBoolean();
++ final boolean isOpenAfterSessionless = sessionClient.submit("g.tx().isOpen()").all().get().get(0).getBoolean();
+ assertTrue("Transaction should stil be closed", !isOpenAfterSessionless);
+ } finally {
+ cluster.close();
+ }
}
@Test
@@@ -1363,24 -1474,26 +1442,25 @@@
@Test
public void shouldAliasTraversalSourceVariables() throws Exception {
- final Cluster cluster = TestClientFactory.open();
+ final Cluster cluster = TestClientFactory.build().serializer(Serializers.GRYO_V3D0).create();
final Client client = cluster.connect();
- try {
-
++ try {
+ try {
+ client.submit("g.addV().property('name','stephen')").all().get().get(0).getVertex();
+ fail("Should have tossed an exception because \"g\" is readonly in this context");
+ } catch (Exception ex) {
+ final Throwable root = ExceptionUtils.getRootCause(ex);
+ assertThat(root, instanceOf(ResponseException.class));
+ final ResponseException re = (ResponseException) root;
- assertEquals(ResponseStatusCode.SERVER_ERROR_SCRIPT_EVALUATION, re.getResponseStatusCode());
++ assertEquals(ResponseStatusCode.SERVER_ERROR_EVALUATION, re.getResponseStatusCode());
+ }
- try {
- client.submit("g.addV().property('name','stephen')").all().get().get(0).getVertex();
- fail("Should have tossed an exception because \"g\" is readonly in this context");
- } catch (Exception ex) {
- final Throwable root = ExceptionUtils.getRootCause(ex);
- assertThat(root, instanceOf(ResponseException.class));
- final ResponseException re = (ResponseException) root;
- assertEquals(ResponseStatusCode.SERVER_ERROR_EVALUATION, re.getResponseStatusCode());
+ final Client clientAliased = client.alias("g1");
+ final Vertex v = clientAliased.submit("g.addV().property('name','jason')").all().get().get(0).getVertex();
+ assertEquals("jason", v.value("name"));
+ } finally {
+ cluster.close();
}
-
- final Client clientAliased = client.alias("g1");
- final Vertex v = clientAliased.submit("g.addV().property('name','jason')").all().get().get(0).getVertex();
- assertEquals("jason", v.value("name"));
-
- cluster.close();
}
@Test
diff --cc gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerSessionIntegrateTest.java
index 7c00bb5,9cf203b..069785e
--- 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
@@@ -91,11 -104,10 +104,9 @@@ public class GremlinServerSessionIntegr
processorSettings.config = new HashMap<>();
processorSettings.config.put(SessionOpProcessor.CONFIG_SESSION_TIMEOUT, 3000L);
settings.processors.add(processorSettings);
- Logger.getRootLogger().setLevel(Level.INFO);
break;
- case "shouldBlockAdditionalRequestsDuringClose":
- case "shouldBlockAdditionalRequestsDuringForceClose":
+ case "shouldCloseSessionOnClientClose":
clearNeo4j(settings);
- Logger.getRootLogger().setLevel(Level.INFO);
break;
case "shouldEnsureSessionBindingsAreThreadSafe":
settings.threadPoolWorker = 2;