Repository: tinkerpop
Updated Branches:
  refs/heads/master 554bbb82e -> ba58ca1b0


Added a test for persisting multi-properties in TinkerGraph

Changed the test back to using a relative path in the data directory - didn't 
like it polluting the source control directories.


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

Branch: refs/heads/master
Commit: 356b7c81a9517c89204efb1f0e0e30037bd04ae0
Parents: 371bb39
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Sep 15 14:08:31 2016 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Sep 15 14:41:00 2016 -0400

----------------------------------------------------------------------
 .../tinkergraph/structure/TinkerGraphTest.java  | 47 +++++++++++++-------
 1 file changed, 32 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/356b7c81/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphTest.java
----------------------------------------------------------------------
diff --git 
a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphTest.java
 
b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphTest.java
index e9b7f7b..f5797ca 100644
--- 
a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphTest.java
+++ 
b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphTest.java
@@ -27,6 +27,7 @@ import org.apache.tinkerpop.gremlin.structure.Edge;
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.T;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.apache.tinkerpop.gremlin.structure.VertexProperty;
 import org.apache.tinkerpop.gremlin.structure.io.Io;
 import org.apache.tinkerpop.gremlin.structure.io.GraphReader;
 import org.apache.tinkerpop.gremlin.structure.io.GraphWriter;
@@ -440,25 +441,41 @@ public class TinkerGraphTest {
     }
 
     @Test
+    public void shouldPersistToGryoAndHandleMultiProperties() {
+        final String graphLocation = 
TestHelper.makeTestDataDirectory(TinkerGraphTest.class) + 
"shouldPersistToGryoMulti.kryo";
+        final File f = new File(graphLocation);
+        if (f.exists() && f.isFile()) f.delete();
+
+        final Configuration conf = new BaseConfiguration();
+        conf.setProperty(TinkerGraph.GREMLIN_TINKERGRAPH_GRAPH_FORMAT, "gryo");
+        conf.setProperty(TinkerGraph.GREMLIN_TINKERGRAPH_GRAPH_LOCATION, 
graphLocation);
+        final TinkerGraph graph = TinkerGraph.open(conf);
+        TinkerFactory.generateTheCrew(graph);
+        graph.close();
+
+        
conf.setProperty(TinkerGraph.GREMLIN_TINKERGRAPH_DEFAULT_VERTEX_PROPERTY_CARDINALITY,
 VertexProperty.Cardinality.list.toString());
+        final TinkerGraph reloadedGraph = TinkerGraph.open(conf);
+        IoTest.assertCrewGraph(reloadedGraph, false);
+        reloadedGraph.close();
+    }
+
+    @Test
     public void shouldPersistWithRelativePath() {
-        final String graphLocation = "shouldPersistToGryoRelative.kryo";
+        final String graphLocation = 
TestHelper.convertToRelative(TinkerGraphTest.class,
+                new 
File(TestHelper.makeTestDataDirectory(TinkerGraphTest.class)))  + 
"shouldPersistToGryoRelative.kryo";
         final File f = new File(graphLocation);
         if (f.exists() && f.isFile()) f.delete();
 
-        try {
-            final Configuration conf = new BaseConfiguration();
-            conf.setProperty(TinkerGraph.GREMLIN_TINKERGRAPH_GRAPH_FORMAT, 
"gryo");
-            conf.setProperty(TinkerGraph.GREMLIN_TINKERGRAPH_GRAPH_LOCATION, 
graphLocation);
-            final TinkerGraph graph = TinkerGraph.open(conf);
-            TinkerFactory.generateModern(graph);
-            graph.close();
-
-            final TinkerGraph reloadedGraph = TinkerGraph.open(conf);
-            IoTest.assertModernGraph(reloadedGraph, true, false);
-            reloadedGraph.close();
-        } catch (Exception ex) {
-            if (f.exists() && f.isFile()) f.delete();
-        }
+        final Configuration conf = new BaseConfiguration();
+        conf.setProperty(TinkerGraph.GREMLIN_TINKERGRAPH_GRAPH_FORMAT, "gryo");
+        conf.setProperty(TinkerGraph.GREMLIN_TINKERGRAPH_GRAPH_LOCATION, 
graphLocation);
+        final TinkerGraph graph = TinkerGraph.open(conf);
+        TinkerFactory.generateModern(graph);
+        graph.close();
+
+        final TinkerGraph reloadedGraph = TinkerGraph.open(conf);
+        IoTest.assertModernGraph(reloadedGraph, true, false);
+        reloadedGraph.close();
     }
 
     @Test

Reply via email to