You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by va...@apache.org on 2022/12/07 20:52:01 UTC
[tinkerpop] branch TINKERPOP-2816-3.6 created (now 5a1d3d7d43)
This is an automated email from the ASF dual-hosted git repository.
valentyn pushed a change to branch TINKERPOP-2816-3.6
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
at 5a1d3d7d43 Improved Gherkin tests for more consistent results.
This branch includes the following new commits:
new 5a1d3d7d43 Improved Gherkin tests for more consistent results.
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[tinkerpop] 01/01: Improved Gherkin tests for more consistent results.
Posted by va...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
valentyn pushed a commit to branch TINKERPOP-2816-3.6
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
commit 5a1d3d7d4318f42d4ef77136c67f21ba08ba0d3c
Author: Valentyn Kahamlyk <va...@bitquilltech.com>
AuthorDate: Wed Dec 7 12:51:51 2022 -0800
Improved Gherkin tests for more consistent results.
---
.../test/Gremlin.Net.IntegrationTest/Gherkin/Gremlin.cs | 4 ++--
gremlin-go/driver/cucumber/gremlin.go | 4 ++--
.../javascript/gremlin-javascript/test/cucumber/gremlin.js | 4 ++--
gremlin-python/src/main/python/radish/gremlin.py | 4 ++--
.../gremlin/test/features/integrated/ReadOnlyStrategy.feature | 11 +++++++----
5 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/Gremlin.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/Gremlin.cs
index 9e1f59f834..7dcad2f86e 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/Gremlin.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/Gremlin.cs
@@ -351,8 +351,8 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
{"g_withStrategiesXReadOnlyStrategyX_V", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.WithStrategies(new ReadOnlyStrategy()).V()}},
{"g_withStrategiesXReadOnlyStrategyX_V_outXknowsX_name", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.WithStrategies(new ReadOnlyStrategy()).V().Out("knows").Values<object>("name")}},
{"g_withStrategiesXReadOnlyStrategyX_addVXpersonX", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.WithStrategies(new ReadOnlyStrategy()).AddV("person")}},
- {"g_withStrategiesXReadOnlyStrategyX_addVXpersonX_fromXVX1XX_toXVX2XX", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.WithStrategies(new ReadOnlyStrategy()).AddE("link").From(__.V(1)).To(__.V(2))}},
- {"g_withStrategiesXReadOnlyStrategyX_V_addVXpersonX_fromXVX1XX", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.WithStrategies(new ReadOnlyStrategy()).V().AddE("link").From(__.V(1))}},
+ {"g_withStrategiesXReadOnlyStrategyX_addVXpersonX_fromXVX1XX_toXVX2XX", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.WithStrategies(new ReadOnlyStrategy()).AddE("link").From(__.V(p["vid1"])).To(__.V(p["vid2"]))}},
+ {"g_withStrategiesXReadOnlyStrategyX_V_addVXpersonX_fromXVX1XX", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.WithStrategies(new ReadOnlyStrategy()).V().AddE("link").From(__.V(p["vid1"]))}},
{"g_withStrategiesXReadOnlyStrategyX_V_propertyXname_joshX", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.WithStrategies(new ReadOnlyStrategy()).V().Property("name","josh")}},
{"g_withStrategiesXReadOnlyStrategyX_E_propertyXweight_0X", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.WithStrategies(new ReadOnlyStrategy()).E().Property("weight",0)}},
{"g_V_classic_recommendation", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.V().Has("name","DARK STAR").As("a").Out("followedBy").Aggregate("stash").In("followedBy").Where(P.Neq("a").And(P.Without(new List<object> {"stash"}))).GroupCount<object>().Unfold<object>().Project<object>("x","y","z").By(__.Select<object>(Column.Keys).Values<object>("name")).By(__.Select<object>(Column.Keys).Values<object>("performances")).By(__.Select<ob [...]
diff --git a/gremlin-go/driver/cucumber/gremlin.go b/gremlin-go/driver/cucumber/gremlin.go
index 88a5be98e2..cddb4195ae 100644
--- a/gremlin-go/driver/cucumber/gremlin.go
+++ b/gremlin-go/driver/cucumber/gremlin.go
@@ -322,8 +322,8 @@ var translationMap = map[string][]func(g *gremlingo.GraphTraversalSource, p map[
"g_withStrategiesXReadOnlyStrategyX_V": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.WithStrategies(gremlingo.ReadOnlyStrategy()).V()}},
"g_withStrategiesXReadOnlyStrategyX_V_outXknowsX_name": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.WithStrategies(gremlingo.ReadOnlyStrategy()).V().Out("knows").Values("name")}},
"g_withStrategiesXReadOnlyStrategyX_addVXpersonX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.WithStrategies(gremlingo.ReadOnlyStrategy()).AddV("person")}},
- "g_withStrategiesXReadOnlyStrategyX_addVXpersonX_fromXVX1XX_toXVX2XX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.WithStrategies(gremlingo.ReadOnlyStrategy()).AddE("link").From(gremlingo.T__.V(1)).To(gremlingo.T__.V(2))}},
- "g_withStrategiesXReadOnlyStrategyX_V_addVXpersonX_fromXVX1XX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.WithStrategies(gremlingo.ReadOnlyStrategy()).V().AddE("link").From(gremlingo.T__.V(1))}},
+ "g_withStrategiesXReadOnlyStrategyX_addVXpersonX_fromXVX1XX_toXVX2XX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.WithStrategies(gremlingo.ReadOnlyStrategy()).AddE("link").From(gremlingo.T__.V(p["vid1"])).To(gremlingo.T__.V(p["vid2"]))}},
+ "g_withStrategiesXReadOnlyStrategyX_V_addVXpersonX_fromXVX1XX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.WithStrategies(gremlingo.ReadOnlyStrategy()).V().AddE("link").From(gremlingo.T__.V(p["vid1"]))}},
"g_withStrategiesXReadOnlyStrategyX_V_propertyXname_joshX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.WithStrategies(gremlingo.ReadOnlyStrategy()).V().Property("name", "josh")}},
"g_withStrategiesXReadOnlyStrategyX_E_propertyXweight_0X": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.WithStrategies(gremlingo.ReadOnlyStrategy()).E().Property("weight", 0)}},
"g_V_classic_recommendation": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().Has("name", "DARK STAR").As("a").Out("followedBy").Aggregate("stash").In("followedBy").Where(gremlingo.P.Neq("a").And(gremlingo.P.Without("stash"))).GroupCount().Unfold().Project("x", "y", "z").By(gremlingo.T__.Select(gremlingo.Column.Keys).Values("name")).By(gremlingo.T__.Select(gremlingo.Column.Keys).Values("performances")).By(gremlingo.T__.Select [...]
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/gremlin.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/gremlin.js
index 64979d72c9..e7850bfd3b 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/gremlin.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/gremlin.js
@@ -341,8 +341,8 @@ const gremlins = {
g_withStrategiesXReadOnlyStrategyX_V: [function({g}) { return g.withStrategies(new ReadOnlyStrategy()).V() }],
g_withStrategiesXReadOnlyStrategyX_V_outXknowsX_name: [function({g}) { return g.withStrategies(new ReadOnlyStrategy()).V().out("knows").values("name") }],
g_withStrategiesXReadOnlyStrategyX_addVXpersonX: [function({g}) { return g.withStrategies(new ReadOnlyStrategy()).addV("person") }],
- g_withStrategiesXReadOnlyStrategyX_addVXpersonX_fromXVX1XX_toXVX2XX: [function({g}) { return g.withStrategies(new ReadOnlyStrategy()).addE("link").from_(__.V(1)).to(__.V(2)) }],
- g_withStrategiesXReadOnlyStrategyX_V_addVXpersonX_fromXVX1XX: [function({g}) { return g.withStrategies(new ReadOnlyStrategy()).V().addE("link").from_(__.V(1)) }],
+ g_withStrategiesXReadOnlyStrategyX_addVXpersonX_fromXVX1XX_toXVX2XX: [function({g, vid2, vid1}) { return g.withStrategies(new ReadOnlyStrategy()).addE("link").from_(__.V(vid1)).to(__.V(vid2)) }],
+ g_withStrategiesXReadOnlyStrategyX_V_addVXpersonX_fromXVX1XX: [function({g, vid1}) { return g.withStrategies(new ReadOnlyStrategy()).V().addE("link").from_(__.V(vid1)) }],
g_withStrategiesXReadOnlyStrategyX_V_propertyXname_joshX: [function({g}) { return g.withStrategies(new ReadOnlyStrategy()).V().property("name","josh") }],
g_withStrategiesXReadOnlyStrategyX_E_propertyXweight_0X: [function({g}) { return g.withStrategies(new ReadOnlyStrategy()).E().property("weight",0) }],
g_V_classic_recommendation: [function({g}) { return g.V().has("name","DARK STAR").as("a").out("followedBy").aggregate("stash").in_("followedBy").where(P.neq("a").and(P.without(["stash"]))).groupCount().unfold().project("x","y","z").by(__.select(Column.keys).values("name")).by(__.select(Column.keys).values("performances")).by(__.select(Column.values)).order().by(__.select("z"),Order.desc).by(__.select("y"),Order.asc).limit(5).aggregate(Scope.local,"m").select("x") }],
diff --git a/gremlin-python/src/main/python/radish/gremlin.py b/gremlin-python/src/main/python/radish/gremlin.py
index d46e491392..046ece90eb 100644
--- a/gremlin-python/src/main/python/radish/gremlin.py
+++ b/gremlin-python/src/main/python/radish/gremlin.py
@@ -323,8 +323,8 @@ world.gremlins = {
'g_withStrategiesXReadOnlyStrategyX_V': [(lambda g:g.withStrategies(*[TraversalStrategy('ReadOnlyStrategy', None, 'org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy')]).V())],
'g_withStrategiesXReadOnlyStrategyX_V_outXknowsX_name': [(lambda g:g.withStrategies(*[TraversalStrategy('ReadOnlyStrategy', None, 'org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy')]).V().out('knows').name)],
'g_withStrategiesXReadOnlyStrategyX_addVXpersonX': [(lambda g:g.withStrategies(*[TraversalStrategy('ReadOnlyStrategy', None, 'org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy')]).addV('person'))],
- 'g_withStrategiesXReadOnlyStrategyX_addVXpersonX_fromXVX1XX_toXVX2XX': [(lambda g:g.withStrategies(*[TraversalStrategy('ReadOnlyStrategy', None, 'org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy')]).addE('link').from_(__.V(1)).to(__.V(2)))],
- 'g_withStrategiesXReadOnlyStrategyX_V_addVXpersonX_fromXVX1XX': [(lambda g:g.withStrategies(*[TraversalStrategy('ReadOnlyStrategy', None, 'org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy')]).V().addE('link').from_(__.V(1)))],
+ 'g_withStrategiesXReadOnlyStrategyX_addVXpersonX_fromXVX1XX_toXVX2XX': [(lambda g, vid2=None,vid1=None:g.withStrategies(*[TraversalStrategy('ReadOnlyStrategy', None, 'org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy')]).addE('link').from_(__.V(vid1)).to(__.V(vid2)))],
+ 'g_withStrategiesXReadOnlyStrategyX_V_addVXpersonX_fromXVX1XX': [(lambda g, vid1=None:g.withStrategies(*[TraversalStrategy('ReadOnlyStrategy', None, 'org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy')]).V().addE('link').from_(__.V(vid1)))],
'g_withStrategiesXReadOnlyStrategyX_V_propertyXname_joshX': [(lambda g:g.withStrategies(*[TraversalStrategy('ReadOnlyStrategy', None, 'org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy')]).V().property('name','josh'))],
'g_withStrategiesXReadOnlyStrategyX_E_propertyXweight_0X': [(lambda g:g.withStrategies(*[TraversalStrategy('ReadOnlyStrategy', None, 'org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy')]).E().property('weight',0))],
'g_V_classic_recommendation': [(lambda g:g.V().has('name','DARK STAR').as_('a').out('followedBy').aggregate('stash').in_('followedBy').where(P.neq('a').and_(P.without(['stash']))).groupCount().unfold().project('x','y','z').by(__.select(Column.keys).name).by(__.select(Column.keys).performances).by(__.select(Column.values)).order().by(__.select('z'),Order.desc).by(__.select('y'),Order.asc)[0:5].aggregate(Scope.local,'m').select('x'))],
diff --git a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/integrated/ReadOnlyStrategy.feature b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/integrated/ReadOnlyStrategy.feature
index 9feaba4b2b..df953e404a 100644
--- a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/integrated/ReadOnlyStrategy.feature
+++ b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/integrated/ReadOnlyStrategy.feature
@@ -60,20 +60,23 @@ Feature: Step - ReadOnlyStrategy
@WithReadOnlyStrategy
Scenario: g_withStrategiesXReadOnlyStrategyX_addVXpersonX_fromXVX1XX_toXVX2XX
- Given the empty graph
+ Given the modern graph
+ And using the parameter vid1 defined as "v[marko].id"
+ And using the parameter vid2 defined as "v[vadas].id"
And the traversal of
"""
- g.withStrategies(ReadOnlyStrategy).addE("link").from(__.V(1)).to(__.V(2))
+ g.withStrategies(ReadOnlyStrategy).addE("link").from(__.V(vid1)).to(__.V(vid2))
"""
When iterated to list
Then the traversal will raise an error with message containing text of "The provided traversal has a mutating step and thus is not read only"
@WithReadOnlyStrategy
Scenario: g_withStrategiesXReadOnlyStrategyX_V_addVXpersonX_fromXVX1XX
- Given the empty graph
+ Given the modern graph
+ And using the parameter vid1 defined as "v[marko].id"
And the traversal of
"""
- g.withStrategies(ReadOnlyStrategy).V().addE("link").from(__.V(1))
+ g.withStrategies(ReadOnlyStrategy).V().addE("link").from(__.V(vid1))
"""
When iterated to list
Then the traversal will raise an error with message containing text of "The provided traversal has a mutating step and thus is not read only"