Repository: tinkerpop Updated Branches: refs/heads/TINKERPOP-1869 [created] 3e83344d2
TINKERPOP-1869 Allowed iterate() to be called after profile() Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/3e83344d Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/3e83344d Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/3e83344d Branch: refs/heads/TINKERPOP-1869 Commit: 3e83344d274d3852f787bee81aaeb05d4a96e113 Parents: b86b183 Author: Stephen Mallette <[email protected]> Authored: Wed Jan 31 13:29:12 2018 -0500 Committer: Stephen Mallette <[email protected]> Committed: Wed Jan 31 13:29:12 2018 -0500 ---------------------------------------------------------------------- CHANGELOG.asciidoc | 1 + .../strategy/verification/StandardVerificationStrategy.java | 9 +++++++-- .../verification/StandardVerificationStrategyTest.java | 4 ++++ 3 files changed, 12 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3e83344d/CHANGELOG.asciidoc ---------------------------------------------------------------------- diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 11b0816..b669a93 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -26,6 +26,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima This release also includes changes from <<release-3-2-8, 3.2.8>>. * Fixed regression issue where the HTTPChannelizer doesn't instantiate the specified AuthenticationHandler +* Modified `StandardVerificationStrategy` to allow for `iterate()` to be called after `profile()`. * Defaulted GLV tests for gremlin-python to run for GraphSON 3.0. * In gremlin-python, the GraphSON 3.0 `g:Set` type is now deserialized to `List`. http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3e83344d/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 cad3b8e..c92b09a 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 @@ -24,6 +24,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.Step; import org.apache.tinkerpop.gremlin.process.traversal.Traversal; import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy; import org.apache.tinkerpop.gremlin.process.traversal.step.branch.RepeatStep; +import org.apache.tinkerpop.gremlin.process.traversal.step.filter.NoneStep; import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.ProfileSideEffectStep; import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.SideEffectCapStep; import org.apache.tinkerpop.gremlin.process.traversal.step.util.ReducingBarrierStep; @@ -63,16 +64,20 @@ public final class StandardVerificationStrategy extends AbstractTraversalStrateg throw new VerificationException("The parent of a reducing barrier can not be repeat()-step: " + step, traversal); } - // The ProfileSideEffectStep must be the last step, 2nd last step when accompanied by the cap step, + // The ProfileSideEffectStep must be the last step, 2nd last step when accompanied by the cap/none step, // or 3rd to last when the traversal ends with a RequirementsStep. final Step<?, ?> endStep = traversal.asAdmin().getEndStep(); if (TraversalHelper.hasStepOfClass(ProfileSideEffectStep.class, traversal) && !(endStep instanceof ProfileSideEffectStep || + (endStep instanceof NoneStep && endStep.getPreviousStep() instanceof ProfileSideEffectStep) || + (endStep instanceof NoneStep && ( + endStep.getPreviousStep() instanceof SideEffectCapStep || + endStep.getPreviousStep() instanceof ProfileSideEffectStep)) || (endStep instanceof SideEffectCapStep && endStep.getPreviousStep() instanceof ProfileSideEffectStep) || (endStep instanceof RequirementsStep && ( endStep.getPreviousStep() instanceof SideEffectCapStep || endStep.getPreviousStep() instanceof ProfileSideEffectStep)))) { - throw new VerificationException("When specified, the profile()-Step must be the last step or followed only by the cap()-step and/or requirements step.", traversal); + throw new VerificationException("When specified, the profile()-Step must be the last step or followed only by the cap()-step, none()-step and/or requirements step.", traversal); } if (TraversalHelper.getStepsOfClass(ProfileSideEffectStep.class, traversal).size() > 1) { http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3e83344d/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 aa64f68..5485d04 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 @@ -53,6 +53,10 @@ public class StandardVerificationStrategyTest { {"__.repeat(sum()).times(2)", repeat(sum()).times(2), false}, {"__.repeat(out().count())", repeat(out().count()), false}, // traversals that should pass verification + {"__.V().profile()",__.V().profile(), true}, + {"__.V().profile().none()",__.V().profile("x").none(), true}, + {"__.V().profile()",__.V().profile("x").cap("x"), true}, + {"__.V().profile('x').cap('x').none()",__.V().profile("x").cap("x").none(), true}, {"__.V().profile().requirementsStep()", __.V().profile().asAdmin().addStep(emptyRequirementStep), true}, {"__.V().profile('metrics').cap('metrics').requirementsStep()",
