[ https://issues.apache.org/jira/browse/TINKERPOP-1274?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15359265#comment-15359265 ]
ASF GitHub Bot commented on TINKERPOP-1274: ------------------------------------------- Github user newkek commented on a diff in the pull request: https://github.com/apache/tinkerpop/pull/351#discussion_r69327810 --- Diff: tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/IoDataGenerationTest.java --- @@ -275,4 +290,78 @@ else if (e.label().equals("writtenBy")) GraphSONWriter.build().mapper(GraphSONMapper.build().embedTypes(true).create()).create().writeGraph(os4, g); os4.close(); } + + @Test + public void shouldWriteGratefulDeadGraphSONV2d0() throws IOException { + final TinkerGraph g = TinkerGraph.open(); + final TinkerGraph readG = TinkerGraph.open(); + + final GraphReader reader = GryoReader.build().create(); + try (final InputStream stream = AbstractGremlinTest.class.getResourceAsStream("/org/apache/tinkerpop/gremlin/structure/io/gryo/grateful-dead.kryo")) { + reader.readGraph(stream, g); + } + final OutputStream os2 = new FileOutputStream(tempPath + "grateful-dead-V2d0-typed.json"); + GraphSONWriter.build().mapper(GraphSONMapper.build().version(GraphSONVersion.V2_0).typeInfo(GraphSONMapper.TypeInfo.PARTIAL_TYPES).create()).create().writeGraph(os2, g); + os2.close(); + + final InputStream is = new FileInputStream(tempPath + "grateful-dead-V2d0-typed.json"); + GraphSONReader.build().mapper(GraphSONMapper.build().version(GraphSONVersion.V2_0).typeInfo(GraphSONMapper.TypeInfo.PARTIAL_TYPES).create()).create().readGraph(is, readG); + is.close(); + + assertEquals(approximateGraphsCheck(g, readG), true); + } + + /** + * Checks sequentially vertices and egdes of both graphs. Will check sequentially Vertex IDs, Vertex Properties IDs + * and values and classes. Then same for edges. To use when serializing a Graph and deserializing the supposedly + * same Graph. + */ + private boolean approximateGraphsCheck(Graph g1, Graph g2) { --- End diff -- So to sum up on that samples issue : - the grateful-dead V1 samples have changed because for some reason, some of the `inE` of some vertices were not written in the same order. I'm almost sure the fix here has nothing to do with that order change, so I pushed the changed ones. It also doesn't concern the `normalize` option of the GraphSON mapper, since the `inE` are generally not ordered. So, quite a mystery but I definitely don't that's something introduced by this branch. - The `data/` folder now has the new `-v2d0` and `-v2d0-typed` graphs, but not the `normalized` ones. - The `gremlin-test/src/main/ressources/etc...` has all the new v2 graphs and the normalized ones. - I don't know what's up with the `sample.kryo` but there's near to 0.00001% chances it's related to that branch. But I pushed the change though. > GraphSON Version 2.0 > -------------------- > > Key: TINKERPOP-1274 > URL: https://issues.apache.org/jira/browse/TINKERPOP-1274 > Project: TinkerPop > Issue Type: Improvement > Components: io > Affects Versions: 3.1.2-incubating > Reporter: stephen mallette > Priority: Minor > Fix For: 3.2.1 > > > Develop a revised version of GraphSON that provides better support for > non-JVM languages that consume it. -- This message was sent by Atlassian JIRA (v6.3.4#6332)