You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2016/09/15 18:24:52 UTC
[3/3] tinkerpop git commit: Added a test for persisting
multi-properties in TinkerGraph
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/2d57a32a
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/2d57a32a
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/2d57a32a
Branch: refs/heads/TINKERPOP-1451
Commit: 2d57a32af554271c766ad4cfa0856b57b5806da7
Parents: b1579f3
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:08:31 2016 -0400
----------------------------------------------------------------------
.../tinkergraph/structure/TinkerGraphTest.java | 47 +++++++++++++-------
1 file changed, 32 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2d57a32a/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