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/05/14 18:58:44 UTC

[3/3] incubator-tinkerpop git commit: Assert exception for ReadOnlyStrategy if not testing OLAP.

Assert exception for ReadOnlyStrategy if not testing OLAP.


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

Branch: refs/heads/master
Commit: 6410240bc1bb8405f15711563789edf3f91ea26b
Parents: 6858def
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu May 14 12:57:17 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu May 14 12:57:17 2015 -0400

----------------------------------------------------------------------
 .../process/AbstractGremlinProcessTest.java       |  2 +-
 .../gremlin/process/ProcessComputerSuite.java     |  2 --
 .../verification/ReadOnlyStrategyProcessTest.java | 18 ++++++++++--------
 3 files changed, 11 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6410240b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/AbstractGremlinProcessTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/AbstractGremlinProcessTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/AbstractGremlinProcessTest.java
index 494dbf8..8f453a9 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/AbstractGremlinProcessTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/AbstractGremlinProcessTest.java
@@ -53,7 +53,7 @@ public abstract class AbstractGremlinProcessTest extends AbstractGremlinTest {
     /**
      * Determines if this test suite has "computer" requirements.
      */
-    private boolean hasGraphComputerRequirement() {
+    protected boolean hasGraphComputerRequirement() {
         // do the negation of STANDARD as we expect a future type of REASONING that would infer COMPUTER support
         return !GraphManager.getTraversalEngineType().equals(TraversalEngine.Type.STANDARD);
     }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6410240b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/ProcessComputerSuite.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/ProcessComputerSuite.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/ProcessComputerSuite.java
index 19e807e..0b0828a 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/ProcessComputerSuite.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/ProcessComputerSuite.java
@@ -48,8 +48,6 @@ import org.junit.runners.model.RunnerBuilder;
  */
 public class ProcessComputerSuite extends AbstractGremlinSuite {
 
-    // todo: all tests are not currently passing. see specific todos in each test
-
     /**
      * This list of tests in the suite that will be executed as part of this suite.
      */

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6410240b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/ReadOnlyStrategyProcessTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/ReadOnlyStrategyProcessTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/ReadOnlyStrategyProcessTest.java
index 24fd73c..12ad2c5 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/ReadOnlyStrategyProcessTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/ReadOnlyStrategyProcessTest.java
@@ -21,15 +21,14 @@ package org.apache.tinkerpop.gremlin.process.traversal.strategy.verification;
 import org.apache.tinkerpop.gremlin.FeatureRequirement;
 import org.apache.tinkerpop.gremlin.process.AbstractGremlinProcessTest;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
-import org.apache.tinkerpop.gremlin.process.traversal.TraversalEngine;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
-import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy;
 import org.apache.tinkerpop.gremlin.structure.Direction;
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.junit.Test;
 
-import static org.junit.Assert.assertEquals;
+import static org.hamcrest.MatcherAssert.assertThat;
 import static org.junit.Assert.fail;
+import static org.hamcrest.CoreMatchers.*;
 
 /**
  * @author Stephen Mallette (http://stephen.genoprime.com)
@@ -100,15 +99,18 @@ public class ReadOnlyStrategyProcessTest extends AbstractGremlinProcessTest {
         return graphProvider.traversal(graph, ReadOnlyStrategy.instance());
     }
 
-    private void assertTraversal(final Traversal t, final boolean hasMutatingStep) {
+    private void assertTraversal(final Traversal t, final boolean expectMutatingStep) {
         try {
             t.asAdmin().applyStrategies();
-            if (hasMutatingStep) fail("The strategy should have found a mutating step.");
+            if (expectMutatingStep) fail("The strategy should have found a mutating step.");
         } catch (final IllegalStateException ise) {
-            if (!hasMutatingStep)
+            if (!expectMutatingStep)
                 fail("The traversal should not have failed as there is no mutating step.");
-            //else  TODO: Stephen, TraversalVerificationStrategy fails before this as mutating operations are not allowed in OLAP
-            //    assertEquals("The provided traversal has a mutating step and thus is not read only", ise.getMessage());
+            else {
+                // TraversalVerificationStrategy fails before this as mutating operations are not allowed in OLAP
+                if (!hasGraphComputerRequirement())
+                    assertThat(ise.getMessage(), startsWith("The provided traversal has a mutating step and thus is not read only"));
+            }
         }
     }
 }