TINKERPOP-1857 Added more has() tests to the GLV suite.

Fixed some consistency problems in the java test itself.


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

Branch: refs/heads/TINKERPOP-1857
Commit: 3298bca7e5d57d60027fb2b195dfc7c9279e4b20
Parents: 1a245c6
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Dec 28 15:05:07 2017 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Feb 9 14:30:58 2018 -0500

----------------------------------------------------------------------
 gremlin-test/features/filter/Has.feature        | 315 ++++++++++++++++++-
 .../process/traversal/step/filter/HasTest.java  |  37 ++-
 2 files changed, 340 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3298bca7/gremlin-test/features/filter/Has.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/filter/Has.feature 
b/gremlin-test/features/filter/Has.feature
index bdede6d..f3ef5a0 100644
--- a/gremlin-test/features/filter/Has.feature
+++ b/gremlin-test/features/filter/Has.feature
@@ -17,6 +17,82 @@
 
 Feature: Step - has()
 
+  Scenario: g_V_outXcreatedX_hasXname__mapXlengthX_isXgtX3XXX_name
+    Given the modern graph
+    And using the parameter l1 defined as "c[it.get().length()]"
+    And the traversal of
+      """
+      g.V().out("created").has("name", __.map(l1).is(P.gt(3))).values("name")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | result |
+      | ripple |
+
+  Scenario: g_VX1X_hasXnameX
+    Given the modern graph
+    And using the parameter v1Id defined as "v[marko].id"
+    And the traversal of
+      """
+      g.V(v1Id).has("name")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | result |
+      | v[marko] |
+
+  Scenario: g_VX1X_hasXcircumferenceX
+    Given the modern graph
+    And using the parameter v1Id defined as "v[marko].id"
+    And the traversal of
+      """
+      g.V(v1Id).has("circumference")
+      """
+    When iterated to list
+    Then the result should be empty
+
+  Scenario: g_VX1X_hasXname_markoX
+    Given the modern graph
+    And using the parameter v1Id defined as "v[marko].id"
+    And the traversal of
+      """
+      g.V(v1Id).has("name", "marko")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | result |
+      | v[marko] |
+
+  Scenario: g_VX2X_hasXname_markoX
+    Given the modern graph
+    And using the parameter v1Id defined as "v[vadas].id"
+    And the traversal of
+      """
+      g.V(v1Id).has("name", "marko")
+      """
+    When iterated to list
+    Then the result should be empty
+
+  Scenario: g_V_hasXname_markoX
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().has("name", "marko")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | result |
+      | v[marko] |
+
+  Scenario: g_V_hasXname_blahX
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().has("name", "blah")
+      """
+    When iterated to list
+    Then the result should be empty
+
   Scenario: g_V_hasXage_gt_30X
     Given the modern graph
     And the traversal of
@@ -29,12 +105,247 @@ Feature: Step - has()
       | v[josh] |
       | v[peter] |
 
+  Scenario: g_V_hasXage_isXgt_30XX
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().has("age", __.is(P.gt(30)))
+      """
+    When iterated to list
+    Then the result should be unordered
+      | result |
+      | v[josh] |
+      | v[peter] |
+
+  Scenario: g_VX1X_hasXage_gt_30X
+    Given the modern graph
+    And using the parameter v1Id defined as "v[marko].id"
+    And the traversal of
+      """
+      g.V(v1Id).has("age", P.gt(30))
+      """
+    When iterated to list
+    Then the result should be empty
+
+  Scenario: g_VX2X_hasXage_gt_30X
+    Given the modern graph
+    And using the parameter v2Id defined as "v[josh].id"
+    And the traversal of
+      """
+      g.V(v2Id).has("age", P.gt(30))
+      """
+    When iterated to list
+    Then the result should be unordered
+      | result |
+      | v[josh] |
+
+  Scenario: g_VXv1X_hasXage_gt_30X
+    Given the modern graph
+    And using the parameter v1 defined as "v[marko]"
+    And the traversal of
+      """
+      g.V(v1).has("age", P.gt(30))
+      """
+    When iterated to list
+    Then the result should be empty
+
+  Scenario: g_VXv2X_hasXage_gt_30X
+    Given the modern graph
+    And using the parameter v2 defined as "v[josh]"
+    And the traversal of
+      """
+      g.V(v2).has("age", P.gt(30))
+      """
+    When iterated to list
+    Then the result should be unordered
+      | result |
+      | v[josh] |
+
+  Scenario: g_VX1X_out_hasIdX2X
+    Given the modern graph
+    And using the parameter v1Id defined as "v[marko].id"
+    And using the parameter v2Id defined as "v[vadas].id"
+    And the traversal of
+      """
+      g.V(v1Id).out().hasId(v2Id)
+      """
+    When iterated to list
+    Then the result should be unordered
+      | result |
+      | v[vadas] |
+
+  Scenario: g_VX1X_out_hasXid_2AsString_3AsStringX
+    Given the modern graph
+    And using the parameter v1Id defined as "v[marko].sid"
+    And using the parameter v2Id defined as "v[vadas].sid"
+    And using the parameter v3Id defined as "v[lop].sid"
+    And the traversal of
+      """
+      g.V(v1Id).out().hasId(v2Id, v3Id)
+      """
+    When iterated to list
+    Then the result should be unordered
+      | result |
+      | v[vadas] |
+      | v[lop] |
+
+  Scenario: g_V_hasXblahX
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().has("blah")
+      """
+    When iterated to list
+    Then the result should be empty
+
+  Scenario: g_EX7X_hasXlabelXknowsX
+    Given the modern graph
+    And using the parameter e7Id defined as "e[marko-knows->vadas].id"
+    And the traversal of
+      """
+      g.E(e7Id).hasLabel("knows")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | result |
+      | e[marko-knows->vadas] |
+
+  Scenario: g_E_hasXlabelXknowsX
+    Given the modern graph
+    And the traversal of
+      """
+      g.E().hasLabel("knows")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | result |
+      | e[marko-knows->vadas] |
+      | e[marko-knows->josh] |
+
+  Scenario: g_E_hasLabelXuses_traversesX
+    Given the crew graph
+    And the traversal of
+      """
+      g.E().hasLabel("uses", "traverses")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | result |
+      | e[marko-uses->gremlin] |
+      | e[marko-uses->tinkergraph] |
+      | e[stephen-uses->gremlin] |
+      | e[stephen-uses->tinkergraph] |
+      | e[daniel-uses->gremlin] |
+      | e[daniel-uses->tinkergraph] |
+      | e[matthias-uses->gremlin] |
+      | e[matthias-uses->tinkergraph] |
+      | e[gremlin-traverses->tinkergraph] |
+
+  Scenario: g_V_hasLabelXperson_software_blahX
+    Given the modern graph
+    And the traversal of
+    """
+    g.V().hasLabel("person","software", "blah")
+    """
+    When iterated to list
+    Then the result should be unordered
+      | result |
+      | v[marko] |
+      | v[vadas] |
+      | v[josh] |
+      | v[peter] |
+      | v[lop] |
+      | v[ripple] |
+
+  Scenario: g_V_hasXperson_name_markoX_age
+    Given the modern graph
+    And the traversal of
+    """
+    g.V().has("person", "name", "marko").values("age")
+    """
+    When iterated to list
+    Then the result should be unordered
+      | result |
+      | d[29].i |
+
+  Scenario: g_VX1X_outE_hasXweight_inside_0_06X_inV
+    Given the modern graph
+    And using the parameter v1Id defined as "v[marko].id"
+    And using the parameter lower defined as "d[0.0].d"
+    And using the parameter upper defined as "d[0.6].d"
+    And the traversal of
+    """
+    g.V(v1Id).outE().has("weight", P.inside(lower, upper)).inV()
+    """
+    When iterated to list
+    Then the result should be unordered
+      | result |
+      | v[vadas] |
+      | v[lop] |
+
+  Scenario: g_EX11X_outV_outE_hasXid_10X
+    Given the modern graph
+    And using the parameter e11Id defined as "e[josh-created->lop].id"
+    And using the parameter e10Id defined as "e[josh-created->ripple].id"
+    And the traversal of
+    """
+    g.E(e11Id).outV().outE().has(T.id, e10Id)
+    """
+    When iterated to list
+    Then the result should be unordered
+      | result |
+      | e[josh-created->ripple] |
+
+  Scenario: g_EX11X_outV_outE_hasXid_10AsStringX
+    Given the modern graph
+    And using the parameter e11Id defined as "e[josh-created->lop].sid"
+    And using the parameter e10Id defined as "e[josh-created->ripple].sid"
+    And the traversal of
+    """
+    g.E(e11Id).outV().outE().has(T.id, e10Id)
+    """
+    When iterated to list
+    Then the result should be unordered
+      | result |
+      | e[josh-created->ripple] |
+
+  Scenario: g_V_hasXlocationX
+    Given the crew graph
+    And the traversal of
+    """
+    g.V().has("location")
+    """
+    When iterated to list
+    Then the result should be unordered
+      | result |
+      | v[marko] |
+      | v[matthias] |
+      | v[stephen] |
+      | v[daniel] |
+
+  Scenario: 
g_V_hasLabelXpersonX_hasXage_notXlteX10X_andXnotXbetweenX11_20XXXX_andXltX29X_orXeqX35XXXX_name
+    Given the modern graph
+    And using the parameter d10 defined as "d[10].i"
+    And using the parameter d11 defined as "d[11].i"
+    And using the parameter d20 defined as "d[20].i"
+    And using the parameter d29 defined as "d[29].i"
+    And using the parameter d35 defined as "d[35].i"
+    And the traversal of
+    """
+    g.V().hasLabel("person").has("age", 
P.not(P.lte(d10).and(P.not(P.between(d11, 
d20)))).and(P.lt(d29).or(P.eq(d35)))).values("name")
+    """
+    When iterated to list
+    Then the result should be unordered
+      | result |
+      | vadas |
+      | peter |
+
   Scenario: g_V_in_hasIdXneqX1XX
     Given the modern graph
-    And using the parameter v1 defined as "v[marko].id"
+    And using the parameter v1Id defined as "v[marko].id"
     And the traversal of
     """
-    g.V().in().hasId(P.neq(v1))
+    g.V().in().hasId(P.neq(v1Id))
     """
     When iterated to list
     Then the result should be unordered

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3298bca7/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/HasTest.java
----------------------------------------------------------------------
diff --git 
a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/HasTest.java
 
b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/HasTest.java
index a5f4a62..9071d7e 100644
--- 
a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/HasTest.java
+++ 
b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/HasTest.java
@@ -135,13 +135,17 @@ public abstract class HasTest extends 
AbstractGremlinProcessTest {
 
     @Test
     @LoadGraphWith(MODERN)
-    public void g_VX1X_hasXkeyX() {
-        Traversal<Vertex, Vertex> traversal = 
get_g_VX1X_hasXkeyX(convertToVertexId("marko"), "name");
+    public void g_VX1X_hasXnameX() {
+        final Traversal<Vertex, Vertex> traversal = 
get_g_VX1X_hasXkeyX(convertToVertexId("marko"), "name");
         printTraversalForm(traversal);
         assertEquals("marko", traversal.next().<String>value("name"));
         assertFalse(traversal.hasNext());
-        //
-        traversal = get_g_VX1X_hasXkeyX(convertToVertexId("marko"), 
"circumference");
+    }
+
+    @Test
+    @LoadGraphWith(MODERN)
+    public void g_VX1X_hasXcircumferenceX() {
+        final Traversal<Vertex, Vertex> traversal = 
get_g_VX1X_hasXkeyX(convertToVertexId("marko"), "circumference");
         printTraversalForm(traversal);
         assertFalse(traversal.hasNext());
     }
@@ -149,11 +153,16 @@ public abstract class HasTest extends 
AbstractGremlinProcessTest {
     @Test
     @LoadGraphWith(MODERN)
     public void g_VX1X_hasXname_markoX() {
-        Traversal<Vertex, Vertex> traversal = 
get_g_VX1X_hasXname_markoX(convertToVertexId("marko"));
+        final Traversal<Vertex, Vertex> traversal = 
get_g_VX1X_hasXname_markoX(convertToVertexId("marko"));
         printTraversalForm(traversal);
         assertEquals("marko", traversal.next().<String>value("name"));
         assertFalse(traversal.hasNext());
-        traversal = get_g_VX1X_hasXname_markoX(convertToVertexId("vadas"));
+    }
+
+    @Test
+    @LoadGraphWith(MODERN)
+    public void g_VX2X_hasXname_markoX() {
+        final Traversal<Vertex, Vertex> traversal = 
get_g_VX1X_hasXname_markoX(convertToVertexId("vadas"));
         printTraversalForm(traversal);
         assertFalse(traversal.hasNext());
     }
@@ -205,6 +214,11 @@ public abstract class HasTest extends 
AbstractGremlinProcessTest {
         final Traversal<Vertex, Vertex> traversalMarko = 
get_g_VX1X_hasXage_gt_30X(convertToVertexId("marko"));
         printTraversalForm(traversalMarko);
         assertFalse(traversalMarko.hasNext());
+    }
+
+    @Test
+    @LoadGraphWith(MODERN)
+    public void g_VX2X_hasXage_gt_30X() {
         final Traversal<Vertex, Vertex> traversalJosh = 
get_g_VX1X_hasXage_gt_30X(convertToVertexId("josh"));
         printTraversalForm(traversalJosh);
         assertTrue(traversalJosh.hasNext());
@@ -216,6 +230,11 @@ public abstract class HasTest extends 
AbstractGremlinProcessTest {
         final Traversal<Vertex, Vertex> traversalMarko = 
get_g_VXv1X_hasXage_gt_30X(convertToVertexId("marko"));
         printTraversalForm(traversalMarko);
         assertFalse(traversalMarko.hasNext());
+    }
+
+    @Test
+    @LoadGraphWith(MODERN)
+    public void g_VXv2X_hasXage_gt_30X() {
         final Traversal<Vertex, Vertex> traversalJosh = 
get_g_VXv1X_hasXage_gt_30X(convertToVertexId("josh"));
         printTraversalForm(traversalJosh);
         assertTrue(traversalJosh.hasNext());
@@ -283,7 +302,6 @@ public abstract class HasTest extends 
AbstractGremlinProcessTest {
     @Test
     @LoadGraphWith(MODERN)
     public void g_V_hasXblahX() {
-        //assumeTrue(graphMeetsTestRequirements());
         final Traversal<Vertex, Vertex> traversal = get_g_V_hasXblahX();
         printTraversalForm(traversal);
         assertFalse(traversal.hasNext());
@@ -293,7 +311,6 @@ public abstract class HasTest extends 
AbstractGremlinProcessTest {
     @Test
     @LoadGraphWith(MODERN)
     public void g_EX7X_hasXlabelXknowsX() {
-        //System.out.println(convertToEdgeId("marko", "knows", "vadas"));
         final Traversal<Edge, Edge> traversal = 
get_g_EX7X_hasLabelXknowsX(convertToEdgeId("marko", "knows", "vadas"));
         printTraversalForm(traversal);
         int counter = 0;
@@ -532,8 +549,8 @@ public abstract class HasTest extends 
AbstractGremlinProcessTest {
 
     public static class Traversals extends HasTest {
         @Override
-        public Traversal<Edge, Edge> get_g_EX11X_outV_outE_hasXid_10X(final 
Object e11Id, final Object e8Id) {
-            return g.E(e11Id).outV().outE().has(T.id, e8Id);
+        public Traversal<Edge, Edge> get_g_EX11X_outV_outE_hasXid_10X(final 
Object e11Id, final Object e10Id) {
+            return g.E(e11Id).outV().outE().has(T.id, e10Id);
         }
 
         @Override

Reply via email to