You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by dm...@apache.org on 2016/03/24 16:16:40 UTC

[1/7] incubator-tinkerpop git commit: TINKERPOP-732 added support for tree() results to be serialized over GraphSON

Repository: incubator-tinkerpop
Updated Branches:
  refs/heads/tp31 94f4d3f34 -> 58f912b11


TINKERPOP-732 added support for tree() results to be serialized over GraphSON


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

Branch: refs/heads/tp31
Commit: c01f19708a56452c368919133bee38c0e00bd3a2
Parents: e8b6f8e
Author: Dylan Millikin <dm...@apache.org>
Authored: Wed Mar 16 12:32:44 2016 -0400
Committer: Dylan Millikin <dm...@apache.org>
Committed: Wed Mar 16 12:32:44 2016 -0400

----------------------------------------------------------------------
 .../structure/io/graphson/GraphSONModule.java   |  2 +
 .../io/graphson/GraphSONSerializers.java        | 38 ++++++++++++++
 gremlin-shaded/pom.xml                          |  2 +-
 .../gremlin/structure/SerializationTest.java    | 53 ++++++++++++++++++++
 4 files changed, 94 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/c01f1970/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONModule.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONModule.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONModule.java
index 821a5dd..075c73b 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONModule.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONModule.java
@@ -42,6 +42,7 @@ import java.time.YearMonth;
 import java.time.ZoneOffset;
 import java.time.ZonedDateTime;
 import java.util.Map;
+import org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree;
 
 /**
  * The set of serializers that handle the core graph interfaces.  These serializers support normalization which
@@ -77,6 +78,7 @@ abstract class GraphSONModule extends SimpleModule {
             addSerializer(TraversalMetrics.class, new GraphSONSerializers.TraversalMetricsJacksonSerializer());
             addSerializer(TraversalExplanation.class, new GraphSONSerializers.TraversalExplanationJacksonSerializer());
             addSerializer(Path.class, new GraphSONSerializers.PathJacksonSerializer());
+            addSerializer(Tree.class, new GraphSONSerializers.TreeJacksonSerializer());
             addSerializer(StarGraphGraphSONSerializer.DirectionalStarGraph.class, new StarGraphGraphSONSerializer(normalize));
 
             // java.util

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/c01f1970/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONSerializers.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONSerializers.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONSerializers.java
index e21bb0e..0712cd1 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONSerializers.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONSerializers.java
@@ -48,7 +48,10 @@ import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import java.util.concurrent.TimeUnit;
+import org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree;
+import org.apache.tinkerpop.gremlin.structure.T;
 
 /**
  * GraphSON serializers for graph-based objects such as vertices, edges, properties, and paths. These serializers
@@ -257,6 +260,41 @@ final class GraphSONSerializers {
         }
 
     }
+    
+    final static class TreeJacksonSerializer extends StdSerializer<Tree> {
+
+        public TreeJacksonSerializer() {
+            super(Tree.class);
+        }
+
+        @Override
+        public void serialize(final Tree tree, final JsonGenerator jsonGenerator, final SerializerProvider serializerProvider) throws IOException, JsonGenerationException {
+            ser(tree, jsonGenerator, null);
+        }
+        
+        @Override
+        public void serializeWithType(final Tree tree, final JsonGenerator jsonGenerator,
+                                      final SerializerProvider serializerProvider, final TypeSerializer typeSerializer)
+                throws IOException, JsonProcessingException {
+            ser(tree, jsonGenerator, typeSerializer);
+        }
+        
+        private static void ser(final Tree tree, final JsonGenerator jsonGenerator, final TypeSerializer typeSerializer)
+                throws IOException {
+            jsonGenerator.writeStartObject(); // {
+            
+            Set<Map.Entry<Element, Tree<T>>> set = tree.entrySet();
+            for(Map.Entry<Element, Tree<T>> entry : set)
+            {
+                jsonGenerator.writeObjectFieldStart(entry.getKey().id().toString()); 
+                if (typeSerializer != null) jsonGenerator.writeStringField(GraphSONTokens.CLASS, HashMap.class.getName()); 
+                jsonGenerator.writeObjectField(GraphSONTokens.KEY, entry.getKey()); 
+                jsonGenerator.writeObjectField(GraphSONTokens.VALUE, entry.getValue());
+                jsonGenerator.writeEndObject();
+            }
+            jsonGenerator.writeEndObject();
+        }
+    } 
 
     /**
      * Maps in the JVM can have {@link Object} as a key, but in JSON they must be a {@link String}.

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/c01f1970/gremlin-shaded/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-shaded/pom.xml b/gremlin-shaded/pom.xml
index a8d1d9b..56f7dd4 100644
--- a/gremlin-shaded/pom.xml
+++ b/gremlin-shaded/pom.xml
@@ -50,7 +50,7 @@ limitations under the License.
             <groupId>com.fasterxml.jackson.core</groupId>
             <artifactId>jackson-databind</artifactId>
             <!-- Update the shade plugin config whenever you change this version -->
-            <version>2.5.3</version>
+            <version>2.7.0</version>
             <optional>true</optional>
         </dependency>
     </dependencies>

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/c01f1970/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/SerializationTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/SerializationTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/SerializationTest.java
index c7bf8b4..5fb8fb0 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/SerializationTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/SerializationTest.java
@@ -46,6 +46,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.TimeUnit;
+import org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree;
 
 import static org.junit.Assert.*;
 
@@ -349,5 +350,57 @@ public class SerializationTest {
             assertTrue(metrics0.containsKey(GraphSONTokens.COUNTS));
             assertTrue(metrics0.containsKey(GraphSONTokens.DURATION));
         }
+        
+        @Test
+        @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
+        public void shouldSerializeTree() throws Exception {
+            final ObjectMapper mapper = graph.io(GraphSONIo.build()).mapper().create().createMapper();
+            final Tree t = g.V(1).out().properties("name").tree().next();
+            final String json = mapper.writeValueAsString(t);
+            
+            final HashMap<String, Object> m = (HashMap<String, Object>) mapper.readValue(json, mapTypeReference);
+            
+            // Check Structure
+            assertEquals(1, m.size());
+            assertTrue(m.containsKey("1"));
+            
+            // Check Structure n+1
+            final HashMap<String, Object> branch = (HashMap<String, Object>) m.get("1");
+            assertEquals(2, branch.size());
+            assertTrue(branch.containsKey(GraphSONTokens.KEY));
+            assertTrue(branch.containsKey(GraphSONTokens.VALUE));
+            
+            //Check n+1 key (traversed element)
+            final HashMap<String, Object> branchKey = (HashMap<String, Object>) branch.get(GraphSONTokens.KEY);
+            assertTrue(branchKey.containsKey(GraphSONTokens.ID));
+            assertTrue(branchKey.containsKey(GraphSONTokens.LABEL));
+            assertTrue(branchKey.containsKey(GraphSONTokens.TYPE));
+            assertTrue(branchKey.containsKey(GraphSONTokens.PROPERTIES));
+            assertEquals(1, branchKey.get(GraphSONTokens.ID));
+            assertEquals("person", branchKey.get(GraphSONTokens.LABEL));
+            assertEquals("vertex", branchKey.get(GraphSONTokens.TYPE));
+            final HashMap<String, List<HashMap<String, Object>>> branchKeyProps = (HashMap<String, List<HashMap<String, Object>>>) branchKey.get(GraphSONTokens.PROPERTIES);
+            assertEquals("marko", branchKeyProps.get("name").get(0).get("value"));
+            assertEquals(29, branchKeyProps.get("age").get(0).get("value"));
+            
+            //Check n+1 value (traversed element)
+            final HashMap<String, Object> branchValue = (HashMap<String, Object>) branch.get(GraphSONTokens.VALUE);
+            assertEquals(3, branchValue.size());
+            assertTrue(branchValue.containsKey("2"));
+            assertTrue(branchValue.containsKey("3"));
+            assertTrue(branchValue.containsKey("4"));
+            
+            // Check that vp[] functioned properly
+            final HashMap<String, HashMap<String, Object>> branch2 = (HashMap<String, HashMap<String, Object>>) branchValue.get("2");
+            assertTrue(branch2.containsKey(GraphSONTokens.KEY));
+            assertTrue(branch2.containsKey(GraphSONTokens.VALUE));
+            final HashMap<String, HashMap<String, Object>> branch2Prop = (HashMap<String, HashMap<String, Object>>) branch2.get(GraphSONTokens.VALUE).get("2");
+            assertTrue(branch2Prop.get(GraphSONTokens.KEY).containsKey(GraphSONTokens.ID));
+            assertTrue(branch2Prop.get(GraphSONTokens.KEY).containsKey(GraphSONTokens.VALUE));
+            assertTrue(branch2Prop.get(GraphSONTokens.KEY).containsKey(GraphSONTokens.LABEL));
+            assertEquals("name", branch2Prop.get(GraphSONTokens.KEY).get(GraphSONTokens.LABEL));
+            assertEquals("vadas", branch2Prop.get(GraphSONTokens.KEY).get(GraphSONTokens.VALUE));
+            assertEquals(2, branch2Prop.get(GraphSONTokens.KEY).get(GraphSONTokens.ID));
+        }
     }
 }


[5/7] incubator-tinkerpop git commit: sync

Posted by dm...@apache.org.
sync


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

Branch: refs/heads/tp31
Commit: e92e45b8c0a6ea54d618a3a7aa3c41f83eddb79d
Parents: 18b2fe6
Author: Dylan Millikin <dm...@apache.org>
Authored: Thu Mar 24 09:52:34 2016 -0400
Committer: Dylan Millikin <dm...@apache.org>
Committed: Thu Mar 24 09:52:34 2016 -0400

----------------------------------------------------------------------
 gremlin-console/src/main/static/NOTICE | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/e92e45b8/gremlin-console/src/main/static/NOTICE
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/static/NOTICE b/gremlin-console/src/main/static/NOTICE
index 6e8865f..3139931 100644
--- a/gremlin-console/src/main/static/NOTICE
+++ b/gremlin-console/src/main/static/NOTICE
@@ -57,3 +57,4 @@ Copyright (c) 2010, The JAVATUPLES team (http://www.javatuples.org)
 Netty
 ------------------------------------------------------------------------
 Copyright 2014 The Netty Project
+


[3/7] incubator-tinkerpop git commit: removed some commented code

Posted by dm...@apache.org.
removed some commented code


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

Branch: refs/heads/tp31
Commit: 2f32f0cf0e158a1a8a2c4fbdc4956bf4fd29fa14
Parents: edb61f5
Author: Dylan Millikin <dm...@apache.org>
Authored: Fri Mar 18 01:02:38 2016 -0400
Committer: Dylan Millikin <dm...@apache.org>
Committed: Fri Mar 18 01:02:38 2016 -0400

----------------------------------------------------------------------
 .../gremlin/structure/io/graphson/GraphSONSerializers.java         | 2 +-
 .../driver/ser/GraphSONMessageSerializerGremlinV1d0Test.java       | 1 -
 .../gremlin/driver/ser/GraphSONMessageSerializerV1d0Test.java      | 1 -
 .../org/apache/tinkerpop/gremlin/structure/SerializationTest.java  | 2 +-
 4 files changed, 2 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/2f32f0cf/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONSerializers.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONSerializers.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONSerializers.java
index cf56218..aaca316 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONSerializers.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONSerializers.java
@@ -280,7 +280,7 @@ final class GraphSONSerializers {
         
         private static void ser(final Tree tree, final JsonGenerator jsonGenerator, final TypeSerializer typeSerializer)
                 throws IOException {
-            jsonGenerator.writeStartObject(); // {
+            jsonGenerator.writeStartObject(); 
             if (typeSerializer != null) jsonGenerator.writeStringField(GraphSONTokens.CLASS, HashMap.class.getName());
             
             Set<Map.Entry<Element, Tree>> set = tree.entrySet();

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/2f32f0cf/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/GraphSONMessageSerializerGremlinV1d0Test.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/GraphSONMessageSerializerGremlinV1d0Test.java b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/GraphSONMessageSerializerGremlinV1d0Test.java
index 7ff6a7e..0091a5f 100644
--- a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/GraphSONMessageSerializerGremlinV1d0Test.java
+++ b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/GraphSONMessageSerializerGremlinV1d0Test.java
@@ -259,7 +259,6 @@ public class GraphSONMessageSerializerGremlinV1d0Test {
     public void shouldSerializeToJsonTree() throws Exception {
         final TinkerGraph graph = TinkerFactory.createClassic();
         final GraphTraversalSource g = graph.traversal();
-        //final Iterable<Tree> iterable = IteratorUtils.list(g.V(1).out().properties("name").tree());
         final Map t = g.V(1).out().properties("name").tree().next();
 
         final ResponseMessage response = convert(t);

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/2f32f0cf/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/GraphSONMessageSerializerV1d0Test.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/GraphSONMessageSerializerV1d0Test.java b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/GraphSONMessageSerializerV1d0Test.java
index e9e4f80..a4cee54 100644
--- a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/GraphSONMessageSerializerV1d0Test.java
+++ b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/GraphSONMessageSerializerV1d0Test.java
@@ -413,7 +413,6 @@ public class GraphSONMessageSerializerV1d0Test {
     public void shouldSerializeToJsonTree() throws Exception {
         final TinkerGraph graph = TinkerFactory.createClassic();
         final GraphTraversalSource g = graph.traversal();
-        //final Iterable<Tree> iterable = IteratorUtils.list(g.V(1).out().properties("name").tree());
         final Tree t = g.V(1).out().properties("name").tree().next();
 
         

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/2f32f0cf/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/SerializationTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/SerializationTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/SerializationTest.java
index 87afa7d..a99bcd5 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/SerializationTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/SerializationTest.java
@@ -240,7 +240,7 @@ public class SerializationTest {
             final ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
             final Tree after = gryoReader.readObject(inputStream, Tree.class);
             assertNotNull(after);
-            //Seeing as Tree implements Serializable the following assertions should be sufficent.
+            //The following assertions should be sufficent.
             assertThat("Type does not match", after, instanceOf(Tree.class));
             assertEquals("The objects differ", after, before);
         }


[4/7] incubator-tinkerpop git commit: removed jackson from NOTICE files

Posted by dm...@apache.org.
removed jackson from NOTICE files


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

Branch: refs/heads/tp31
Commit: 18b2fe6f8b23ccf6c9e6dc593ae6a943291de8ab
Parents: 2f32f0c
Author: Dylan Millikin <dm...@apache.org>
Authored: Thu Mar 24 02:50:52 2016 -0400
Committer: Dylan Millikin <dm...@apache.org>
Committed: Thu Mar 24 02:50:52 2016 -0400

----------------------------------------------------------------------
 gremlin-console/src/main/static/NOTICE | 24 ------------------------
 gremlin-server/src/main/static/NOTICE  | 24 ------------------------
 2 files changed, 48 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/18b2fe6f/gremlin-console/src/main/static/NOTICE
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/static/NOTICE b/gremlin-console/src/main/static/NOTICE
index 0901755..6e8865f 100644
--- a/gremlin-console/src/main/static/NOTICE
+++ b/gremlin-console/src/main/static/NOTICE
@@ -57,27 +57,3 @@ Copyright (c) 2010, The JAVATUPLES team (http://www.javatuples.org)
 Netty
 ------------------------------------------------------------------------
 Copyright 2014 The Netty Project
-
-------------------------------------------------------------------------
-Jackson databind - shaded in gremlin-shaded to org.apache.tinkerpop.shaded.jackson
-------------------------------------------------------------------------
-# Jackson JSON processor
-
-Jackson is a high-performance, Free/Open Source JSON processing library.
-It was originally written by Tatu Saloranta (tatu.saloranta@iki.fi), and has
-been in development since 2007.
-It is currently developed by a community of developers, as well as supported
-commercially by FasterXML.com.
-
-## Licensing
-
-Jackson core and extension components may be licensed under different licenses.
-To find the details that apply to this artifact see the accompanying LICENSE file.
-For more information, including possible other licensing options, contact
-FasterXML.com (http://fasterxml.com).
-
-## Credits
-
-A list of contributors may be found from CREDITS file, which is included
-in some artifacts (usually source distributions); but is always available
-from the source code management (SCM) system project uses.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/18b2fe6f/gremlin-server/src/main/static/NOTICE
----------------------------------------------------------------------
diff --git a/gremlin-server/src/main/static/NOTICE b/gremlin-server/src/main/static/NOTICE
index 9055cf6..13a3bc6 100644
--- a/gremlin-server/src/main/static/NOTICE
+++ b/gremlin-server/src/main/static/NOTICE
@@ -58,27 +58,3 @@ LongAdder), which was released with the following comments:
 Netty
 ------------------------------------------------------------------------
 Copyright 2014 The Netty Project
-
-------------------------------------------------------------------------
-Jackson databind - shaded in gremlin-shaded to org.apache.tinkerpop.shaded.jackson
-------------------------------------------------------------------------
-# Jackson JSON processor
-
-Jackson is a high-performance, Free/Open Source JSON processing library.
-It was originally written by Tatu Saloranta (tatu.saloranta@iki.fi), and has
-been in development since 2007.
-It is currently developed by a community of developers, as well as supported
-commercially by FasterXML.com.
-
-## Licensing
-
-Jackson core and extension components may be licensed under different licenses.
-To find the details that apply to this artifact see the accompanying LICENSE file.
-For more information, including possible other licensing options, contact
-FasterXML.com (http://fasterxml.com).
-
-## Credits
-
-A list of contributors may be found from CREDITS file, which is included
-in some artifacts (usually source distributions); but is always available
-from the source code management (SCM) system project uses.
\ No newline at end of file


[7/7] incubator-tinkerpop git commit: added a note in the changelog for TINKERPOP-732

Posted by dm...@apache.org.
added a note in the changelog for TINKERPOP-732


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

Branch: refs/heads/tp31
Commit: 58f912b1199cb5ee99c3a45f28343c01a19312da
Parents: 9dca398
Author: Dylan Millikin <dm...@apache.org>
Authored: Thu Mar 24 11:16:32 2016 -0400
Committer: Dylan Millikin <dm...@apache.org>
Committed: Thu Mar 24 11:16:32 2016 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/58f912b1/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index f569257..93d5a81 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,6 +26,7 @@ image::https://raw.githubusercontent.com/apache/incubator-tinkerpop/master/docs/
 TinkerPop 3.1.2 (NOT OFFICIALLY RELEASED YET)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+* Fixed a bug where tree() did not serialize into GraphSON
 * Bumped to SLF4j 1.7.19.
 * Bumped to Apache Hadoop 2.7.2.
 * Fixed a bug in `gremlin-driver` where a really fast call to get a `Future` to wait for a result might not register an error raised from the server.


[6/7] incubator-tinkerpop git commit: Merge branch 'TINKERPOP-733' into tp31

Posted by dm...@apache.org.
Merge branch 'TINKERPOP-733' into tp31


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

Branch: refs/heads/tp31
Commit: 9dca39854c08a1da3a6764ed4add670f8dc9ff33
Parents: 94f4d3f e92e45b
Author: Dylan Millikin <dm...@apache.org>
Authored: Thu Mar 24 11:14:23 2016 -0400
Committer: Dylan Millikin <dm...@apache.org>
Committed: Thu Mar 24 11:14:23 2016 -0400

----------------------------------------------------------------------
 gremlin-console/src/main/static/NOTICE          |  3 +-
 .../structure/io/graphson/GraphSONModule.java   |  4 +-
 .../io/graphson/GraphSONSerializers.java        | 38 ++++++++++
 ...raphSONMessageSerializerGremlinV1d0Test.java | 36 +++++++++-
 .../ser/GraphSONMessageSerializerV1d0Test.java  | 42 +++++++++++
 gremlin-server/src/main/static/NOTICE           |  2 +-
 gremlin-shaded/pom.xml                          |  2 +-
 .../gremlin/structure/SerializationTest.java    | 76 +++++++++++++++++++-
 8 files changed, 197 insertions(+), 6 deletions(-)
----------------------------------------------------------------------



[2/7] incubator-tinkerpop git commit: Added mentions to notice. Added tests and made a slight correction to serialization

Posted by dm...@apache.org.
Added mentions to notice. Added tests and made a slight correction to serialization


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

Branch: refs/heads/tp31
Commit: edb61f5e356dc30fc75a318bbf41e887f6bd361b
Parents: c01f197
Author: Dylan Millikin <dm...@apache.org>
Authored: Thu Mar 17 23:11:30 2016 -0400
Committer: Dylan Millikin <dm...@apache.org>
Committed: Thu Mar 17 23:11:30 2016 -0400

----------------------------------------------------------------------
 gremlin-console/src/main/static/NOTICE          | 26 +++++++++++-
 .../structure/io/graphson/GraphSONModule.java   |  4 +-
 .../io/graphson/GraphSONSerializers.java        | 12 +++---
 ...raphSONMessageSerializerGremlinV1d0Test.java | 37 ++++++++++++++++-
 .../ser/GraphSONMessageSerializerV1d0Test.java  | 43 ++++++++++++++++++++
 gremlin-server/src/main/static/NOTICE           | 26 +++++++++++-
 gremlin-shaded/pom.xml                          |  2 +-
 .../gremlin/structure/SerializationTest.java    | 23 ++++++++++-
 8 files changed, 160 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/edb61f5e/gremlin-console/src/main/static/NOTICE
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/static/NOTICE b/gremlin-console/src/main/static/NOTICE
index b9fa6eb..0901755 100644
--- a/gremlin-console/src/main/static/NOTICE
+++ b/gremlin-console/src/main/static/NOTICE
@@ -56,4 +56,28 @@ Copyright (c) 2010, The JAVATUPLES team (http://www.javatuples.org)
 ------------------------------------------------------------------------
 Netty
 ------------------------------------------------------------------------
-Copyright 2014 The Netty Project
\ No newline at end of file
+Copyright 2014 The Netty Project
+
+------------------------------------------------------------------------
+Jackson databind - shaded in gremlin-shaded to org.apache.tinkerpop.shaded.jackson
+------------------------------------------------------------------------
+# Jackson JSON processor
+
+Jackson is a high-performance, Free/Open Source JSON processing library.
+It was originally written by Tatu Saloranta (tatu.saloranta@iki.fi), and has
+been in development since 2007.
+It is currently developed by a community of developers, as well as supported
+commercially by FasterXML.com.
+
+## Licensing
+
+Jackson core and extension components may be licensed under different licenses.
+To find the details that apply to this artifact see the accompanying LICENSE file.
+For more information, including possible other licensing options, contact
+FasterXML.com (http://fasterxml.com).
+
+## Credits
+
+A list of contributors may be found from CREDITS file, which is included
+in some artifacts (usually source distributions); but is always available
+from the source code management (SCM) system project uses.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/edb61f5e/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONModule.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONModule.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONModule.java
index 075c73b..7cc6c91 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONModule.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONModule.java
@@ -78,9 +78,9 @@ abstract class GraphSONModule extends SimpleModule {
             addSerializer(TraversalMetrics.class, new GraphSONSerializers.TraversalMetricsJacksonSerializer());
             addSerializer(TraversalExplanation.class, new GraphSONSerializers.TraversalExplanationJacksonSerializer());
             addSerializer(Path.class, new GraphSONSerializers.PathJacksonSerializer());
-            addSerializer(Tree.class, new GraphSONSerializers.TreeJacksonSerializer());
             addSerializer(StarGraphGraphSONSerializer.DirectionalStarGraph.class, new StarGraphGraphSONSerializer(normalize));
-
+            addSerializer(Tree.class, new GraphSONSerializers.TreeJacksonSerializer());
+           
             // java.util
             addSerializer(Map.Entry.class, new JavaUtilSerializers.MapEntryJacksonSerializer());
 

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/edb61f5e/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONSerializers.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONSerializers.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONSerializers.java
index 0712cd1..cf56218 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONSerializers.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONSerializers.java
@@ -51,7 +51,6 @@ import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.TimeUnit;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree;
-import org.apache.tinkerpop.gremlin.structure.T;
 
 /**
  * GraphSON serializers for graph-based objects such as vertices, edges, properties, and paths. These serializers
@@ -282,12 +281,13 @@ final class GraphSONSerializers {
         private static void ser(final Tree tree, final JsonGenerator jsonGenerator, final TypeSerializer typeSerializer)
                 throws IOException {
             jsonGenerator.writeStartObject(); // {
+            if (typeSerializer != null) jsonGenerator.writeStringField(GraphSONTokens.CLASS, HashMap.class.getName());
             
-            Set<Map.Entry<Element, Tree<T>>> set = tree.entrySet();
-            for(Map.Entry<Element, Tree<T>> entry : set)
+            Set<Map.Entry<Element, Tree>> set = tree.entrySet();
+            for(Map.Entry<Element, Tree> entry : set)
             {
-                jsonGenerator.writeObjectFieldStart(entry.getKey().id().toString()); 
-                if (typeSerializer != null) jsonGenerator.writeStringField(GraphSONTokens.CLASS, HashMap.class.getName()); 
+                jsonGenerator.writeObjectFieldStart(entry.getKey().id().toString());
+                if (typeSerializer != null) jsonGenerator.writeStringField(GraphSONTokens.CLASS, HashMap.class.getName());
                 jsonGenerator.writeObjectField(GraphSONTokens.KEY, entry.getKey()); 
                 jsonGenerator.writeObjectField(GraphSONTokens.VALUE, entry.getValue());
                 jsonGenerator.writeEndObject();
@@ -295,7 +295,7 @@ final class GraphSONSerializers {
             jsonGenerator.writeEndObject();
         }
     } 
-
+    
     /**
      * Maps in the JVM can have {@link Object} as a key, but in JSON they must be a {@link String}.
      */

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/edb61f5e/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/GraphSONMessageSerializerGremlinV1d0Test.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/GraphSONMessageSerializerGremlinV1d0Test.java b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/GraphSONMessageSerializerGremlinV1d0Test.java
index de719c1..7ff6a7e 100644
--- a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/GraphSONMessageSerializerGremlinV1d0Test.java
+++ b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/GraphSONMessageSerializerGremlinV1d0Test.java
@@ -43,6 +43,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.UUID;
+import org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
@@ -254,6 +255,40 @@ public class GraphSONMessageSerializerGremlinV1d0Test {
         assertEquals(new Integer(1000), deserializedMap.get("1"));
     }
 
+    @Test
+    public void shouldSerializeToJsonTree() throws Exception {
+        final TinkerGraph graph = TinkerFactory.createClassic();
+        final GraphTraversalSource g = graph.traversal();
+        //final Iterable<Tree> iterable = IteratorUtils.list(g.V(1).out().properties("name").tree());
+        final Map t = g.V(1).out().properties("name").tree().next();
+
+        final ResponseMessage response = convert(t);
+        assertCommon(response);
+
+        final Map<String, Map<String, Map>> deserializedMap = (Map<String, Map<String, Map>>) response.getResult().getData();
+        
+        assertEquals(1, deserializedMap.size());
+        
+        //check the first object and it's properties
+        Map<String,Object> vertex = deserializedMap.get("1").get("key");
+        Map<String,List<Map>> vertexProperties = (Map<String, List<Map>>)vertex.get("properties");
+        assertEquals(1, (int)vertex.get("id"));
+        assertEquals("marko", vertexProperties.get("name").get(0).get("value"));
+        
+        //check objects tree structure
+        //check Vertex property
+        Map<String, Map<String, Map>> subTreeMap =  deserializedMap.get("1").get("value");
+        Map<String, Map<String, Map>> subTreeMap2 = subTreeMap.get("2").get("value");
+        Map<String, String> vertexPropertiesDeep = subTreeMap2.get("3").get("key");
+        assertEquals("vadas", vertexPropertiesDeep.get("value"));
+        assertEquals("name", vertexPropertiesDeep.get("label"));
+        
+        // check subitem
+        Map<String,Object> vertex2 = subTreeMap.get("3").get("key");
+        Map<String,List<Map>> vertexProperties2 = (Map<String, List<Map>>)vertex2.get("properties");
+        
+        assertEquals("lop", vertexProperties2.get("name").get(0).get("value"));
+    }
 
     @Test
     public void shouldSerializeFullResponseMessage() throws Exception {
@@ -287,7 +322,7 @@ public class GraphSONMessageSerializerGremlinV1d0Test {
         assertEquals(ResponseStatusCode.SUCCESS.getValue(), deserialized.getStatus().getCode().getValue());
         assertEquals("worked", deserialized.getStatus().getMessage());
     }
-
+    
     private void assertCommon(final ResponseMessage response) {
         assertEquals(requestId, response.getRequestId());
         assertEquals(ResponseStatusCode.SUCCESS, response.getStatus().getCode());

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/edb61f5e/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/GraphSONMessageSerializerV1d0Test.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/GraphSONMessageSerializerV1d0Test.java b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/GraphSONMessageSerializerV1d0Test.java
index de4b4b6..e9e4f80 100644
--- a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/GraphSONMessageSerializerV1d0Test.java
+++ b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/GraphSONMessageSerializerV1d0Test.java
@@ -57,6 +57,7 @@ import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
+import org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree;
 
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.core.Is.is;
@@ -407,6 +408,48 @@ public class GraphSONMessageSerializerV1d0Test {
         assertEquals(ResponseStatusCode.SUCCESS.getValue(), deserialized.getStatus().getCode().getValue());
         assertEquals("worked", deserialized.getStatus().getMessage());
     }
+    
+    @Test
+    public void shouldSerializeToJsonTree() throws Exception {
+        final TinkerGraph graph = TinkerFactory.createClassic();
+        final GraphTraversalSource g = graph.traversal();
+        //final Iterable<Tree> iterable = IteratorUtils.list(g.V(1).out().properties("name").tree());
+        final Tree t = g.V(1).out().properties("name").tree().next();
+
+        
+        final String results = SERIALIZER.serializeResponseAsString(ResponseMessage.build(msg).result(t).create());
+
+        final JsonNode json = mapper.readTree(results);
+
+        assertNotNull(json);
+        assertEquals(msg.getRequestId().toString(), json.get(SerTokens.TOKEN_REQUEST).asText());
+        final JsonNode converted = json.get(SerTokens.TOKEN_RESULT).get(SerTokens.TOKEN_DATA);
+        assertNotNull(converted);
+        
+        //check the first object and it's properties
+        assertEquals(1, converted.get("1").get("key").get("id").asInt());
+        assertEquals("marko", converted.get("1").get("key").get("properties").get("name").get(0).get("value").asText());
+        
+        //check objects tree structure
+        //check Vertex property
+        assertEquals("vadas", converted.get("1")
+                                 .get("value")
+                                 .get("2")
+                                 .get("value")
+                                 .get("3").get("key").get("value").asText());
+        assertEquals("name", converted.get("1")
+                                 .get("value")
+                                 .get("2")
+                                 .get("value")
+                                 .get("3").get("key").get("label").asText());
+        
+        // check subitem
+        assertEquals("lop", converted.get("1")
+                                 .get("value")
+                                 .get("3")
+                                 .get("key")
+                                 .get("properties").get("name").get(0).get("value").asText());
+    }
 
     private class FunObject {
         private String val;

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/edb61f5e/gremlin-server/src/main/static/NOTICE
----------------------------------------------------------------------
diff --git a/gremlin-server/src/main/static/NOTICE b/gremlin-server/src/main/static/NOTICE
index a767d39..9055cf6 100644
--- a/gremlin-server/src/main/static/NOTICE
+++ b/gremlin-server/src/main/static/NOTICE
@@ -57,4 +57,28 @@ LongAdder), which was released with the following comments:
 ------------------------------------------------------------------------
 Netty
 ------------------------------------------------------------------------
-Copyright 2014 The Netty Project
\ No newline at end of file
+Copyright 2014 The Netty Project
+
+------------------------------------------------------------------------
+Jackson databind - shaded in gremlin-shaded to org.apache.tinkerpop.shaded.jackson
+------------------------------------------------------------------------
+# Jackson JSON processor
+
+Jackson is a high-performance, Free/Open Source JSON processing library.
+It was originally written by Tatu Saloranta (tatu.saloranta@iki.fi), and has
+been in development since 2007.
+It is currently developed by a community of developers, as well as supported
+commercially by FasterXML.com.
+
+## Licensing
+
+Jackson core and extension components may be licensed under different licenses.
+To find the details that apply to this artifact see the accompanying LICENSE file.
+For more information, including possible other licensing options, contact
+FasterXML.com (http://fasterxml.com).
+
+## Credits
+
+A list of contributors may be found from CREDITS file, which is included
+in some artifacts (usually source distributions); but is always available
+from the source code management (SCM) system project uses.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/edb61f5e/gremlin-shaded/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-shaded/pom.xml b/gremlin-shaded/pom.xml
index 56f7dd4..d3eeb55 100644
--- a/gremlin-shaded/pom.xml
+++ b/gremlin-shaded/pom.xml
@@ -50,7 +50,7 @@ limitations under the License.
             <groupId>com.fasterxml.jackson.core</groupId>
             <artifactId>jackson-databind</artifactId>
             <!-- Update the shade plugin config whenever you change this version -->
-            <version>2.7.0</version>
+            <version>2.7.2</version>
             <optional>true</optional>
         </dependency>
     </dependencies>

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/edb61f5e/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/SerializationTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/SerializationTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/SerializationTest.java
index 5fb8fb0..87afa7d 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/SerializationTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/SerializationTest.java
@@ -47,6 +47,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.concurrent.TimeUnit;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree;
+import static org.hamcrest.CoreMatchers.instanceOf;
 
 import static org.junit.Assert.*;
 
@@ -223,8 +224,28 @@ public class SerializationTest {
             assertEquals(before.getDuration(TimeUnit.MILLISECONDS), after.getDuration(TimeUnit.MILLISECONDS));
             assertEquals(before.getMetrics(0).getCounts(), after.getMetrics(0).getCounts());
         }
-    }
+        
+        @Test
+        @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
+        public void shouldSerializeTree() throws Exception {
+            final GryoIo gryoIo = graph.io(GryoIo.build());
+            final GryoWriter gryoWriter = gryoIo.writer().create();
+            final GryoReader gryoReader = gryoIo.reader().create();
 
+            final Tree before = g.V(1).out().properties("name").tree().next();
+            
+            final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+            gryoWriter.writeObject(outputStream, before);
+
+            final ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
+            final Tree after = gryoReader.readObject(inputStream, Tree.class);
+            assertNotNull(after);
+            //Seeing as Tree implements Serializable the following assertions should be sufficent.
+            assertThat("Type does not match", after, instanceOf(Tree.class));
+            assertEquals("The objects differ", after, before);
+        }
+    }
+    
     public static class GraphSONTest extends AbstractGremlinTest {
         private final TypeReference<HashMap<String, Object>> mapTypeReference = new TypeReference<HashMap<String, Object>>() {
         };