tinkerpop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ok...@apache.org
Subject [01/10] tinkerpop git commit: Fixed a bug where ReferenceVertex was not returning label() (only EMPTY_STRING). ReferenceEdge and ReferenceVertexProperty were behaving correctly, but I needed to make a change at ReferenceElement for general handling. Thus
Date Thu, 28 Sep 2017 20:09:01 GMT
Repository: tinkerpop
Updated Branches:
  refs/heads/master bccdb4cb0 -> fd3a3e483


Fixed a bug where ReferenceVertex was not returning label() (only EMPTY_STRING). ReferenceEdge
and ReferenceVertexProperty were behaving correctly, but I needed to make a change at ReferenceElement
for general handling. Thus, those other two classes changed. And thus, the Gryo. I updated
all the ReferenceXXXTest classes to check for label() to be certain of proper data handling.
Updated CHANGELOG and upgrade docs.


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

Branch: refs/heads/master
Commit: d6cb13e8fb1ff37b354d31cdc96aa5a765538e02
Parents: 98ed3d4
Author: Marko A. Rodriguez <okrammarko@gmail.com>
Authored: Thu Sep 21 13:23:15 2017 -0600
Committer: Marko A. Rodriguez <okrammarko@gmail.com>
Committed: Thu Sep 21 13:23:15 2017 -0600

----------------------------------------------------------------------
 CHANGELOG.asciidoc                                     |  1 +
 docs/src/upgrade/release-3.2.x-incubating.asciidoc     | 13 +++++++++++++
 .../structure/util/reference/ReferenceEdge.java        |  7 -------
 .../structure/util/reference/ReferenceElement.java     |  6 +++---
 .../util/reference/ReferenceVertexProperty.java        |  9 +--------
 .../structure/util/reference/ReferenceEdgeTest.java    |  6 +++++-
 .../util/reference/ReferenceVertexPropertyTest.java    |  8 +++++++-
 .../structure/util/reference/ReferenceVertexTest.java  |  1 +
 8 files changed, 31 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d6cb13e8/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index ecfd078..795a3b0 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,6 +26,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 TinkerPop 3.2.7 (Release Date: NOT OFFICIALLY RELEASED YET)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+* `ReferenceVertex` was missing its `label()` string. `ReferenceElement` now supports all
label handling.
 * Added `GraphHelper.cloneElements(Graph original, Graph clone)` to the `gremlin-test` module
to quickly clone a graph.
 * Bump to GMavenPlus 1.6.
 * Added better error message for illegal use of `repeat()`-step.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d6cb13e8/docs/src/upgrade/release-3.2.x-incubating.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/upgrade/release-3.2.x-incubating.asciidoc b/docs/src/upgrade/release-3.2.x-incubating.asciidoc
index 71d1930..5f9043b 100644
--- a/docs/src/upgrade/release-3.2.x-incubating.asciidoc
+++ b/docs/src/upgrade/release-3.2.x-incubating.asciidoc
@@ -95,6 +95,19 @@ In `gremlin-test` there is a new `GraphHelper` class that has a `cloneElements()
 the first graph to the second - `GraphHelper.cloneElements(Graph original, Graph clone)`.
This helper method is
 primarily intended for use in tests.
 
+Upgrading for Providers
+~~~~~~~~~~~~~~~~~~~~~~~
+
+ReferenceVertex Label
+^^^^^^^^^^^^^^^^^^^^^
+
+`ReferenceVertex.label()` was hard coded to return `EMPTY_STRING`. At some point, `ReferenceElements`
were support to
+return labels and `ReferenceVertex` was never updated as such. Note that `ReferenceEdge`
and `ReferenceVertexProperty`
+work as expected. However, given a general change at `ReferenceElement`, the Gryo serialization
of `ReferenceXXX` is
+different.
+
+See: https://issues.apache.org/jira/browse/TINKERPOP-1789[TINKERPOP-1789]
+
 TinkerPop 3.2.6
 ---------------
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d6cb13e8/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceEdge.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceEdge.java
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceEdge.java
index 51711c9..a353ea7 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceEdge.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceEdge.java
@@ -36,7 +36,6 @@ public class ReferenceEdge extends ReferenceElement<Edge> implements
Edge {
 
     private ReferenceVertex inVertex;
     private ReferenceVertex outVertex;
-    private String label;
 
     private ReferenceEdge() {
 
@@ -46,7 +45,6 @@ public class ReferenceEdge extends ReferenceElement<Edge> implements
Edge {
         super(edge);
         this.inVertex = new ReferenceVertex(edge.inVertex());
         this.outVertex = new ReferenceVertex(edge.outVertex());
-        this.label = edge.label();
     }
 
     @Override
@@ -88,9 +86,4 @@ public class ReferenceEdge extends ReferenceElement<Edge> implements
Edge {
     public String toString() {
         return StringFactory.edgeString(this);
     }
-
-    @Override
-    public String label() {
-        return this.label;
-    }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d6cb13e8/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceElement.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceElement.java
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceElement.java
index dfdf5a9..14e5ab3 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceElement.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceElement.java
@@ -31,9 +31,8 @@ import java.io.Serializable;
  */
 public abstract class ReferenceElement<E extends Element> implements Element, Serializable,
Attachable<E> {
 
-    protected static final String EMPTY_STRING = "";
-
     protected Object id;
+    protected String label;
 
     protected ReferenceElement() {
 
@@ -41,6 +40,7 @@ public abstract class ReferenceElement<E extends Element> implements
Element, Se
 
     public ReferenceElement(final Element element) {
         this.id = element.id();
+        this.label = element.label();
     }
 
     @Override
@@ -50,7 +50,7 @@ public abstract class ReferenceElement<E extends Element> implements
Element, Se
 
     @Override
     public String label() {
-        return EMPTY_STRING;
+        return this.label;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d6cb13e8/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceVertexProperty.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceVertexProperty.java
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceVertexProperty.java
index 93b4c48..e607ebb 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceVertexProperty.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceVertexProperty.java
@@ -34,7 +34,6 @@ import java.util.NoSuchElementException;
 public class ReferenceVertexProperty<V> extends ReferenceElement<VertexProperty<V>>
implements VertexProperty<V> {
 
     private ReferenceVertex vertex;
-    private String key;
     private V value;
 
     private ReferenceVertexProperty() {
@@ -44,7 +43,6 @@ public class ReferenceVertexProperty<V> extends ReferenceElement<VertexProperty<
     public ReferenceVertexProperty(final VertexProperty<V> vertexProperty) {
         super(vertexProperty);
         this.vertex = ReferenceFactory.detach(vertexProperty.element());
-        this.key = vertexProperty.key();
         this.value = vertexProperty.value();
     }
 
@@ -55,12 +53,7 @@ public class ReferenceVertexProperty<V> extends ReferenceElement<VertexProperty<
 
     @Override
     public String key() {
-        return this.key;
-    }
-
-    @Override
-    public String label() {
-        return this.key;
+        return this.label();
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d6cb13e8/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceEdgeTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceEdgeTest.java
b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceEdgeTest.java
index a0d3a3d..3602223 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceEdgeTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceEdgeTest.java
@@ -34,7 +34,10 @@ import org.junit.Test;
 import java.util.HashSet;
 import java.util.Set;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
 
 /**
  * @author Marko A. Rodriguez (http://markorodriguez.com)
@@ -60,6 +63,7 @@ public class ReferenceEdgeTest extends AbstractGremlinTest {
         final Vertex v = graph.addVertex();
         final Edge e = v.addEdge("test", v);
         final ReferenceEdge re = ReferenceFactory.detach(e);
+        assertEquals("test", e.label());
         assertSame(re, ReferenceFactory.detach(re));
     }
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d6cb13e8/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceVertexPropertyTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceVertexPropertyTest.java
b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceVertexPropertyTest.java
index 1920e67..15980da 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceVertexPropertyTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceVertexPropertyTest.java
@@ -25,7 +25,10 @@ import org.apache.tinkerpop.gremlin.structure.VertexProperty;
 import org.apache.tinkerpop.gremlin.structure.util.Attachable;
 import org.junit.Test;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
 
 /**
  * @author Marko A. Rodriguez (http://markorodriguez.com)
@@ -38,6 +41,9 @@ public class ReferenceVertexPropertyTest extends AbstractGremlinTest {
         final Vertex v = graph.addVertex();
         final VertexProperty vp = v.property(VertexProperty.Cardinality.single, "test", "this");
         final ReferenceVertexProperty dvp = ReferenceFactory.detach(vp);
+        assertEquals("test", vp.label());
+        assertEquals("test", vp.key());
+        assertEquals("this", vp.value());
         assertSame(dvp, ReferenceFactory.detach(dvp));
     }
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d6cb13e8/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceVertexTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceVertexTest.java
b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceVertexTest.java
index 35c31c6..e342e1e 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceVertexTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceVertexTest.java
@@ -74,6 +74,7 @@ public class ReferenceVertexTest extends AbstractGremlinTest {
         final ReferenceVertex referenceVertex = ReferenceFactory.detach(v);
 
         assertEquals(v.id(), referenceVertex.id());
+        assertEquals("test", v.label());
         assertEquals(0, IteratorUtils.count(referenceVertex.properties()));
     }
 


Mime
View raw message