You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2018/08/09 18:12:54 UTC

[12/12] tinkerpop git commit: TINKERPOP-1967 Added GLV tests for connectedComponent()

TINKERPOP-1967 Added GLV tests for connectedComponent()


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

Branch: refs/heads/master
Commit: 0c2fc21fb9534060aa8758406e5e38d553ea12be
Parents: 2cc2aed
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Aug 9 12:29:40 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Aug 9 12:29:40 2018 -0400

----------------------------------------------------------------------
 .../test/cucumber/feature-steps.js              |  4 ++
 .../features/map/ConnectedComponent.feature     | 76 ++++++++++++++++++++
 .../step/map/ConnectedComponentTest.java        |  4 +-
 3 files changed, 82 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/0c2fc21f/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js
index 96eeaaf..a0ae7ca 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js
@@ -63,6 +63,10 @@ const ignoreReason = {
 
 const ignoredScenarios = {
   // An associative array containing the scenario name as key, for example:
+  'g_V_connectedComponent_hasXcomponentX': new IgnoreError(ignoreReason.computerNotSupported),
+  'g_V_dedup_connectedComponent_hasXcomponentX': new IgnoreError(ignoreReason.computerNotSupported),
+  'g_V_hasLabelXsoftwareX_connectedComponent_project_byXnameX_byXcomponentX': new IgnoreError(ignoreReason.computerNotSupported),
+  'g_V_connectedComponent_withXEDGES_bothEXknowsXX_withXPROPERTY_NAME_clusterX_project_byXnameX_byXclusterX': new IgnoreError(ignoreReason.computerNotSupported),
   'g_V_pageRank_hasXpageRankX': new IgnoreError(ignoreReason.computerNotSupported),
   'g_V_outXcreatedX_pageRank_byXbothEX_byXprojectRankX_timesX0X_valueMapXname_projectRankX': new IgnoreError(ignoreReason.computerNotSupported),
   'g_V_pageRank_order_byXpageRank_decrX_byXnameX_name': new IgnoreError(ignoreReason.computerNotSupported),

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/0c2fc21f/gremlin-test/features/map/ConnectedComponent.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/map/ConnectedComponent.feature b/gremlin-test/features/map/ConnectedComponent.feature
new file mode 100644
index 0000000..0f95488
--- /dev/null
+++ b/gremlin-test/features/map/ConnectedComponent.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 - connectedComponent()
+                
+  Scenario: g_V_connectedComponent_hasXcomponentX
+    Given the modern graph
+    And the traversal of
+      """
+      g.withComputer().V().connectedComponent().has("gremlin.connectedComponentVertexProgram.component")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | result |
+      | v[marko] |
+      | v[vadas] |
+      | v[lop] |
+      | v[josh] |
+      | v[ripple] |
+      | v[peter] |
+
+  Scenario: g_V_dedup_connectedComponent_hasXcomponentX
+    Given the modern graph
+    And the traversal of
+      """
+      g.withComputer().V().dedup().connectedComponent().has("gremlin.connectedComponentVertexProgram.component")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | result |
+      | v[marko] |
+      | v[vadas] |
+      | v[lop] |
+      | v[josh] |
+      | v[ripple] |
+      | v[peter] |
+
+  Scenario: g_V_hasLabelXsoftwareX_connectedComponent_project_byXnameX_byXcomponentX
+    Given the modern graph
+    And the traversal of
+      """
+      g.withComputer().V().hasLabel("software").connectedComponent().project("name","component").by("name").by("gremlin.connectedComponentVertexProgram.component")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | result |
+      | m[{"name": "lop", "component": "1"}] |
+      | m[{"name": "ripple", "component": "1"}] |
+
+  Scenario: g_V_connectedComponent_withXEDGES_bothEXknowsXX_withXPROPERTY_NAME_clusterX_project_byXnameX_byXclusterX
+    Given the modern graph
+    And the traversal of
+      """
+      g.withComputer().V().hasLabel("person").connectedComponent().with("~tinkerpop.connectedComponent.edges", __.bothE("knows")).with("~tinkerpop.connectedComponent.propertyName", "cluster").project("name","cluster").by("name").by("cluster")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | result |
+      | m[{"name": "marko", "cluster": "1"}] |
+      | m[{"name": "vadas", "cluster": "1"}] |
+      | m[{"name": "josh", "cluster": "1"}] |
+      | m[{"name": "peter", "cluster": "6"}] |
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/0c2fc21f/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ConnectedComponentTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ConnectedComponentTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ConnectedComponentTest.java
index a542bed..bf0d047 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ConnectedComponentTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ConnectedComponentTest.java
@@ -108,12 +108,12 @@ public abstract class ConnectedComponentTest extends AbstractGremlinProcessTest
     public static class Traversals extends ConnectedComponentTest {
         @Override
         public Traversal<Vertex, Vertex> get_g_V_connectedComponent_hasXcomponentX() {
-            return g.V().connectedComponent();
+            return g.V().connectedComponent().has(ConnectedComponent.component);
         }
 
         @Override
         public Traversal<Vertex, Vertex> get_g_V_dedup_connectedComponent_hasXcomponentX() {
-            return g.V().dedup().connectedComponent();
+            return g.V().dedup().connectedComponent().has(ConnectedComponent.component);
         }
 
         @Override