This is an automated email from the ASF dual-hosted git repository. xiazcy pushed a commit to branch multi-label-experiment in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
commit d7b15faeed70aa04200a1554633cdb566a27f565 Author: Yang Xia <[email protected]> AuthorDate: Thu Jun 4 22:06:26 2026 -0700 add a set of simple feature tests --- .../Gherkin/GherkinTestRunner.cs | 6 ++ .../Gherkin/IgnoreException.cs | 7 +- gremlin-go/driver/cucumber/cucumberSteps_test.go | 1 + .../gremlin-javascript/test/cucumber/world.js | 4 + .../src/main/python/tests/feature/feature_steps.py | 4 + .../gremlin/test/features/map/AddVertex.feature | 25 ++++- .../gremlin/test/features/map/Labels.feature | 110 +++++++++++++++++++++ .../test/features/sideEffect/AddLabel.feature | 66 +++++++++++++ .../test/features/sideEffect/DropLabel.feature | 83 ++++++++++++++++ .../gremlin/structure/ExceptionCoverageTest.java | 3 + 10 files changed, 307 insertions(+), 2 deletions(-) diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs index 6aee902762..04969b5fae 100644 --- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs +++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs @@ -125,6 +125,12 @@ namespace Gremlin.Net.IntegrationTest.Gherkin continue; } + if (scenario.Tags.Any(t => t.Name == "@MultiLabel")) + { + failedSteps.Add(scenario.Steps.First(), new IgnoreException(IgnoreReason.MultiLabelStepsNotSupported)); + continue; + } + StepBlock? currentStep = null; StepDefinition? stepDefinition = null; foreach (var step in scenario.Steps) diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/IgnoreException.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/IgnoreException.cs index 7001391004..bf3918f253 100644 --- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/IgnoreException.cs +++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/IgnoreException.cs @@ -70,6 +70,11 @@ namespace Gremlin.Net.IntegrationTest.Gherkin /// <summary> /// write() is not supported yet for testing /// </summary> - WriteStepTestingNotSupported + WriteStepTestingNotSupported, + + /// <summary> + /// Multi-label steps (labels(), addLabel(), dropLabel(), dropLabels()) are not yet available in the .NET GLV + /// </summary> + MultiLabelStepsNotSupported } } \ No newline at end of file diff --git a/gremlin-go/driver/cucumber/cucumberSteps_test.go b/gremlin-go/driver/cucumber/cucumberSteps_test.go index 495d56fd40..b4e44f6415 100644 --- a/gremlin-go/driver/cucumber/cucumberSteps_test.go +++ b/gremlin-go/driver/cucumber/cucumberSteps_test.go @@ -1133,6 +1133,7 @@ func TestCucumberFeatures(t *testing.T) { ScenarioInitializer: InitializeScenario, Options: &godog.Options{ Tags: "~@GraphComputerOnly && ~@AllowNullPropertyValues && ~@StepTree && ~@StepWrite && ~@DataChar", + Tags: "~@GraphComputerOnly && ~@AllowNullPropertyValues && ~@StepTree && ~@StepWrite && ~@DataChar && ~@MultiLabel", Format: "pretty", Paths: []string{getEnvOrDefaultString("CUCUMBER_FEATURE_FOLDER", "../../../gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features")}, TestingT: t, // Testing instance that will run subtests. diff --git a/gremlin-js/gremlin-javascript/test/cucumber/world.js b/gremlin-js/gremlin-javascript/test/cucumber/world.js index 563abb8ce8..8dcd7d18ba 100644 --- a/gremlin-js/gremlin-javascript/test/cucumber/world.js +++ b/gremlin-js/gremlin-javascript/test/cucumber/world.js @@ -118,6 +118,10 @@ Before({tags: "@DataDuration"}, function() { return 'skipped' }) +Before({tags: "@MultiLabel"}, function() { + return 'skipped' +}) + function getVertices(connection) { const g = anon.traversal().withRemote(connection); return g.V().group().by('name').by(__.tail()).next().then(it => { diff --git a/gremlin-python/src/main/python/tests/feature/feature_steps.py b/gremlin-python/src/main/python/tests/feature/feature_steps.py index f40c3fa91e..56feab3a29 100644 --- a/gremlin-python/src/main/python/tests/feature/feature_steps.py +++ b/gremlin-python/src/main/python/tests/feature/feature_steps.py @@ -90,6 +90,10 @@ def choose_graph(step, graph_name): if not step.context.ignore: step.context.ignore = "WithReservedKeysVerificationStrategy" in tagset + # Multi-label steps not yet available in Python GLV + if not step.context.ignore: + step.context.ignore = "MultiLabel" in tagset + if (step.context.ignore): return diff --git a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/map/AddVertex.feature b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/map/AddVertex.feature index 99e1492f56..0d7fdaf2c7 100644 --- a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/map/AddVertex.feature +++ b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/map/AddVertex.feature @@ -703,4 +703,27 @@ Feature: Step - addV() When iterated to list Then the result should be unordered | result | - | d[2010].i | \ No newline at end of file + | d[2010].i | + + @MultiLabel + Scenario: g_addVXa_bX_labels + Given the empty graph + And the traversal of + """ + g.addV("a", "b").labels().fold() + """ + When iterated to list + Then the result should have a count of 1 + And the graph should return 1 for count of "g.V().hasLabel(\"a\").hasLabel(\"b\")" + + @MultiLabel + Scenario: g_addVXa_b_cX_labels_count + Given the empty graph + And the traversal of + """ + g.addV("a", "b", "c").labels().count() + """ + When iterated to list + Then the result should be unordered + | result | + | d[3].l | diff --git a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/map/Labels.feature b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/map/Labels.feature new file mode 100644 index 0000000000..322d0ca42c --- /dev/null +++ b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/map/Labels.feature @@ -0,0 +1,110 @@ +# 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. + +@StepClassMap @StepLabels @MultiLabel +Feature: Step - labels() + + @MultiLabel + Scenario: g_V_hasLabelXpersonX_labels + Given the modern graph + And the traversal of + """ + g.V().hasLabel("person").labels() + """ + When iterated to list + Then the result should be unordered + | result | + | person | + | person | + | person | + | person | + + @MultiLabel + Scenario: g_addVXa_bX_labels + Given the empty graph + And the graph initializer of + """ + g.addV("a", "b") + """ + And the traversal of + """ + g.V().labels() + """ + When iterated to list + Then the result should be unordered + | result | + | a | + | b | + + @MultiLabel + Scenario: g_addVXa_bX_labels_fold + Given the empty graph + And the graph initializer of + """ + g.addV("a", "b") + """ + And the traversal of + """ + g.V().labels().fold() + """ + When iterated to list + Then the result should have a count of 1 + + @MultiLabel + Scenario: g_addVXa_bX_labels_count + Given the empty graph + And the graph initializer of + """ + g.addV("a", "b") + """ + And the traversal of + """ + g.V().labels().count() + """ + When iterated to list + Then the result should be unordered + | result | + | d[2].l | + + @MultiLabel + Scenario: g_addV_labels + Given the empty graph + And the graph initializer of + """ + g.addV() + """ + And the traversal of + """ + g.V().labels() + """ + When iterated to list + Then the result should be unordered + | result | + | vertex | + + @MultiLabel + Scenario: g_E_labels + Given the modern graph + And the traversal of + """ + g.E().hasLabel("knows").labels() + """ + When iterated to list + Then the result should be unordered + | result | + | knows | + | knows | diff --git a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/sideEffect/AddLabel.feature b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/sideEffect/AddLabel.feature new file mode 100644 index 0000000000..821b80ab72 --- /dev/null +++ b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/sideEffect/AddLabel.feature @@ -0,0 +1,66 @@ +# 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. + +@StepClassSideEffect @StepAddLabel @MultiLabel +Feature: Step - addLabel() + + @MultiLabel + Scenario: g_V_hasLabelXpersonX_hasXname_markoX_addLabelXemployeeX_labels + Given the empty graph + And the graph initializer of + """ + g.addV("person").property("name", "marko") + """ + And the traversal of + """ + g.V().hasLabel("person").has("name", "marko").addLabel("employee").labels().fold() + """ + When iterated to list + Then the result should have a count of 1 + And the graph should return 1 for count of "g.V().hasLabel(\"person\").hasLabel(\"employee\")" + + @MultiLabel + Scenario: g_V_addLabelXa_bX_labels_count + Given the empty graph + And the graph initializer of + """ + g.addV("person") + """ + And the traversal of + """ + g.V().addLabel("a", "b").labels().count() + """ + When iterated to list + Then the result should be unordered + | result | + | d[3].l | + + @MultiLabel + Scenario: g_V_addLabelXexistingX_labels_count + Given the empty graph + And the graph initializer of + """ + g.addV("person") + """ + And the traversal of + """ + g.V().addLabel("person").labels().count() + """ + When iterated to list + Then the result should be unordered + | result | + | d[1].l | diff --git a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/sideEffect/DropLabel.feature b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/sideEffect/DropLabel.feature new file mode 100644 index 0000000000..051cc793af --- /dev/null +++ b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/sideEffect/DropLabel.feature @@ -0,0 +1,83 @@ +# 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. + +@StepClassSideEffect @StepDropLabel @MultiLabel +Feature: Step - dropLabel() / dropLabels() + + @MultiLabel + Scenario: g_V_dropLabelXaX_labels + Given the empty graph + And the graph initializer of + """ + g.addV("a", "b") + """ + And the traversal of + """ + g.V().dropLabel("a").labels().fold() + """ + When iterated to list + Then the result should have a count of 1 + And the graph should return 0 for count of "g.V().hasLabel(\"a\")" + And the graph should return 1 for count of "g.V().hasLabel(\"b\")" + + @MultiLabel + Scenario: g_V_dropLabels_labels + Given the empty graph + And the graph initializer of + """ + g.addV("a", "b") + """ + And the traversal of + """ + g.V().dropLabels().labels() + """ + When iterated to list + Then the result should be unordered + | result | + | vertex | + + @MultiLabel + Scenario: g_V_dropLabelXa_bX_labels + Given the empty graph + And the graph initializer of + """ + g.addV("a", "b", "c") + """ + And the traversal of + """ + g.V().dropLabel("a", "b").labels() + """ + When iterated to list + Then the result should be unordered + | result | + | c | + + @MultiLabel + Scenario: g_V_dropLabels_defaultLabel + Given the empty graph + And the graph initializer of + """ + g.addV("person") + """ + And the traversal of + """ + g.V().dropLabels().labels() + """ + When iterated to list + Then the result should be unordered + | result | + | vertex | diff --git a/gremlin-test/src/test/java/org/apache/tinkerpop/gremlin/structure/ExceptionCoverageTest.java b/gremlin-test/src/test/java/org/apache/tinkerpop/gremlin/structure/ExceptionCoverageTest.java index a8f3946128..17b8b020dc 100644 --- a/gremlin-test/src/test/java/org/apache/tinkerpop/gremlin/structure/ExceptionCoverageTest.java +++ b/gremlin-test/src/test/java/org/apache/tinkerpop/gremlin/structure/ExceptionCoverageTest.java @@ -75,6 +75,9 @@ public class ExceptionCoverageTest { add("org.apache.tinkerpop.gremlin.structure.Element$Exceptions#elementAlreadyRemoved"); // as of 3.1.0 add("org.apache.tinkerpop.gremlin.structure.Graph$Exceptions#traversalEngineNotSupported"); // as of 3.2.0 + // this is a general default exception for providers that don't support label mutation: + add("org.apache.tinkerpop.gremlin.structure.Element$Exceptions#labelMutationNotSupported"); + // need to write consistency tests for the following items still........... add("org.apache.tinkerpop.gremlin.process.computer.GraphComputer$Exceptions#supportsDirectObjects"); }};
