Update javadoc and comments for clear method;
Remove unused import

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

Branch: refs/heads/tp32
Commit: 038b9cd759d0ac97a3c3820ec55026938d4c74be
Parents: 32a8ee6
Author: Justin Chu <15710241+justinch...@users.noreply.github.com>
Authored: Tue Aug 21 15:14:16 2018 -0400
Committer: Justin Chu <15710241+justinch...@users.noreply.github.com>
Committed: Tue Aug 21 17:33:34 2018 -0400

----------------------------------------------------------------------
 .../apache/tinkerpop/gremlin/AbstractGremlinTest.java   |  4 +++-
 .../org/apache/tinkerpop/gremlin/GraphProvider.java     | 12 +++++++++---
 2 files changed, 12 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/038b9cd7/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 8485d56..a03e351 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
@@ -31,7 +31,6 @@ import org.apache.tinkerpop.gremlin.structure.VertexProperty;
 import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
 import org.junit.After;
 import org.junit.Before;
-import org.junit.BeforeClass;
 import org.junit.Rule;
 import org.junit.rules.TestName;
 import org.slf4j.Logger;
@@ -133,6 +132,8 @@ public abstract class AbstractGremlinTest {
     public void tearDown() throws Exception {
         if (null != graphProvider) {
             graphProvider.getTestListener().ifPresent(l -> 
l.onTestEnd(this.getClass(), name.getMethodName()));
+
+            // GraphProvider that has implemented the clear method must check 
null for graph and config.
             graphProvider.clear(graph, config);
 
             // All GraphProvider objects should be an instance of 
ManagedGraphProvider, as this is handled by GraphManager
@@ -144,6 +145,7 @@ public abstract class AbstractGremlinTest {
                 logger.warn("The {} is not of type ManagedGraphProvider and 
therefore graph instances may leak between test cases.", 
graphProvider.getClass());
 
             g = null;
+            graph = null;
             config = null;
             graphProvider = null;
         }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/038b9cd7/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphProvider.java
----------------------------------------------------------------------
diff --git 
a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphProvider.java 
b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphProvider.java
index c785cfc..30af95a 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphProvider.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphProvider.java
@@ -125,8 +125,8 @@ public interface GraphProvider {
     }
 
     /**
-     * Creates a new {@link Graph} instance from the Configuration object 
using {@link GraphFactory}. The assumption
-     * here is that the {@code Configuration} has been created by one of the
+     * Creates a new {@link Graph} instance from the {@link 
org.apache.commons.configuration.Configuration} object using {@link 
GraphFactory}.
+     * The assumption here is that the {@code Configuration} has been created 
by one of the
      * {@link #newGraphConfiguration(String, Class, String, 
LoadGraphWith.GraphData)} methods and has therefore
      * already been modified by the implementation as necessary for {@link 
Graph} creation.
      */
@@ -149,6 +149,9 @@ public interface GraphProvider {
      * to construct the graph.  The default implementation simply calls
      * {@link #clear(Graph, org.apache.commons.configuration.Configuration)} 
with
      * a null graph argument.
+     * <p/>
+     * Implementations should be able to accept an argument of null for the 
{@code org.apache.commons.configuration.Configuration}
+     * as well, and a proper handling is needed. Otherwise, a 
NullPointerException may be thrown.
      */
     public default void clear(final Configuration configuration) throws 
Exception {
         clear(null, configuration);
@@ -160,10 +163,13 @@ public interface GraphProvider {
      * For a brute force approach, implementers can simply delete data 
directories provided in the configuration.
      * Implementers may choose a more elegant approach if it exists.
      * <p/>
-     * Implementations should be able to accept an argument of null for the 
Graph, in which case the only action
+     * Implementations should be able to accept an argument of null for the 
{@code Graph}, in which case the only action
      * that can be performed is a clear given the configuration.  The method 
will typically be called this way
      * as clean up task on setup to ensure that a persisted graph has a clear 
space to create a test graph.
      * <p/>
+     * Implementations should be able to accept an argument of null for the 
{@code org.apache.commons.configuration.Configuration}
+     * as well, and a proper handling is needed. Otherwise, a 
NullPointerException may be thrown.
+     * <p/>
      * Calls to this method may occur multiple times for a specific test. 
Develop this method to be idempotent.
      */
     public void clear(final Graph graph, final Configuration configuration) 
throws Exception;

Reply via email to