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/07/31 18:58:55 UTC
incubator-tinkerpop git commit: Add a session test for ensuring
results return in order.
Repository: incubator-tinkerpop
Updated Branches:
refs/heads/tp30 7e4c80ddb -> 53113298e
Add a session test for ensuring results return in order.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/53113298
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/53113298
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/53113298
Branch: refs/heads/tp30
Commit: 53113298e1802fd4d14b5fb13e101d81b18fa38d
Parents: 7e4c80d
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Jul 31 12:58:34 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Jul 31 12:58:34 2015 -0400
----------------------------------------------------------------------
.../server/GremlinDriverIntegrateTest.java | 27 ++++++++++++++++++++
1 file changed, 27 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/53113298/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 c31337c..407436c 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
@@ -47,6 +47,7 @@ import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
@@ -145,6 +146,32 @@ public class GremlinDriverIntegrateTest extends AbstractGremlinServerIntegration
}
@Test
+ public void shouldProcessSessionRequestsInOrder() throws Exception {
+ final Cluster cluster = Cluster.open();
+ final Client client = cluster.connect(name.getMethodName());
+
+ final ResultSet rsFive = client.submit("Thread.sleep(5000);'five'");
+ final ResultSet rsZero = client.submit("'zero'");
+
+ final CompletableFuture<List<Result>> futureFive = rsFive.all();
+ final CompletableFuture<List<Result>> futureZero = rsZero.all();
+
+ final AtomicBoolean hit = new AtomicBoolean(false);
+ while (!futureFive.isDone()) {
+ // futureZero can't finish before futureFive - racy business here?
+ assertThat(futureZero.isDone(), is(false));
+ hit.set(true);
+ }
+
+ // should have entered the loop at least once and thus proven that futureZero didn't return ahead of
+ // futureFive
+ assertThat(hit.get(), is(true));
+
+ assertEquals("zero", futureZero.get().get(0).getString());
+ assertEquals("five", futureFive.get(10, TimeUnit.SECONDS).get(0).getString());
+ }
+
+ @Test
public void shouldWaitForAllResultsToArrive() throws Exception {
final Cluster cluster = Cluster.open();
final Client client = cluster.connect();