tinkerpop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From spmalle...@apache.org
Subject [19/49] tinkerpop git commit: TINKERPOP-786 Improved TraversalSource for testing purposes
Date Fri, 26 May 2017 12:55:29 GMT
TINKERPOP-786 Improved TraversalSource for testing purposes


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

Branch: refs/heads/TINKERPOP-1618
Commit: e661359a9a760bb398b590c9c1bffa8268463f78
Parents: b47b25c
Author: Stephen Mallette <spmva@genoprime.com>
Authored: Tue May 9 13:52:42 2017 -0400
Committer: Stephen Mallette <spmva@genoprime.com>
Committed: Tue May 16 11:01:51 2017 -0400

----------------------------------------------------------------------
 .../dsl/SocialPackageTraversalSourceDsl.java         | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e661359a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/SocialPackageTraversalSourceDsl.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/SocialPackageTraversalSourceDsl.java
b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/SocialPackageTraversalSourceDsl.java
index 143a5c9..64859eb 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/SocialPackageTraversalSourceDsl.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/SocialPackageTraversalSourceDsl.java
@@ -44,11 +44,16 @@ public class SocialPackageTraversalSourceDsl extends GraphTraversalSource
{
         super(graph);
     }
 
-    public GraphTraversal<Vertex, Vertex> persons() {
-        final GraphTraversalSource clone = this.clone();
+    public GraphTraversal<Vertex, Vertex> persons(String... names) {
+        GraphTraversalSource clone = this.clone();
+
         clone.getBytecode().addStep(GraphTraversal.Symbols.V);
-        clone.getBytecode().addStep(GraphTraversal.Symbols.hasLabel, "person");
-        final GraphTraversal.Admin<Vertex, Vertex> traversal = new DefaultGraphTraversal<>(clone);
-        return TraversalHelper.addHasContainer(traversal.addStep(new GraphStep<>(traversal,
Vertex.class, true)), new HasContainer(T.label.getAccessor(), P.eq("person")));
+        GraphTraversal<Vertex, Vertex> traversal = new DefaultGraphTraversal<>(clone);
+        traversal.asAdmin().addStep(new GraphStep<>(traversal.asAdmin(), Vertex.class,
true));
+
+        traversal = traversal.hasLabel("person");
+        if (names.length > 0) traversal = traversal.has("name", P.within(names));
+
+        return traversal;
     }
 }


Mime
View raw message