tinkerpop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From spmalle...@apache.org
Subject [33/38] tinkerpop git commit: TINKERPOP-1996 Fixed verification on io()
Date Tue, 31 Jul 2018 12:17:50 GMT
TINKERPOP-1996 Fixed verification on io()


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

Branch: refs/heads/master
Commit: 23c71b60cc34c14e9defc6a9a7ab6c57c090460b
Parents: ae3f685
Author: Stephen Mallette <spmva@genoprime.com>
Authored: Fri Jul 20 13:22:47 2018 -0400
Committer: Stephen Mallette <spmva@genoprime.com>
Committed: Fri Jul 20 13:22:47 2018 -0400

----------------------------------------------------------------------
 .../verification/StandardVerificationStrategy.java  |  6 ++++--
 .../StandardVerificationStrategyTest.java           | 16 +++++++++++-----
 2 files changed, 15 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/23c71b60/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/StandardVerificationStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/StandardVerificationStrategy.java
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/StandardVerificationStrategy.java
index 258d345..7d88ed9 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/StandardVerificationStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/StandardVerificationStrategy.java
@@ -84,8 +84,10 @@ public final class StandardVerificationStrategy extends AbstractTraversalStrateg
             throw new VerificationException("The profile()-Step cannot be specified multiple
times.", traversal);
         }
 
-        if (traversal.getStartStep() instanceof ReadWriting && traversal.getSteps().size()
!= 1) {
-            if (TraversalHelper.getStepsOfClass(NoneStep.class, traversal).size() != traversal.getSteps().size()
- 1)
+        if (traversal.getStartStep() instanceof ReadWriting && !endStep.equals(traversal.getStartStep()))
{
+            final int total = TraversalHelper.getStepsOfClass(NoneStep.class, traversal).size()
+
+                    TraversalHelper.getStepsOfClass(RequirementsStep.class, traversal).size()
+ 1;
+            if (total != traversal.getSteps().size())
                 throw new VerificationException("The io() step must be the first and only
step in the traversal - it cannot be used with other steps", traversal);
         }
     }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/23c71b60/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/StandardVerificationStrategyTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/StandardVerificationStrategyTest.java
b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/StandardVerificationStrategyTest.java
index deec002..96a68b2 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/StandardVerificationStrategyTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/StandardVerificationStrategyTest.java
@@ -18,6 +18,7 @@
  */
 package org.apache.tinkerpop.gremlin.process.traversal.strategy.verification;
 
+import org.apache.tinkerpop.gremlin.TestHelper;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
@@ -29,6 +30,7 @@ import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
 
+import java.io.File;
 import java.util.Arrays;
 
 import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.out;
@@ -44,18 +46,22 @@ import static org.junit.Assert.fail;
 @RunWith(Parameterized.class)
 public class StandardVerificationStrategyTest {
 
+
     @Parameterized.Parameters(name = "{0}")
-    public static Iterable<Object[]> data() {
+    public static Iterable<Object[]> data() throws Exception {
+
+        final String file = TestHelper.generateTempFile(StandardVerificationStrategyTest.class,
"shouldBeVerified", ".kryo").getAbsolutePath();
+
         return Arrays.asList(new Object[][]{
                 // traversals that should fail verification
                 {"__.repeat(out().fold().unfold()).times(2)", repeat(out().fold().unfold()).times(2),
false},
                 {"__.repeat(sum()).times(2)", repeat(sum()).times(2), false},
                 {"__.repeat(out().count())", repeat(out().count()), false},
-                {"__.io().read().V()", EmptyGraph.instance().traversal().io("junk.kryo").read().V(),
false},
-                {"__.io().write().V()", EmptyGraph.instance().traversal().io("junk.kryo").write().V(),
false},
+                {"__.io().read().V()", EmptyGraph.instance().traversal().io(file).read().V(),
false},
+                {"__.io().write().V()", EmptyGraph.instance().traversal().io(file).write().V(),
false},
                 // traversals that should pass verification
-                {"__.io().read().V().none()", EmptyGraph.instance().traversal().io("junk.kryo").read().none(),
true},
-                {"__.io().write().V().none()", EmptyGraph.instance().traversal().io("junk.kryo").write().none(),
true},
+                {"__.io().read()", EmptyGraph.instance().traversal().io(file).read(), true},
+                {"__.io().write()", EmptyGraph.instance().traversal().io(file).write(), true},
                 {"__.V().profile()",
                         __.V().profile(), true},
                 {"__.V().profile('metrics').cap('metrics')",


Mime
View raw message