TINKERPOP-1565 Added tests for GraphSON 3.0 And fixed some broken tests preventing a proper build.
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/729af57f Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/729af57f Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/729af57f Branch: refs/heads/TINKERPOP-1612 Commit: 729af57f0d3515ccff591259f529a999af0b717c Parents: 2dc9b51 Author: Stephen Mallette <sp...@genoprime.com> Authored: Fri Jan 13 08:20:22 2017 -0500 Committer: Stephen Mallette <sp...@genoprime.com> Committed: Thu Jan 19 15:15:33 2017 -0500 ---------------------------------------------------------------------- .../ser/GraphSONMessageSerializerV2d0Test.java | 13 +- .../gremlin/structure/io/IoCustomTest.java | 3 + .../gremlin/structure/io/IoEdgeTest.java | 3 + .../gremlin/structure/io/IoGraphTest.java | 1 + .../gremlin/structure/io/IoPropertyTest.java | 12 +- .../tinkerpop/gremlin/structure/io/IoTest.java | 123 +++++++++++++++++++ .../gremlin/structure/io/IoVertexTest.java | 3 + .../tinkerpop-classic-normalized-v3d0.json | 6 + 8 files changed, 151 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/729af57f/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/GraphSONMessageSerializerV2d0Test.java ---------------------------------------------------------------------- diff --git a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/GraphSONMessageSerializerV2d0Test.java b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/GraphSONMessageSerializerV2d0Test.java index 4125946..0bdc08d 100644 --- a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/GraphSONMessageSerializerV2d0Test.java +++ b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/GraphSONMessageSerializerV2d0Test.java @@ -251,7 +251,7 @@ public class GraphSONMessageSerializerV2d0Test { final JsonNode properties = edgeAsJson.get(GraphSONTokens.PROPERTIES); assertNotNull(properties); - assertEquals(123, properties.get("abc").get(GraphSONTokens.VALUEPROP).asInt()); + assertEquals(123, properties.get("abc").get(GraphSONTokens.VALUEPROP).get("value").get(GraphSONTokens.VALUEPROP).asInt()); } @Test @@ -315,7 +315,7 @@ public class GraphSONMessageSerializerV2d0Test { final JsonNode friendProperties = properties.get("friends"); assertEquals(1, friendProperties.size()); - final JsonNode friendsProperty = friendProperties.get(0).get(GraphSONTokens.VALUE); + final JsonNode friendsProperty = friendProperties.get(0).get(GraphSONTokens.VALUEPROP).get(GraphSONTokens.VALUE); assertNotNull(friendsProperty); assertEquals(3, friendsProperty.size()); @@ -416,7 +416,6 @@ public class GraphSONMessageSerializerV2d0Test { final GraphTraversalSource g = graph.traversal(); 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); @@ -440,7 +439,7 @@ public class GraphSONMessageSerializerV2d0Test { .get(GraphSONTokens.PROPERTIES) .get("name") .get(0) - .get(GraphSONTokens.VALUE).asText()); + .get(GraphSONTokens.VALUEPROP).get(GraphSONTokens.VALUE).asText()); //check the leafs assertEquals("vadas", converted.get(GraphSONTokens.VALUEPROP) @@ -451,7 +450,7 @@ public class GraphSONMessageSerializerV2d0Test { .get(GraphSONTokens.PROPERTIES) .get("name") .get(0) - .get(GraphSONTokens.VALUE).asText()); + .get(GraphSONTokens.VALUEPROP).get(GraphSONTokens.VALUE).asText()); assertEquals("lop", converted.get(GraphSONTokens.VALUEPROP) .get(0) @@ -461,7 +460,7 @@ public class GraphSONMessageSerializerV2d0Test { .get(GraphSONTokens.PROPERTIES) .get("name") .get(0) - .get(GraphSONTokens.VALUE).asText()); + .get(GraphSONTokens.VALUEPROP).get(GraphSONTokens.VALUE).asText()); assertEquals("josh", converted.get(GraphSONTokens.VALUEPROP) .get(0) @@ -471,7 +470,7 @@ public class GraphSONMessageSerializerV2d0Test { .get(GraphSONTokens.PROPERTIES) .get("name") .get(0) - .get(GraphSONTokens.VALUE).asText()); + .get(GraphSONTokens.VALUEPROP).get(GraphSONTokens.VALUE).asText()); } @Test http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/729af57f/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoCustomTest.java ---------------------------------------------------------------------- diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoCustomTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoCustomTest.java index d89f97e..f7340f8 100644 --- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoCustomTest.java +++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoCustomTest.java @@ -67,6 +67,9 @@ public class IoCustomTest extends AbstractGremlinTest { {"graphson-v2-embedded", true, (Function<Graph, GraphReader>) g -> g.io(IoCore.graphson()).reader().mapper(g.io(GraphSONIo.build(GraphSONVersion.V2_0)).mapper().addCustomModule(moduleV2d0).typeInfo(TypeInfo.PARTIAL_TYPES).create()).create(), (Function<Graph, GraphWriter>) g -> g.io(IoCore.graphson()).writer().mapper(g.io(GraphSONIo.build(GraphSONVersion.V2_0)).mapper().addCustomModule(moduleV2d0).typeInfo(TypeInfo.PARTIAL_TYPES).create()).create()}, + {"graphson-v3", true, + (Function<Graph, GraphReader>) g -> g.io(IoCore.graphson()).reader().mapper(g.io(GraphSONIo.build(GraphSONVersion.V3_0)).mapper().addCustomModule(moduleV2d0).create()).create(), + (Function<Graph, GraphWriter>) g -> g.io(IoCore.graphson()).writer().mapper(g.io(GraphSONIo.build(GraphSONVersion.V3_0)).mapper().addCustomModule(moduleV2d0).create()).create()}, {"gryo", true, (Function<Graph, GraphReader>) g -> g.io(IoCore.gryo()).reader().mapper(g.io(IoCore.gryo()).mapper().addCustom(CustomId.class).create()).create(), (Function<Graph, GraphWriter>) g -> g.io(IoCore.gryo()).writer().mapper(g.io(IoCore.gryo()).mapper().addCustom(CustomId.class).create()).create()} http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/729af57f/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoEdgeTest.java ---------------------------------------------------------------------- diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoEdgeTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoEdgeTest.java index 8d2a58a..fa656a5 100644 --- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoEdgeTest.java +++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoEdgeTest.java @@ -66,6 +66,9 @@ public class IoEdgeTest extends AbstractGremlinTest { {"graphson-v2-embedded", true, true, (Function<Graph, GraphReader>) g -> g.io(IoCore.graphson()).reader().mapper(g.io(GraphSONIo.build(GraphSONVersion.V2_0)).mapper().typeInfo(TypeInfo.PARTIAL_TYPES).create()).create(), (Function<Graph, GraphWriter>) g -> g.io(IoCore.graphson()).writer().mapper(g.io(GraphSONIo.build(GraphSONVersion.V2_0)).mapper().typeInfo(TypeInfo.PARTIAL_TYPES).create()).create()}, + {"graphson-v3", true, true, + (Function<Graph, GraphReader>) g -> g.io(IoCore.graphson()).reader().mapper(g.io(GraphSONIo.build(GraphSONVersion.V3_0)).mapper().create()).create(), + (Function<Graph, GraphWriter>) g -> g.io(IoCore.graphson()).writer().mapper(g.io(GraphSONIo.build(GraphSONVersion.V3_0)).mapper().create()).create()}, {"gryo", true, true, (Function<Graph,GraphReader>) g -> g.io(IoCore.gryo()).reader().create(), (Function<Graph, GraphWriter>) g -> g.io(IoCore.gryo()).writer().create()} http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/729af57f/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoGraphTest.java ---------------------------------------------------------------------- diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoGraphTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoGraphTest.java index 040849e..6e54377 100644 --- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoGraphTest.java +++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoGraphTest.java @@ -53,6 +53,7 @@ public class IoGraphTest extends AbstractGremlinTest { {"graphml", IoCore.graphml(), false, true, ".xml"}, {"graphsonv1d0", IoCore.graphson(), true, true, ".json"}, {"graphsonv2d0", GraphSONIo.build(GraphSONVersion.V2_0), true, true, ".json"}, + {"graphsonv3d0", GraphSONIo.build(GraphSONVersion.V3_0), true, true, ".json"}, {"gryo", IoCore.gryo(), false, false, ".kryo"} }); } http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/729af57f/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoPropertyTest.java ---------------------------------------------------------------------- diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoPropertyTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoPropertyTest.java index dec7230..ecde126 100644 --- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoPropertyTest.java +++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoPropertyTest.java @@ -63,6 +63,9 @@ public class IoPropertyTest extends AbstractGremlinTest { {"graphson-v2-embedded", true, true, (Function<Graph, GraphReader>) g -> g.io(IoCore.graphson()).reader().mapper(g.io(GraphSONIo.build(GraphSONVersion.V2_0)).mapper().typeInfo(TypeInfo.PARTIAL_TYPES).create()).create(), (Function<Graph, GraphWriter>) g -> g.io(IoCore.graphson()).writer().mapper(g.io(GraphSONIo.build(GraphSONVersion.V2_0)).mapper().typeInfo(TypeInfo.PARTIAL_TYPES).create()).create()}, + {"graphson-v3", true, true, + (Function<Graph, GraphReader>) g -> g.io(IoCore.graphson()).reader().mapper(g.io(GraphSONIo.build(GraphSONVersion.V3_0)).mapper().create()).create(), + (Function<Graph, GraphWriter>) g -> g.io(IoCore.graphson()).writer().mapper(g.io(GraphSONIo.build(GraphSONVersion.V3_0)).mapper().create()).create()}, {"gryo", true, true, (Function<Graph, GraphReader>) g -> g.io(IoCore.gryo()).reader().create(), (Function<Graph, GraphWriter>) g -> g.io(IoCore.gryo()).writer().create()} @@ -92,7 +95,6 @@ public class IoPropertyTest extends AbstractGremlinTest { // select any vertexproperty that has both start/end time final VertexProperty p = (VertexProperty) g.V(convertToVertexId("marko")).properties("location").as("p").has("endTime").select("p").next(); - final Vertex v = p.element(); writer.writeVertexProperty(os, p); final AtomicBoolean called = new AtomicBoolean(false); @@ -104,7 +106,7 @@ public class IoPropertyTest extends AbstractGremlinTest { assertEquals(IteratorUtils.count(p.properties()), IteratorUtils.count(propertyAttachable.get().properties())); assertEquals(p.property("startTime").value(), ((Property) propertyAttachable.get().properties("startTime").next()).value()); assertEquals(p.property("endTime").value(), ((Property) propertyAttachable.get().properties("endTime").next()).value()); - if (ioType.equals("graphson-v2-embedded")) { // TODO: make this work with Gryo + if (ioType.equals("graphson-v3")) { // TODO: make this work with Gryo assertEquals(p, propertyAttachable.get()); assertEquals(p.element(), propertyAttachable.get().element()); } @@ -123,7 +125,6 @@ public class IoPropertyTest extends AbstractGremlinTest { try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) { final GraphWriter writer = writerMaker.apply(graph); final VertexProperty p = g.V(convertToVertexId("marko")).next().property("name"); - final Vertex v = p.element(); writer.writeVertexProperty(os, p); final AtomicBoolean called = new AtomicBoolean(false); @@ -133,7 +134,7 @@ public class IoPropertyTest extends AbstractGremlinTest { assertEquals(p.value(), propertyAttachable.get().value()); assertEquals(p.key(), propertyAttachable.get().key()); assertEquals(0, IteratorUtils.count(propertyAttachable.get().properties())); - if (ioType.equals("graphson-v2-embedded")) { // TODO: make this work with Gryo + if (ioType.equals("graphson-v3")) { // TODO: make this work with Gryo assertEquals(p, propertyAttachable.get()); assertEquals(p.element(), propertyAttachable.get().element()); } @@ -152,7 +153,6 @@ public class IoPropertyTest extends AbstractGremlinTest { try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) { final GraphWriter writer = writerMaker.apply(graph); final Property p = g.E(convertToEdgeId("marko", "knows", "vadas")).next().property("weight"); - final Edge e = (Edge) p.element(); writer.writeProperty(os, p); final AtomicBoolean called = new AtomicBoolean(false); @@ -161,7 +161,7 @@ public class IoPropertyTest extends AbstractGremlinTest { reader.readProperty(bais, propertyAttachable -> { assertEquals(p.value(), propertyAttachable.get().value()); assertEquals(p.key(), propertyAttachable.get().key()); - if (ioType.equals("graphson-v2-embedded")) { // TODO: make this work with Gryo + if (ioType.equals("graphson-v3")) { // TODO: make this work with Gryo assertEquals(p, propertyAttachable.get()); assertEquals(p.element(), propertyAttachable.get().element()); } http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/729af57f/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoTest.java ---------------------------------------------------------------------- diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoTest.java index e16bbcc..6c188bd 100644 --- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoTest.java +++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoTest.java @@ -607,6 +607,129 @@ public class IoTest { } } + public static final class GraphSONV3D0Test extends AbstractGremlinTest { + private Io.Builder<GraphSONIo> graphson; + + @Before + public void setupBeforeEachTest() { + graphson = graphson(); + } + + /** + * Only need to execute this test with TinkerGraph or other graphs that support user supplied identifiers. + */ + @Test + @FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_STRING_VALUES) + @FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_INTEGER_VALUES) + @FeatureRequirement(featureClass = EdgePropertyFeatures.class, feature = EdgePropertyFeatures.FEATURE_FLOAT_VALUES) + @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_USER_SUPPLIED_IDS) + @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_NUMERIC_IDS) + @FeatureRequirement(featureClass = Graph.Features.VertexPropertyFeatures.class, feature = Graph.Features.VertexPropertyFeatures.FEATURE_USER_SUPPLIED_IDS) + @FeatureRequirement(featureClass = Graph.Features.VariableFeatures.class, feature = FEATURE_VARIABLES) + @LoadGraphWith(LoadGraphWith.GraphData.CLASSIC) + public void shouldWriteNormalizedGraphSON() throws Exception { + try (ByteArrayOutputStream bos = new ByteArrayOutputStream()) { + final GraphSONMapper mapper = graph.io(graphson).mapper().version(GraphSONVersion.V3_0).normalize(true).create(); + final GraphSONWriter w = graph.io(graphson).writer().mapper(mapper).create(); + w.writeGraph(bos, graph); + + final String expected = streamToString(IoTest.class.getResourceAsStream(TestHelper.convertPackageToResourcePath(GraphSONResourceAccess.class) + "tinkerpop-classic-normalized-v3d0.json")); + assertEquals(expected.replace("\n", "").replace("\r", ""), bos.toString().replace("\n", "").replace("\r", "")); + } + } + + @Test + @LoadGraphWith(LoadGraphWith.GraphData.MODERN) + @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES) + @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES) + public void shouldReadWriteModernWrappedInJsonObject() throws Exception { + final GraphSONMapper mapper = graph.io(graphson).mapper().version(GraphSONVersion.V3_0).create(); + try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) { + final GraphWriter writer = graph.io(graphson()).writer().wrapAdjacencyList(true).mapper(mapper).create(); + writer.writeGraph(os, graph); + + final Configuration configuration = graphProvider.newGraphConfiguration("readGraph", this.getClass(), name.getMethodName(), LoadGraphWith.GraphData.MODERN); + graphProvider.clear(configuration); + final Graph g1 = graphProvider.openTestGraph(configuration); + final GraphReader reader = graph.io(graphson()).reader().mapper(mapper).unwrapAdjacencyList(true).create(); + try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) { + reader.readGraph(bais, g1); + } + + // modern uses double natively so always assert as such + IoTest.assertModernGraph(g1, true, true); + + graphProvider.clear(g1, configuration); + } + } + + /** + * This is just a serialization check for JSON. + */ + @Test + @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES) + @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = FEATURE_USER_SUPPLIED_IDS) + @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = FEATURE_ANY_IDS) + public void shouldProperlySerializeCustomIdWithGraphSON() throws Exception { + final UUID id = UUID.fromString("AF4B5965-B176-4552-B3C1-FBBE2F52C305"); + graph.addVertex(T.id, new CustomId("vertex", id)); + + final SimpleModule module = new CustomId.CustomIdTinkerPopJacksonModule(); + final GraphWriter writer = graph.io(graphson).writer().mapper( + graph.io(graphson).mapper().version(GraphSONVersion.V3_0).addCustomModule(module).create()).create(); + + try (final ByteArrayOutputStream baos = new ByteArrayOutputStream()) { + writer.writeGraph(baos, graph); + + // reusing the same config used for creation of "g". + final Configuration configuration = graphProvider.newGraphConfiguration("g2", this.getClass(), name.getMethodName(), null); + graphProvider.clear(configuration); + final Graph g2 = graphProvider.openTestGraph(configuration); + + try (final InputStream is = new ByteArrayInputStream(baos.toByteArray())) { + final GraphReader reader = graph.io(graphson).reader() + .mapper(graph.io(graphson).mapper().version(GraphSONVersion.V3_0).addCustomModule(module).create()).create(); + reader.readGraph(is, g2); + } + + final Vertex v2 = g2.vertices().next(); + final CustomId customId = (CustomId) v2.id(); + assertEquals(id, customId.getElementId()); + assertEquals("vertex", customId.getCluster()); + + // need to manually close the "g2" instance + graphProvider.clear(g2, configuration); + } + } + + @Test + @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES) + @FeatureRequirement(featureClass = EdgePropertyFeatures.class, feature = FEATURE_STRING_VALUES) + @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES) + public void shouldReadWriteSelfLoopingEdges() throws Exception { + final GraphSONMapper mapper = graph.io(graphson).mapper().version(GraphSONVersion.V3_0).create(); + final Graph source = graph; + final Vertex v1 = source.addVertex(); + final Vertex v2 = source.addVertex(); + v1.addEdge("CONTROL", v2); + v1.addEdge("SELFLOOP", v1); + + final Configuration targetConf = graphProvider.newGraphConfiguration("target", this.getClass(), name.getMethodName(), null); + final Graph target = graphProvider.openTestGraph(targetConf); + try (ByteArrayOutputStream os = new ByteArrayOutputStream()) { + source.io(IoCore.graphson()).writer().mapper(mapper).create().writeGraph(os, source); + try (ByteArrayInputStream is = new ByteArrayInputStream(os.toByteArray())) { + target.io(IoCore.graphson()).reader().mapper(mapper).create().readGraph(is, target); + } + } catch (IOException ioe) { + throw new RuntimeException(ioe); + } + + assertEquals(IteratorUtils.count(source.vertices()), IteratorUtils.count(target.vertices())); + assertEquals(IteratorUtils.count(source.edges()), IteratorUtils.count(target.edges())); + } + } + public static void assertCrewGraph(final Graph g1, final boolean lossyForId) { assertEquals(new Long(6), g1.traversal().V().count().next()); assertEquals(new Long(14), g1.traversal().E().count().next()); http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/729af57f/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoVertexTest.java ---------------------------------------------------------------------- diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoVertexTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoVertexTest.java index 6e692c4..d3aaa81 100644 --- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoVertexTest.java +++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoVertexTest.java @@ -83,6 +83,9 @@ public class IoVertexTest extends AbstractGremlinTest { {"graphson-v2-embedded", true, false, (Function<Graph, GraphReader>) g -> g.io(IoCore.graphson()).reader().mapper(g.io(GraphSONIo.build(GraphSONVersion.V2_0)).mapper().typeInfo(TypeInfo.PARTIAL_TYPES).create()).create(), (Function<Graph, GraphWriter>) g -> g.io(IoCore.graphson()).writer().mapper(g.io(GraphSONIo.build(GraphSONVersion.V2_0)).mapper().typeInfo(TypeInfo.PARTIAL_TYPES).create()).create()}, + {"graphson-v3", true, false, + (Function<Graph, GraphReader>) g -> g.io(IoCore.graphson()).reader().mapper(g.io(GraphSONIo.build(GraphSONVersion.V3_0)).mapper().create()).create(), + (Function<Graph, GraphWriter>) g -> g.io(IoCore.graphson()).writer().mapper(g.io(GraphSONIo.build(GraphSONVersion.V3_0)).mapper().create()).create()}, {"gryo", true, true, (Function<Graph, GraphReader>) g -> g.io(IoCore.gryo()).reader().create(), (Function<Graph, GraphWriter>) g -> g.io(IoCore.gryo()).writer().create()} http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/729af57f/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/tinkerpop-classic-normalized-v3d0.json ---------------------------------------------------------------------- diff --git a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/tinkerpop-classic-normalized-v3d0.json b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/tinkerpop-classic-normalized-v3d0.json new file mode 100644 index 0000000..57d1777 --- /dev/null +++ b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/tinkerpop-classic-normalized-v3d0.json @@ -0,0 +1,6 @@ +{"id":{"@type":"g:Int32","@value":1},"label":"vertex","outE":{"created":[{"id":{"@type":"g:Int32","@value":9},"inV":{"@type":"g:Int32","@value":3},"properties":{"weight":{"@type":"g:Float","@value":0.4}}}],"knows":[{"id":{"@type":"g:Int32","@value":7},"inV":{"@type":"g:Int32","@value":2},"properties":{"weight":{"@type":"g:Float","@value":0.5}}},{"id":{"@type":"g:Int32","@value":8},"inV":{"@type":"g:Int32","@value":4},"properties":{"weight":{"@type":"g:Float","@value":1.0}}}]},"properties":{"age":[{"id":{"@type":"g:Int32","@value":2},"value":{"@type":"g:Int32","@value":29}}],"name":[{"id":{"@type":"g:Int32","@value":0},"value":"marko"}]}} +{"id":{"@type":"g:Int32","@value":2},"label":"vertex","inE":{"knows":[{"id":{"@type":"g:Int32","@value":7},"outV":{"@type":"g:Int32","@value":1},"properties":{"weight":{"@type":"g:Float","@value":0.5}}}]},"properties":{"age":[{"id":{"@type":"g:Int32","@value":4},"value":{"@type":"g:Int32","@value":27}}],"name":[{"id":{"@type":"g:Int32","@value":3},"value":"vadas"}]}} +{"id":{"@type":"g:Int32","@value":3},"label":"vertex","inE":{"created":[{"id":{"@type":"g:Int32","@value":11},"outV":{"@type":"g:Int32","@value":4},"properties":{"weight":{"@type":"g:Float","@value":0.4}}},{"id":{"@type":"g:Int32","@value":12},"outV":{"@type":"g:Int32","@value":6},"properties":{"weight":{"@type":"g:Float","@value":0.2}}},{"id":{"@type":"g:Int32","@value":9},"outV":{"@type":"g:Int32","@value":1},"properties":{"weight":{"@type":"g:Float","@value":0.4}}}]},"properties":{"lang":[{"id":{"@type":"g:Int32","@value":6},"value":"java"}],"name":[{"id":{"@type":"g:Int32","@value":5},"value":"lop"}]}} +{"id":{"@type":"g:Int32","@value":4},"label":"vertex","inE":{"knows":[{"id":{"@type":"g:Int32","@value":8},"outV":{"@type":"g:Int32","@value":1},"properties":{"weight":{"@type":"g:Float","@value":1.0}}}]},"outE":{"created":[{"id":{"@type":"g:Int32","@value":10},"inV":{"@type":"g:Int32","@value":5},"properties":{"weight":{"@type":"g:Float","@value":1.0}}},{"id":{"@type":"g:Int32","@value":11},"inV":{"@type":"g:Int32","@value":3},"properties":{"weight":{"@type":"g:Float","@value":0.4}}}]},"properties":{"age":[{"id":{"@type":"g:Int32","@value":8},"value":{"@type":"g:Int32","@value":32}}],"name":[{"id":{"@type":"g:Int32","@value":7},"value":"josh"}]}} +{"id":{"@type":"g:Int32","@value":5},"label":"vertex","inE":{"created":[{"id":{"@type":"g:Int32","@value":10},"outV":{"@type":"g:Int32","@value":4},"properties":{"weight":{"@type":"g:Float","@value":1.0}}}]},"properties":{"lang":[{"id":{"@type":"g:Int32","@value":10},"value":"java"}],"name":[{"id":{"@type":"g:Int32","@value":9},"value":"ripple"}]}} +{"id":{"@type":"g:Int32","@value":6},"label":"vertex","outE":{"created":[{"id":{"@type":"g:Int32","@value":12},"inV":{"@type":"g:Int32","@value":3},"properties":{"weight":{"@type":"g:Float","@value":0.2}}}]},"properties":{"age":[{"id":{"@type":"g:Int32","@value":12},"value":{"@type":"g:Int32","@value":35}}],"name":[{"id":{"@type":"g:Int32","@value":11},"value":"peter"}]}} \ No newline at end of file