TINKERPOP-1784 Added aggregate() tests Included option for next() in the test language.
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/1ab6a86c Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/1ab6a86c Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/1ab6a86c Branch: refs/heads/TINKERPOP-1784 Commit: 1ab6a86c7ac74ded6748108545747beb8b03caac Parents: 04d9046 Author: Stephen Mallette <sp...@genoprime.com> Authored: Mon Oct 16 11:16:11 2017 -0400 Committer: Stephen Mallette <sp...@genoprime.com> Committed: Fri Nov 10 19:55:20 2017 -0500 ---------------------------------------------------------------------- .../src/main/jython/radish/feature_steps.py | 5 ++ gremlin-test/features/map/Path.feature | 2 +- .../features/sideEffect/Aggregate.feature | 76 ++++++++++++++++++++ .../gremlin/process/FeatureCoverageTest.java | 2 + 4 files changed, 84 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1ab6a86c/gremlin-python/src/main/jython/radish/feature_steps.py ---------------------------------------------------------------------- diff --git a/gremlin-python/src/main/jython/radish/feature_steps.py b/gremlin-python/src/main/jython/radish/feature_steps.py index 859d809..c753323 100644 --- a/gremlin-python/src/main/jython/radish/feature_steps.py +++ b/gremlin-python/src/main/jython/radish/feature_steps.py @@ -79,6 +79,11 @@ def iterate_the_traversal(step): step.context.result = map(lambda x: _convert_results(x), step.context.traversal.toList()) +@when("iterated next") +def next_the_traversal(step): + step.context.result = map(lambda x: _convert_results(x), step.context.traversal.next()) + + @then("the result should be {characterized_as:w}") def assert_result(step, characterized_as): if characterized_as == "empty": http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1ab6a86c/gremlin-test/features/map/Path.feature ---------------------------------------------------------------------- diff --git a/gremlin-test/features/map/Path.feature b/gremlin-test/features/map/Path.feature index 350e6c6..e7904db 100644 --- a/gremlin-test/features/map/Path.feature +++ b/gremlin-test/features/map/Path.feature @@ -41,7 +41,7 @@ Feature: Step - count() | p[d[29],vadas] | | p[d[29],josh] | - Scenario: g_V_repeatXoutX_timesX2X_path_by_byXnameX_byXlangX + Scenario: g_V_repeatXoutX_timesX2X_path_byXitX_byXnameX_byXlangX Given the modern graph And the traversal of """ http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1ab6a86c/gremlin-test/features/sideEffect/Aggregate.feature ---------------------------------------------------------------------- diff --git a/gremlin-test/features/sideEffect/Aggregate.feature b/gremlin-test/features/sideEffect/Aggregate.feature new file mode 100644 index 0000000..1a5634d --- /dev/null +++ b/gremlin-test/features/sideEffect/Aggregate.feature @@ -0,0 +1,76 @@ +# 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. + +Feature: Step - aggregate() + + Scenario: g_V_valueXnameX_aggregateXxX_capXxX + Given the modern graph + And the traversal of + """ + g.V().values("name").aggregate("x").cap("x") + """ + When iterated next + Then the result should be unordered + | marko | + | josh | + | peter | + | lop | + | vadas | + | ripple | + + Scenario: g_V_aggregateXxX_byXnameX_capXxX + Given the modern graph + And the traversal of + """ + g.V().aggregate("x").by("name").cap("x") + """ + When iterated next + Then the result should be unordered + | marko | + | josh | + | peter | + | lop | + | vadas | + | ripple | + + Scenario: g_V_out_aggregateXaX_path + Given the modern graph + And the traversal of + """ + g.V().out().aggregate("a").path() + """ + When iterated to list + Then the result should be unordered + | p[v[marko],v[lop]] | + | p[v[marko],v[vadas]] | + | p[v[marko],v[josh]] | + | p[v[josh],v[ripple]] | + | p[v[josh],v[lop]] | + | p[v[peter],v[lop]] | + + Scenario: g_V_hasLabelXpersonX_aggregateXxX_byXageX_capXxX_asXyX_selectXyX + Given the modern graph + And the traversal of + """ + g.V().hasLabel("person").aggregate("x").by("age").cap("x").as("y").select("y") + """ + When iterated next + Then the result should be unordered + | d[29] | + | d[27] | + | d[32] | + | d[35] | \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1ab6a86c/gremlin-test/src/test/java/org/apache/tinkerpop/gremlin/process/FeatureCoverageTest.java ---------------------------------------------------------------------- diff --git a/gremlin-test/src/test/java/org/apache/tinkerpop/gremlin/process/FeatureCoverageTest.java b/gremlin-test/src/test/java/org/apache/tinkerpop/gremlin/process/FeatureCoverageTest.java index c3b46be..7c53cb9 100644 --- a/gremlin-test/src/test/java/org/apache/tinkerpop/gremlin/process/FeatureCoverageTest.java +++ b/gremlin-test/src/test/java/org/apache/tinkerpop/gremlin/process/FeatureCoverageTest.java @@ -25,6 +25,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.step.filter.CoinTest; import org.apache.tinkerpop.gremlin.process.traversal.step.map.CountTest; import org.apache.tinkerpop.gremlin.process.traversal.step.map.PathTest; import org.apache.tinkerpop.gremlin.process.traversal.step.map.VertexTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.AggregateTest; import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.GroupCountTest; import org.junit.Test; @@ -71,6 +72,7 @@ public class FeatureCoverageTest { PathTest.class, VertexTest.class, // sideEffect + AggregateTest.class, GroupCountTest.class); final Field field = ProcessStandardSuite.class.getDeclaredField("testsToEnforce");