tinkerpop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From spmalle...@apache.org
Subject [5/7] tinkerpop git commit: TINKERPOP-786 Improved TraversalSource for testing purposes
Date Tue, 09 May 2017 17:58:43 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/cf3e8ad1
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/cf3e8ad1
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/cf3e8ad1

Branch: refs/heads/TINKERPOP-786
Commit: cf3e8ad1bf1a1acdf19afd11752eae61123f7bd5
Parents: b8f47fa
Author: Stephen Mallette <spmva@genoprime.com>
Authored: Tue May 9 13:52:42 2017 -0400
Committer: Stephen Mallette <spmva@genoprime.com>
Committed: Tue May 9 13:52:42 2017 -0400

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


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/cf3e8ad1/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