Repository: tinkerpop Updated Branches: refs/heads/TINKERPOP-1451 [created] 2d57a32af
TinkerGraph's would not save on close() if the path was just a file name. Tested "just a file name" manually and added a test for relative paths - didn't want to generate test data outside of our test directories. TINKERPOP-1451 Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/6a6b44d8 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/6a6b44d8 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/6a6b44d8 Branch: refs/heads/TINKERPOP-1451 Commit: 6a6b44d85a4e3e7f6e83778aab9fc21436ef6004 Parents: 146f36f Author: Stephen Mallette <[email protected]> Authored: Thu Sep 15 13:51:33 2016 -0400 Committer: Stephen Mallette <[email protected]> Committed: Thu Sep 15 13:51:33 2016 -0400 ---------------------------------------------------------------------- CHANGELOG.asciidoc | 3 ++- .../tinkergraph/structure/TinkerGraph.java | 4 +++- .../tinkergraph/structure/TinkerGraphTest.java | 19 +++++++++++++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6a6b44d8/CHANGELOG.asciidoc ---------------------------------------------------------------------- diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 646e496..1c715cc 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -26,7 +26,8 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima TinkerPop 3.1.5 (Release Date: NOT OFFICIALLY RELEASED YET) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+ Removed the `appveyor.yml` file as the AppVeyor build is no longer enabled by Apache Infrastructure. +* Removed the `appveyor.yml` file as the AppVeyor build is no longer enabled by Apache Infrastructure. +* Fixed TinkerGraph which was not saving on `close()` if the path only consisted of the file name. [[release-3-1-4]] TinkerPop 3.1.4 (Release Date: September 6, 2016) http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6a6b44d8/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java ---------------------------------------------------------------------- diff --git a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java index af7245a..5df47b6 100644 --- a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java +++ b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java @@ -299,7 +299,9 @@ public final class TinkerGraph implements Graph { f.delete(); } else { final File parent = f.getParentFile(); - if (!parent.exists()) { + + // the parent would be null in the case of an relative path if the graphLocation was simply: "f.gryo" + if (parent != null && !parent.exists()) { parent.mkdirs(); } } http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6a6b44d8/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 fca1275..c527647 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 @@ -440,6 +440,25 @@ public class TinkerGraphTest { } @Test + public void shouldPersistWithRelativePath() { + final String graphLocation = TestHelper.convertToRelative(TinkerGraphTest.class, + new File(TestHelper.makeTestDataDirectory(TinkerGraphTest.class))) + "shouldPersistToGryo.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.generateModern(graph); + graph.close(); + + final TinkerGraph reloadedGraph = TinkerGraph.open(conf); + IoTest.assertModernGraph(reloadedGraph, true, false); + reloadedGraph.close(); + } + + @Test public void shouldPersistToAnyGraphFormat() { final String graphLocation = TestHelper.makeTestDataDirectory(TinkerGraphTest.class) + "shouldPersistToAnyGraphFormat.dat"; final File f = new File(graphLocation);
