tinkerpop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rd...@apache.org
Subject [34/50] tinkerpop git commit: added repeat simple path test
Date Sun, 03 Sep 2017 00:43:09 GMT
added repeat simple path test


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

Branch: refs/heads/TINKERPOP-1692
Commit: bc588cdcb096e81e179c21f8885f51e659fe3a62
Parents: eb57077
Author: Xian Teng <xian.teng@datastax.com>
Authored: Tue Aug 22 10:43:09 2017 -0500
Committer: Marko A. Rodriguez <okrammarko@gmail.com>
Committed: Mon Aug 28 17:28:58 2017 -0600

----------------------------------------------------------------------
 .../step/branch/GroovyRepeatTest.groovy         |  5 ++++
 .../traversal/step/branch/RepeatTest.java       | 27 ++++++++++++++++++--
 2 files changed, 30 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bc588cdc/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/branch/GroovyRepeatTest.groovy
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/branch/GroovyRepeatTest.groovy
b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/branch/GroovyRepeatTest.groovy
index b45c191..897d04c 100644
--- a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/branch/GroovyRepeatTest.groovy
+++ b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/branch/GroovyRepeatTest.groovy
@@ -97,5 +97,10 @@ public abstract class GroovyRepeatTest {
         public Traversal<Vertex, Map<String, Long>> get_g_V_repeatXbothX_untilXname_eq_marko_or_loops_gt_1X_groupCount_byXnameX()
{
             new ScriptTraversal<>(g, "gremlin-groovy", "g.V.repeat(both()).until{it.get().value('name').equals('lop')
|| it.loops() > 1}.groupCount.by('name')")
         }
+
+        @Override
+        public Traversal<Vertex, Path> get_g_V_hasXname_markoX_repeatXoutE_inV_simplePathX_untilXhasXname_rippleXX_path_byXnameX_byXlabelX()
{
+            new ScriptTraversal<>(g, "gremlin-groovy", "g.V().has('name', 'marko').repeat(outE().inV().simplePath()).until(has('name',
'ripple')).limit(1).path().by(values('name')).by(T.label)")
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bc588cdc/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/RepeatTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/RepeatTest.java
b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/RepeatTest.java
index 90d7d07..4be3389 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/RepeatTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/RepeatTest.java
@@ -43,6 +43,7 @@ import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.in;
 import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.loops;
 import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.out;
 import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.outE;
+import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.values;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
@@ -89,6 +90,8 @@ public abstract class RepeatTest extends AbstractGremlinProcessTest {
 
     public abstract Traversal<Vertex, Map<String, Long>> get_g_V_repeatXbothX_untilXname_eq_marko_or_loops_gt_1X_groupCount_byXnameX();
 
+    public abstract Traversal<Vertex, Path> get_g_V_hasXname_markoX_repeatXoutE_inV_simplePathX_untilXhasXname_rippleXX_path_byXnameX_byXlabelX();
+
     @Test
     @LoadGraphWith(MODERN)
     public void g_V_repeatXoutX_timesX2X_emit_path() {
@@ -276,6 +279,21 @@ public abstract class RepeatTest extends AbstractGremlinProcessTest {
         assertEquals(4L, map.get("marko").longValue());
     }
 
+    @Test
+    @LoadGraphWith(MODERN)
+    public void g_VXX_hasXname_markoX_repeatXoutEXX_inVXX_simplePathXXX_untilXhasXname_rippleXX_limitX1X_pathXX_byXvaluesXnameXX_byXT_labelX()
{
+        final Traversal<Vertex, Path> traversal = get_g_V_hasXname_markoX_repeatXoutE_inV_simplePathX_untilXhasXname_rippleXX_path_byXnameX_byXlabelX();
+        printTraversalForm(traversal);
+        final Path path = traversal.next();
+        assertFalse(traversal.hasNext());
+        assertEquals(5, path.size());
+        assertEquals("marko", path.get(0));
+        assertEquals("knows", path.get(1));
+        assertEquals("josh", path.get(2));
+        assertEquals("created", path.get(3));
+        assertEquals("ripple", path.get(4));
+    }
+
     public static class Traversals extends RepeatTest {
 
         @Override
@@ -342,5 +360,10 @@ public abstract class RepeatTest extends AbstractGremlinProcessTest {
         public Traversal<Vertex, Map<String, Long>> get_g_V_repeatXbothX_untilXname_eq_marko_or_loops_gt_1X_groupCount_byXnameX()
{
             return g.V().repeat(both()).until(t -> t.get().value("name").equals("lop")
|| t.loops() > 1).<String>groupCount().by("name");
         }
-    }
-}
\ No newline at end of file
+
+        @Override
+        public Traversal<Vertex, Path> get_g_V_hasXname_markoX_repeatXoutE_inV_simplePathX_untilXhasXname_rippleXX_path_byXnameX_byXlabelX()
{
+            return g.V().has("name", "marko").repeat(outE().inV().simplePath()).until(has("name",
"ripple")).path().by(values("name")).by(T.label);
+        }
+   }
+}


Mime
View raw message