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/06/29 21:14:46 UTC
[1/7] incubator-tinkerpop git commit: need to commit transactions on
success
Repository: incubator-tinkerpop
Updated Branches:
refs/heads/master c49b40631 -> 75ae7bdac
need to commit transactions on success
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/9f18cd49
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/9f18cd49
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/9f18cd49
Branch: refs/heads/master
Commit: 9f18cd4935871b1d8d749dfb703274b9a7a7f52f
Parents: c33468c
Author: Jason Plurad <pl...@users.noreply.github.com>
Authored: Mon Jun 29 12:56:28 2015 -0400
Committer: Jason Plurad <pl...@users.noreply.github.com>
Committed: Mon Jun 29 12:56:28 2015 -0400
----------------------------------------------------------------------
.../gremlin/server/handler/HttpGremlinEndpointHandler.java | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/9f18cd49/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java
index c53f09c..a9a901c 100644
--- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java
+++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java
@@ -210,7 +210,10 @@ public class HttpGremlinEndpointHandler extends ChannelInboundHandlerAdapter {
.code(ResponseStatusCode.SUCCESS)
.result(IteratorUtils.asList(o)).create();
try {
- return (Object) Unpooled.wrappedBuffer(serializer.serializeResponseAsString(responseMessage).getBytes(UTF8));
+ Object wrappedBuffer = (Object) Unpooled.wrappedBuffer(serializer.serializeResponseAsString(responseMessage).getBytes(UTF8));
+ // http server is sessionless and must handle commit on transactions
+ this.graphManager.commitAll();
+ return wrappedBuffer;
} catch (Exception ex) {
logger.warn(String.format("Error during serialization for %s", responseMessage), ex);
throw ex;
[7/7] incubator-tinkerpop git commit: Add test for REST of
transactional graph.
Posted by sp...@apache.org.
Add test for REST of transactional graph.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/75ae7bda
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/75ae7bda
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/75ae7bda
Branch: refs/heads/master
Commit: 75ae7bdac65dca49a5847a98df48da6015db7800
Parents: b05151c
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Jun 29 15:14:27 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Jun 29 15:14:27 2015 -0400
----------------------------------------------------------------------
.../server/GremlinServerHttpIntegrateTest.java | 39 ++++++++++++++++++++
1 file changed, 39 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/75ae7bda/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 57dbd3e..650a195 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
@@ -34,6 +34,7 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
+import java.io.File;
import java.util.Arrays;
import static org.junit.Assert.assertEquals;
@@ -63,6 +64,10 @@ public class GremlinServerHttpIntegrateTest extends AbstractGremlinServerIntegra
case "should200OnGETWithGremlinQueryStringArgumentWithIteratorResultAndRebinding":
settings.scriptEngines.get("gremlin-groovy").scripts = Arrays.asList("scripts/generate-classic.groovy");
break;
+ case "should200OnPOSTTransactionalGraph":
+ deleteDirectory(new File("/tmp/neo4j"));
+ settings.graphs.put("graph", "conf/neo4j-empty.properties");
+ break;
}
return settings;
}
@@ -204,6 +209,40 @@ public class GremlinServerHttpIntegrateTest extends AbstractGremlinServerIntegra
}
@Test
+ public void should200OnPOSTTransactionalGraph() throws Exception {
+ assumeNeo4jIsPresent();
+
+ final CloseableHttpClient httpclient = HttpClients.createDefault();
+ final HttpPost httppost = new HttpPost("http://localhost:8182");
+ httppost.addHeader("Content-Type", "application/json");
+ httppost.setEntity(new StringEntity("{\"gremlin\":\"graph.addVertex('name','stephen');g.V().count()\"}", Consts.UTF_8));
+
+ try (final CloseableHttpResponse response = httpclient.execute(httppost)) {
+ assertEquals(200, response.getStatusLine().getStatusCode());
+ assertEquals("application/json", response.getEntity().getContentType().getValue());
+ final String json = EntityUtils.toString(response.getEntity());
+ final JsonNode node = mapper.readTree(json);
+ assertEquals(1, node.get("result").get("data").get(0).intValue());
+ }
+
+ final HttpGet httpget = new HttpGet("http://localhost:8182?gremlin=g.V().count()");
+ httpget.addHeader("Accept", "application/json");
+
+ // execute this a bunch of times so that there's a good chance a different thread on the server processes
+ // the request
+ for (int ix = 0; ix < 100; ix++) {
+ try (final CloseableHttpResponse response = httpclient.execute(httpget)) {
+ assertEquals(200, response.getStatusLine().getStatusCode());
+ assertEquals("application/json", response.getEntity().getContentType().getValue());
+ final String json = EntityUtils.toString(response.getEntity());
+ final JsonNode node = mapper.readTree(json);
+ assertEquals(1, node.get("result").get("data").get(0).intValue());
+ }
+ }
+
+ }
+
+ @Test
public void should200OnPOSTWithGremlinJsonEndcodedBodyWithIteratorResult() throws Exception {
final CloseableHttpClient httpclient = HttpClients.createDefault();
final HttpPost httppost = new HttpPost("http://localhost:8182");
[5/7] incubator-tinkerpop git commit: Enabled neo4j on a transaction
test - wasn't enabled previously.
Posted by sp...@apache.org.
Enabled neo4j on a transaction test - wasn't enabled previously.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/28f97d57
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/28f97d57
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/28f97d57
Branch: refs/heads/master
Commit: 28f97d57120f878aee5687d9db244bbf389f3653
Parents: 1736876
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Jun 29 14:40:55 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Jun 29 14:40:55 2015 -0400
----------------------------------------------------------------------
.../apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/28f97d57/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 aa82382..21f14b8 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
@@ -95,6 +95,7 @@ public class GremlinDriverIntegrateTest extends AbstractGremlinServerIntegration
.findFirst().get().config.put("custom", custom);
break;
case "shouldExecuteScriptInSessionOnTransactionalGraph":
+ case "shouldExecuteSessionlessScriptOnTransactionalGraph":
deleteDirectory(new File("/tmp/neo4j"));
settings.graphs.put("graph", "conf/neo4j-empty.properties");
break;
[2/7] incubator-tinkerpop git commit: Move neo4j test assumption to
base integration tests class.
Posted by sp...@apache.org.
Move neo4j test assumption to base integration tests class.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/e77b62b4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/e77b62b4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/e77b62b4
Branch: refs/heads/master
Commit: e77b62b4f055d7dcfaa1654864f3f0216c528548
Parents: c49b406
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Jun 29 14:20:35 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Jun 29 14:20:35 2015 -0400
----------------------------------------------------------------------
.../server/AbstractGremlinServerIntegrationTest.java | 14 ++++++++++++++
.../gremlin/server/GremlinDriverIntegrateTest.java | 10 ----------
2 files changed, 14 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/e77b62b4/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/AbstractGremlinServerIntegrationTest.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/AbstractGremlinServerIntegrationTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/AbstractGremlinServerIntegrationTest.java
index f6025c4..19f8eec 100644
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/AbstractGremlinServerIntegrationTest.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/AbstractGremlinServerIntegrationTest.java
@@ -24,6 +24,9 @@ import org.junit.Before;
import java.io.File;
import java.io.InputStream;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assume.assumeThat;
+
/**
* Starts and stops an instance for each executed test.
*
@@ -78,4 +81,15 @@ public abstract class AbstractGremlinServerIntegrationTest {
return (directory.delete());
}
+
+ protected static void assumeNeo4jIsPresent() {
+ boolean neo4jIncludedForTesting;
+ try {
+ Class.forName("org.neo4j.tinkerpop.api.impl.Neo4jGraphAPIImpl");
+ neo4jIncludedForTesting = true;
+ } catch (Exception ex) {
+ neo4jIncludedForTesting = false;
+ }
+ assumeThat("Neo4j implementation was not included for testing - run with -DincludeNeo4j", neo4jIncludedForTesting, is(true));
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/e77b62b4/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 ac440ab..0959fbc 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
@@ -546,14 +546,4 @@ public class GremlinDriverIntegrateTest extends AbstractGremlinServerIntegration
cluster.close();
}
- private static void assumeNeo4jIsPresent() {
- boolean neo4jIncludedForTesting;
- try {
- Class.forName("org.neo4j.tinkerpop.api.impl.Neo4jGraphAPIImpl");
- neo4jIncludedForTesting = true;
- } catch (Exception ex) {
- neo4jIncludedForTesting = false;
- }
- assumeThat("Neo4j implementation was not included for testing - run with -DincludeNeo4j", neo4jIncludedForTesting, is(true));
- }
}
[4/7] incubator-tinkerpop git commit: Clean up imports.
Posted by sp...@apache.org.
Clean up imports.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/17368761
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/17368761
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/17368761
Branch: refs/heads/master
Commit: 17368761ad0288ff2e82e88240f7cbf7bc638ef1
Parents: b3afb85
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Jun 29 14:34:04 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Jun 29 14:34:04 2015 -0400
----------------------------------------------------------------------
.../gremlin/server/GremlinDriverIntegrateTest.java | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/17368761/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 2e1a02e..aa82382 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
@@ -54,9 +54,11 @@ import java.util.stream.Collectors;
import java.util.stream.IntStream;
import static org.hamcrest.CoreMatchers.instanceOf;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.*;
-import static org.junit.Assume.assumeThat;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
/**
* Integration tests for gremlin-driver configurations and settings.
@@ -110,7 +112,7 @@ public class GremlinDriverIntegrateTest extends AbstractGremlinServerIntegration
try {
results.all().join();
- fail();
+ fail("Should have thrown exception over bad serialization");
} catch (Exception ex) {
final Throwable inner = ExceptionUtils.getRootCause(ex);
assertTrue(inner instanceof RuntimeException);
[6/7] incubator-tinkerpop git commit: Merge branch 'TINKERPOP3-755'
of https://github.com/pluradj/incubator-tinkerpop
Posted by sp...@apache.org.
Merge branch 'TINKERPOP3-755' of https://github.com/pluradj/incubator-tinkerpop
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/b05151c0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/b05151c0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/b05151c0
Branch: refs/heads/master
Commit: b05151c001500afde6bb4af1f69761b4f4c11f7e
Parents: 28f97d5 9f18cd4
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Jun 29 14:54:32 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Jun 29 14:54:32 2015 -0400
----------------------------------------------------------------------
.../gremlin/server/handler/HttpGremlinEndpointHandler.java | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
[3/7] incubator-tinkerpop git commit: Add test for sessionless
execution over a transactional graph.
Posted by sp...@apache.org.
Add test for sessionless execution over a transactional graph.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/b3afb854
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/b3afb854
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/b3afb854
Branch: refs/heads/master
Commit: b3afb85436e5f411b4ae27baea1c2357d1b43f52
Parents: e77b62b
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Jun 29 14:32:24 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Jun 29 14:32:24 2015 -0400
----------------------------------------------------------------------
.../server/GremlinDriverIntegrateTest.java | 21 ++++++++++++++++++++
1 file changed, 21 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/b3afb854/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 0959fbc..2e1a02e 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
@@ -425,6 +425,27 @@ public class GremlinDriverIntegrateTest extends AbstractGremlinServerIntegration
}
@Test
+ public void shouldExecuteSessionlessScriptOnTransactionalGraph() throws Exception {
+ assumeNeo4jIsPresent();
+
+ final Cluster cluster = Cluster.build().create();
+ final Client client = cluster.connect();
+
+ final Vertex vertexRequest1 = client.submit("graph.addVertex(\"name\",\"stephen\")").all().get().get(0).getVertex();
+ assertEquals("stephen", vertexRequest1.values("name").next());
+
+ final Vertex vertexRequest2 = client.submit("graph.vertices().next()").all().get().get(0).getVertex();
+ assertEquals("stephen", vertexRequest2.values("name").next());
+
+ final Vertex vertexRequest3 = client.submit("graph.addVertex(\"name\",\"marko\")").all().get().get(0).getVertex();
+ assertEquals("marko", vertexRequest3.values("name").next());
+
+ assertEquals(2, client.submit("g.V().count()").all().get().get(0).getLong());
+
+ cluster.close();
+ }
+
+ @Test
public void shouldExecuteScriptInSessionWithBindingsSavedOnServerBetweenRequests() throws Exception {
final Cluster cluster = Cluster.build().create();
final Client client = cluster.connect(name.getMethodName());