You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by ok...@apache.org on 2016/01/05 23:54:46 UTC
[14/50] incubator-tinkerpop git commit: Added Java docs.
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/TINKERPOP-1033
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<>();