You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by ok...@apache.org on 2016/12/09 22:08:54 UTC

tinkerpop git commit: done for the weekend. added back the 10000 public static void main() test just to validate thread safety as we tweak things up.

Repository: tinkerpop
Updated Branches:
  refs/heads/TINKERPOP-1564 1a78a30da -> d651d38f0


done for the weekend. added back the 10000 public static void main() test just to validate thread safety as we tweak things up.


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

Branch: refs/heads/TINKERPOP-1564
Commit: d651d38f00b19963225102176ce31e7d06bf6852
Parents: 1a78a30
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Fri Dec 9 15:08:49 2016 -0700
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Fri Dec 9 15:08:49 2016 -0700

----------------------------------------------------------------------
 .../process/akka/TinkerActorSystem.java         | 50 +++++++++++++++++++-
 1 file changed, 48 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d651d38f/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/akka/TinkerActorSystem.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/akka/TinkerActorSystem.java b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/akka/TinkerActorSystem.java
index 7d7de19..3eeae71 100644
--- a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/akka/TinkerActorSystem.java
+++ b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/akka/TinkerActorSystem.java
@@ -21,19 +21,31 @@ package org.apache.tinkerpop.gremlin.tinkergraph.process.akka;
 
 import akka.actor.ActorSystem;
 import akka.actor.Props;
+
+import org.apache.tinkerpop.gremlin.process.traversal.Order;
+import org.apache.tinkerpop.gremlin.process.traversal.P;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.traverser.util.TraverserSet;
+import org.apache.tinkerpop.gremlin.structure.Column;
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.Partitioner;
 import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoIo;
 import org.apache.tinkerpop.gremlin.structure.util.HashPartitioner;
 import org.apache.tinkerpop.gremlin.tinkergraph.process.akka.traversal.PartitionerStrategy;
 import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
+import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
+import org.javatuples.Pair;
 
+import java.util.Arrays;
+import java.util.List;
 import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.Future;
 
+import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.as;
+import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.both;
+import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.out;
+
 /**
  * @author Marko A. Rodriguez (http://markorodriguez.com)
  */
@@ -60,10 +72,44 @@ public final class TinkerActorSystem<S, E> {
     //////////////
 
     public static void main(String args[]) throws Exception {
-        final Graph graph = TinkerGraph.open();
+        /*final Graph graph = TinkerGraph.open();
         graph.io(GryoIo.build()).readGraph("data/tinkerpop-modern.kryo");
         GraphTraversalSource g = graph.traversal().withStrategies(new PartitionerStrategy(new HashPartitioner(graph.partitioner(), 3)));
-        System.out.println(g.V().out().values("name").toList());
+        System.out.println(g.V().out().values("name").toList());*/
+
+        for (int i = 0; i < 10000; i++) {
+            final Graph graph = TinkerGraph.open();
+            graph.io(GryoIo.build()).readGraph("data/tinkerpop-modern.kryo");
+            final GraphTraversalSource g = graph.traversal().withComputer();
+            final List<Pair<Integer, Traversal.Admin<?, ?>>> traversals = Arrays.asList(
+                    // match() works
+                    Pair.with(6, g.V().match(
+                            as("a").out("created").as("b"),
+                            as("b").in("created").as("c"),
+                            as("b").has("name", P.eq("lop"))).where("a", P.neq("c")).select("a", "b", "c").by("name").asAdmin()),
+                    // side-effects work
+                    Pair.with(3, g.V().repeat(both()).times(2).
+                            groupCount("a").by("name").
+                            cap("a").unfold().order().by(Column.values, Order.decr).limit(3).asAdmin()),
+                    // barriers work and beyond the local star graph works
+                    Pair.with(1, g.V().repeat(both()).times(2).hasLabel("person").
+                            group().
+                            by("name").
+                            by(out("created").values("name").dedup().fold()).asAdmin()),
+                    // no results works
+                    Pair.with(0, g.V().out("blah").asAdmin())
+            );
+            for (final Pair<Integer,Traversal.Admin<?, ?>> pair : traversals) {
+                final Integer count = pair.getValue0();
+                final Traversal.Admin<?,?> traversal = pair.getValue1();
+                System.out.println("EXECUTING: " + traversal.getBytecode());
+                final TinkerActorSystem<?,?> actors = new TinkerActorSystem<>(traversal.clone(),new HashPartitioner(graph.partitioner(), 3));
+                System.out.println(IteratorUtils.asList(actors.getResults().get()));
+                if(IteratorUtils.count(actors.getResults().get()) != count)
+                    throw new IllegalStateException();
+                System.out.println("//////////////////////////////////\n");
+            }
+        }
     }