tinkerpop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ok...@apache.org
Subject incubator-tinkerpop git commit: Fixed a bug in BranchStep (and its inheriting children -- union(), choose(), etc.). Branch options are global traversals and should never reset() on each insert. Moreover, they should fully pull from the source and not --
Date Tue, 01 Mar 2016 19:59:11 GMT
Repository: incubator-tinkerpop
Updated Branches:
  refs/heads/TINKERPOP-1188 [created] 14b54efb3


Fixed a bug in BranchStep (and its inheriting children -- union(), choose(), etc.). Branch
options are global traversals and should never reset() on each insert. Moreover, they should
fully pull from the source and not -- like a local traversal -- process one traverser at a
time. If users were doing union(sum,count), to get the same result they will need to do local(union(sum,count)).
Thus, its a breaking change -- but was a bug. This also allowed us to remove one more ComputerVerificationStrategy
filter. At this point, OLAP is just like OLTP except for 'local star graph' stuff. Added a
new test case to UnionTest that demonstrates the local(union()) vs union() behavior.


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

Branch: refs/heads/TINKERPOP-1188
Commit: 14b54efb32000467b6949c12dd9422068297ac21
Parents: 7bf7159
Author: Marko A. Rodriguez <okrammarko@gmail.com>
Authored: Tue Mar 1 12:59:01 2016 -0700
Committer: Marko A. Rodriguez <okrammarko@gmail.com>
Committed: Tue Mar 1 12:59:01 2016 -0700

----------------------------------------------------------------------
 .../traversal/step/branch/BranchStep.java       |  41 ++++---
 .../traversal/step/branch/LocalStep.java        |   1 +
 .../ComputerVerificationStrategy.java           |  10 +-
 .../StandardVerificationStrategy.java           |   6 +-
 .../step/branch/GroovyUnionTest.groovy          |   6 +
 .../gremlin/process/ProcessComputerSuite.java   |   4 +-
 .../gremlin/process/ProcessStandardSuite.java   |   4 +-
 .../traversal/step/branch/UnionTest.java        |  49 ++++----
 ...ComputerVerificationStrategyProcessTest.java | 111 -------------------
 .../VerificationStrategyProcessTest.java        | 101 +++++++++++++++++
 .../structure/TinkerGraphPlayTest.java          |   2 +-
 11 files changed, 170 insertions(+), 165 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/14b54efb/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/BranchStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/BranchStep.java
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/BranchStep.java
index 2989096..c563cf0 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/BranchStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/BranchStep.java
@@ -23,10 +23,17 @@ import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
 import org.apache.tinkerpop.gremlin.process.traversal.step.TraversalOptionParent;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.ComputerAwareStep;
 import org.apache.tinkerpop.gremlin.process.traversal.traverser.TraverserRequirement;
+import org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException;
 import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalUtil;
 import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 import java.util.stream.Collectors;
 
 /**
@@ -86,22 +93,24 @@ public class BranchStep<S, E, M> extends ComputerAwareStep<S,
E> implements Trav
             }
             this.first = false;
             ///
-            final Traverser.Admin<S> start = this.starts.next();
-            final M choice = TraversalUtil.apply(start, this.branchTraversal);
-            final List<Traversal.Admin<S, E>> branch = this.traversalOptions.containsKey(choice)
? this.traversalOptions.get(choice) : this.traversalOptions.get(Pick.none);
-            if (null != branch) {
-                branch.forEach(traversal -> {
-                    traversal.reset();
-                    traversal.addStart(start.split());
-                });
-            }
-            if (choice != Pick.any) {
-                final List<Traversal.Admin<S, E>> anyBranch = this.traversalOptions.get(Pick.any);
-                if (null != anyBranch)
-                    anyBranch.forEach(traversal -> {
-                        traversal.reset();
+            if(!this.starts.hasNext())
+                throw FastNoSuchElementException.instance();
+            while (this.starts.hasNext()) {
+                final Traverser.Admin<S> start = this.starts.next();
+                final M choice = TraversalUtil.apply(start, this.branchTraversal);
+                final List<Traversal.Admin<S, E>> branch = this.traversalOptions.containsKey(choice)
? this.traversalOptions.get(choice) : this.traversalOptions.get(Pick.none);
+                if (null != branch) {
+                    branch.forEach(traversal -> {
                         traversal.addStart(start.split());
                     });
+                }
+                if (choice != Pick.any) {
+                    final List<Traversal.Admin<S, E>> anyBranch = this.traversalOptions.get(Pick.any);
+                    if (null != anyBranch)
+                        anyBranch.forEach(traversal -> {
+                            traversal.addStart(start.split());
+                        });
+                }
             }
         }
     }
@@ -173,6 +182,8 @@ public class BranchStep<S, E, M> extends ComputerAwareStep<S,
E> implements Trav
     @Override
     public void reset() {
         super.reset();
+        this.getGlobalChildren().forEach(Traversal.Admin::reset);
+        this.branchTraversal.reset();
         this.first = true;
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/14b54efb/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/LocalStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/LocalStep.java
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/LocalStep.java
index 123177b..30504e4 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/LocalStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/LocalStep.java
@@ -94,5 +94,6 @@ public final class LocalStep<S, E> extends AbstractStep<S, E>
implements Travers
     public void reset() {
         super.reset();
         this.first = true;
+        this.localTraversal.reset();
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/14b54efb/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/ComputerVerificationStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/ComputerVerificationStrategy.java
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/ComputerVerificationStrategy.java
index 09e3d0b..e07522e 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/ComputerVerificationStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/ComputerVerificationStrategy.java
@@ -37,7 +37,6 @@ import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.SubgraphSt
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.CollectingBarrierStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.ComputerAwareStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep;
-import org.apache.tinkerpop.gremlin.process.traversal.step.util.ReducingBarrierStep;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.AbstractTraversalStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.traverser.TraverserRequirement;
 import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;
@@ -90,7 +89,7 @@ public final class ComputerVerificationStrategy extends AbstractTraversalStrateg
 
         for (final Step<?, ?> step : traversal.getSteps()) {
 
-            // you can not traverser past the local star graph with localChildren (e.g. by()-modulators).
+            // you can not traverse past the local star graph with localChildren (e.g. by()-modulators).
             if (step instanceof TraversalParent) {
                 final Optional<Traversal.Admin<Object, Object>> traversalOptional
= ((TraversalParent) step).getLocalChildren().stream()
                         .filter(t -> !TraversalHelper.isLocalStarGraph(t.asAdmin()))
@@ -111,16 +110,11 @@ public final class ComputerVerificationStrategy extends AbstractTraversalStrateg
                 throw new VerificationException("A dedup()-step can not process scoped elements:
" + step, traversal);
             }
 
-            // this is a problem with global parents and reseting reducers back to their
seeds (this is more complicated than just an OLAP issue)
-            if (step instanceof ReducingBarrierStep && !(step.getTraversal().getParent()
instanceof TraversalVertexProgramStep || step.getTraversal().getParent() instanceof EmptyStep))
-                throw new VerificationException("Reducing barriers withing global children
are not allowed: " + step, traversal);
-
             // this is a problem because sideEffect.merge() is transient on the OLAP reduction
             if (TraversalHelper.getRootTraversal(traversal).getTraverserRequirements().contains(TraverserRequirement.ONE_BULK))
                 throw new VerificationException("One bulk us currently not supported: " +
step, traversal);
 
-            if ((step instanceof WherePredicateStep && ((WherePredicateStep) step).getStartKey().isPresent())
||
-                    (step instanceof WhereTraversalStep && TraversalHelper.getVariableLocations(((WhereTraversalStep<?>)
step).getLocalChildren().get(0)).contains(Scoping.Variable.START)))
+            if ((step instanceof WhereTraversalStep && TraversalHelper.getVariableLocations(((WhereTraversalStep<?>)
step).getLocalChildren().get(0)).contains(Scoping.Variable.START)))
                 throw new VerificationException("A where()-step that has a start variable
is not allowed because the variable value is retrieved from the path: " + step, traversal);
 
             if (UNSUPPORTED_STEPS.stream().filter(c -> c.isAssignableFrom(step.getClass())).findFirst().isPresent())

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/14b54efb/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 62f2654..be1a16d 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
@@ -21,8 +21,8 @@ package org.apache.tinkerpop.gremlin.process.traversal.strategy.verification;
 import org.apache.tinkerpop.gremlin.process.computer.traversal.step.VertexComputing;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.step.Barrier;
 import org.apache.tinkerpop.gremlin.process.traversal.step.branch.RepeatStep;
-import org.apache.tinkerpop.gremlin.process.traversal.step.util.ReducingBarrierStep;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.AbstractTraversalStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;
 
@@ -44,8 +44,8 @@ public final class StandardVerificationStrategy extends AbstractTraversalStrateg
         }
 
         traversal.getSteps().forEach(step -> {
-            if (step instanceof ReducingBarrierStep && step.getTraversal().getParent()
instanceof RepeatStep && step.getTraversal().getParent().getGlobalChildren().get(0).getSteps().contains(step))
-                throw new VerificationException("The direct parent of a ReducingBarrierStep
can not be a RepeatStep: " + step, traversal);
+            if (step instanceof Barrier && step.getTraversal().getParent() instanceof
RepeatStep && step.getTraversal().getParent().getGlobalChildren().get(0).getSteps().contains(step))
+                throw new VerificationException("The parent of barrier can not be repeat()-step:
" + step, traversal);
         });
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/14b54efb/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/branch/GroovyUnionTest.groovy
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/branch/GroovyUnionTest.groovy
b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/branch/GroovyUnionTest.groovy
index 0fa395f..5627cdc 100644
--- a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/branch/GroovyUnionTest.groovy
+++ b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/branch/GroovyUnionTest.groovy
@@ -67,5 +67,11 @@ public abstract class GroovyUnionTest {
                 final Object v1Id, final Object v2Id) {
             new ScriptTraversal<>(g, "gremlin-groovy", "g.V(v1Id, v2Id).union(outE().count,
inE().count, outE().weight.sum)", "v1Id", v1Id, "v2Id", v2Id);
         }
+
+        @Override
+        public Traversal<Vertex, Number> get_g_VX1_2X_localXunionXoutE_count__inE_count__outE_weight_sumXX(
+                final Object v1Id, final Object v2Id) {
+            new ScriptTraversal<>(g, "gremlin-groovy", "g.V(v1Id, v2Id).local(union(outE().count,
inE().count, outE().weight.sum))", "v1Id", v1Id, "v2Id", v2Id);
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/14b54efb/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 d680421..5e32b2b 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
@@ -83,7 +83,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.StoreTest;
 import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.SubgraphTest;
 import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.TreeTest;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SubgraphStrategyProcessTest;
-import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ComputerVerificationStrategyProcessTest;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.VerificationStrategyProcessTest;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategyProcessTest;
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.StructureStandardSuite;
@@ -183,7 +183,7 @@ public class ProcessComputerSuite extends AbstractGremlinSuite {
             BulkDumperVertexProgramTest.class,
 
             // strategy
-            ComputerVerificationStrategyProcessTest.ComputerTraversals.class,
+            VerificationStrategyProcessTest.ComputerVerificationStrategyTest.class,
 
             // decorations
             ReadOnlyStrategyProcessTest.class,

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/14b54efb/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/ProcessStandardSuite.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/ProcessStandardSuite.java
b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/ProcessStandardSuite.java
index 3b7e634..7b1fe31 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/ProcessStandardSuite.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/ProcessStandardSuite.java
@@ -82,7 +82,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.Elemen
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.EventStrategyProcessTest;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.PartitionStrategyProcessTest;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SubgraphStrategyProcessTest;
-import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ComputerVerificationStrategyProcessTest;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.VerificationStrategyProcessTest;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategyProcessTest;
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.StructureStandardSuite;
@@ -176,7 +176,7 @@ public class ProcessStandardSuite extends AbstractGremlinSuite {
             CoreTraversalTest.class,
 
             // strategy
-            ComputerVerificationStrategyProcessTest.StandardTraversals.class,
+            VerificationStrategyProcessTest.StandardVerificationStrategyTest.class,
 
             // algorithms
             // PageRankVertexProgramTest.class

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/14b54efb/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/UnionTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/UnionTest.java
b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/UnionTest.java
index 101be6c..df52f9b 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/UnionTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/UnionTest.java
@@ -22,17 +22,24 @@ import org.apache.tinkerpop.gremlin.LoadGraphWith;
 import org.apache.tinkerpop.gremlin.process.AbstractGremlinProcessTest;
 import org.apache.tinkerpop.gremlin.process.GremlinProcessRunner;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
-import org.apache.tinkerpop.gremlin.process.traversal.TraversalEngine;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Map;
 
 import static org.apache.tinkerpop.gremlin.LoadGraphWith.GraphData.MODERN;
-import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.*;
-import static org.junit.Assert.*;
+import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.in;
+import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.inE;
+import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.label;
+import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.out;
+import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.outE;
+import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.repeat;
+import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.union;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 
 /**
  * @author Marko A. Rodriguez (http://markorodriguez.com)
@@ -52,6 +59,8 @@ public abstract class UnionTest extends AbstractGremlinProcessTest {
 
     public abstract Traversal<Vertex, Number> get_g_VX1_2X_unionXoutE_count__inE_count__outE_weight_sumX(final
Object v1Id, final Object v2Id);
 
+    public abstract Traversal<Vertex, Number> get_g_VX1_2X_localXunionXoutE_count__inE_count__outE_weight_sumXX(final
Object v1Id, final Object v2Id);
+
     @Test
     @LoadGraphWith(MODERN)
     public void g_V_unionXout__inX_name() {
@@ -127,29 +136,18 @@ public abstract class UnionTest extends AbstractGremlinProcessTest {
 
     @Test
     @LoadGraphWith(MODERN)
-    // NEED TO DETERMINE IF TRAVERSAL IS LOCAL AND THEN ALLOW COUNT ON LOCALS
+    public void g_VX1_2X_localXunionXoutE_count__inE_count__outE_weight_sumXX() {
+        final Traversal<Vertex, Number> traversal = get_g_VX1_2X_localXunionXoutE_count__inE_count__outE_weight_sumXX(convertToVertexId("marko"),
convertToVertexId("vadas"));
+        printTraversalForm(traversal);
+        checkResults(Arrays.asList(0l, 0l, 0, 3l, 1l, 1.9d), traversal);
+    }
+
+    @Test
+    @LoadGraphWith(MODERN)
     public void g_VX1_2X_unionXoutE_count__inE_count__outE_weight_sumX() {
         final Traversal<Vertex, Number> traversal = get_g_VX1_2X_unionXoutE_count__inE_count__outE_weight_sumX(convertToVertexId("marko"),
convertToVertexId("vadas"));
         printTraversalForm(traversal);
-        assertTrue(traversal.hasNext());
-        final Number startNumber = traversal.next();
-        assertTrue(traversal.hasNext());
-        if (startNumber.longValue() == 3l) {
-            assertEquals(0l, traversal.next().longValue());
-            assertEquals(1.9d, traversal.next().doubleValue(), 0.1d);
-            //
-            assertEquals(0l, traversal.next().longValue());
-            assertEquals(1l, traversal.next().longValue());
-            assertEquals(0.0d, traversal.next().doubleValue(), 0.1d);
-        } else {
-            assertEquals(1l, traversal.next().longValue());
-            assertEquals(0.0d, traversal.next().doubleValue(), 0.1d);
-            //
-            assertEquals(3l, traversal.next().longValue());
-            assertEquals(0l, traversal.next().longValue());
-            assertEquals(1.9d, traversal.next().doubleValue(), 0.1d);
-        }
-        assertFalse(traversal.hasNext());
+        checkResults(Arrays.asList(3l, 1.9d, 1l), traversal);
     }
 
     public static class Traversals extends UnionTest {
@@ -189,5 +187,10 @@ public abstract class UnionTest extends AbstractGremlinProcessTest {
         public Traversal<Vertex, Number> get_g_VX1_2X_unionXoutE_count__inE_count__outE_weight_sumX(final
Object v1Id, final Object v2Id) {
             return g.V(v1Id, v2Id).union(outE().count(), inE().count(), (Traversal) outE().values("weight").sum());
         }
+
+        @Override
+        public Traversal<Vertex, Number> get_g_VX1_2X_localXunionXoutE_count__inE_count__outE_weight_sumXX(final
Object v1Id, final Object v2Id) {
+            return g.V(v1Id, v2Id).local(union(outE().count(), inE().count(), (Traversal)
outE().values("weight").sum()));
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/14b54efb/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/ComputerVerificationStrategyProcessTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/ComputerVerificationStrategyProcessTest.java
b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/ComputerVerificationStrategyProcessTest.java
deleted file mode 100644
index 2de89db..0000000
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/ComputerVerificationStrategyProcessTest.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.process.traversal.strategy.verification;
-
-import org.apache.tinkerpop.gremlin.LoadGraphWith;
-import org.apache.tinkerpop.gremlin.process.AbstractGremlinProcessTest;
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
-import org.junit.Test;
-
-import static org.apache.tinkerpop.gremlin.LoadGraphWith.GraphData.MODERN;
-import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.max;
-import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.min;
-import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.out;
-import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.outE;
-import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.sum;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public abstract class ComputerVerificationStrategyProcessTest extends AbstractGremlinProcessTest
{
-
-    public static class StandardTraversals extends ComputerVerificationStrategyProcessTest
{
-        @Test
-        @LoadGraphWith(MODERN)
-        public void shouldAllowNestedGlobalTraversalToHaveBarriers() {
-            try {
-                g.V().values("age").union(max(), min(), sum()).iterate();
-            } catch (IllegalStateException e) {
-                fail("Nested global traversals can have barrier steps on STANDARD:" + e.getMessage());
-            }
-        }
-
-        @Test
-        @LoadGraphWith(MODERN)
-        public void shouldAllowMidTraversalBarriersOnComputer() {
-            try {
-                g.V().count().sum().iterate();
-            } catch (IllegalStateException e) {
-                fail("Mid-traversal barrier steps are OK on STANDARD: " + e.getMessage());
-            }
-        }
-
-        @Test
-        @LoadGraphWith(MODERN)
-        public void shouldAllowLocalTraversalsToLeaveTheStarGraphOnComputer() {
-            try {
-                g.V().local(out().out()).iterate();
-            } catch (IllegalStateException e) {
-                fail("Local traversals leaving the star-graph are OK on STANDARD: " + e.getMessage());
-            }
-        }
-    }
-
-    public static class ComputerTraversals extends ComputerVerificationStrategyProcessTest
{
-
-        @Test
-        @LoadGraphWith(MODERN)
-        public void shouldNotAllowNestedGlobalTraversalToHaveBarriers() {
-            try {
-                final GraphTraversal t = g.V().values("age").union(max(), min(), sum()).iterate();
-                fail("Nested global traversals should not be allowed to contain barriers
(COMPUTER): " + t);
-            } catch (IllegalStateException e) {
-                assertTrue(true);
-            }
-        }
-
-        @Test
-        @LoadGraphWith(MODERN)
-        public void shouldNotAllowLocalTraversalsToLeaveTheStarGraphOnComputer() {
-            try {
-                final GraphTraversal t = g.V().local(out().out()).iterate();
-                fail("Local traversals should not be allowed to leave the star-graph (COMPUTER):
" + t);
-            } catch (IllegalStateException e) {
-                assertTrue(true);
-            }
-
-            try {
-                final GraphTraversal t = g.V().local(out().values("name")).iterate();
-                fail("Local traversals should not be allowed to leave the star-graph (COMPUTER):
" + t);
-            } catch (IllegalStateException e) {
-                assertTrue(true);
-            }
-
-            try {
-                g.V().local(outE().values("weight")).iterate();
-                g.V().local(out().id()).iterate();
-                g.V().local(outE().inV()).iterate();
-            } catch (IllegalStateException e) {
-                fail("Local traversals on the star-graph are OK on COMPUTER: " + e.getMessage());
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/14b54efb/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/VerificationStrategyProcessTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/VerificationStrategyProcessTest.java
b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/VerificationStrategyProcessTest.java
new file mode 100644
index 0000000..1f501db
--- /dev/null
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/VerificationStrategyProcessTest.java
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.process.traversal.strategy.verification;
+
+import org.apache.tinkerpop.gremlin.LoadGraphWith;
+import org.apache.tinkerpop.gremlin.process.AbstractGremlinProcessTest;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
+import org.junit.Test;
+
+import static org.apache.tinkerpop.gremlin.LoadGraphWith.GraphData.MODERN;
+import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.max;
+import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.min;
+import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.out;
+import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.outE;
+import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.sum;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public abstract class VerificationStrategyProcessTest extends AbstractGremlinProcessTest
{
+
+    public static class StandardVerificationStrategyTest extends VerificationStrategyProcessTest
{
+
+        @Test
+        @LoadGraphWith(MODERN)
+        public void shouldAllowNestedGlobalTraversalToHaveBarriers() {
+            try {
+                g.V().values("age").union(max(), min(), sum()).iterate();
+            } catch (IllegalStateException e) {
+                fail("Nested global traversals can have barrier steps on STANDARD:" + e.getMessage());
+            }
+        }
+
+        @Test
+        @LoadGraphWith(MODERN)
+        public void shouldAllowMidTraversalBarriersOnComputer() {
+            try {
+                g.V().count().sum().iterate();
+            } catch (IllegalStateException e) {
+                fail("Mid-traversal barrier steps are OK on STANDARD: " + e.getMessage());
+            }
+        }
+
+        @Test
+        @LoadGraphWith(MODERN)
+        public void shouldAllowLocalTraversalsToLeaveTheStarGraphOnComputer() {
+            try {
+                g.V().local(out().out()).iterate();
+            } catch (IllegalStateException e) {
+                fail("Local traversals leaving the star-graph are OK on STANDARD: " + e.getMessage());
+            }
+        }
+    }
+
+    public static class ComputerVerificationStrategyTest extends VerificationStrategyProcessTest
{
+
+        @Test
+        @LoadGraphWith(MODERN)
+        public void shouldNotAllowLocalTraversalsToLeaveTheStarGraphOnComputer() {
+            try {
+                final GraphTraversal t = g.V().local(out().out()).iterate();
+                fail("Local traversals should not be allowed to leave the star-graph (COMPUTER):
" + t);
+            } catch (IllegalStateException e) {
+                assertTrue(true);
+            }
+
+            try {
+                final GraphTraversal t = g.V().local(out().values("name")).iterate();
+                fail("Local traversals should not be allowed to leave the star-graph (COMPUTER):
" + t);
+            } catch (IllegalStateException e) {
+                assertTrue(true);
+            }
+
+            try {
+                g.V().local(outE().values("weight")).iterate();
+                g.V().local(out().id()).iterate();
+                g.V().local(outE().inV()).iterate();
+            } catch (IllegalStateException e) {
+                fail("Local traversals on the star-graph are OK on COMPUTER: " + e.getMessage());
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/14b54efb/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphPlayTest.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphPlayTest.java
b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphPlayTest.java
index 1d682b5..e5d62ae 100644
--- a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphPlayTest.java
+++ b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphPlayTest.java
@@ -73,7 +73,7 @@ public class TinkerGraphPlayTest {
         GraphTraversalSource g = graph.traversal().withComputer();//GraphTraversalSource.computer());
         //System.out.println(g.V().outE("knows").identity().inV().count().is(P.eq(5)).explain());
         //System.out.println(g.V().hasLabel("person").fold().order(Scope.local).by("age").toList());
-        final Traversal<?,?> traversal = g.V(1, 2).union(outE().count(), inE().count(),
(Traversal) outE().values("weight").sum());
+        final Traversal<?,?> traversal = g.V(1, 2).local(union(outE().count(), inE().count(),
(Traversal) outE().values("weight").sum()));
 
         System.out.println(traversal.asAdmin().clone().toString());
         final Traversal<?,?> clone = traversal.asAdmin().clone();


Mime
View raw message