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 2015/12/16 21:19:52 UTC

incubator-tinkerpop git commit: Ensure driver connectivity is still valid after script failure.

Repository: incubator-tinkerpop
Updated Branches:
  refs/heads/master 48dca5487 -> f2e0545ab


Ensure driver connectivity is still valid after script failure.


Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/f2e0545a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/f2e0545a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/f2e0545a

Branch: refs/heads/master
Commit: f2e0545abc52d9b23b7314a474ccafd13dc2cfac
Parents: 48dca54
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Dec 16 15:19:12 2015 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Dec 16 15:19:12 2015 -0500

----------------------------------------------------------------------
 .../server/GremlinDriverIntegrateTest.java      | 24 ++++++++++++++++++++
 1 file changed, 24 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/f2e0545a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java
----------------------------------------------------------------------
diff --git 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
index 4aae6f2..376b620 100644
--- 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
@@ -58,6 +58,7 @@ import java.util.concurrent.atomic.AtomicReference;
 import java.util.stream.Collectors;
 import java.util.stream.IntStream;
 
+import static org.hamcrest.CoreMatchers.endsWith;
 import static org.hamcrest.CoreMatchers.instanceOf;
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.junit.Assert.assertEquals;
@@ -184,6 +185,29 @@ public class GremlinDriverIntegrateTest extends AbstractGremlinServerIntegration
     }
 
     @Test
+    public void shouldFailWithScriptExecutionException() throws Exception {
+        final Cluster cluster = Cluster.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"));
+        }
+
+        // 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());
+
+        cluster.close();
+    }
+
+    @Test
     public void shouldProcessRequestsOutOfOrder() throws Exception {
         final Cluster cluster = Cluster.open();
         final Client client = cluster.connect();