Repository: tinkerpop
Updated Branches:
  refs/heads/master 4579a0e29 -> 4113f0e8f


TINKERPOP-1509 Fixed bug in Tree serialization for GraphSON

Needed to ensure that Tree didn't serialize as Map now that Map has special 
formatting in GraphSON 3.0 CTR


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

Branch: refs/heads/master
Commit: 27cc57469492e9ea6bca8b7db3962fa8e8a9ad4c
Parents: 31762f7
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Mar 2 15:47:41 2018 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Mar 2 15:47:41 2018 -0500

----------------------------------------------------------------------
 CHANGELOG.asciidoc                                        |  1 +
 .../structure/io/graphson/GraphSONTypeSerializerV3d0.java | 10 +++++++---
 .../driver/ser/GraphSONMessageSerializerV3d0Test.java     |  3 +--
 3 files changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/27cc5746/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index dcbf547..e6074e9 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -27,6 +27,7 @@ This release also includes changes from <<release-3-2-8, 
3.2.8>>.
 
 * Fixed regression issue where the HTTPChannelizer doesn't instantiate the 
specified AuthenticationHandler
 * Defaulted GLV tests for gremlin-python to run for GraphSON 3.0.
+* Fixed a bug with `Tree` serialization in GraphSON 3.0.
 * In gremlin-python, the GraphSON 3.0 `g:Set` type is now deserialized to 
`List`.
 
 [[release-3-3-1]]

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/27cc5746/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONTypeSerializerV3d0.java
----------------------------------------------------------------------
diff --git 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONTypeSerializerV3d0.java
 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONTypeSerializerV3d0.java
index 6d47ad9..0724e25 100644
--- 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONTypeSerializerV3d0.java
+++ 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONTypeSerializerV3d0.java
@@ -26,6 +26,7 @@ import 
org.apache.tinkerpop.gremlin.process.traversal.SackFunctions;
 import org.apache.tinkerpop.gremlin.process.traversal.Scope;
 import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
 import 
org.apache.tinkerpop.gremlin.process.traversal.step.TraversalOptionParent;
+import org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree;
 import org.apache.tinkerpop.gremlin.process.traversal.util.Metrics;
 import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalMetrics;
 import org.apache.tinkerpop.gremlin.structure.Column;
@@ -106,9 +107,12 @@ public class GraphSONTypeSerializerV3d0 extends 
AbstractGraphSONTypeSerializer {
             return classMap.get(c);
 
         final Class mapped;
-        if (Map.class.isAssignableFrom(c))
-            mapped = Map.class;
-        else if (List.class.isAssignableFrom(c))
+        if (Map.class.isAssignableFrom(c)) {
+            if (Tree.class.isAssignableFrom(c))
+                mapped = Tree.class;
+            else
+                mapped = Map.class;
+        } else if (List.class.isAssignableFrom(c))
             mapped = List.class;
         else if (Set.class.isAssignableFrom(c))
             mapped = Set.class;

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/27cc5746/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/GraphSONMessageSerializerV3d0Test.java
----------------------------------------------------------------------
diff --git 
a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/GraphSONMessageSerializerV3d0Test.java
 
b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/GraphSONMessageSerializerV3d0Test.java
index b6398f5..88dfcf0 100644
--- 
a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/GraphSONMessageSerializerV3d0Test.java
+++ 
b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/GraphSONMessageSerializerV3d0Test.java
@@ -259,11 +259,10 @@ public class GraphSONMessageSerializerV3d0Test {
     }
 
     @Test
-    @org.junit.Ignore
     public void shouldSerializeToTreeJson() throws Exception {
         final TinkerGraph graph = TinkerFactory.createClassic();
         final GraphTraversalSource g = graph.traversal();
-        final Map t = g.V(1).out().properties("name").tree().next();
+        final Tree t = g.V(1).out().properties("name").tree().next();
 
         final ResponseMessage response = convert(t);
         assertCommon(response);

Reply via email to