Github user spmallette commented on a diff in the pull request:
https://github.com/apache/tinkerpop/pull/351#discussion_r68940083
--- 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 --
These are good tests, but they don't belong in `IoDataGenerationTest`. I
think you could move them somewhere else. The point of this test is to generate
the sample data that we ship with our distributions and use in tests. You
should include "tests" that generate 2.0 versions of grateful-dead, classic,
modern and crew graphs. Then, to generate the data, just run:
```text
cd tinkergraph-gremlin
mvn clean install -Dio
```
You should see the new files in the appropriate places. I guess for now
they should be named with a suffix like:
```text
grateful-dead-v2d0.json
```
Let's leave the 1.0 naming as-is for now so as not to break anything
existing that relies on the file names being what they are. I think we had also
said that we would keep 1.0 as the default for now and then look to 3.3.x to
make 2.0 the default - that would produce the least amount of breaking change,
so i guess that approach would be in line with that thinking. Does that make
sense?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---