You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2015/04/15 19:47:28 UTC

[06/50] incubator-tinkerpop git commit: Add tests for g.V/E where string values of the id are present as a filter.

Add tests for g.V/E where string values of the id are present as a filter.


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

Branch: refs/heads/variables
Commit: 0c16dc8650f7f0f149c4c2c5b315bd2b481f8073
Parents: f273a56
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Apr 13 16:22:36 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Apr 13 16:22:36 2015 -0400

----------------------------------------------------------------------
 .../gremlin/process/traversal/step/util/HasContainer.java     | 4 +++-
 .../tinkerpop/gremlin/structure/util/ElementHelper.java       | 7 +++++--
 .../process/traversal/step/map/GroovyVertexTest.groovy        | 4 ++--
 3 files changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/0c16dc86/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/HasContainer.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/HasContainer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/HasContainer.java
index cc98041..c69e90b 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/HasContainer.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/HasContainer.java
@@ -62,8 +62,10 @@ public final class HasContainer implements Serializable {
 
     public boolean test(final Element element) {
         if (null != this.value) {
+            // it is OK to evaluate equality of ids via toString() now given that the toString() the test suite
+            // enforces the value of id.()toString() to be a first class representation of the identifier
             if (this.key.equals(T.id.getAccessor()))
-                return this.predicate.test(element.id(), this.value);
+                return this.predicate.test(element.id().toString(), this.value.toString());
             else if (this.key.equals(T.label.getAccessor()))
                 return this.predicate.test(element.label(), this.value);
             else if (element instanceof VertexProperty && this.key.equals(T.value.getAccessor()))

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/0c16dc86/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/ElementHelper.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/ElementHelper.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/ElementHelper.java
index 94d4a5b..e6a39a6 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/ElementHelper.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/ElementHelper.java
@@ -503,10 +503,13 @@ public final class ElementHelper {
 
     public static boolean idExists(final Object id, final Object... providedIds) {
         if (0 == providedIds.length) return true;
-        if (1 == providedIds.length) return id.equals(providedIds[0]);
+
+        // it is OK to evaluate equality of ids via toString() now given that the toString() the test suite
+        // enforces the value of id.()toString() to be a first class representation of the identifier
+        if (1 == providedIds.length) return id.toString().equals(providedIds[0].toString());
         else {
             for (final Object temp : providedIds) {
-                if (temp.equals(id))
+                if (temp.toString().equals(id.toString()))
                     return true;
             }
             return false;

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/0c16dc86/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyVertexTest.groovy
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyVertexTest.groovy b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyVertexTest.groovy
index 4edb264..bb3506c 100644
--- a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyVertexTest.groovy
+++ b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyVertexTest.groovy
@@ -62,7 +62,7 @@ public abstract class GroovyVertexTest {
         }
 
         @Override
-        public Traversal<Edge, Edge> get_g_EX11X(Object e11Id) {
+        public Traversal<Edge, Edge> get_g_EX11X(final Object e11Id) {
             g.E(e11Id);
         }
 
@@ -196,7 +196,7 @@ public abstract class GroovyVertexTest {
         }
 
         @Override
-        public Traversal<Edge, Edge> get_g_EX11X(Object e11Id) {
+        public Traversal<Edge, Edge> get_g_EX11X(final Object e11Id) {
             ComputerTestHelper.compute("g.E($e11Id)", g)
         }