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:35 UTC

[03/50] incubator-tinkerpop git commit: TINKERPOP-1052 Fixed a bug in OptOut when using method wildcard.

TINKERPOP-1052 Fixed a bug in OptOut when using method wildcard.

This problem seemed to occur when trying to opt-out a whole test case of parameterized tests (i think).  Seems like parameterized tests don't pass the test class down in the junit test Description which then triggers a NullPointerException.


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

Branch: refs/heads/TINKERPOP-1033
Commit: 529512f6eb23db456c6766bb13e5b2554fffddc1
Parents: 0c74e39
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Dec 18 08:39:32 2015 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Dec 18 08:39:32 2015 -0500

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |  1 +
 .../tinkerpop/gremlin/AbstractGremlinSuite.java | 25 +++++++++++++-------
 2 files changed, 17 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/529512f6/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 4de69c1..f90c92d 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,6 +26,7 @@ image::https://raw.githubusercontent.com/apache/incubator-tinkerpop/master/docs/
 TinkerPop 3.1.1 (NOT OFFICIALLY RELEASED YET)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+* Fixed a bug in `Graph.OptOut` when trying to opt-out of certain test cases with the `method` property set to "*".
 * Fixed a `SparkGraphComputer` sorting bug in MapReduce that occurred when there was more than one partition.
 * Added `strictTransactionManagement` to the Gremlin Server settings to indicate that the `aliases` parameter must be passed on requests and that transaction management will be scoped to the graphs provided in that argument.
 * Fixed a `NullPointerException` bug in `PeerPressureVertexProgram` that occurred when an adjacency traversal was not provided.

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/529512f6/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinSuite.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinSuite.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinSuite.java
index 1aab8aa..fa9d0e6 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinSuite.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinSuite.java
@@ -282,15 +282,14 @@ public abstract class AbstractGremlinSuite extends Suite {
 
         @Override
         public boolean shouldRun(final Description description) {
-            // first check if all tests from a class should be ignored.
-            if (!entireTestCaseToIgnore.isEmpty() && entireTestCaseToIgnore.stream().map(optOut -> {
-                try {
-                    return Class.forName(optOut.test());
-                } catch (Exception ex) {
-                    throw new RuntimeException(ex);
-                }
-            }).anyMatch(claxx -> claxx.isAssignableFrom(description.getTestClass()))) {
-                return false;
+            // first check if all tests from a class should be ignored - where "OptOut.method" is set to "*". the
+            // description appears to be null in some cases of parameterized tests, but if the entire test case
+            // was ignored it would have been caught earlier and these parameterized tests wouldn't be considered
+            // for a call to shouldRun
+            if (description.getTestClass() != null) {
+                final boolean ignoreWholeTestCase = entireTestCaseToIgnore.stream().map(this::transformToClass)
+                        .anyMatch(claxx -> claxx.isAssignableFrom(description.getTestClass()));
+                if (ignoreWholeTestCase) return false;
             }
 
             if (description.isTest()) {
@@ -346,5 +345,13 @@ public abstract class AbstractGremlinSuite extends Suite {
                 }
             }).filter(c -> !c.equals(Object.class)).anyMatch(c -> c == graphProviderDescriptor.get().computer());
         }
+
+        private Class<?> transformToClass(final Graph.OptOut optOut) {
+            try {
+                return Class.forName(optOut.test());
+            } catch (Exception ex) {
+                throw new RuntimeException(ex);
+            }
+        }
     }
 }