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/03/20 12:10:47 UTC

incubator-tinkerpop git commit: Add test to validate empty when no meta property is present.

Repository: incubator-tinkerpop
Updated Branches:
  refs/heads/master 91788dee6 -> 50f298bb0


Add test to validate empty when no meta property is present.

Made neo4j pass the test.


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

Branch: refs/heads/master
Commit: 50f298bb0e1f2a239dc212e58c09311482f0516f
Parents: 91788de
Author: Stephen Mallette <sp...@apache.org>
Authored: Fri Mar 20 07:10:06 2015 -0400
Committer: Stephen Mallette <sp...@apache.org>
Committed: Fri Mar 20 07:10:06 2015 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                                          | 2 ++
 .../tinkerpop/gremlin/structure/VertexPropertyTest.java     | 9 +++++++++
 .../gremlin/neo4j/structure/Neo4jVertexProperty.java        | 2 +-
 3 files changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/50f298bb/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index e9ebd66..b084784 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -25,6 +25,8 @@ image::http://www.tinkerpop.com/docs/current/images/gremlin-hindu.png[width=225]
 TinkerPop 3.0.0.M8 (Release Date: NOT OFFICIALLY RELEASED YET)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+* Added test to enforce return of an empty `Property` on `VertexProperty.property(k)` if no meta properties exist.
+* Fixed bug in Neo4j where return of an empty meta property was returning a `NullPointerException`.
 * Refactored step API -- the TinkerPop3 steps are the foundation for any domain specific language (including graph).
 * `MapReduce` now has `workerStart(Stage)` and `workerEnd(Stage)` methods with analagous semantics to `VertexProgram`.
 * Hadoop-Gremlin `ObjectWritable` now leverages Kryo for data serialization.

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/50f298bb/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexPropertyTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexPropertyTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexPropertyTest.java
index 37a0ac7..719a174 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexPropertyTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexPropertyTest.java
@@ -488,6 +488,15 @@ public class VertexPropertyTest extends AbstractGremlinTest {
         @Test
         @FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY)
         @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_META_PROPERTIES)
+        public void shouldReturnEmptyIfNoMetaProperties() {
+            final Vertex v = graph.addVertex();
+            final VertexProperty<String> vp = v.property("name", "marko");
+            assertEquals(Property.empty(), vp.property("name"));
+        }
+
+        @Test
+        @FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY)
+        @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_META_PROPERTIES)
         @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_MULTI_PROPERTIES)
         @FeatureRequirement(featureClass = Graph.Features.VertexPropertyFeatures.class, feature = Graph.Features.VertexPropertyFeatures.FEATURE_INTEGER_VALUES)
         public void shouldSupportPropertiesOnMultiProperties() {

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/50f298bb/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jVertexProperty.java
----------------------------------------------------------------------
diff --git a/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jVertexProperty.java b/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jVertexProperty.java
index 95b6455..c665c0b 100644
--- a/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jVertexProperty.java
+++ b/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jVertexProperty.java
@@ -126,7 +126,7 @@ public class Neo4jVertexProperty<V> implements VertexProperty<V>, WrappedVertex<
 
         this.vertex.graph.tx().readWrite();
         try {
-            if (this.node.hasProperty(key))
+            if (isNode() && this.node.hasProperty(key))
                 return new Neo4jProperty<>(this, key, (U) this.node.getProperty(key));
             else
                 return Property.empty();