You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by dk...@apache.org on 2018/08/01 19:29:46 UTC

[22/50] [abbrv] tinkerpop git commit: TINKERPOP-1996 Testing for GraphSON and IoRegistry configuration

TINKERPOP-1996 Testing for GraphSON and IoRegistry configuration


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

Branch: refs/heads/TINKERPOP-1990
Commit: ae3f685ad7af326c9f1282da296e9db49f94da03
Parents: 7f1bf17
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Jul 20 11:55:09 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Jul 20 11:55:09 2018 -0400

----------------------------------------------------------------------
 .../step/sideEffect/TinkerGraphIoStepTest.java  | 23 ++++++++++++++++++++
 1 file changed, 23 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ae3f685a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/traversal/step/sideEffect/TinkerGraphIoStepTest.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/traversal/step/sideEffect/TinkerGraphIoStepTest.java b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/traversal/step/sideEffect/TinkerGraphIoStepTest.java
index 06c4db8..8bab7da 100644
--- a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/traversal/step/sideEffect/TinkerGraphIoStepTest.java
+++ b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/traversal/step/sideEffect/TinkerGraphIoStepTest.java
@@ -72,4 +72,27 @@ public class TinkerGraphIoStepTest {
 
         assertEquals(1, emptyG.V().has("custom", new CustomId("a", uuid)).count().next().intValue());
     }
+
+    @Test
+    public void shouldWriteReadWithCustomIoRegistryGraphSON() throws Exception {
+        final UUID uuid = UUID.randomUUID();
+        g.addV("person").property("name","stephen").property("custom", new CustomId("a", uuid)).iterate();
+
+        final File file = TestHelper.generateTempFile(TinkerGraphIoStepTest.class, "shouldWriteReadWithCustomIoRegistryGraphSON", ".json");
+        g.io(file.getAbsolutePath()).with(IO.registry, CustomId.CustomIdIoRegistry.class.getName()).write().iterate();
+
+        final Graph emptyGraph = TinkerGraph.open();
+        final GraphTraversalSource emptyG = emptyGraph.traversal();
+
+        try {
+            emptyG.io(file.getAbsolutePath()).read().iterate();
+            fail("Can't read without a registry");
+        } catch (Exception ignored) {
+            // do nothing
+        }
+
+        emptyG.io(file.getAbsolutePath()).with(IO.registry, CustomId.CustomIdIoRegistry.instance()).read().iterate();
+
+        assertEquals(1, emptyG.V().has("custom", new CustomId("a", uuid)).count().next().intValue());
+    }
 }