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 2015/12/30 17:30:45 UTC

[1/5] incubator-tinkerpop git commit: Initial development to track open graph instances in the tests.

Repository: incubator-tinkerpop
Updated Branches:
  refs/heads/master 2ca6c9629 -> 9444168f9


Initial development to track open graph instances in the tests.

Neo4j is currently not passing


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

Branch: refs/heads/master
Commit: 947d192e682fb1a3c9470c87bed8b4cebf69a60e
Parents: 0926604
Author: Nghia Tran <ng...@gmail.com>
Authored: Sun Dec 6 17:25:34 2015 -0500
Committer: Nghia Tran <ng...@gmail.com>
Committed: Mon Dec 21 17:01:34 2015 -0500

----------------------------------------------------------------------
 .../tinkerpop/gremlin/AbstractGremlinTest.java  |   3 +
 .../apache/tinkerpop/gremlin/GraphManager.java  | 102 ++++++++++++++++++-
 2 files changed, 104 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/947d192e/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinTest.java
index ebf804b..e859208 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinTest.java
@@ -133,6 +133,9 @@ public abstract class AbstractGremlinTest {
     public void tearDown() throws Exception {
         if (null != graphProvider) {
             graphProvider.clear(graph, config);
+            if(graphProvider instanceof GraphManager.ManagedGraphProvider)
+                ((GraphManager.ManagedGraphProvider)graphProvider).tryCloseGraphs();
+
             g = null;
             config = null;
             graphProvider = null;

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/947d192e/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphManager.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphManager.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphManager.java
index 4b3c98c..23f5c8e 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphManager.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphManager.java
@@ -18,7 +18,17 @@
  */
 package org.apache.tinkerpop.gremlin;
 
+import org.apache.commons.configuration.Configuration;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalEngine;
+import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
+import org.apache.tinkerpop.gremlin.structure.Element;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
 /**
  * Holds objects specified by the test suites supplying them in a static manner to the test cases.
@@ -36,7 +46,7 @@ public class GraphManager {
     }
 
     public static GraphProvider getGraphProvider() {
-        return graphProvider;
+        return new ManagedGraphProvider(graphProvider);
     }
 
     public static TraversalEngine.Type setTraversalEngineType(final TraversalEngine.Type traversalEngine) {
@@ -48,4 +58,94 @@ public class GraphManager {
     public static TraversalEngine.Type getTraversalEngineType() {
         return traversalEngineType;
     }
+
+    public static class ManagedGraphProvider implements GraphProvider {
+        private final GraphProvider innerGraphProvider;
+        private final List<Graph> openGraphs = new ArrayList<>();
+
+        public ManagedGraphProvider(final GraphProvider innerGraphProvider){
+            this.innerGraphProvider = innerGraphProvider;
+        }
+
+        public void tryCloseGraphs(){
+            for(Graph graph : openGraphs) {
+                try {
+                    graph.close();
+                }catch (Exception e){
+                    e.printStackTrace();
+                }
+            }
+        }
+
+        @Override
+        public GraphTraversalSource traversal(final Graph graph) {
+            return innerGraphProvider.traversal(graph);
+        }
+
+        @Override
+        public GraphTraversalSource traversal(final Graph graph, final TraversalStrategy... strategies) {
+            return innerGraphProvider.traversal(graph, strategies);
+        }
+
+        @Override
+        public Graph standardTestGraph(final Class<?> test, final String testMethodName, final LoadGraphWith.GraphData loadGraphWith) {
+            final Graph graph = innerGraphProvider.standardTestGraph(test, testMethodName, loadGraphWith);
+            openGraphs.add(graph);
+            return graph;
+        }
+
+        @Override
+        public Graph openTestGraph(final Configuration config) {
+            final Graph graph = innerGraphProvider.openTestGraph(config);
+            openGraphs.add(graph);
+            return graph;
+        }
+
+        @Override
+        public Configuration standardGraphConfiguration(final Class<?> test, final String testMethodName, final LoadGraphWith.GraphData loadGraphWith) {
+            return innerGraphProvider.standardGraphConfiguration(test, testMethodName, loadGraphWith);
+        }
+
+        @Override
+        public void clear(final Configuration configuration) throws Exception {
+            innerGraphProvider.clear(configuration);
+        }
+
+        @Override
+        public void clear(final Graph graph, final Configuration configuration) throws Exception {
+            innerGraphProvider.clear(graph, configuration);
+        }
+
+        @Override
+        public Object convertId(final Object id, final Class<? extends Element> c) {
+            return innerGraphProvider.convertId(id, c);
+        }
+
+        @Override
+        public String convertLabel(final String label) {
+            return innerGraphProvider.convertLabel(label);
+        }
+
+        @Override
+        public Configuration newGraphConfiguration(final String graphName, final Class<?> test, final String testMethodName,
+                                                   final Map<String, Object> configurationOverrides, final LoadGraphWith.GraphData loadGraphWith) {
+            return innerGraphProvider.newGraphConfiguration(graphName, test, testMethodName, configurationOverrides, loadGraphWith);
+        }
+
+        @Override
+        public Configuration newGraphConfiguration(final String graphName, final Class<?> test, final String testMethodName,final LoadGraphWith.GraphData loadGraphWith) {
+            return innerGraphProvider.newGraphConfiguration(graphName, test, testMethodName, loadGraphWith);
+        }
+
+        @Override
+        public void loadGraphData(final Graph graph, final LoadGraphWith loadGraphWith, final Class testClass, final String testName) {
+            innerGraphProvider.loadGraphData(graph, loadGraphWith, testClass, testName);
+        }
+
+        @Override
+        public Set<Class> getImplementations() {
+            return innerGraphProvider.getImplementations();
+        }
+    }
+
 }


[2/5] incubator-tinkerpop git commit: Refactor tests to use member variables for graphProvider

Posted by sp...@apache.org.
Refactor tests to use member variables for graphProvider


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

Branch: refs/heads/master
Commit: 0926604ecdfcf5c9ece592f94470df7d3434c701
Parents: 5760bf0
Author: Nghia Tran <ng...@gmail.com>
Authored: Tue Dec 1 19:18:42 2015 -0500
Committer: Nghia Tran <ng...@gmail.com>
Committed: Mon Dec 21 17:01:34 2015 -0500

----------------------------------------------------------------------
 .../tinkerpop/gremlin/structure/GraphTest.java    | 16 +++-------------
 .../tinkerpop/gremlin/structure/PropertyTest.java |  4 ++--
 .../tinkerpop/gremlin/structure/VertexTest.java   | 18 +++++++++---------
 3 files changed, 14 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/0926604e/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/GraphTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/GraphTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/GraphTest.java
index 09d836a..830e259 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/GraphTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/GraphTest.java
@@ -874,7 +874,7 @@ public class GraphTest extends AbstractGremlinTest {
                 final Vertex a = vertices.get(random.nextInt(vertices.size()));
                 final Vertex b = vertices.get(random.nextInt(vertices.size()));
                 if (a != b) {
-                    edges.add(a.addEdge(GraphManager.getGraphProvider().convertLabel("a" + UUID.randomUUID()), b));
+                    edges.add(a.addEdge(graphProvider.convertLabel("a" + UUID.randomUUID()), b));
                     created = true;
                 }
             }
@@ -910,7 +910,7 @@ public class GraphTest extends AbstractGremlinTest {
         for (int i = 0; i < vertexCount; i = i + 2) {
             final Vertex a = vertices.get(i);
             final Vertex b = vertices.get(i + 1);
-            edges.add(a.addEdge(GraphManager.getGraphProvider().convertLabel("a" + UUID.randomUUID()), b));
+            edges.add(a.addEdge(graphProvider.convertLabel("a" + UUID.randomUUID()), b));
         }
 
         tryCommit(graph, assertVertexEdgeCounts(vertexCount, vertexCount / 2));
@@ -975,8 +975,6 @@ public class GraphTest extends AbstractGremlinTest {
     @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
     public void shouldEvaluateConnectivityPatterns() {
-        final GraphProvider graphProvider = GraphManager.getGraphProvider();
-
         final Vertex a;
         final Vertex b;
         final Vertex c;
@@ -1066,10 +1064,7 @@ public class GraphTest extends AbstractGremlinTest {
     @Test
     @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
-    public void shouldTraverseInOutFromVertexWithSingleEdgeLabelFilter() {
-        final GraphProvider graphProvider = GraphManager.getGraphProvider();
-
-        final Vertex a = graph.addVertex();
+    public void shouldTraverseInOutFromVertexWithSingleEdgeLabelFilter() {final Vertex a = graph.addVertex();
         final Vertex b = graph.addVertex();
         final Vertex c = graph.addVertex();
 
@@ -1117,7 +1112,6 @@ public class GraphTest extends AbstractGremlinTest {
     @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
     public void shouldTraverseInOutFromVertexWithMultipleEdgeLabelFilter() {
-        final GraphProvider graphProvider = GraphManager.getGraphProvider();
         final Vertex a = graph.addVertex();
         final Vertex b = graph.addVertex();
         final Vertex c = graph.addVertex();
@@ -1154,8 +1148,6 @@ public class GraphTest extends AbstractGremlinTest {
     @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
     public void shouldTestTreeConnectivity() {
-        final GraphProvider graphProvider = GraphManager.getGraphProvider();
-
         int branchSize = 11;
         final Vertex start = graph.addVertex();
         for (int i = 0; i < branchSize; i++) {
@@ -1201,8 +1193,6 @@ public class GraphTest extends AbstractGremlinTest {
     @FeatureRequirementSet(FeatureRequirementSet.Package.SIMPLE)
     @FeatureRequirement(featureClass = Graph.Features.GraphFeatures.class, feature = Graph.Features.GraphFeatures.FEATURE_PERSISTENCE)
     public void shouldPersistDataOnClose() throws Exception {
-        final GraphProvider graphProvider = GraphManager.getGraphProvider();
-
         final Vertex v = graph.addVertex();
         final Vertex u = graph.addVertex();
         if (graph.features().vertex().properties().supportsStringValues()) {

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/0926604e/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/PropertyTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/PropertyTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/PropertyTest.java
index 6d48961..2d5623e 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/PropertyTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/PropertyTest.java
@@ -472,13 +472,13 @@ public class PropertyTest {
         private Edge createEdgeForPropertyFeatureTests() {
             final Vertex vertexA = graph.addVertex();
             final Vertex vertexB = graph.addVertex();
-            return vertexA.addEdge(GraphManager.getGraphProvider().convertLabel("knows"), vertexB);
+            return vertexA.addEdge(graphProvider.convertLabel("knows"), vertexB);
         }
 
         private Edge createEdgeForPropertyFeatureTests(final String k, Object v) {
             final Vertex vertexA = graph.addVertex();
             final Vertex vertexB = graph.addVertex();
-            return vertexA.addEdge(GraphManager.getGraphProvider().convertLabel("knows"), vertexB, k, v);
+            return vertexA.addEdge(graphProvider.convertLabel("knows"), vertexB, k, v);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/0926604e/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexTest.java
index f097e01..9aab219 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexTest.java
@@ -259,7 +259,7 @@ public class VertexTest {
         @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_USER_SUPPLIED_IDS)
         public void shouldHaveExceptionConsistencyWhenAssigningSameIdOnEdge() {
             final Vertex v = graph.addVertex();
-            final Object o = GraphManager.getGraphProvider().convertId("1", Edge.class);
+            final Object o = graphProvider.convertId("1", Edge.class);
             v.addEdge("self", v, T.id, o);
 
             try {
@@ -359,8 +359,8 @@ public class VertexTest {
         @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
         @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_USER_SUPPLIED_IDS)
         public void shouldEvaluateVerticesEquivalentWithSuppliedIdsViaTraversal() {
-            final Vertex v = graph.addVertex(T.id, GraphManager.getGraphProvider().convertId("1", Vertex.class));
-            final Vertex u = graph.vertices(GraphManager.getGraphProvider().convertId("1", Vertex.class)).next();
+            final Vertex v = graph.addVertex(T.id, graphProvider.convertId("1", Vertex.class));
+            final Vertex u = graph.vertices(graphProvider.convertId("1", Vertex.class)).next();
             assertEquals(v, u);
         }
 
@@ -368,8 +368,8 @@ public class VertexTest {
         @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
         @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_USER_SUPPLIED_IDS)
         public void shouldEvaluateVerticesEquivalentWithSuppliedIdsViaIterators() {
-            final Vertex v = graph.addVertex(T.id, GraphManager.getGraphProvider().convertId("1", Vertex.class));
-            final Vertex u = graph.vertices(GraphManager.getGraphProvider().convertId("1", Vertex.class)).next();
+            final Vertex v = graph.addVertex(T.id, graphProvider.convertId("1", Vertex.class));
+            final Vertex u = graph.vertices(graphProvider.convertId("1", Vertex.class)).next();
             assertEquals(v, u);
         }
 
@@ -392,8 +392,8 @@ public class VertexTest {
         @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
         @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_USER_SUPPLIED_IDS)
         public void shouldEvaluateEquivalentVertexHashCodeWithSuppliedIds() {
-            final Vertex v = graph.addVertex(T.id, GraphManager.getGraphProvider().convertId("1", Vertex.class));
-            final Vertex u = graph.vertices(GraphManager.getGraphProvider().convertId("1", Vertex.class)).next();
+            final Vertex v = graph.addVertex(T.id, graphProvider.convertId("1", Vertex.class));
+            final Vertex u = graph.vertices(graphProvider.convertId("1", Vertex.class)).next();
             assertEquals(v, u);
 
             final Set<Vertex> set = new HashSet<>();
@@ -401,8 +401,8 @@ public class VertexTest {
             set.add(v);
             set.add(u);
             set.add(u);
-            set.add(graph.vertices(GraphManager.getGraphProvider().convertId("1", Vertex.class)).next());
-            set.add(graph.vertices(GraphManager.getGraphProvider().convertId("1", Vertex.class)).next());
+            set.add(graph.vertices(graphProvider.convertId("1", Vertex.class)).next());
+            set.add(graph.vertices(graphProvider.convertId("1", Vertex.class)).next());
 
             assertEquals(1, set.size());
             assertEquals(v.hashCode(), u.hashCode());


[4/5] incubator-tinkerpop git commit: HDFS wasn't getting the right directory and the assert fails.

Posted by sp...@apache.org.
HDFS wasn't getting the right directory and the assert fails.


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

Branch: refs/heads/master
Commit: eb7321184004a8a89445c8072e4a3ce3385e8e46
Parents: 2c07233
Author: Nghia Tran <ng...@gmail.com>
Authored: Wed Dec 23 15:22:15 2015 -0500
Committer: Nghia Tran <ng...@gmail.com>
Committed: Wed Dec 23 15:22:15 2015 -0500

----------------------------------------------------------------------
 .../main/java/org/apache/tinkerpop/gremlin/GraphManager.java    | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/eb732118/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphManager.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphManager.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphManager.java
index 0c93e58..39524bf 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphManager.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphManager.java
@@ -86,6 +86,11 @@ public class GraphManager {
         }
 
         @Override
+        public String getWorkingDirectory() {
+            return innerGraphProvider.getWorkingDirectory();
+        }
+
+        @Override
         public GraphTraversalSource traversal(final Graph graph) {
             return innerGraphProvider.traversal(graph);
         }


[3/5] incubator-tinkerpop git commit: Added Java docs.

Posted by sp...@apache.org.
Added Java docs.


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

Branch: refs/heads/master
Commit: 2c07233e98561a9609ea17ea7a24cf49fc6261fe
Parents: 947d192
Author: Nghia Tran <ng...@gmail.com>
Authored: Mon Dec 21 19:27:57 2015 -0500
Committer: Nghia Tran <ng...@gmail.com>
Committed: Mon Dec 21 19:27:57 2015 -0500

----------------------------------------------------------------------
 .../org/apache/tinkerpop/gremlin/AbstractGremlinTest.java    | 6 ++++++
 .../main/java/org/apache/tinkerpop/gremlin/GraphManager.java | 8 ++++++++
 2 files changed, 14 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/2c07233e/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinTest.java
index e859208..14b1bcf 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinTest.java
@@ -133,8 +133,14 @@ public abstract class AbstractGremlinTest {
     public void tearDown() throws Exception {
         if (null != graphProvider) {
             graphProvider.clear(graph, config);
+
+            // All GraphProvider objects should be an instance of ManagedGraphProvider, as this is handled by GraphManager
+            // which wraps injected GraphProviders with a ManagedGraphProvider instance. If this doesn't happen, there
+            // is no way to trace open graphs.
             if(graphProvider instanceof GraphManager.ManagedGraphProvider)
                 ((GraphManager.ManagedGraphProvider)graphProvider).tryCloseGraphs();
+            else
+                logger.warn("The {} is not of type ManagedGraphProvider and therefore graph instances may leak between test cases.", graphProvider.getClass());
 
             g = null;
             config = null;

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/2c07233e/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphManager.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphManager.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphManager.java
index 23f5c8e..0c93e58 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphManager.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphManager.java
@@ -45,6 +45,9 @@ public class GraphManager {
         return old;
     }
 
+    /**
+     * Gets the {@link GraphProvider} from the current test suite and wraps it in a {@link ManagedGraphProvider}.
+     */
     public static GraphProvider getGraphProvider() {
         return new ManagedGraphProvider(graphProvider);
     }
@@ -59,6 +62,11 @@ public class GraphManager {
         return traversalEngineType;
     }
 
+    /**
+     * This class provides a way to intercepts calls to {@link Graph} implementation's {@link GraphProvider} instances.
+     * When {@link #openTestGraph(Configuration)} is called the created object is stored in a list and when tests are
+     * complete the {@link #tryCloseGraphs()} is called. When this is called, an attempt is made to close all open graphs.
+     */
     public static class ManagedGraphProvider implements GraphProvider {
         private final GraphProvider innerGraphProvider;
         private final List<Graph> openGraphs = new ArrayList<>();


[5/5] incubator-tinkerpop git commit: Merge branch 'TINKERPOP-983' of https://github.com/n-tran/incubator-tinkerpop

Posted by sp...@apache.org.
Merge branch 'TINKERPOP-983' of https://github.com/n-tran/incubator-tinkerpop


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

Branch: refs/heads/master
Commit: 9444168f913717db14aa2063a44f9c8c5c2dbd29
Parents: 2ca6c96 eb73211
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Dec 30 11:30:25 2015 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Dec 30 11:30:25 2015 -0500

----------------------------------------------------------------------
 .../tinkerpop/gremlin/AbstractGremlinTest.java  |   9 ++
 .../apache/tinkerpop/gremlin/GraphManager.java  | 115 ++++++++++++++++++-
 .../tinkerpop/gremlin/structure/GraphTest.java  |  16 +--
 .../gremlin/structure/PropertyTest.java         |   4 +-
 .../tinkerpop/gremlin/structure/VertexTest.java |  18 +--
 5 files changed, 137 insertions(+), 25 deletions(-)
----------------------------------------------------------------------