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 2017/10/16 15:20:14 UTC

[01/47] tinkerpop git commit: TINKERPOP-1761: Cancel script evaluation timeout in when script evaluation finished. [Forced Update!]

Repository: tinkerpop
Updated Branches:
  refs/heads/TINKERPOP-1784 15a967c4b -> 76a88db89 (forced update)


TINKERPOP-1761: Cancel script evaluation timeout in  when script evaluation finished.


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

Branch: refs/heads/TINKERPOP-1784
Commit: 2a8c92f245aa28b66c616e62230bfd3972e7e5b9
Parents: 60a34d1
Author: Konstantin Mueller <ko...@mnemonic.no>
Authored: Mon Sep 11 11:25:12 2017 +0200
Committer: Konstantin Mueller <ko...@mnemonic.no>
Committed: Mon Sep 11 11:25:12 2017 +0200

----------------------------------------------------------------------
 CHANGELOG.asciidoc                                    |  1 +
 .../gremlin/groovy/engine/GremlinExecutor.java        | 14 +++++++++++++-
 .../gremlin/groovy/engine/GremlinExecutorTest.java    | 13 +++++++++++++
 3 files changed, 27 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2a8c92f2/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index ff0948a..fe1da7a 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -34,6 +34,7 @@ TinkerPop 3.2.7 (Release Date: NOT OFFICIALLY RELEASED YET)
 * Fixed a bug in `Neo4jGremlinPlugin` that prevented it from loading properly in the `GremlinPythonScriptEngine`.
 * Fixed a bug in `ComputerVerificationStrategy` where child traversals were being analyzed prior to compilation.
 * Fixed a bug that prevented Gremlin from ordering lists and streams made of mixed number types.
+* Cancel script evaluation timeout in `GremlinExecutor` when script evaluation finished.
 
 [[release-3-2-6]]
 TinkerPop 3.2.6 (Release Date: August 21, 2017)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2a8c92f2/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
index fabc8cb..dd01f74 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
@@ -56,6 +56,7 @@ import java.util.concurrent.Executors;
 import java.util.concurrent.Future;
 import java.util.concurrent.FutureTask;
 import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ScheduledFuture;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 import java.util.concurrent.atomic.AtomicBoolean;
@@ -329,7 +330,7 @@ public class GremlinExecutor implements AutoCloseable {
         final Future<?> executionFuture = executorService.submit(evalFuture);
         if (scriptEvalTimeOut > 0) {
             // Schedule a timeout in the thread pool for future execution
-            scheduledExecutorService.schedule(() -> {
+            final ScheduledFuture<?> sf = scheduledExecutorService.schedule(() -> {
                 if (executionFuture.cancel(true)) {
                     final CompletableFuture<Object> ef = evaluationFutureRef.get();
                     if (ef != null) {
@@ -338,6 +339,17 @@ public class GremlinExecutor implements AutoCloseable {
                     }
                 }
             }, scriptEvalTimeOut, TimeUnit.MILLISECONDS);
+
+            // Cancel the scheduled timeout if the eval future is complete or the script evaluation failed with exception
+            evaluationFuture.handleAsync((v, t) -> {
+                if (!sf.isDone()) {
+                    logger.debug("Killing scheduled timeout on script evaluation - {} - as the eval completed (possibly with exception).", script);
+                    sf.cancel(true);
+                }
+
+                // no return is necessary - nothing downstream is concerned with what happens in here
+                return null;
+            }, scheduledExecutorService);
         }
 
         return evaluationFuture;

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2a8c92f2/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutorTest.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutorTest.java b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutorTest.java
index 8aed8a6..ca361a0 100644
--- a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutorTest.java
+++ b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutorTest.java
@@ -418,6 +418,19 @@ public class GremlinExecutorTest {
     }
 
     @Test
+    public void shouldCancelTimeoutOnSuccessfulEval() throws Exception {
+        final long scriptEvaluationTimeout = 5_000;
+        final GremlinExecutor gremlinExecutor = GremlinExecutor.build()
+                .scriptEvaluationTimeout(scriptEvaluationTimeout)
+                .create();
+
+        final long now = System.currentTimeMillis();
+        assertEquals(2, gremlinExecutor.eval("1+1").get());
+        gremlinExecutor.close();
+        assertTrue(System.currentTimeMillis() - now < scriptEvaluationTimeout);
+    }
+
+    @Test
     public void shouldEvalInMultipleThreads() throws Exception {
         final GremlinExecutor gremlinExecutor = GremlinExecutor.build().create();
 


[36/47] tinkerpop git commit: TINKERPOP-1784 Added another feature test for groupCount()

Posted by sp...@apache.org.
TINKERPOP-1784 Added another feature test for groupCount()


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

Branch: refs/heads/TINKERPOP-1784
Commit: 012c7c7788ecd35100728552edef3e0c533e2d8a
Parents: 7ebd6bc
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Oct 3 13:06:19 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Oct 16 11:19:30 2017 -0400

----------------------------------------------------------------------
 gremlin-test/features/sideEffect/GroupCount.feature       | 10 ++++++++++
 .../tinkerpop/gremlin/process/FeatureCoverageTest.java    |  2 ++
 2 files changed, 12 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/012c7c77/gremlin-test/features/sideEffect/GroupCount.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/sideEffect/GroupCount.feature b/gremlin-test/features/sideEffect/GroupCount.feature
index d68a964..3fb363e 100644
--- a/gremlin-test/features/sideEffect/GroupCount.feature
+++ b/gremlin-test/features/sideEffect/GroupCount.feature
@@ -27,6 +27,16 @@ Feature: Step - groupCount()
     Then the result should be ordered
       | m[{"ripple": 1, "lop": 3}] |
 
+  Scenario: g_V_outXcreatedX_name_groupCount
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().out("created").values("name").groupCount()
+      """
+    When iterated to list
+    Then the result should be ordered
+      | m[{"ripple": 1, "lop": 3}] |
+
   Scenario: g_V_groupCount_byXbothE_countX
     Given an unsupported test
     Then nothing should happen because

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/012c7c77/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 00975be..ce66889 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
@@ -21,6 +21,7 @@ package org.apache.tinkerpop.gremlin.process;
 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.VertexTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.GroupCountTest;
 import org.junit.Test;
 
 import java.io.BufferedReader;
@@ -57,6 +58,7 @@ public class FeatureCoverageTest {
         final List<Class<?>> temp = Arrays.asList(
                 CoinTest.class,
                 CountTest.class,
+                GroupCountTest.class,
                 VertexTest.class);
 
         final Field field = ProcessStandardSuite.class.getDeclaredField("testsToEnforce");


[38/47] tinkerpop git commit: TINKERPOP-1784 Added some more vertex tests

Posted by sp...@apache.org.
TINKERPOP-1784 Added some more vertex tests


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

Branch: refs/heads/TINKERPOP-1784
Commit: 0273480e412d15d2aeadf81c75d1b9284297cebe
Parents: fb3fc7f
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Sep 28 10:29:47 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Oct 16 11:19:30 2017 -0400

----------------------------------------------------------------------
 gremlin-test/features/map/Vertex.feature | 70 +++++++++++++++++++++++++--
 1 file changed, 65 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/0273480e/gremlin-test/features/map/Vertex.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/map/Vertex.feature b/gremlin-test/features/map/Vertex.feature
index fbd4168..5bed2a6 100644
--- a/gremlin-test/features/map/Vertex.feature
+++ b/gremlin-test/features/map/Vertex.feature
@@ -73,10 +73,10 @@ Feature: Step - V(), E(), out(), in(), both(), inE(), outE(), bothE()
 
   Scenario: g_VX2X_in
     Given the modern graph
-    And using the parameter v1 is "v[vadas]"
+    And using the parameter v2 is "v[vadas]"
     And the traversal of
       """
-      g.V(v1).in()
+      g.V(v2).in()
       """
     When iterated to list
     Then the result should be unordered
@@ -84,10 +84,10 @@ Feature: Step - V(), E(), out(), in(), both(), inE(), outE(), bothE()
 
   Scenario: g_VX4X_both
     Given the modern graph
-    And using the parameter v1 is "v[josh]"
+    And using the parameter v4 is "v[josh]"
     And the traversal of
       """
-      g.V(v1).both()
+      g.V(v4).both()
       """
     When iterated to list
     Then the result should be unordered
@@ -108,4 +108,64 @@ Feature: Step - V(), E(), out(), in(), both(), inE(), outE(), bothE()
       | edge | marko-knows->vadas |
       | edge | peter-created->lop |
       | edge | josh-created->lop |
-      | edge | josh-created->ripple |
\ No newline at end of file
+      | edge | josh-created->ripple |
+
+  Scenario: g_EX11X
+    Given the modern graph
+    And using the parameter e11 is "e[josh-created->lop]"
+    And the traversal of
+    """
+      g.E(e11)
+      """
+    When iterated to list
+    Then the result should be unordered
+      | edge | josh-created->lop |
+
+  Scenario: g_VX1X_outE
+    Given the modern graph
+    And using the parameter v1 is "v[marko]"
+    And the traversal of
+    """
+      g.V(v1).outE()
+      """
+    When iterated to list
+    Then the result should be unordered
+      | edge | marko-created->lop |
+      | edge | marko-knows->josh |
+      | edge | marko-knows->vadas |
+
+  Scenario: g_VX2X_outE
+    Given the modern graph
+    And using the parameter v2 is "v[vadas]"
+    And the traversal of
+    """
+      g.V(v2).inE()
+      """
+    When iterated to list
+    Then the result should be unordered
+      | edge | marko-knows->vadas |
+
+  Scenario: g_VX4X_bothEXcreatedX
+    Given the modern graph
+    And using the parameter v4 is "v[josh]"
+    And the traversal of
+    """
+      g.V(v4).bothE("created")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | edge | josh-created->lop |
+      | edge | josh-created->ripple |
+
+  Scenario: g_VX4X_bothE
+    Given the modern graph
+    And using the parameter v4 is "v[josh]"
+    And the traversal of
+    """
+      g.V(v4).bothE()
+      """
+    When iterated to list
+    Then the result should be unordered
+      | edge | josh-created->lop |
+      | edge | josh-created->ripple |
+      | edge | marko-knows->josh |


[11/47] tinkerpop git commit: Added some "tutorials" to the list CTR

Posted by sp...@apache.org.
Added some "tutorials" to the list CTR


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

Branch: refs/heads/TINKERPOP-1784
Commit: cb7057c5f747705effb8a722365cf752272771c9
Parents: 021db56
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Oct 12 13:41:38 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Oct 12 13:41:38 2017 -0400

----------------------------------------------------------------------
 docs/src/index.asciidoc                   |   4 ++++
 docs/static/images/gremlin-compendium.png | Bin 0 -> 212061 bytes
 2 files changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/cb7057c5/docs/src/index.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/index.asciidoc b/docs/src/index.asciidoc
index eb76a7b..40fbb8c 100644
--- a/docs/src/index.asciidoc
+++ b/docs/src/index.asciidoc
@@ -66,6 +66,10 @@ Learn Gremlin using typical patterns found when querying data with SQL. (*extern
 ^|image:gremlin-standing.png[width=125] |link:https://academy.datastax.com/resources/getting-started-graph-databases[Getting Started with Graph Databases] +
 A brief overview of RDBMS architecture in comparison to graph, basic graph terminology, a real-world use case for graph,
 and an overview of Gremlin. (*external*)
+^|image:gremlin-compendium.png[width=200] |link:http://www.doanduyhai.com/blog/?p=13460[The Gremlin Compendium, minimum survival kit for any Gremlin user] +
+A series of blog posts that examine the Gremlin language in the context of various graph traversal patterns. (*external*)
+^|image:gremlin-running.png[width=125] |link:http://kelvinlawrence.net/book/Gremlin-Graph-Guide.html[Graph Databases, Gremlin and TinkerPop: A Tutorial] +
+A getting started guide for users of graph databases and the Gremlin query language featuring hints, tips and sample queries. (*external*)
 |=========================================================
 
 [[publications]]

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/cb7057c5/docs/static/images/gremlin-compendium.png
----------------------------------------------------------------------
diff --git a/docs/static/images/gremlin-compendium.png b/docs/static/images/gremlin-compendium.png
new file mode 100755
index 0000000..19a38b8
Binary files /dev/null and b/docs/static/images/gremlin-compendium.png differ


[18/47] tinkerpop git commit: TINKERPOP-1784 Categorize feature by step type

Posted by sp...@apache.org.
TINKERPOP-1784 Categorize feature by step type

This matches he pattern of the java test suite.


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

Branch: refs/heads/TINKERPOP-1784
Commit: 84fb552ff9620696bd17a9085ff3191efa1c7833
Parents: b835a60
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Sep 20 13:39:00 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Oct 16 11:19:29 2017 -0400

----------------------------------------------------------------------
 gremlin-test/features/Count.feature     | 54 ----------------------------
 gremlin-test/features/map/Count.feature | 54 ++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+), 54 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/84fb552f/gremlin-test/features/Count.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/Count.feature b/gremlin-test/features/Count.feature
deleted file mode 100644
index 383eecf..0000000
--- a/gremlin-test/features/Count.feature
+++ /dev/null
@@ -1,54 +0,0 @@
-# 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: Count Step
-
-  Scenario: Count all vertices
-    Given the modern graph
-    And the traversal of
-    """
-    g.V().count()
-    """
-    When iterating
-    Then the result should be 6
-
-  Scenario: Count vertices after traversing both() twice
-    Given the modern graph
-    And the traversal of
-    """
-    g.V().both().both().count()
-    """
-    When iterating
-    Then the result should be 30
-
-  Scenario: Count local
-    Given the modern graph
-    And the traversal of
-    """
-    g.V().fold().count(Scope.local)
-    """
-    When iterating
-    Then the result should be 6
-
-  Scenario: Count no vertices
-    Given the modern graph
-    And the traversal of
-    """
-    g.V().has("no").count()
-    """
-    When iterating
-    Then the result should be 0
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/84fb552f/gremlin-test/features/map/Count.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/map/Count.feature b/gremlin-test/features/map/Count.feature
new file mode 100644
index 0000000..383eecf
--- /dev/null
+++ b/gremlin-test/features/map/Count.feature
@@ -0,0 +1,54 @@
+# 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: Count Step
+
+  Scenario: Count all vertices
+    Given the modern graph
+    And the traversal of
+    """
+    g.V().count()
+    """
+    When iterating
+    Then the result should be 6
+
+  Scenario: Count vertices after traversing both() twice
+    Given the modern graph
+    And the traversal of
+    """
+    g.V().both().both().count()
+    """
+    When iterating
+    Then the result should be 30
+
+  Scenario: Count local
+    Given the modern graph
+    And the traversal of
+    """
+    g.V().fold().count(Scope.local)
+    """
+    When iterating
+    Then the result should be 6
+
+  Scenario: Count no vertices
+    Given the modern graph
+    And the traversal of
+    """
+    g.V().has("no").count()
+    """
+    When iterating
+    Then the result should be 0
\ No newline at end of file


[05/47] tinkerpop git commit: Truncate error message for "method code too large" exceptions CTR

Posted by sp...@apache.org.
Truncate error message for "method code too large" exceptions CTR


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

Branch: refs/heads/TINKERPOP-1784
Commit: b3e301e66ae7410aac6e7c35186ab8d909166ca0
Parents: 9f501cd
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Oct 4 08:27:31 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Oct 4 08:27:31 2017 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                                    |  1 +
 .../gremlin/server/op/AbstractEvalOpProcessor.java    | 14 +++++++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b3e301e6/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 9f98c08..5ea3034 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -23,6 +23,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 [[release-3-2-7]]
 === TinkerPop 3.2.7 (Release Date: NOT OFFICIALLY RELEASED YET)
 
+* Truncate the script in error logs and error return messages for "Method code too large" errors in Gremlin Server.
 * `ReferenceVertex` was missing its `label()` string. `ReferenceElement` now supports all label handling.
 * Fixed a bug where bytecode containing lambdas would randomly select a traversal source from bindings.
 * Deprecated `GremlinScriptEngine.eval()` methods and replaced them with new overloads that include the specific `TraversalSource` to bind to.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b3e301e6/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/AbstractEvalOpProcessor.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/AbstractEvalOpProcessor.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/AbstractEvalOpProcessor.java
index 46b3c8d..5c43b4d 100644
--- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/AbstractEvalOpProcessor.java
+++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/AbstractEvalOpProcessor.java
@@ -312,7 +312,7 @@ public abstract class AbstractEvalOpProcessor extends AbstractOpProcessor {
                     // up being favorable for this problem
                     if (t instanceof MultipleCompilationErrorsException && t.getMessage().contains("Method code too large!") &&
                             ((MultipleCompilationErrorsException) t).getErrorCollector().getErrorCount() == 1) {
-                        final String errorMessage = String.format("The Gremlin statement that was submitted exceed the maximum compilation size allowed by the JVM, please split it into multiple smaller statements - %s", msg);
+                        final String errorMessage = String.format("The Gremlin statement that was submitted exceed the maximum compilation size allowed by the JVM, please split it into multiple smaller statements - %s", trimMessage(msg));
                         logger.warn(errorMessage);
                         ctx.writeAndFlush(ResponseMessage.build(msg).code(ResponseStatusCode.SERVER_ERROR_SCRIPT_EVALUATION)
                                 .statusMessage(errorMessage)
@@ -330,6 +330,18 @@ public abstract class AbstractEvalOpProcessor extends AbstractOpProcessor {
         });
     }
 
+    /**
+     * Used to decrease the size of a Gremlin script that triggered a "method code too large" exception so that it
+     * doesn't log a massive text string nor return a large error message.
+     */
+    private RequestMessage trimMessage(final RequestMessage msg) {
+        final RequestMessage trimmedMsg = RequestMessage.from(msg).create();
+        if (trimmedMsg.getArgs().containsKey(Tokens.ARGS_GREMLIN))
+            trimmedMsg.getArgs().put(Tokens.ARGS_GREMLIN, trimmedMsg.getArgs().get(Tokens.ARGS_GREMLIN).toString().substring(0, 1021) + "...");
+
+        return trimmedMsg;
+    }
+
     @FunctionalInterface
     public interface BindingSupplier {
         public Bindings get() throws OpProcessorException;


[33/47] tinkerpop git commit: TINKERPOP-1784 Completed the VertexTest cases

Posted by sp...@apache.org.
TINKERPOP-1784 Completed the VertexTest cases


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

Branch: refs/heads/TINKERPOP-1784
Commit: 4983fe4039ef7242df637fd3e7b9513c84954797
Parents: b0423f5
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Sep 29 15:44:50 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Oct 16 11:19:30 2017 -0400

----------------------------------------------------------------------
 .../src/main/jython/radish/feature_steps.py     |  18 +-
 gremlin-test/features/map/Vertex.feature        | 226 ++++++++++++++++---
 .../gremlin/process/FeatureCoverageTest.java    |  93 ++++++++
 .../gremlin/structure/FeatureCoverageTest.java  |  92 --------
 4 files changed, 305 insertions(+), 124 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/4983fe40/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 a298d6c..340f84a 100644
--- a/gremlin-python/src/main/jython/radish/feature_steps.py
+++ b/gremlin-python/src/main/jython/radish/feature_steps.py
@@ -21,7 +21,7 @@ import json
 import re
 from gremlin_python.structure.graph import Graph
 from gremlin_python.process.graph_traversal import __
-from gremlin_python.process.traversal import P, Scope, Column
+from gremlin_python.process.traversal import P, Scope, Column, Direction
 from radish import given, when, then
 from hamcrest import *
 
@@ -35,6 +35,12 @@ def choose_graph(step, graph_name):
     step.context.g = Graph().traversal().withRemote(step.context.remote_conn[graph_name])
 
 
+@given("an unsupported test")
+def unsupported_scenario(step):
+    # this is a do nothing step as the test can't be supported for whatever reason
+    return
+
+
 @given("using the parameter {param_name:w} is {param:QuotedString}")
 def add_parameter(step, param_name, param):
     if not hasattr(step.context, "traversal_params"):
@@ -48,6 +54,7 @@ def translate_traversal(step):
     g = step.context.g
     b = {"g": g,
          "Column": Column,
+         "Direction": Direction,
          "P": P,
          "Scope": Scope,
          "bothE": __.bothE}
@@ -75,6 +82,11 @@ def assert_result(step, characterized_as):
         raise ValueError("unknown data characterization of " + characterized_as)
 
 
+@then("nothing should happen")
+def nothing_happening(step):
+    return
+
+
 def __convert(val, ctx):
     if isinstance(val, dict):                                         # convert dictionary keys/values
         n = {}
@@ -89,10 +101,14 @@ def __convert(val, ctx):
         return long(val[2:-1])
     elif isinstance(val, str) and re.match("^v\[.*\]\.id$", val):     # parse vertex id
         return ctx.lookup_v["modern"][val[2:-4]].id
+    elif isinstance(val, str) and re.match("^v\[.*\]\.sid$", val):    # parse vertex id as string
+        return ctx.lookup_v["modern"][val[2:-5]].id
     elif isinstance(val, str) and re.match("^v\[.*\]$", val):         # parse vertex
         return ctx.lookup_v["modern"][val[2:-1]]
     elif isinstance(val, str) and re.match("^e\[.*\]\.id$", val):     # parse edge id
         return ctx.lookup_e["modern"][val[2:-4]].id
+    elif isinstance(val, str) and re.match("^e\[.*\]\.sid$", val):    # parse edge id as string
+        return ctx.lookup_e["modern"][val[2:-5]].id
     elif isinstance(val, str) and re.match("^e\[.*\]$", val):         # parse edge
         return ctx.lookup_e["modern"][val[2:-1]]
     elif isinstance(val, str) and re.match("^m\[.*\]$", val):         # parse json as a map

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/4983fe40/gremlin-test/features/map/Vertex.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/map/Vertex.feature b/gremlin-test/features/map/Vertex.feature
index 1905f3a..37e398b 100644
--- a/gremlin-test/features/map/Vertex.feature
+++ b/gremlin-test/features/map/Vertex.feature
@@ -19,7 +19,7 @@ Feature: Step - V(), E(), out(), in(), both(), inE(), outE(), bothE()
 
   Scenario: g_VXlistX1_2_3XX_name
     Given the modern graph
-    And using the parameter vx is "l[v[marko],v[vadas],v[lop]]"
+    And using the parameter vx is "l[v[marko].id,v[vadas].id,v[lop].id]"
     And the traversal of
       """
       g.V(vx).values("name")
@@ -32,7 +32,7 @@ Feature: Step - V(), E(), out(), in(), both(), inE(), outE(), bothE()
 
   Scenario: g_VXlistXv1_v2_v3XX_name
     Given the modern graph
-    And using the parameter vx is "l[v[marko].id,v[vadas].id,v[lop].id]"
+    And using the parameter vx is "l[v[marko],v[vadas],v[lop]]"
     And the traversal of
       """
       g.V(vx).values("name")
@@ -60,10 +60,10 @@ Feature: Step - V(), E(), out(), in(), both(), inE(), outE(), bothE()
 
   Scenario: g_VX1X_out
     Given the modern graph
-    And using the parameter v1 is "v[marko]"
+    And using the parameter v1Id is "v[marko].id"
     And the traversal of
       """
-      g.V(v1).out()
+      g.V(v1Id).out()
       """
     When iterated to list
     Then the result should be unordered
@@ -73,10 +73,10 @@ Feature: Step - V(), E(), out(), in(), both(), inE(), outE(), bothE()
 
   Scenario: g_VX2X_in
     Given the modern graph
-    And using the parameter v2 is "v[vadas]"
+    And using the parameter v2Id is "v[vadas].id"
     And the traversal of
       """
-      g.V(v2).in()
+      g.V(v2Id).in()
       """
     When iterated to list
     Then the result should be unordered
@@ -84,10 +84,10 @@ Feature: Step - V(), E(), out(), in(), both(), inE(), outE(), bothE()
 
   Scenario: g_VX4X_both
     Given the modern graph
-    And using the parameter v4 is "v[josh]"
+    And using the parameter v4Id is "v[josh].id"
     And the traversal of
       """
-      g.V(v4).both()
+      g.V(v4Id).both()
       """
     When iterated to list
     Then the result should be unordered
@@ -112,10 +112,21 @@ Feature: Step - V(), E(), out(), in(), both(), inE(), outE(), bothE()
 
   Scenario: g_EX11X
     Given the modern graph
-    And using the parameter e11 is "e[josh-created->lop]"
+    And using the parameter e11Id is "e[josh-created->lop].id"
+    And the traversal of
+    """
+      g.E(e11Id)
+      """
+    When iterated to list
+    Then the result should be unordered
+      | e[josh-created->lop] |
+
+  Scenario: g_EX11AsStringX
+    Given the modern graph
+    And using the parameter e11Id is "e[josh-created->lop].sid"
     And the traversal of
     """
-      g.E(e11)
+      g.E(e11Id)
       """
     When iterated to list
     Then the result should be unordered
@@ -123,10 +134,10 @@ Feature: Step - V(), E(), out(), in(), both(), inE(), outE(), bothE()
 
   Scenario: g_VX1X_outE
     Given the modern graph
-    And using the parameter v1 is "v[marko]"
+    And using the parameter v1Id is "v[marko].id"
     And the traversal of
     """
-      g.V(v1).outE()
+      g.V(v1Id).outE()
       """
     When iterated to list
     Then the result should be unordered
@@ -136,10 +147,10 @@ Feature: Step - V(), E(), out(), in(), both(), inE(), outE(), bothE()
 
   Scenario: g_VX2X_outE
     Given the modern graph
-    And using the parameter v2 is "v[vadas]"
+    And using the parameter v2Id is "v[vadas].id"
     And the traversal of
     """
-      g.V(v2).inE()
+      g.V(v2Id).inE()
       """
     When iterated to list
     Then the result should be unordered
@@ -147,10 +158,10 @@ Feature: Step - V(), E(), out(), in(), both(), inE(), outE(), bothE()
 
   Scenario: g_VX4X_bothEXcreatedX
     Given the modern graph
-    And using the parameter v4 is "v[josh]"
+    And using the parameter v4Id is "v[josh].id"
     And the traversal of
     """
-      g.V(v4).bothE("created")
+      g.V(v4Id).bothE("created")
       """
     When iterated to list
     Then the result should be unordered
@@ -159,10 +170,10 @@ Feature: Step - V(), E(), out(), in(), both(), inE(), outE(), bothE()
 
   Scenario: g_VX4X_bothE
     Given the modern graph
-    And using the parameter v4 is "v[josh]"
+    And using the parameter v4Id is "v[josh].id"
     And the traversal of
     """
-      g.V(v4).bothE()
+      g.V(v4Id).bothE()
       """
     When iterated to list
     Then the result should be unordered
@@ -172,10 +183,10 @@ Feature: Step - V(), E(), out(), in(), both(), inE(), outE(), bothE()
 
   Scenario: g_VX1X_outE_inV
     Given the modern graph
-    And using the parameter v1 is "v[marko]"
+    And using the parameter v1Id is "v[marko].id"
     And the traversal of
       """
-      g.V(v1).both()
+      g.V(v1Id).both()
       """
     When iterated to list
     Then the result should be unordered
@@ -185,10 +196,10 @@ Feature: Step - V(), E(), out(), in(), both(), inE(), outE(), bothE()
 
   Scenario: g_VX2X_inE_outV
     Given the modern graph
-    And using the parameter v2 is "v[vadas]"
+    And using the parameter v2Id is "v[vadas].id"
     And the traversal of
       """
-      g.V(v2).inE().outV()
+      g.V(v2Id).inE().outV()
       """
     When iterated to list
     Then the result should be unordered
@@ -226,10 +237,10 @@ Feature: Step - V(), E(), out(), in(), both(), inE(), outE(), bothE()
 
   Scenario: g_VX1X_outEXknowsX_bothV_name
     Given the modern graph
-    And using the parameter v1 is "v[marko]"
+    And using the parameter v1Id is "v[marko].id"
     And the traversal of
       """
-      g.V(v1).outE("knows").bothV().values("name")
+      g.V(v1Id).outE("knows").bothV().values("name")
       """
     When iterated to list
     Then the result should be unordered
@@ -240,10 +251,10 @@ Feature: Step - V(), E(), out(), in(), both(), inE(), outE(), bothE()
 
   Scenario: g_VX1X_outE_otherV
     Given the modern graph
-    And using the parameter v1 is "v[marko]"
+    And using the parameter v1Id is "v[marko].id"
     And the traversal of
       """
-      g.V(v1).outE().otherV()
+      g.V(v1Id).outE().otherV()
       """
     When iterated to list
     Then the result should be unordered
@@ -253,10 +264,10 @@ Feature: Step - V(), E(), out(), in(), both(), inE(), outE(), bothE()
 
   Scenario: g_VX4X_bothE_otherV
     Given the modern graph
-    And using the parameter v4 is "v[josh]"
+    And using the parameter v4Id is "v[josh].id"
     And the traversal of
       """
-      g.V(v4).bothE().otherV()
+      g.V(v4Id).bothE().otherV()
       """
     When iterated to list
     Then the result should be unordered
@@ -266,11 +277,164 @@ Feature: Step - V(), E(), out(), in(), both(), inE(), outE(), bothE()
 
   Scenario: g_VX4X_bothE_hasXweight_lt_1X_otherV
     Given the modern graph
-    And using the parameter v4 is "v[josh]"
+    And using the parameter v4Id is "v[josh].id"
+    And the traversal of
+      """
+      g.V(v4Id).bothE().has("weight", P.lt(1.0)).otherV()
+      """
+    When iterated to list
+    Then the result should be unordered
+      | v[lop] |
+
+  Scenario: g_VX2X_inE
+    Given the modern graph
+    And using the parameter v2Id is "v[vadas].id"
+    And the traversal of
+    """
+      g.V(v2Id).bothE()
+      """
+    When iterated to list
+    Then the result should be unordered
+      | e[marko-knows->vadas] |
+
+  Scenario: get_g_VX1X_outE_otherV
+    Given the modern graph
+    And using the parameter v1Id is "v[marko].id"
+    And the traversal of
+      """
+      g.V(v1Id).outE().otherV()
+      """
+    When iterated to list
+    Then the result should be unordered
+      | v[vadas] |                               
+      | v[josh] |
+      | v[lop] |
+
+  Scenario: g_VX1X_outXknowsX
+    Given the modern graph
+    And using the parameter v1Id is "v[marko].id"
+    And the traversal of
+      """
+      g.V(v1Id).out("knows")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | v[vadas] |
+      | v[josh] |
+
+  Scenario: g_VX1AsStringX_outXknowsX
+    Given the modern graph
+    And using the parameter v1Id is "v[marko].sid"
     And the traversal of
       """
-      g.V(v4).bothE().has("weight", P.lt(1.0)).otherV()
+      g.V(v1Id).out("knows")
       """
     When iterated to list
     Then the result should be unordered
-      | v[lop] |
\ No newline at end of file
+      | v[vadas] |
+      | v[josh] |
+
+  Scenario: g_VX1X_outXknows_createdX
+    Given the modern graph
+    And using the parameter v1Id is "v[marko].id"
+    And the traversal of
+      """
+      g.V(v1Id).out("knows","created")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | v[vadas] |
+      | v[josh] |
+      | v[lop] |
+
+  Scenario: g_VX1X_outEXknowsX_inV
+    Given the modern graph
+    And using the parameter v1Id is "v[marko].id"
+    And the traversal of
+      """
+      g.V(v1Id).outE("knows").inV()
+      """
+    When iterated to list
+    Then the result should be unordered
+      | v[vadas] |
+      | v[josh] |
+
+  Scenario: g_VX1X_outEXknows_createdX_inV
+    Given the modern graph
+    And using the parameter v1Id is "v[marko].id"
+    And the traversal of
+      """
+      g.V(v1Id).outE("knows","created").inV()
+      """
+    When iterated to list
+    Then the result should be unordered
+      | v[vadas] |
+      | v[josh] |
+      | v[lop] |
+
+  Scenario: g_V_out_out
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().out().out()
+      """
+    When iterated to list
+    Then the result should be unordered
+      | v[ripple] |
+      | v[lop] |
+
+  Scenario: g_VX1X_out_out_out
+    Given the modern graph
+    And using the parameter v1Id is "v[marko].id"
+    And the traversal of
+      """
+      g.V(v1Id).out().out().out()
+      """
+    When iterated to list
+    Then the result should be empty
+
+  Scenario: g_VX1X_out_name
+    Given the modern graph
+    And using the parameter v1Id is "v[marko].id"
+    And the traversal of
+      """
+      g.V(v1Id).out().values("name")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | vadas |
+      | josh |
+      | lop |
+
+  Scenario: g_VX1X_to_XOUT_knowsX
+    Given the modern graph
+    And using the parameter v1Id is "v[marko].id"
+    And the traversal of
+      """
+      g.V(v1Id).to(Direction.OUT, "knows")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | v[vadas] |
+      | v[josh] |
+
+  Scenario: g_VX1_2_3_4X_name
+    Given an unsupported test
+    Then nothing should happen
+
+  Scenario: g_V_hasLabelXpersonX_V_hasLabelXsoftwareX_name
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().hasLabel("person").V().hasLabel("software").values("name")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | lop |
+      | lop |
+      | lop |
+      | lop |
+      | ripple |
+      | ripple |
+      | ripple |
+      | ripple |
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/4983fe40/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
new file mode 100644
index 0000000..d3212a4
--- /dev/null
+++ b/gremlin-test/src/test/java/org/apache/tinkerpop/gremlin/process/FeatureCoverageTest.java
@@ -0,0 +1,93 @@
+/*
+ * 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.
+ */
+package org.apache.tinkerpop.gremlin.process;
+
+import org.apache.tinkerpop.gremlin.process.traversal.step.filter.CoinTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.VertexTest;
+import org.junit.Test;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class FeatureCoverageTest {
+
+    private static Pattern scenarioName = Pattern.compile("^\\s*Scenario:\\s*(.*)$");
+
+    @Test
+    public void shouldImplementAllProcessTestsAsFeatures() throws Exception {
+
+        // TEMPORARY while test framework is under development - all tests should ultimately be included
+        final List<Class<?>> temp = Arrays.asList(CoinTest.class, VertexTest.class);
+
+        final Field field = ProcessStandardSuite.class.getDeclaredField("testsToEnforce");
+        field.setAccessible(true);
+        final Class<?>[] testsToEnforce = (Class<?>[]) field.get(null);
+
+        final List<Class<?>> testClassesToEnforce = Stream.of(testsToEnforce).filter(temp::contains).collect(Collectors.toList());
+        for (Class<?> t : testClassesToEnforce) {
+            final String packge = t.getPackage().getName();
+            final String group = packge.substring(packge.lastIndexOf(".") + 1, packge.length());
+            final String featureFileName = "features" + File.separator +
+                                           group + File.separator +
+                                           t.getSimpleName().replace("Test", "") + ".feature";
+            final Set<String> testMethods = Stream.of(t.getDeclaredMethods())
+                    .filter(m -> m.isAnnotationPresent(Test.class))
+                    .map(Method::getName).collect(Collectors.toSet());
+
+            final File featureFile = new File(featureFileName);
+            assertThat(featureFile.exists(), is(true));
+            assertThat(featureFile.isFile(), is(true));
+
+            final Set<String> testsInFeatureFile = new HashSet<>();
+            final InputStream is = new FileInputStream(featureFile);
+            final BufferedReader buf = new BufferedReader(new InputStreamReader(is));
+            String line = buf.readLine();
+            while(line != null){
+                final Matcher matcher = scenarioName.matcher(line);
+                if (matcher.matches())
+                    testsInFeatureFile.add(matcher.group(1));
+                line = buf.readLine();
+            }
+
+            testMethods.removeAll(testsInFeatureFile);
+
+            assertEquals("All test methods are not implemented in the " + featureFileName + ": " + testMethods, testMethods.size(), 0);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/4983fe40/gremlin-test/src/test/java/org/apache/tinkerpop/gremlin/structure/FeatureCoverageTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/test/java/org/apache/tinkerpop/gremlin/structure/FeatureCoverageTest.java b/gremlin-test/src/test/java/org/apache/tinkerpop/gremlin/structure/FeatureCoverageTest.java
deleted file mode 100644
index 791d44e..0000000
--- a/gremlin-test/src/test/java/org/apache/tinkerpop/gremlin/structure/FeatureCoverageTest.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * 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.
- */
-package org.apache.tinkerpop.gremlin.structure;
-
-import org.apache.tinkerpop.gremlin.process.ProcessStandardSuite;
-import org.apache.tinkerpop.gremlin.process.traversal.step.filter.CoinTest;
-import org.apache.tinkerpop.gremlin.process.traversal.step.map.CountTest;
-import org.junit.Test;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-
-/**
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-public class FeatureCoverageTest {
-
-    private static Pattern scenarioName = Pattern.compile("^\\s*Scenario:\\s*(.*)$");
-
-    @Test
-    public void shouldImplementAllProcessTestsAsFeatures() throws Exception {
-
-        // TEMPORARY while test framework is under development - all tests should ultimately be included
-        final List<Class<?>> temp = Arrays.asList(CoinTest.class);
-
-        final Field field = ProcessStandardSuite.class.getDeclaredField("testsToEnforce");
-        field.setAccessible(true);
-        final Class<?>[] testsToEnforce = (Class<?>[]) field.get(null);
-
-        final List<Class<?>> testClassesToEnforce = Stream.of(testsToEnforce).filter(temp::contains).collect(Collectors.toList());
-        for (Class<?> t : testClassesToEnforce) {
-            final String packge = t.getPackage().getName();
-            final String group = packge.substring(packge.lastIndexOf(".") + 1, packge.length());
-            final String featureFileName = "features" + File.separator +
-                                           group + File.separator +
-                                           t.getSimpleName().replace("Test", "") + ".feature";
-            final Set<String> testMethods = Stream.of(t.getDeclaredMethods())
-                    .filter(m -> m.isAnnotationPresent(Test.class))
-                    .map(Method::getName).collect(Collectors.toSet());
-
-            final File featureFile = new File(featureFileName);
-            assertThat(featureFile.exists(), is(true));
-            assertThat(featureFile.isFile(), is(true));
-
-            final Set<String> testsInFeatureFile = new HashSet<>();
-            final InputStream is = new FileInputStream(featureFile);
-            final BufferedReader buf = new BufferedReader(new InputStreamReader(is));
-            String line = buf.readLine();
-            while(line != null){
-                final Matcher matcher = scenarioName.matcher(line);
-                if (matcher.matches())
-                    testsInFeatureFile.add(matcher.group(1));
-                line = buf.readLine();
-            }
-
-            assertEquals("All test methods are not implemented in the " + featureFileName, testMethods, testsInFeatureFile);
-        }
-    }
-}


[31/47] tinkerpop git commit: TINKERPOP-1784 Changed assertion logic and table formats in feature files

Posted by sp...@apache.org.
TINKERPOP-1784 Changed assertion logic and table formats in feature files


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

Branch: refs/heads/TINKERPOP-1784
Commit: dea081c69c7169a34e70d8d7cdef78b92eb48856
Parents: 0273480
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Sep 28 14:54:40 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Oct 16 11:19:30 2017 -0400

----------------------------------------------------------------------
 .../src/main/jython/radish/feature_steps.py     | 61 +++++------------
 gremlin-test/features/filter/Coin.feature       | 12 ++--
 gremlin-test/features/filter/Has.feature        | 10 +--
 gremlin-test/features/map/Count.feature         | 10 +--
 gremlin-test/features/map/Select.feature        |  4 +-
 gremlin-test/features/map/Vertex.feature        | 70 ++++++++++----------
 .../features/sideEffect/GroupCount.feature      | 41 ++++++------
 7 files changed, 89 insertions(+), 119 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/dea081c6/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 2154536..7a4a30a 100644
--- a/gremlin-python/src/main/jython/radish/feature_steps.py
+++ b/gremlin-python/src/main/jython/radish/feature_steps.py
@@ -81,22 +81,24 @@ def __convert(val, ctx):
         for key, value in val.items():
             n[__convert(key, ctx)] = __convert(value, ctx)
         return n
-    elif isinstance(val, (str, unicode)) and re.match("^l\[.*\]$", val):         # parse list
+    elif isinstance(val, unicode):
+        return __convert(val.encode('utf-8'), ctx)
+    elif isinstance(val, str) and re.match("^l\[.*\]$", val):         # parse list
         return list(map((lambda x: __convert(x, ctx)), val[2:-1].split(",")))
-    elif isinstance(val, (str, unicode)) and re.match("^d\[.*\]$", val):         # parse numeric
+    elif isinstance(val, str) and re.match("^d\[.*\]$", val):         # parse numeric
         return long(val[2:-1])
-    elif isinstance(val, (str, unicode)) and re.match("^v\[.*\]\.id$", val):     # parse vertex id
+    elif isinstance(val, str) and re.match("^v\[.*\]\.id$", val):     # parse vertex id
         return ctx.lookup_v["modern"][val[2:-4]].id
-    elif isinstance(val, (str, unicode)) and re.match("^v\[.*\]$", val):         # parse vertex
+    elif isinstance(val, str) and re.match("^v\[.*\]$", val):         # parse vertex
         return ctx.lookup_v["modern"][val[2:-1]]
-    elif isinstance(val, (str, unicode)) and re.match("^e\[.*\]\.id$", val):     # parse edge id
+    elif isinstance(val, str) and re.match("^e\[.*\]\.id$", val):     # parse edge id
         return ctx.lookup_e["modern"][val[2:-4]].id
-    elif isinstance(val, (str, unicode)) and re.match("^e\[.*\]$", val):         # parse edge
+    elif isinstance(val, str) and re.match("^e\[.*\]$", val):         # parse edge
         return ctx.lookup_e["modern"][val[2:-1]]
-    elif isinstance(val, unicode):
-        return val.encode('utf-8')
+    elif isinstance(val, str) and re.match("^m\[.*\]$", val):         # parse json as a map
+        return __convert(json.loads(val[2:-1]), ctx)
     else:
-        return str(val)
+        return val
 
 
 def __ordered_assertion(step):
@@ -109,19 +111,7 @@ def __ordered_assertion(step):
     # the data to assert. the contents of the second column will be dependent on the type specified
     # in the first column
     for ix, line in enumerate(data):
-        if line[0] == "numeric":
-            assert_that(long(step.context.result[ix]), equal_to(long(line[1])))
-        elif line[0] == "string":
-            assert_that(str(step.context.result[ix]), equal_to(str(line[1])))
-        elif line[0] == "vertex":
-            assert_that(step.context.result[ix].label, equal_to(line[1]))
-        elif line[0] == "edge":
-            assert_that(step.context.result[ix].label, equal_to(line[1]))
-        elif line[0] == "map":
-            assert_that(__convert(step.context.result[ix], step.context), json.loads(line[1]))
-        else:
-            raise ValueError("unknown type of " + line[0])
-
+        assert_that(step.context.result[ix], equal_to(__convert(line[0], step.context)))
 
 def __unordered_assertion(step):
     data = step.table
@@ -134,30 +124,9 @@ def __unordered_assertion(step):
     # finds a match in the results for each line of data to assert and then removes that item
     # from the list - in the end there should be no items left over and each will have been asserted
     for line in data:
-        if line[0] == "numeric":
-            val = long(line[1])
-            assert_that(val, is_in(list(map(long, results_to_test))))
-            results_to_test.remove(val)
-        elif line[0] == "string":
-            val = str(line[1])
-            assert_that(val, is_in(list(map(str, results_to_test))))
-            results_to_test.remove(val)
-        elif line[0] == "vertex":
-            val = str(line[1])
-            v = step.context.lookup_v["modern"][val]
-            assert_that(v, is_in(results_to_test))
-            results_to_test.remove(v)
-        elif line[0] == "edge":
-            val = str(line[1])
-            e = step.context.lookup_e["modern"][val]
-            assert_that(e, is_in(results_to_test))
-            results_to_test.remove(e)
-        elif line[0] == "map":
-            val = __convert(json.loads(line[1]), step.context)
-            assert_that(val, is_in(results_to_test))
-            results_to_test.remove(val)
-        else:
-            raise ValueError("unknown type of " + line[0])
+        val = __convert(line[0], step.context)
+        assert_that(val, is_in(results_to_test))
+        results_to_test.remove(val)
 
     assert_that(len(results_to_test), is_(0))
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/dea081c6/gremlin-test/features/filter/Coin.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/filter/Coin.feature b/gremlin-test/features/filter/Coin.feature
index 802ebdc..d1acc46 100644
--- a/gremlin-test/features/filter/Coin.feature
+++ b/gremlin-test/features/filter/Coin.feature
@@ -25,12 +25,12 @@ Feature: Step - coin()
       """
     When iterated to list
     Then the result should be unordered
-      | vertex | marko  |
-      | vertex | vadas  |
-      | vertex | lop    |
-      | vertex | josh   |
-      | vertex | ripple |
-      | vertex | peter  |
+      | v[marko] |
+      | v[vadas] |
+      | v[lop] |
+      | v[josh] |
+      | v[ripple] |
+      | v[peter]  |
 
 
   Scenario: g_V_coinX0X

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/dea081c6/gremlin-test/features/filter/Has.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/filter/Has.feature b/gremlin-test/features/filter/Has.feature
index 4a2e085..8ff3a2b 100644
--- a/gremlin-test/features/filter/Has.feature
+++ b/gremlin-test/features/filter/Has.feature
@@ -25,8 +25,8 @@ Feature: Step - has()
       """
     When iterated to list
     Then the result should be unordered
-      | vertex | josh   |
-      | vertex | peter  |
+      | v[josh] |
+      | v[peter] |
 
   Scenario: Use hasId() with P
     Given the modern graph
@@ -37,7 +37,7 @@ Feature: Step - has()
     """
     When iterated to list
     Then the result should be unordered
-      | vertex | josh   |
-      | vertex | josh   |
-      | vertex | peter  |
+      | v[josh] |
+      | v[josh] |
+      | v[peter] |
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/dea081c6/gremlin-test/features/map/Count.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/map/Count.feature b/gremlin-test/features/map/Count.feature
index 1233ed3..b7f5c66 100644
--- a/gremlin-test/features/map/Count.feature
+++ b/gremlin-test/features/map/Count.feature
@@ -25,7 +25,7 @@ Feature: Step - count()
       """
     When iterated to list
     Then the result should be ordered
-      | numeric | 6 |
+      | d[6] |
 
   Scenario: g_V_out_count
     Given the modern graph
@@ -35,7 +35,7 @@ Feature: Step - count()
       """
     When iterated to list
     Then the result should be ordered
-      | numeric | 6 |
+      | d[6] |
 
   Scenario: g_V_both_both_count
     Given the modern graph
@@ -45,7 +45,7 @@ Feature: Step - count()
       """
     When iterated to list
     Then the result should be ordered
-      | numeric | 30 |
+      | d[30] |
 
   Scenario: g_V_fold_countXlocalX
     Given the modern graph
@@ -55,7 +55,7 @@ Feature: Step - count()
       """
     When iterated to list
     Then the result should be ordered
-      | numeric | 6 |
+      | d[6] |
 
   Scenario: g_V_hasXnoX_count
     Given the modern graph
@@ -65,4 +65,4 @@ Feature: Step - count()
       """
     When iterated to list
     Then the result should be ordered
-      | numeric | 0 |
\ No newline at end of file
+      | d[0] |
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/dea081c6/gremlin-test/features/map/Select.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/map/Select.feature b/gremlin-test/features/map/Select.feature
index b2d208c..9166954 100644
--- a/gremlin-test/features/map/Select.feature
+++ b/gremlin-test/features/map/Select.feature
@@ -26,5 +26,5 @@ Feature: Step - select()
       """
     When iterated to list
     Then the result should be unordered
-      | map | {"a": "v[marko]", "b": "v[vadas]"} |
-      | map | {"a": "v[marko]", "b": "v[josh]"} |
\ No newline at end of file
+      | m[{"a": "v[marko]", "b": "v[vadas]"}] |
+      | m[{"a": "v[marko]", "b": "v[josh]"}] |
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/dea081c6/gremlin-test/features/map/Vertex.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/map/Vertex.feature b/gremlin-test/features/map/Vertex.feature
index 5bed2a6..9aa506c 100644
--- a/gremlin-test/features/map/Vertex.feature
+++ b/gremlin-test/features/map/Vertex.feature
@@ -26,9 +26,9 @@ Feature: Step - V(), E(), out(), in(), both(), inE(), outE(), bothE()
       """
     When iterated to list
     Then the result should be unordered
-      | string | marko |
-      | string | vadas |
-      | string | lop |
+      | marko |
+      | vadas |
+      | lop |
 
   Scenario: g_VXlistXv1_v2_v3XX_name
     Given the modern graph
@@ -39,9 +39,9 @@ Feature: Step - V(), E(), out(), in(), both(), inE(), outE(), bothE()
       """
     When iterated to list
     Then the result should be unordered
-      | string | marko |
-      | string | vadas |
-      | string | lop |
+      | marko |
+      | vadas |
+      | lop |
 
   Scenario: g_V
     Given the modern graph
@@ -51,12 +51,12 @@ Feature: Step - V(), E(), out(), in(), both(), inE(), outE(), bothE()
       """
     When iterated to list
     Then the result should be unordered
-      | vertex | marko |
-      | vertex | vadas |
-      | vertex | lop |
-      | vertex | josh |
-      | vertex | ripple |
-      | vertex | peter |
+      | v[marko] |
+      | v[vadas] |
+      | v[lop] |
+      | v[josh] |
+      | v[ripple] |
+      | v[peter] |
 
   Scenario: g_VX1X_out
     Given the modern graph
@@ -67,9 +67,9 @@ Feature: Step - V(), E(), out(), in(), both(), inE(), outE(), bothE()
       """
     When iterated to list
     Then the result should be unordered
-      | vertex | vadas |
-      | vertex | lop |
-      | vertex | josh |
+      | v[vadas] |
+      | v[lop] |
+      | v[josh] |
 
   Scenario: g_VX2X_in
     Given the modern graph
@@ -80,7 +80,7 @@ Feature: Step - V(), E(), out(), in(), both(), inE(), outE(), bothE()
       """
     When iterated to list
     Then the result should be unordered
-      | vertex | marko |
+      | v[marko] |
 
   Scenario: g_VX4X_both
     Given the modern graph
@@ -91,9 +91,9 @@ Feature: Step - V(), E(), out(), in(), both(), inE(), outE(), bothE()
       """
     When iterated to list
     Then the result should be unordered
-      | vertex | marko |
-      | vertex | lop |
-      | vertex | ripple |
+      | v[marko] |
+      | v[lop] |
+      | v[ripple] |
 
   Scenario: g_E
     Given the modern graph
@@ -103,12 +103,12 @@ Feature: Step - V(), E(), out(), in(), both(), inE(), outE(), bothE()
       """
     When iterated to list
     Then the result should be unordered
-      | edge | marko-created->lop |
-      | edge | marko-knows->josh |
-      | edge | marko-knows->vadas |
-      | edge | peter-created->lop |
-      | edge | josh-created->lop |
-      | edge | josh-created->ripple |
+      | e[marko-created->lop] |
+      | e[marko-knows->josh] |
+      | e[marko-knows->vadas] |
+      | e[peter-created->lop] |
+      | e[josh-created->lop] |
+      | e[josh-created->ripple] |
 
   Scenario: g_EX11X
     Given the modern graph
@@ -119,7 +119,7 @@ Feature: Step - V(), E(), out(), in(), both(), inE(), outE(), bothE()
       """
     When iterated to list
     Then the result should be unordered
-      | edge | josh-created->lop |
+      | e[josh-created->lop] |
 
   Scenario: g_VX1X_outE
     Given the modern graph
@@ -130,9 +130,9 @@ Feature: Step - V(), E(), out(), in(), both(), inE(), outE(), bothE()
       """
     When iterated to list
     Then the result should be unordered
-      | edge | marko-created->lop |
-      | edge | marko-knows->josh |
-      | edge | marko-knows->vadas |
+      | e[marko-created->lop] |
+      | e[marko-knows->josh] |
+      | e[marko-knows->vadas] |
 
   Scenario: g_VX2X_outE
     Given the modern graph
@@ -143,7 +143,7 @@ Feature: Step - V(), E(), out(), in(), both(), inE(), outE(), bothE()
       """
     When iterated to list
     Then the result should be unordered
-      | edge | marko-knows->vadas |
+      | e[marko-knows->vadas] |
 
   Scenario: g_VX4X_bothEXcreatedX
     Given the modern graph
@@ -154,8 +154,8 @@ Feature: Step - V(), E(), out(), in(), both(), inE(), outE(), bothE()
       """
     When iterated to list
     Then the result should be unordered
-      | edge | josh-created->lop |
-      | edge | josh-created->ripple |
+      | e[josh-created->lop] |
+      | e[josh-created->ripple] |
 
   Scenario: g_VX4X_bothE
     Given the modern graph
@@ -166,6 +166,6 @@ Feature: Step - V(), E(), out(), in(), both(), inE(), outE(), bothE()
       """
     When iterated to list
     Then the result should be unordered
-      | edge | josh-created->lop |
-      | edge | josh-created->ripple |
-      | edge | marko-knows->josh |
+      | e[josh-created->lop] |
+      | e[josh-created->ripple] |
+      | e[marko-knows->josh] |

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/dea081c6/gremlin-test/features/sideEffect/GroupCount.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/sideEffect/GroupCount.feature b/gremlin-test/features/sideEffect/GroupCount.feature
index 7b4a0a6..bfb7363 100644
--- a/gremlin-test/features/sideEffect/GroupCount.feature
+++ b/gremlin-test/features/sideEffect/GroupCount.feature
@@ -25,24 +25,25 @@ Feature: Step - groupCount()
       """
     When iterated to list
     Then the result should be ordered
-      | map | {"ripple": 1, "lop": 3} |
+      | m[{"ripple": 1, "lop": 3}] |
 
-  Scenario: Edge count distribution
-    Given the modern graph
-    And the traversal of
-      """
-      g.V().groupCount().by(bothE().count())
-      """
-    When iterated to list
-    Then the result should be ordered
-      | map | {"d[1]": 3, "d[3]": 3} |
-
-  Scenario: Group count vertices, cap to retrieve the map and unfold it to group count again
-    Given the modern graph
-    And the traversal of
-      """
-      g.V().both().groupCount("a").out().cap("a").select(Column.keys).unfold().both().groupCount("a").cap("a")
-      """
-    When iterated to list
-    Then the result should be ordered
-      | map | {"v[marko]": 6, "v[vadas]": 2, "v[lop]": 6, "v[josh]": 6, "v[ripple]": 2, "v[peter]": 2} |
\ No newline at end of file
+# NOT SUPPORTED UNTIL GRAPHSON 3.X WHICH HAS SUPPORT FOR NON-STRING KEYS
+#  Scenario: Edge count distribution
+#    Given the modern graph
+#    And the traversal of
+#      """
+#      g.V().groupCount().by(bothE().count())
+#      """
+#    When iterated to list
+#    Then the result should be ordered
+#      | m[{"d[1]": 3, "d[3]": 3}] |
+#
+#  Scenario: Group count vertices, cap to retrieve the map and unfold it to group count again
+#    Given the modern graph
+#    And the traversal of
+#      """
+#      g.V().both().groupCount("a").out().cap("a").select(Column.keys).unfold().both().groupCount("a").cap("a")
+#      """
+#    When iterated to list
+#    Then the result should be ordered
+#      | m[{"v[marko]": 6, "v[vadas]": 2, "v[lop]": 6, "v[josh]": 6, "v[ripple]": 2, "v[peter]": 2}] |
\ No newline at end of file


[35/47] tinkerpop git commit: TINKERPOP-1784 Added test to enforce implementation of process tests as features

Posted by sp...@apache.org.
TINKERPOP-1784 Added test to enforce implementation of process tests as features


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

Branch: refs/heads/TINKERPOP-1784
Commit: 672faea3d636b2fb8f7afbd64715a921c9fbe240
Parents: 8325d46
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Sep 27 13:26:17 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Oct 16 11:19:30 2017 -0400

----------------------------------------------------------------------
 gremlin-test/features/filter/Coin.feature       |  4 +-
 gremlin-test/features/map/Count.feature         | 18 +++-
 .../gremlin/structure/FeatureCoverageTest.java  | 92 ++++++++++++++++++++
 3 files changed, 108 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/672faea3/gremlin-test/features/filter/Coin.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/filter/Coin.feature b/gremlin-test/features/filter/Coin.feature
index 1b88f58..802ebdc 100644
--- a/gremlin-test/features/filter/Coin.feature
+++ b/gremlin-test/features/filter/Coin.feature
@@ -17,7 +17,7 @@
 
 Feature: Step - coin()
 
-  Scenario: Use coin at 1.0
+  Scenario: g_V_coinX1X
     Given the modern graph
     And the traversal of
       """
@@ -33,7 +33,7 @@ Feature: Step - coin()
       | vertex | peter  |
 
 
-  Scenario: Use coin at 0.0
+  Scenario: g_V_coinX0X
     Given the modern graph
     And the traversal of
       """

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/672faea3/gremlin-test/features/map/Count.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/map/Count.feature b/gremlin-test/features/map/Count.feature
index 316976e..1233ed3 100644
--- a/gremlin-test/features/map/Count.feature
+++ b/gremlin-test/features/map/Count.feature
@@ -17,7 +17,7 @@
 
 Feature: Step - count()
 
-  Scenario: Count all vertices
+  Scenario: g_V_count
     Given the modern graph
     And the traversal of
       """
@@ -27,7 +27,17 @@ Feature: Step - count()
     Then the result should be ordered
       | numeric | 6 |
 
-  Scenario: Count vertices after traversing both() twice
+  Scenario: g_V_out_count
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().out().count()
+      """
+    When iterated to list
+    Then the result should be ordered
+      | numeric | 6 |
+
+  Scenario: g_V_both_both_count
     Given the modern graph
     And the traversal of
       """
@@ -37,7 +47,7 @@ Feature: Step - count()
     Then the result should be ordered
       | numeric | 30 |
 
-  Scenario: Count local
+  Scenario: g_V_fold_countXlocalX
     Given the modern graph
     And the traversal of
       """
@@ -47,7 +57,7 @@ Feature: Step - count()
     Then the result should be ordered
       | numeric | 6 |
 
-  Scenario: Count no vertices
+  Scenario: g_V_hasXnoX_count
     Given the modern graph
     And the traversal of
       """

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/672faea3/gremlin-test/src/test/java/org/apache/tinkerpop/gremlin/structure/FeatureCoverageTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/test/java/org/apache/tinkerpop/gremlin/structure/FeatureCoverageTest.java b/gremlin-test/src/test/java/org/apache/tinkerpop/gremlin/structure/FeatureCoverageTest.java
new file mode 100644
index 0000000..791d44e
--- /dev/null
+++ b/gremlin-test/src/test/java/org/apache/tinkerpop/gremlin/structure/FeatureCoverageTest.java
@@ -0,0 +1,92 @@
+/*
+ * 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.
+ */
+package org.apache.tinkerpop.gremlin.structure;
+
+import org.apache.tinkerpop.gremlin.process.ProcessStandardSuite;
+import org.apache.tinkerpop.gremlin.process.traversal.step.filter.CoinTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.CountTest;
+import org.junit.Test;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class FeatureCoverageTest {
+
+    private static Pattern scenarioName = Pattern.compile("^\\s*Scenario:\\s*(.*)$");
+
+    @Test
+    public void shouldImplementAllProcessTestsAsFeatures() throws Exception {
+
+        // TEMPORARY while test framework is under development - all tests should ultimately be included
+        final List<Class<?>> temp = Arrays.asList(CoinTest.class);
+
+        final Field field = ProcessStandardSuite.class.getDeclaredField("testsToEnforce");
+        field.setAccessible(true);
+        final Class<?>[] testsToEnforce = (Class<?>[]) field.get(null);
+
+        final List<Class<?>> testClassesToEnforce = Stream.of(testsToEnforce).filter(temp::contains).collect(Collectors.toList());
+        for (Class<?> t : testClassesToEnforce) {
+            final String packge = t.getPackage().getName();
+            final String group = packge.substring(packge.lastIndexOf(".") + 1, packge.length());
+            final String featureFileName = "features" + File.separator +
+                                           group + File.separator +
+                                           t.getSimpleName().replace("Test", "") + ".feature";
+            final Set<String> testMethods = Stream.of(t.getDeclaredMethods())
+                    .filter(m -> m.isAnnotationPresent(Test.class))
+                    .map(Method::getName).collect(Collectors.toSet());
+
+            final File featureFile = new File(featureFileName);
+            assertThat(featureFile.exists(), is(true));
+            assertThat(featureFile.isFile(), is(true));
+
+            final Set<String> testsInFeatureFile = new HashSet<>();
+            final InputStream is = new FileInputStream(featureFile);
+            final BufferedReader buf = new BufferedReader(new InputStreamReader(is));
+            String line = buf.readLine();
+            while(line != null){
+                final Matcher matcher = scenarioName.matcher(line);
+                if (matcher.matches())
+                    testsInFeatureFile.add(matcher.group(1));
+                line = buf.readLine();
+            }
+
+            assertEquals("All test methods are not implemented in the " + featureFileName, testMethods, testsInFeatureFile);
+        }
+    }
+}


[19/47] tinkerpop git commit: TINKERPOP-1784 Minor refactoring of python gherkin steps

Posted by sp...@apache.org.
TINKERPOP-1784 Minor refactoring of python gherkin steps


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

Branch: refs/heads/TINKERPOP-1784
Commit: 2881ace3a6003e87926839696879168063427d84
Parents: 1b9d992
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Sep 22 13:49:50 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Oct 16 11:19:29 2017 -0400

----------------------------------------------------------------------
 .../src/main/jython/radish/feature_steps.py     | 130 ++++++++++---------
 1 file changed, 69 insertions(+), 61 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2881ace3/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 f67a4c2..19da3ec 100644
--- a/gremlin-python/src/main/jython/radish/feature_steps.py
+++ b/gremlin-python/src/main/jython/radish/feature_steps.py
@@ -28,17 +28,6 @@ from hamcrest import *
 out = __.out
 
 
-def convert(m, ctx):
-    n = {}
-    for key, value in m.items():
-        if isinstance(key, str) and re.match("v\[.*\]", key):
-            n[ctx.lookup["modern"][key[2:-1]]] = value
-        else:
-            n[key] = value
-
-    return n
-
-
 @given("the {graph_name:w} graph")
 def choose_graph(step, graph_name):
     # only have modern atm but graphName would be used to select the right one
@@ -59,62 +48,81 @@ def iterate_the_traversal(step):
     step.context.result = step.context.traversal.toList()
 
 
+def __convert(m, ctx):
+    n = {}
+    for key, value in m.items():
+        if isinstance(key, str) and re.match("v\[.*\]", key):
+            n[ctx.lookup["modern"][key[2:-1]]] = value
+        else:
+            n[key] = value
+
+    return n
+
+
+def __ordered_assertion(step):
+    data = step.table
+
+    # results from traversal should have the same number of entries as the feature data table
+    assert_that(len(step.context.result), equal_to(len(data)))
+
+    # assert the results by type where the first column will hold the type and the second column
+    # the data to assert. the contents of the second column will be dependent on the type specified
+    # in the first column
+    for ix, line in enumerate(data):
+        if line[0] == "numeric":
+            assert_that(long(step.context.result[ix]), equal_to(long(line[1])))
+        elif line[0] == "string":
+            assert_that(str(step.context.result[ix]), equal_to(str(line[1])))
+        elif line[0] == "vertex":
+            assert_that(step.context.result[ix].label, equal_to(line[1]))
+        elif line[0] == "map":
+            assert_that(__convert(step.context.result[ix], step.context), json.loads(line[1]))
+        else:
+            raise ValueError("unknown type of " + line[0])
+
+
+def __unordered_assertion(step):
+    data = step.table
+
+    # results from traversal should have the same number of entries as the feature data table
+    assert_that(len(step.context.result), equal_to(len(data)))
+
+    results_to_test = list(step.context.result)
+
+    # finds a match in the results for each line of data to assert and then removes that item
+    # from the list - in the end there should be no items left over and each will have been asserted
+    for line in data:
+        if line[0] == "numeric":
+            val = long(line[1])
+            assert_that(val, is_in(list(map(long, results_to_test))))
+            results_to_test.remove(val)
+        elif line[0] == "string":
+            val = str(line[1])
+            assert_that(val, is_in(list(map(str, results_to_test))))
+            results_to_test.remove(val)
+        elif line[0] == "vertex":
+            val = str(line[1])
+            v = step.context.lookup["modern"][val]
+            assert_that(v, is_in(results_to_test))
+            results_to_test.remove(v)
+        elif line[0] == "map":
+            val = __convert(json.load(line[1]), step.context)
+            assert_that(val, is_in(results_to_test))
+            results_to_test.remove(val)
+        else:
+            raise ValueError("unknown type of " + line[0])
+
+    assert_that(len(results_to_test), is_(0))
+
+    
 @then("the result should be {characterized_as:w}")
 def assert_result(step, characterized_as):
     if characterized_as == "empty":
         assert_that(len(step.context.result), equal_to(0))
     elif characterized_as == "ordered":
-        data = step.table
-    
-        # results from traversal should have the same number of entries as the feature data table
-        assert_that(len(step.context.result), equal_to(len(data)))
-
-        # assert the results by type where the first column will hold the type and the second column
-        # the data to assert. the contents of the second column will be dependent on the type specified
-        # in the first column
-        for ix, line in enumerate(data):
-            if line[0] == "numeric":
-                assert_that(long(step.context.result[ix]), equal_to(long(line[1])))
-            elif line[0] == "string":
-                assert_that(str(step.context.result[ix]), equal_to(str(line[1])))
-            elif line[0] == "vertex":
-                assert_that(step.context.result[ix].label, equal_to(line[1]))
-            elif line[0] == "map":
-                assert_that(convert(step.context.result[ix], step.context), json.loads(line[1]))
-            else:
-                raise ValueError("unknown type of " + line[0])
+        __ordered_assertion(step)
     elif characterized_as == "unordered":
-        data = step.table
-
-        # results from traversal should have the same number of entries as the feature data table
-        assert_that(len(step.context.result), equal_to(len(data)))
-
-        results_to_test = list(step.context.result)
-
-        # finds a match in the results for each line of data to assert and then removes that item
-        # from the list - in the end there should be no items left over and each will have been asserted
-        for line in data:
-            if line[0] == "numeric":
-                val = long(line[1])
-                assert_that(val, is_in(list(map(long, results_to_test))))
-                results_to_test.remove(val)
-            elif line[0] == "string":
-                val = str(line[1])
-                assert_that(val, is_in(list(map(str, results_to_test))))
-                results_to_test.remove(val)
-            elif line[0] == "vertex":
-                val = str(line[1])
-                v = step.context.lookup["modern"][val]
-                assert_that(v, is_in(results_to_test))
-                results_to_test.remove(v)
-            elif line[0] == "map":
-                val = convert(json.load(line[1]), step.context)
-                assert_that(val, is_in(results_to_test))
-                results_to_test.remove(val)
-            else:
-                raise ValueError("unknown type of " + line[0])
-
-        assert_that(len(results_to_test), is_(0))
+        __unordered_assertion(step)
     else:
         raise ValueError("unknown data characterization of " + characterized_as)
 


[47/47] tinkerpop git commit: TINKERPOP-1784 Added aggregate() tests

Posted by sp...@apache.org.
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/76a88db8
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/76a88db8
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/76a88db8

Branch: refs/heads/TINKERPOP-1784
Commit: 76a88db89066797cd52d0db8e0f36db8f345d155
Parents: 163a392
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Oct 16 11:16:11 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Oct 16 11:19:49 2017 -0400

----------------------------------------------------------------------
 .../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/76a88db8/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/76a88db8/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/76a88db8/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/76a88db8/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");


[42/47] tinkerpop git commit: TINKERPOP-1784 Added support for path() testing

Posted by sp...@apache.org.
TINKERPOP-1784 Added support for path() testing


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

Branch: refs/heads/TINKERPOP-1784
Commit: 163a39298047af1a0765fccbc318f1d6c5ed6592
Parents: 3ac29a6
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Oct 12 11:26:41 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Oct 16 11:19:31 2017 -0400

----------------------------------------------------------------------
 gremlin-python/pom.xml                          |  2 +-
 .../src/main/jython/radish/feature_steps.py     | 29 ++++--
 gremlin-test/features/map/Path.feature          | 98 ++++++++++++++++++++
 .../gremlin/process/FeatureCoverageTest.java    | 10 +-
 4 files changed, 130 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/163a3929/gremlin-python/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-python/pom.xml b/gremlin-python/pom.xml
index a6cede6..b70f964 100644
--- a/gremlin-python/pom.xml
+++ b/gremlin-python/pom.xml
@@ -447,7 +447,7 @@ limitations under the License.
                                         <exec executable="env/bin/radish" dir="${project.build.directory}/python2"
                                               failonerror="true">
                                             <env key="PYTHONPATH" value=""/>
-                                            <arg line="-e -t -b ${project.build.directory}/python2/radish ${project.basedir}/../gremlin-test/features/"/> <!-- -no-line-jump -->
+                                            <arg line="-e -t -b ${project.build.directory}/python2/radish ${project.basedir}/../gremlin-test/features/ --no-line-jump"/> <!-- -no-line-jump -->
                                         </exec>                                                                  
                                     </target>
                                 </configuration>

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/163a3929/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 1876f5b..859d809 100644
--- a/gremlin-python/src/main/jython/radish/feature_steps.py
+++ b/gremlin-python/src/main/jython/radish/feature_steps.py
@@ -27,8 +27,11 @@ from hamcrest import *
 
 regex_and = re.compile(r"([(.,\s])and\(")
 regex_as = re.compile(r"([(.,\s])as\(")
+regex_from = re.compile(r"([(.,\s])from\(")
 regex_in = re.compile(r"([(.,\s])in\(")
 regex_is = re.compile(r"([(.,\s])is\(")
+regex_not = re.compile(r"([(.,\s])not\(")
+regex_or = re.compile(r"([(.,\s])or\(")
 
 
 @given("the {graph_name:w} graph")
@@ -67,13 +70,13 @@ def translate_traversal(step):
     if hasattr(step.context, "traversal_params"):
         b.update(step.context.traversal_params)
 
-    print _translate(step.text + " - " + str(b))
+    # print _translate(step.text + " - " + str(b))
     step.context.traversal = eval(_translate(step.text), b)
 
 
 @when("iterated to list")
 def iterate_the_traversal(step):
-    step.context.result = step.context.traversal.toList()
+    step.context.result = map(lambda x: _convert_results(x), step.context.traversal.toList())
 
 
 @then("the result should be {characterized_as:w}")
@@ -99,7 +102,7 @@ def _convert(val, ctx):
         for key, value in val.items():
             n[_convert(key, ctx)] = _convert(value, ctx)
         return n
-    elif isinstance(val, unicode):                                    # stupid unicode/string nonsense in py 2/x
+    elif isinstance(val, unicode):                                    # convert annoying python 2.x unicode nonsense
         return _convert(val.encode('utf-8'), ctx)
     elif isinstance(val, str) and re.match("^l\[.*\]$", val):         # parse list
         return list(map((lambda x: _convert(x, ctx)), val[2:-1].split(",")))
@@ -121,14 +124,21 @@ def _convert(val, ctx):
         return _convert(json.loads(val[2:-1]), ctx)
     elif isinstance(val, str) and re.match("^p\[.*\]$", val):         # parse path
         path_objects = list(map((lambda x: _convert(x, ctx)), val[2:-1].split(",")))
-        labels = [set([]) for i in range(len(path_objects))]
-        return Path(labels, path_objects)
+        return Path([set([])], path_objects)
     elif isinstance(val, str) and re.match("^c\[.*\]$", val):         # parse lambda/closure
         return lambda: (val[2:-1], "gremlin-groovy")
     else:
         return val
 
 
+def _convert_results(val):
+    if isinstance(val, Path):
+        # kill out labels as they aren't in the assertion logic
+        return Path([set([])], map(lambda p: p.encode("utf-8") if isinstance(p, unicode) else p, val.objects))
+    else:
+        return val
+
+
 def _table_assertion(data, result, ctx, ordered):
     # results from traversal should have the same number of entries as the feature data table
     assert_that(len(result), equal_to(len(data)))
@@ -139,10 +149,14 @@ def _table_assertion(data, result, ctx, ordered):
     # from the list - in the end there should be no items left over and each will have been asserted
     for ix, line in enumerate(data):
         val = _convert(line[0], ctx)
+
+        # clear the labels since we don't define them in .feature files
+        if isinstance(val, Path):
+            val.labels = [set([])]
+
         if ordered:
             assert_that(results_to_test[ix], equal_to(val))
         else:
-            print str(type(val)) + "---------" + str(type(results_to_test[0]))
             assert_that(val, is_in(results_to_test))
         results_to_test.remove(val)
 
@@ -152,6 +166,9 @@ def _table_assertion(data, result, ctx, ordered):
 def _translate(traversal):
     replaced = traversal.replace("\n", "")
     replaced = regex_and.sub(r"\1and_(", replaced)
+    replaced = regex_from.sub(r"\1from_(", replaced)
     replaced = regex_as.sub(r"\1as_(", replaced)
     replaced = regex_is.sub(r"\1is_(", replaced)
+    replaced = regex_not.sub(r"\1not_(", replaced)
+    replaced = regex_or.sub(r"\1or_(", replaced)
     return regex_in.sub(r"\1in_(", replaced)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/163a3929/gremlin-test/features/map/Path.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/map/Path.feature b/gremlin-test/features/map/Path.feature
new file mode 100644
index 0000000..350e6c6
--- /dev/null
+++ b/gremlin-test/features/map/Path.feature
@@ -0,0 +1,98 @@
+# 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 - count()
+
+  Scenario: g_VX1X_name_path
+    Given the modern graph
+    And using the parameter v1Id is "v[marko].id"
+    And the traversal of
+      """
+      g.V(v1Id).values("name").path()
+      """
+    When iterated to list
+    Then the result should be unordered
+      | p[v[marko],marko] |
+
+  Scenario: g_VX1X_out_path_byXageX_byXnameX
+    Given the modern graph
+    And using the parameter v1Id is "v[marko].id"
+    And the traversal of
+      """
+      g.V(v1Id).out().path().by("age").by("name")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | p[d[29],lop] |
+      | p[d[29],vadas] |
+      | p[d[29],josh] |
+
+  Scenario: g_V_repeatXoutX_timesX2X_path_by_byXnameX_byXlangX
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().repeat(__.out()).times(2).path().by().by("name").by("lang")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | p[v[marko],josh,java] |
+      | p[v[marko],josh,java] |
+
+  Scenario: g_V_out_out_path_byXnameX_byXageX
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().out().out().path().by("name").by("age")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | p[marko,d[32],ripple] |
+      | p[marko,d[32],lop] |
+
+  Scenario: g_V_asXaX_hasXname_markoX_asXbX_hasXage_29X_asXcX_path
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().as("a").has("name", "marko").as("b").has("age", 29).as("c").path()
+      """
+    When iterated to list
+    Then the result should be unordered
+      | p[v[marko]] |
+
+  Scenario: g_VX1X_outEXcreatedX_inV_inE_outV_path
+    Given the modern graph
+    And using the parameter v1Id is "v[marko].id"
+    And the traversal of
+      """
+      g.V(v1Id).outE("created").inV().inE().outV().path()
+      """
+    When iterated to list
+    Then the result should be unordered
+      | p[v[marko],e[marko-created->lop],v[lop],e[marko-created->lop],v[marko]] |
+      | p[v[marko],e[marko-created->lop],v[lop],e[josh-created->lop],v[josh]] |
+      | p[v[marko],e[marko-created->lop],v[lop],e[peter-created->lop],v[peter]] |
+
+  Scenario: g_V_asXaX_out_asXbX_out_asXcX_path_fromXbX_toXcX_byXnameX
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().as("a").out().as("b").out().as("c").path().from("b").to("c").by("name")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | p[josh,ripple] |
+      | p[josh,lop] |

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/163a3929/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 1ac9ed8..c3b46be 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
@@ -23,6 +23,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.step.branch.ChooseTest;
 import org.apache.tinkerpop.gremlin.process.traversal.step.branch.OptionalTest;
 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.GroupCountTest;
 import org.junit.Test;
@@ -59,13 +60,18 @@ public class FeatureCoverageTest {
 
         // TEMPORARY while test framework is under development - all tests should ultimately be included
         final List<Class<?>> temp = Arrays.asList(
+                // branch
                 BranchTest.class,
                 ChooseTest.class,
                 OptionalTest.class,
+                // filter
                 CoinTest.class,
+                // map
                 CountTest.class,
-                GroupCountTest.class,
-                VertexTest.class);
+                PathTest.class,
+                VertexTest.class,
+                // sideEffect
+                GroupCountTest.class);
 
         final Field field = ProcessStandardSuite.class.getDeclaredField("testsToEnforce");
         field.setAccessible(true);


[43/47] tinkerpop git commit: TINKERPOP-1784 Added tests for optional() and Path object assertion

Posted by sp...@apache.org.
TINKERPOP-1784 Added tests for optional() and Path object assertion


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

Branch: refs/heads/TINKERPOP-1784
Commit: 3ac29a62796222cb078438bc072f26331a0e9b8b
Parents: 6bb5c09
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Oct 11 14:05:54 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Oct 16 11:19:31 2017 -0400

----------------------------------------------------------------------
 gremlin-python/pom.xml                          |  2 +-
 .../src/main/jython/radish/feature_steps.py     | 33 +++++----
 gremlin-test/features/branch/Optional.feature   | 77 ++++++++++++++++++++
 .../traversal/step/branch/OptionalTest.java     |  4 +-
 .../gremlin/process/FeatureCoverageTest.java    |  2 +
 5 files changed, 101 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3ac29a62/gremlin-python/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-python/pom.xml b/gremlin-python/pom.xml
index 1833233..a6cede6 100644
--- a/gremlin-python/pom.xml
+++ b/gremlin-python/pom.xml
@@ -447,7 +447,7 @@ limitations under the License.
                                         <exec executable="env/bin/radish" dir="${project.build.directory}/python2"
                                               failonerror="true">
                                             <env key="PYTHONPATH" value=""/>
-                                            <arg line="-b ${project.build.directory}/python2/radish ${project.basedir}/../gremlin-test/features/"/> <!-- -no-line-jump -->
+                                            <arg line="-e -t -b ${project.build.directory}/python2/radish ${project.basedir}/../gremlin-test/features/"/> <!-- -no-line-jump -->
                                         </exec>                                                                  
                                     </target>
                                 </configuration>

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3ac29a62/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 a34bb8d..1876f5b 100644
--- a/gremlin-python/src/main/jython/radish/feature_steps.py
+++ b/gremlin-python/src/main/jython/radish/feature_steps.py
@@ -19,7 +19,7 @@ under the License.
 
 import json
 import re
-from gremlin_python.structure.graph import Graph
+from gremlin_python.structure.graph import Graph, Path
 from gremlin_python.process.graph_traversal import __
 from gremlin_python.process.traversal import P, Scope, Column, Order, Direction, T, Pick
 from radish import given, when, then
@@ -48,7 +48,7 @@ def add_parameter(step, param_name, param):
     if not hasattr(step.context, "traversal_params"):
         step.context.traversal_params = {}
 
-    step.context.traversal_params[param_name] = __convert(param, step.context)
+    step.context.traversal_params[param_name] = _convert(param, step.context)
 
 
 @given("the traversal of")
@@ -67,8 +67,8 @@ def translate_traversal(step):
     if hasattr(step.context, "traversal_params"):
         b.update(step.context.traversal_params)
 
-    print __translate(step.text + " - " + str(b))
-    step.context.traversal = eval(__translate(step.text), b)
+    print _translate(step.text + " - " + str(b))
+    step.context.traversal = eval(_translate(step.text), b)
 
 
 @when("iterated to list")
@@ -81,9 +81,9 @@ def assert_result(step, characterized_as):
     if characterized_as == "empty":
         assert_that(len(step.context.result), equal_to(0))
     elif characterized_as == "ordered":
-        __table_assertion(step.table, step.context.result, step.context, True)
+        _table_assertion(step.table, step.context.result, step.context, True)
     elif characterized_as == "unordered":
-        __table_assertion(step.table, step.context.result, step.context, False)
+        _table_assertion(step.table, step.context.result, step.context, False)
     else:
         raise ValueError("unknown data characterization of " + characterized_as)
 
@@ -93,16 +93,16 @@ def nothing_happening(step):
     return
 
 
-def __convert(val, ctx):
+def _convert(val, ctx):
     if isinstance(val, dict):                                         # convert dictionary keys/values
         n = {}
         for key, value in val.items():
-            n[__convert(key, ctx)] = __convert(value, ctx)
+            n[_convert(key, ctx)] = _convert(value, ctx)
         return n
     elif isinstance(val, unicode):                                    # stupid unicode/string nonsense in py 2/x
-        return __convert(val.encode('utf-8'), ctx)
+        return _convert(val.encode('utf-8'), ctx)
     elif isinstance(val, str) and re.match("^l\[.*\]$", val):         # parse list
-        return list(map((lambda x: __convert(x, ctx)), val[2:-1].split(",")))
+        return list(map((lambda x: _convert(x, ctx)), val[2:-1].split(",")))
     elif isinstance(val, str) and re.match("^d\[.*\]$", val):         # parse numeric
         return long(val[2:-1])
     elif isinstance(val, str) and re.match("^v\[.*\]\.id$", val):     # parse vertex id
@@ -118,14 +118,18 @@ def __convert(val, ctx):
     elif isinstance(val, str) and re.match("^e\[.*\]$", val):         # parse edge
         return ctx.lookup_e["modern"][val[2:-1]]
     elif isinstance(val, str) and re.match("^m\[.*\]$", val):         # parse json as a map
-        return __convert(json.loads(val[2:-1]), ctx)
+        return _convert(json.loads(val[2:-1]), ctx)
+    elif isinstance(val, str) and re.match("^p\[.*\]$", val):         # parse path
+        path_objects = list(map((lambda x: _convert(x, ctx)), val[2:-1].split(",")))
+        labels = [set([]) for i in range(len(path_objects))]
+        return Path(labels, path_objects)
     elif isinstance(val, str) and re.match("^c\[.*\]$", val):         # parse lambda/closure
         return lambda: (val[2:-1], "gremlin-groovy")
     else:
         return val
 
 
-def __table_assertion(data, result, ctx, ordered):
+def _table_assertion(data, result, ctx, ordered):
     # results from traversal should have the same number of entries as the feature data table
     assert_that(len(result), equal_to(len(data)))
 
@@ -134,17 +138,18 @@ def __table_assertion(data, result, ctx, ordered):
     # finds a match in the results for each line of data to assert and then removes that item
     # from the list - in the end there should be no items left over and each will have been asserted
     for ix, line in enumerate(data):
-        val = __convert(line[0], ctx)
+        val = _convert(line[0], ctx)
         if ordered:
             assert_that(results_to_test[ix], equal_to(val))
         else:
+            print str(type(val)) + "---------" + str(type(results_to_test[0]))
             assert_that(val, is_in(results_to_test))
         results_to_test.remove(val)
 
     assert_that(len(results_to_test), is_(0))
 
 
-def __translate(traversal):
+def _translate(traversal):
     replaced = traversal.replace("\n", "")
     replaced = regex_and.sub(r"\1and_(", replaced)
     replaced = regex_as.sub(r"\1as_(", replaced)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3ac29a62/gremlin-test/features/branch/Optional.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/branch/Optional.feature b/gremlin-test/features/branch/Optional.feature
new file mode 100644
index 0000000..ebd0de2
--- /dev/null
+++ b/gremlin-test/features/branch/Optional.feature
@@ -0,0 +1,77 @@
+# 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 - choose()
+
+  Scenario: g_VX2X_optionalXoutXknowsXX
+    Given the modern graph
+    And using the parameter v2Id is "v[vadas].id"
+    And the traversal of
+      """
+      g.V(v2Id).optional(__.out("knows"))
+      """
+    When iterated to list
+    Then the result should be unordered
+      | v[vadas] |
+
+  Scenario: g_VX2X_optionalXinXknowsXX
+    Given the modern graph
+    And using the parameter v2Id is "v[vadas].id"
+    And the traversal of
+      """
+      g.V(v2Id).optional(__.in("knows"))
+      """
+    When iterated to list
+    Then the result should be unordered
+      | v[marko] |
+
+  Scenario: g_V_hasLabelXpersonX_optionalXoutXknowsX_optionalXoutXcreatedXXX_path
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().hasLabel("person").
+        optional(__.out("knows").
+                    optional(__.out("created"))).
+        path()
+      """
+    When iterated to list
+    Then the result should be unordered
+      | p[v[marko],v[vadas]] |
+      | p[v[marko],v[josh],v[ripple]] |
+      | p[v[marko],v[josh],v[lop]] |
+      | p[v[vadas]] |
+      | p[v[josh]] |
+      | p[v[peter]] |
+    
+  Scenario: g_V_optionalXout_optionalXoutXX_path
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().optional(__.out().optional(__.out())).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],v[ripple]] |
+      | p[v[marko],v[josh],v[lop]] |
+      | p[v[vadas]] |
+      | p[v[lop]] |
+      | p[v[josh],v[ripple]] |
+      | p[v[josh],v[lop]] |
+      | p[v[ripple]] |
+      | p[v[peter],v[lop]] |

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3ac29a62/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/OptionalTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/OptionalTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/OptionalTest.java
index 660af6c..403c413 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/OptionalTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/OptionalTest.java
@@ -125,12 +125,12 @@ public abstract class OptionalTest extends AbstractGremlinProcessTest {
     public static class Traversals extends OptionalTest {
 
         @Override
-        public Traversal<Vertex, Vertex> get_g_VX2X_optionalXoutXknowsXX(Object v2Id) {
+        public Traversal<Vertex, Vertex> get_g_VX2X_optionalXoutXknowsXX(final Object v2Id) {
             return this.g.V(v2Id).optional(out("knows"));
         }
 
         @Override
-        public Traversal<Vertex, Vertex> get_g_VX2X_optionalXinXknowsXX(Object v2Id) {
+        public Traversal<Vertex, Vertex> get_g_VX2X_optionalXinXknowsXX(final Object v2Id) {
             return this.g.V(v2Id).optional(in("knows"));
         }
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3ac29a62/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 4ee540e..1ac9ed8 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
@@ -20,6 +20,7 @@ package org.apache.tinkerpop.gremlin.process;
 
 import org.apache.tinkerpop.gremlin.process.traversal.step.branch.BranchTest;
 import org.apache.tinkerpop.gremlin.process.traversal.step.branch.ChooseTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.branch.OptionalTest;
 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.VertexTest;
@@ -60,6 +61,7 @@ public class FeatureCoverageTest {
         final List<Class<?>> temp = Arrays.asList(
                 BranchTest.class,
                 ChooseTest.class,
+                OptionalTest.class,
                 CoinTest.class,
                 CountTest.class,
                 GroupCountTest.class,


[28/47] tinkerpop git commit: TINKERPOP-1784 Get all count() tests working

Posted by sp...@apache.org.
TINKERPOP-1784 Get all count() tests working

Needed to add support for cleaning up traversal strings to more properly handle reserved python words.


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

Branch: refs/heads/TINKERPOP-1784
Commit: 7ebd6bc087c7b80e2dd0f5bbc56e817cba294aea
Parents: 00c3b97
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Oct 2 14:59:59 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Oct 16 11:19:30 2017 -0400

----------------------------------------------------------------------
 .../src/main/jython/radish/feature_steps.py     | 15 ++++---
 gremlin-test/features/map/Count.feature         | 45 +++++++++++++++++++-
 .../gremlin/process/FeatureCoverageTest.java    |  6 ++-
 3 files changed, 59 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7ebd6bc0/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 5b11ca1..11cc86e 100644
--- a/gremlin-python/src/main/jython/radish/feature_steps.py
+++ b/gremlin-python/src/main/jython/radish/feature_steps.py
@@ -25,8 +25,9 @@ from gremlin_python.process.traversal import P, Scope, Column, Direction
 from radish import given, when, then
 from hamcrest import *
 
-regex_as = re.compile(r"\.as\(")
-regex_in = re.compile(r"\.in\(")
+regex_as = re.compile(r"([(.])as\(")
+regex_in = re.compile(r"([(.])in\(")
+regex_is = re.compile(r"([(.])is\(")
 
 
 @given("the {graph_name:w} graph")
@@ -57,11 +58,14 @@ def translate_traversal(step):
          "Direction": Direction,
          "P": P,
          "Scope": Scope,
-         "bothE": __.bothE}
+         "bothE": __.bothE,
+         "in_": __.in_,
+         "out": __.out}
 
     if hasattr(step.context, "traversal_params"):
         b.update(step.context.traversal_params)
 
+    print __translate(step.text)
     step.context.traversal = eval(__translate(step.text), b)
 
 
@@ -137,5 +141,6 @@ def __table_assertion(data, result, ctx, ordered):
 
 
 def __translate(traversal):
-    replaced = regex_as.sub(".as_(", traversal)
-    return regex_in.sub(".in_(", replaced)
+    replaced = regex_as.sub(r"\1as_(", traversal)
+    replaced = regex_is.sub(r"\1is_(", replaced)
+    return regex_in.sub(r"\1in_(", replaced)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7ebd6bc0/gremlin-test/features/map/Count.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/map/Count.feature b/gremlin-test/features/map/Count.feature
index b7f5c66..5faa975 100644
--- a/gremlin-test/features/map/Count.feature
+++ b/gremlin-test/features/map/Count.feature
@@ -65,4 +65,47 @@ Feature: Step - count()
       """
     When iterated to list
     Then the result should be ordered
-      | d[0] |
\ No newline at end of file
+      | d[0] |
+
+  Scenario: g_V_whereXinXkknowsX_outXcreatedX_count_is_0XX_name
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().where(in("knows").out("created").count().is(0)).values("name")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | marko |
+      | lop  |
+      | ripple |
+      | peter |
+
+  Scenario: g_V_repeatXoutX_timesX8X_count
+    Given the grateful graph
+    And the traversal of
+      """
+      g.V().repeat(out()).times(8).count()
+      """
+    When iterated to list
+    Then the result should be ordered
+      | d[2505037961767380] |
+
+  Scenario: g_V_repeatXoutX_timesX5X_asXaX_outXwrittenByX_asXbX_selectXa_bX_count
+    Given the grateful graph
+    And the traversal of
+      """
+      g.V().repeat(out()).times(5).as("a").out("writtenBy").as("b").select("a", "b").count()
+      """
+    When iterated to list
+    Then the result should be ordered
+      | d[24309134024] |
+
+  Scenario: g_V_repeatXoutX_timesX3X_count
+    Given the grateful graph
+    And the traversal of
+      """
+      g.V().repeat(out()).times(3).count()
+      """
+    When iterated to list
+    Then the result should be ordered
+      | d[14465066] |

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7ebd6bc0/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 d3212a4..00975be 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
@@ -19,6 +19,7 @@
 package org.apache.tinkerpop.gremlin.process;
 
 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.VertexTest;
 import org.junit.Test;
 
@@ -53,7 +54,10 @@ public class FeatureCoverageTest {
     public void shouldImplementAllProcessTestsAsFeatures() throws Exception {
 
         // TEMPORARY while test framework is under development - all tests should ultimately be included
-        final List<Class<?>> temp = Arrays.asList(CoinTest.class, VertexTest.class);
+        final List<Class<?>> temp = Arrays.asList(
+                CoinTest.class,
+                CountTest.class,
+                VertexTest.class);
 
         final Field field = ProcessStandardSuite.class.getDeclaredField("testsToEnforce");
         field.setAccessible(true);


[10/47] tinkerpop git commit: Merge branch 'pr-709' into tp32

Posted by sp...@apache.org.
Merge branch 'pr-709' into tp32

Conflicts:
	CHANGELOG.asciidoc


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

Branch: refs/heads/TINKERPOP-1784
Commit: 021db56542f68dbd104ea7c8ed56c86aa50c3237
Parents: 1fa01ef 2a8c92f
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Oct 12 12:46:51 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Oct 12 12:46:51 2017 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                                    |  3 ++-
 .../gremlin/groovy/engine/GremlinExecutor.java        | 14 +++++++++++++-
 .../gremlin/groovy/engine/GremlinExecutorTest.java    | 13 +++++++++++++
 3 files changed, 28 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/021db565/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --cc CHANGELOG.asciidoc
index 2f6069d,fe1da7a..d8fe716
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@@ -43,10 -34,11 +43,11 @@@ image::https://raw.githubusercontent.co
  * Fixed a bug in `Neo4jGremlinPlugin` that prevented it from loading properly in the `GremlinPythonScriptEngine`.
  * Fixed a bug in `ComputerVerificationStrategy` where child traversals were being analyzed prior to compilation.
  * Fixed a bug that prevented Gremlin from ordering lists and streams made of mixed number types.
- * Fixed a bug where `keepLabels` were being corrupted because a defensive copy was not being made when they were being set by `PathRetractionStrategy`. 
++* Fixed a bug where `keepLabels` were being corrupted because a defensive copy was not being made when they were being set by `PathRetractionStrategy`.
+ * Cancel script evaluation timeout in `GremlinExecutor` when script evaluation finished.
  
  [[release-3-2-6]]
 -TinkerPop 3.2.6 (Release Date: August 21, 2017)
 -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 +=== TinkerPop 3.2.6 (Release Date: August 21, 2017)
  
  This release also includes changes from <<release-3-1-8, 3.1.8>>.
  

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/021db565/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
----------------------------------------------------------------------


[26/47] tinkerpop git commit: TINKERPOP-1784 Added support for testing branch() with gherkin

Posted by sp...@apache.org.
TINKERPOP-1784 Added support for testing branch() with gherkin


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

Branch: refs/heads/TINKERPOP-1784
Commit: bd5e0282b286e21f9a55a5955146ef0549d58faf
Parents: b582a22
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Oct 10 13:17:55 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Oct 16 11:19:30 2017 -0400

----------------------------------------------------------------------
 .../src/main/jython/radish/feature_steps.py     | 12 ++--
 gremlin-test/features/branch/Branch.feature     | 76 ++++++++++++++++++++
 .../gremlin/process/FeatureCoverageTest.java    |  2 +
 3 files changed, 86 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bd5e0282/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 a2efb67..0d52d75 100644
--- a/gremlin-python/src/main/jython/radish/feature_steps.py
+++ b/gremlin-python/src/main/jython/radish/feature_steps.py
@@ -21,7 +21,7 @@ import json
 import re
 from gremlin_python.structure.graph import Graph
 from gremlin_python.process.graph_traversal import __
-from gremlin_python.process.traversal import P, Scope, Column, Order, Direction, T
+from gremlin_python.process.traversal import P, Scope, Column, Order, Direction, T, Pick
 from radish import given, when, then
 from hamcrest import *
 
@@ -58,15 +58,17 @@ def translate_traversal(step):
          "Column": Column,
          "Direction": Direction,
          "Order": Order,
-         "P": P,
-         "gt": P.gt,
+         "P": P, "gt": P.gt,
+         "Pick": Pick, "any": Pick.any,
          "Scope": Scope,
          "T": T,
          "as_": __.as_,
          "bothE": __.bothE,
          "in_": __.in_,
+         "label": __.label,
          "out": __.out,
-         "repeat": __.repeat}
+         "repeat": __.repeat,
+         "values": __.values}
 
     if hasattr(step.context, "traversal_params"):
         b.update(step.context.traversal_params)
@@ -123,6 +125,8 @@ def __convert(val, ctx):
         return ctx.lookup_e["modern"][val[2:-1]]
     elif isinstance(val, str) and re.match("^m\[.*\]$", val):         # parse json as a map
         return __convert(json.loads(val[2:-1]), ctx)
+    elif isinstance(val, str) and re.match("^c\[.*\]$", val):         # parse lambda
+        return lambda: (val[2:-1], "gremlin-groovy")
     else:
         return val
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bd5e0282/gremlin-test/features/branch/Branch.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/branch/Branch.feature b/gremlin-test/features/branch/Branch.feature
new file mode 100644
index 0000000..d12fc0f
--- /dev/null
+++ b/gremlin-test/features/branch/Branch.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 - branch()
+
+  Scenario: g_V_branchXlabel_eq_person__a_bX_optionXa__ageX_optionXb__langX_optionXb__nameX
+    Given the modern graph
+    And using the parameter l1 is "c[it.get().label() == 'person' ? 'a' : 'b']"
+    And the traversal of
+      """
+      g.V().branch(l1).option("a", values("age")).option("b", values("lang")).option("b", values("name"))
+      """
+    When iterated to list
+    Then the result should be unordered
+      | java |
+      | java |
+      | lop |
+      | ripple |
+      | d[29] |
+      | d[27] |
+      | d[32] |
+      | d[35] |
+
+  Scenario: g_V_branchXlabel_isXpersonX_countX_optionX1__ageX_optionX0__langX_optionX0__nameX
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().branch(label().is("person").count()).option(1L, values("age")).option(0L, values("lang")).option(0L, values("name"))
+      """
+    When iterated to list
+    Then the result should be unordered
+      | java |
+      | java |
+      | lop |
+      | ripple |
+      | d[29] |
+      | d[27] |
+      | d[32] |
+      | d[35] |
+
+  Scenario: g_V_branchXlabel_isXpersonX_countX_optionX1__ageX_optionX0__langX_optionX0__nameX_optionXany__labelX
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().branch(label().is("person").count()).option(1L, values("age")).option(0L, values("lang")).option(0L, values("name")).option(any, label())
+      """
+    When iterated to list
+    Then the result should be unordered
+      | java |
+      | java |
+      | lop |
+      | ripple |
+      | d[29] |
+      | d[27] |
+      | d[32] |
+      | d[35] |
+      | person |
+      | person |
+      | person |
+      | person |
+      | software |
+      | software |
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bd5e0282/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 ce66889..be01613 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
@@ -18,6 +18,7 @@
  */
 package org.apache.tinkerpop.gremlin.process;
 
+import org.apache.tinkerpop.gremlin.process.traversal.step.branch.BranchTest;
 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.VertexTest;
@@ -56,6 +57,7 @@ public class FeatureCoverageTest {
 
         // TEMPORARY while test framework is under development - all tests should ultimately be included
         final List<Class<?>> temp = Arrays.asList(
+                BranchTest.class,
                 CoinTest.class,
                 CountTest.class,
                 GroupCountTest.class,


[30/47] tinkerpop git commit: TINKERPOP-1784 Provided translation for python specific syntax

Posted by sp...@apache.org.
TINKERPOP-1784 Provided translation for python specific syntax

Included a way to specify element identifiers in feature files.


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

Branch: refs/heads/TINKERPOP-1784
Commit: 8325d46b116d2fe239260df92697d1d22ebb7271
Parents: 5210453
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Sep 27 12:16:08 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Oct 16 11:19:30 2017 -0400

----------------------------------------------------------------------
 .../src/main/jython/radish/feature_steps.py        | 17 +++++++++++++----
 gremlin-test/features/filter/Has.feature           | 13 +++++++++++++
 gremlin-test/features/map/Select.feature           |  2 +-
 3 files changed, 27 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8325d46b/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 8ef0f1b..989e781 100644
--- a/gremlin-python/src/main/jython/radish/feature_steps.py
+++ b/gremlin-python/src/main/jython/radish/feature_steps.py
@@ -25,6 +25,8 @@ from gremlin_python.process.traversal import P, Scope, Column
 from radish import given, when, then
 from hamcrest import *
 
+regex_as = re.compile(r"\.as\(")
+regex_in = re.compile(r"\.in\(")
 
 @given("the {graph_name:w} graph")
 def choose_graph(step, graph_name):
@@ -52,7 +54,7 @@ def translate_traversal(step):
     if hasattr(step.context, "traversal_params"):
         b.update(step.context.traversal_params)
 
-    step.context.traversal = eval(step.text, b)
+    step.context.traversal = eval(__translate(step.text), b)
 
 
 @when("iterated to list")
@@ -78,9 +80,11 @@ def __convert(val, ctx):
         for key, value in val.items():
             n[__convert(key, ctx)] = __convert(value, ctx)
         return n
-    elif isinstance(val, (str, unicode)) and re.match("d\[.*\]", val):
+    elif isinstance(val, (str, unicode)) and re.match("^d\[.*\]$", val):
         return long(val[2:-1])
-    elif isinstance(val, (str, unicode)) and re.match("v\[.*\]", val):
+    elif isinstance(val, (str, unicode)) and re.match("^v\[.*\]\.id$", val):
+        return ctx.lookup["modern"][val[2:-4]].id
+    elif isinstance(val, (str, unicode)) and re.match("^v\[.*\]$", val):
         return ctx.lookup["modern"][val[2:-1]]
     elif isinstance(val, unicode):
         return val.encode('utf-8')
@@ -141,4 +145,9 @@ def __unordered_assertion(step):
         else:
             raise ValueError("unknown type of " + line[0])
 
-    assert_that(len(results_to_test), is_(0))
\ No newline at end of file
+    assert_that(len(results_to_test), is_(0))
+
+
+def __translate(traversal):
+    replaced = regex_as.sub(".as_(", traversal)
+    return regex_in.sub(".in_(", replaced)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8325d46b/gremlin-test/features/filter/Has.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/filter/Has.feature b/gremlin-test/features/filter/Has.feature
index 0bb82e0..4a2e085 100644
--- a/gremlin-test/features/filter/Has.feature
+++ b/gremlin-test/features/filter/Has.feature
@@ -28,3 +28,16 @@ Feature: Step - has()
       | vertex | josh   |
       | vertex | peter  |
 
+  Scenario: Use hasId() with P
+    Given the modern graph
+    And using the parameter v1 is "v[marko].id"
+    And the traversal of
+    """
+    g.V().in().hasId(P.neq(v1))
+    """
+    When iterated to list
+    Then the result should be unordered
+      | vertex | josh   |
+      | vertex | josh   |
+      | vertex | peter  |
+

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8325d46b/gremlin-test/features/map/Select.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/map/Select.feature b/gremlin-test/features/map/Select.feature
index e64417a..b2d208c 100644
--- a/gremlin-test/features/map/Select.feature
+++ b/gremlin-test/features/map/Select.feature
@@ -22,7 +22,7 @@ Feature: Step - select()
     And using the parameter v1 is "v[marko]"
     And the traversal of
       """
-      g.V(v1).as_("a").out("knows").as_("b").select("a", "b")
+      g.V(v1).as("a").out("knows").as("b").select("a", "b")
       """
     When iterated to list
     Then the result should be unordered


[39/47] tinkerpop git commit: TINKERPOP-1784 Refactored the assertion logic for ordered/unordered

Posted by sp...@apache.org.
TINKERPOP-1784 Refactored the assertion logic for ordered/unordered


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

Branch: refs/heads/TINKERPOP-1784
Commit: a44ce910e222454bc1259ad8115f9b7975f2665b
Parents: dea081c
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Sep 28 15:17:14 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Oct 16 11:19:30 2017 -0400

----------------------------------------------------------------------
 .../src/main/jython/radish/feature_steps.py     | 41 ++++++++++----------
 1 file changed, 20 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a44ce910/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 7a4a30a..2db5922 100644
--- a/gremlin-python/src/main/jython/radish/feature_steps.py
+++ b/gremlin-python/src/main/jython/radish/feature_steps.py
@@ -68,9 +68,9 @@ def assert_result(step, characterized_as):
     if characterized_as == "empty":
         assert_that(len(step.context.result), equal_to(0))
     elif characterized_as == "ordered":
-        __ordered_assertion(step)
+        __table_assertion(step.table, step.context.result, step.context, True)
     elif characterized_as == "unordered":
-        __unordered_assertion(step)
+        __table_assertion(step.table, step.context.result, step.context, False)
     else:
         raise ValueError("unknown data characterization of " + characterized_as)
 
@@ -100,32 +100,31 @@ def __convert(val, ctx):
     else:
         return val
 
+#
+# def __ordered_assertion(data, result, ctx):
+#     # results from traversal should have the same number of entries as the feature data table
+#     assert_that(len(result), equal_to(len(data)))
+#
+#     # assert the results in order they are expected in the data from the features file
+#     for ix, line in enumerate(data):
+#         assert_that(result[ix], equal_to(__convert(line[0], ctx)))
+#
 
-def __ordered_assertion(step):
-    data = step.table
 
+def __table_assertion(data, result, ctx, ordered):
     # results from traversal should have the same number of entries as the feature data table
-    assert_that(len(step.context.result), equal_to(len(data)))
+    assert_that(len(result), equal_to(len(data)))
 
-    # assert the results by type where the first column will hold the type and the second column
-    # the data to assert. the contents of the second column will be dependent on the type specified
-    # in the first column
-    for ix, line in enumerate(data):
-        assert_that(step.context.result[ix], equal_to(__convert(line[0], step.context)))
-
-def __unordered_assertion(step):
-    data = step.table
-
-    # results from traversal should have the same number of entries as the feature data table
-    assert_that(len(step.context.result), equal_to(len(data)))
-
-    results_to_test = list(step.context.result)
+    results_to_test = list(result)
 
     # finds a match in the results for each line of data to assert and then removes that item
     # from the list - in the end there should be no items left over and each will have been asserted
-    for line in data:
-        val = __convert(line[0], step.context)
-        assert_that(val, is_in(results_to_test))
+    for ix, line in enumerate(data):
+        val = __convert(line[0], ctx)
+        if ordered:
+            assert_that(results_to_test[ix], equal_to(val))
+        else:
+            assert_that(val, is_in(results_to_test))
         results_to_test.remove(val)
 
     assert_that(len(results_to_test), is_(0))


[14/47] tinkerpop git commit: Remove doc references to GraphSON 2.0 for GLVs

Posted by sp...@apache.org.
Remove doc references to GraphSON 2.0 for GLVs

GLVs are not bound to GraphSON 2.0 as both support 3.0 on the 3.3.x line. They basically just exclude 1.0. Also moved docs on GLV serialization extensions to the dev docs as that's not really something that users would do.


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

Branch: refs/heads/TINKERPOP-1784
Commit: c13bf94234e4409b6d78138b53ad8d244ae8401c
Parents: ea10316
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Oct 16 08:25:55 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Oct 16 08:25:55 2017 -0400

----------------------------------------------------------------------
 docs/src/dev/provider/index.asciidoc         | 103 ++++++++++++++++++++++
 docs/src/reference/gremlin-variants.asciidoc |  95 +-------------------
 2 files changed, 105 insertions(+), 93 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c13bf942/docs/src/dev/provider/index.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/dev/provider/index.asciidoc b/docs/src/dev/provider/index.asciidoc
index c64261f..1479320 100644
--- a/docs/src/dev/provider/index.asciidoc
+++ b/docs/src/dev/provider/index.asciidoc
@@ -401,6 +401,109 @@ TIP: Consider separating serializer code into its own module, if possible, so th
 implementation remotely don't need a full dependency on the entire `Graph` - just the IO components and related
 classes being serialized.
 
+There is an important implication to consider when the addition of a custom serializer. Presumably, the custom
+serializer was written for the JVM to be deployed with a `Graph` instance. For example, a graph may expose a
+geographical type like a `Point` or something similar. The library that contains `Point` assuming users expected to
+deserialize back to a `Point` would need to have the library with `Point` and the "`PointSerializer`" class available
+to them. In cases where that deployment approach is not desirable, it is possible to coerce a class like `Point` to
+a type that is already in the list of types supported in TinkerPop. For example, `Point` could be coerced one-way to
+`Map` of keys "x" and "y". Of course, on the client side, users would have to construct a `Map` for a `Point` which
+isn't quite as user-friendly.
+
+If doing a type coercion is not desired, then it is important to remember that writing a `Point` class and related
+serializer in Java is not sufficient for full support of Gremlin, as users of non-JVM Gremlin Language Variants (GLV)
+will not be able to consume them. Getting full support would mean writing similar classes for each GLV. While
+developing  those classes is not hard, it also means more code to support.
+
+===== Supporting Gremlin-Python IO
+
+The serialization system of Gremlin-Python provides ways to add new types by creating serializers and deserializers in
+Python and registering them with the `RemoteConnection`.
+
+[source,python]
+----
+class MyType(object):
+  GRAPHSON_PREFIX = "providerx"
+  GRAPHSON_BASE_TYPE = "MyType"
+  GRAPHSON_TYPE = GraphSONUtil.formatType(GRAPHSON_PREFIX, GRAPHSON_BASE_TYPE)
+
+  def __init__(self, x, y):
+    self.x = x
+    self.y = y
+
+  @classmethod
+  def objectify(cls, value, reader):
+    return cls(value['x'], value['y'])
+
+  @classmethod
+  def dictify(cls, value, writer):
+    return GraphSONUtil.typedValue(cls.GRAPHSON_BASE_TYPE,
+                                  {'x': value.x, 'y': value.y},
+                                  cls.GRAPHSON_PREFIX)
+
+graphson_reader = GraphSONReader({MyType.GRAPHSON_TYPE: MyType})
+graphson_writer = GraphSONWriter({MyType: MyType})
+
+connection = DriverRemoteConnection('ws://localhost:8182/gremlin', 'g',
+                                     graphson_reader=graphson_reader,
+                                     graphson_writer=graphson_writer)
+----
+
+===== Supporting Gremlin-DotNet IO
+
+The serialization system of Gremlin-DotNet provides ways to add new types by creating serializers and deserializers in
+any .NET language and registering them with the `GremlinClient`.
+
+[source,csharp]
+----
+internal class MyType
+{
+    public static string GraphsonPrefix = "providerx";
+    public static string GraphsonBaseType = "MyType";
+    public static string GraphsonType = GraphSONUtil.FormatTypeName(GraphsonPrefix, GraphsonBaseType);
+
+    public MyType(int x, int y)
+    {
+        X = x;
+        Y = y;
+    }
+
+    public int X { get; }
+    public int Y { get; }
+}
+
+internal class MyClassWriter : IGraphSONSerializer
+{
+    public Dictionary<string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer)
+    {
+        MyType myType = objectData;
+        var valueDict = new Dictionary<string, object>
+        {
+            {"x", myType.X},
+            {"y", myType.Y}
+        };
+        return GraphSONUtil.ToTypedValue(nameof(TestClass), valueDict, MyType.GraphsonPrefix);
+    }
+}
+
+internal class MyTypeReader : IGraphSONDeserializer
+{
+    public dynamic Objectify(JToken graphsonObject, GraphSONReader reader)
+    {
+        var x = reader.ToObject(graphsonObject["x"]);
+        var y = reader.ToObject(graphsonObject["y"]);
+        return new MyType(x, y);
+    }
+}
+
+var graphsonReader = new GraphSONReader(
+    new Dictionary<string, IGraphSONDeserializer> {{MyType.GraphsonType, new MyTypeReader()}});
+var graphsonWriter = new GraphSONWriter(
+    new Dictionary<Type, IGraphSONSerializer> {{typeof(MyType), new MyClassWriter()}});
+
+var gremlinClient = new GremlinClient(new GremlinServer("localhost", 8182), graphsonReader, graphsonWriter);
+----
+
 [[remoteconnection-implementations]]
 ==== RemoteConnection Implementations
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c13bf942/docs/src/reference/gremlin-variants.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/gremlin-variants.asciidoc b/docs/src/reference/gremlin-variants.asciidoc
index 3076c14..bb4bbba 100644
--- a/docs/src/reference/gremlin-variants.asciidoc
+++ b/docs/src/reference/gremlin-variants.asciidoc
@@ -116,7 +116,7 @@ IMPORTANT: For developers wishing to provide another *driver implementation*, be
 When Gremlin Server is running, Gremlin-Python can communicate with Gremlin Server. The `conf/gremlin-server-modern-py.yaml`
 configuration maintains a `GremlinJythonScriptEngine` as well as the appropriate serializers for communicating `Bytecode`.
 
-IMPORTANT: Gremlin-Python is compatible with GraphSON 2.0 only, so this serializer must be configured in Gremlin Server.
+IMPORTANT: Gremlin-Python is not compatible with GraphSON 1.0.
 
 [source,bash]
 ----
@@ -308,41 +308,6 @@ g.V().out().map(lambda: "x: len(x.get().value('name'))").sum().toList()
 <7> The default lambda language is changed back to Gremlin-Python.
 <8> If the `lambda`-prefix is not provided, then it is appended automatically in order to give a more natural look to the expression.
 
-=== Custom Serialization
-
-Gremlin-Python provides a GraphSON 2.0 serialization package with the standard Apache TinkerPop `g`-types registered
-(see link:http://tinkerpop.apache.org/docs/x.y.z/dev/io/#graphson-2d0[GraphSON 2.0]). It is possible for users to add
-new types by creating serializers and deserializers in Python and registering them with the `RemoteConnection`.
-
-[source,python]
-----
-class MyType(object):
-  GRAPHSON_PREFIX = "providerx"
-  GRAPHSON_BASE_TYPE = "MyType"
-  GRAPHSON_TYPE = GraphSONUtil.formatType(GRAPHSON_PREFIX, GRAPHSON_BASE_TYPE)
-
-  def __init__(self, x, y):
-    self.x = x
-    self.y = y
-
-  @classmethod
-  def objectify(cls, value, reader):
-    return cls(value['x'], value['y'])
-
-  @classmethod
-  def dictify(cls, value, writer):
-    return GraphSONUtil.typedValue(cls.GRAPHSON_BASE_TYPE,
-                                  {'x': value.x, 'y': value.y},
-                                  cls.GRAPHSON_PREFIX)
-
-graphson_reader = GraphSONReader({MyType.GRAPHSON_TYPE: MyType})
-graphson_writer = GraphSONWriter({MyType: MyType})
-
-connection = DriverRemoteConnection('ws://localhost:8182/gremlin', 'g',
-                                     graphson_reader=graphson_reader,
-                                     graphson_writer=graphson_writer)
-----
-
 [[gremlin-DotNet]]
 == Gremlin.Net
 
@@ -369,7 +334,7 @@ IMPORTANT: For developers wishing to provide another driver implementation, be s
 
 When Gremlin Server is running, Gremlin-DotNet can communicate with Gremlin Server by sending traversals serialized as `Bytecode`.
 
-IMPORTANT: Gremlin-DotNet is compatible with GraphSON 2.0 only, so this serializer must be configured in Gremlin Server.
+IMPORTANT: Gremlin-DotNet is not compatible with GraphSON 1.0.
 
 A traversal source can be spawned with `RemoteStrategy` from an empty `Graph`.
 
@@ -470,59 +435,3 @@ edgeValueMaps = g.V().OutE().ValueMap(true).ToList();
 NOTE: Many of the TraversalStrategy classes in Gremlin-DotNet are proxies to the respective strategy on Apache TinkerPop’s
 JVM-based Gremlin traversal machine. As such, their `Apply(ITraversal)` method does nothing. However, the strategy is
 encoded in the Gremlin-DotNet bytecode and transmitted to the Gremlin traversal machine for re-construction machine-side.
-
-=== Custom Serialization
-
-Gremlin-DotNet provides a GraphSON 2.0 serialization package with the standard Apache TinkerPop `g`-types registered
-(see link:http://tinkerpop.apache.org/docs/x.y.z/dev/io/#graphson-2d0[GraphSON 2.0]). It is possible for users to add new
-types by creating serializers and deserializers in C# (or any other .NET language) and registering them with the `GremlinClient`.
-
-[source,csharp]
-----
-internal class MyType
-{
-    public static string GraphsonPrefix = "providerx";
-    public static string GraphsonBaseType = "MyType";
-    public static string GraphsonType = GraphSONUtil.FormatTypeName(GraphsonPrefix, GraphsonBaseType);
-
-    public MyType(int x, int y)
-    {
-        X = x;
-        Y = y;
-    }
-
-    public int X { get; }
-    public int Y { get; }
-}
-
-internal class MyClassWriter : IGraphSONSerializer
-{
-    public Dictionary<string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer)
-    {
-        MyType myType = objectData;
-        var valueDict = new Dictionary<string, object>
-        {
-            {"x", myType.X},
-            {"y", myType.Y}
-        };
-        return GraphSONUtil.ToTypedValue(nameof(TestClass), valueDict, MyType.GraphsonPrefix);
-    }
-}
-
-internal class MyTypeReader : IGraphSONDeserializer
-{
-    public dynamic Objectify(JToken graphsonObject, GraphSONReader reader)
-    {
-        var x = reader.ToObject(graphsonObject["x"]);
-        var y = reader.ToObject(graphsonObject["y"]);
-        return new MyType(x, y);
-    }
-}
-
-var graphsonReader = new GraphSONReader(
-    new Dictionary<string, IGraphSONDeserializer> {{MyType.GraphsonType, new MyTypeReader()}});
-var graphsonWriter = new GraphSONWriter(
-    new Dictionary<Type, IGraphSONSerializer> {{typeof(MyType), new MyClassWriter()}});
-
-var gremlinClient = new GremlinClient(new GremlinServer("localhost", 8182), graphsonReader, graphsonWriter);
-----


[12/47] tinkerpop git commit: Merge branch 'pr-728' into tp32

Posted by sp...@apache.org.
Merge branch 'pr-728' into tp32


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

Branch: refs/heads/TINKERPOP-1784
Commit: 5e4ae46696edb32c4cbfc3be0c19ac55b9fac370
Parents: cb7057c 64479b3
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Oct 12 21:00:51 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Oct 12 21:00:51 2017 -0400

----------------------------------------------------------------------
 gremlin-python/src/main/jython/setup.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------



[25/47] tinkerpop git commit: TINKERPOP-1784 Added support for numeric keys in glv tests

Posted by sp...@apache.org.
TINKERPOP-1784 Added support for numeric keys in glv tests


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

Branch: refs/heads/TINKERPOP-1784
Commit: 769e8ae2f6a4fd6c84872ee858b91c46a2a25836
Parents: 2881ace
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Sep 22 14:43:13 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Oct 16 11:19:30 2017 -0400

----------------------------------------------------------------------
 gremlin-python/src/main/jython/radish/feature_steps.py | 10 ++++++----
 gremlin-test/features/sideEffect/GroupCount.feature    | 10 ++++++++++
 2 files changed, 16 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/769e8ae2/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 19da3ec..35103f3 100644
--- a/gremlin-python/src/main/jython/radish/feature_steps.py
+++ b/gremlin-python/src/main/jython/radish/feature_steps.py
@@ -25,8 +25,6 @@ from gremlin_python.process.traversal import P, Scope, Column
 from radish import given, when, then
 from hamcrest import *
 
-out = __.out
-
 
 @given("the {graph_name:w} graph")
 def choose_graph(step, graph_name):
@@ -40,7 +38,8 @@ def translate_traversal(step):
     step.context.traversal = eval(step.text, {"g": g,
                                               "Column": Column,
                                               "P": P,
-                                              "Scope": Scope})
+                                              "Scope": Scope,
+                                              "bothE": __.bothE})
 
 
 @when("iterated to list")
@@ -49,9 +48,12 @@ def iterate_the_traversal(step):
 
 
 def __convert(m, ctx):
+    # transform string map keys from the test spec to numbers when it encounters the appropriate patterns
     n = {}
     for key, value in m.items():
-        if isinstance(key, str) and re.match("v\[.*\]", key):
+        if re.match("d\[.*\]", key):
+            n[long(key[2:-1])] = value
+        elif re.match("v\[.*\]", key):
             n[ctx.lookup["modern"][key[2:-1]]] = value
         else:
             n[key] = value

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/769e8ae2/gremlin-test/features/sideEffect/GroupCount.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/sideEffect/GroupCount.feature b/gremlin-test/features/sideEffect/GroupCount.feature
index d8d5b51..7b4a0a6 100644
--- a/gremlin-test/features/sideEffect/GroupCount.feature
+++ b/gremlin-test/features/sideEffect/GroupCount.feature
@@ -27,6 +27,16 @@ Feature: Step - groupCount()
     Then the result should be ordered
       | map | {"ripple": 1, "lop": 3} |
 
+  Scenario: Edge count distribution
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().groupCount().by(bothE().count())
+      """
+    When iterated to list
+    Then the result should be ordered
+      | map | {"d[1]": 3, "d[3]": 3} |
+
   Scenario: Group count vertices, cap to retrieve the map and unfold it to group count again
     Given the modern graph
     And the traversal of


[02/47] tinkerpop git commit: fixed a bug in LambdaRestrictionStrategy where named @ steps were considered lambda. Came up with a different way to check lambdas in .toString(). Works for Groovy, Java, and Python.

Posted by sp...@apache.org.
fixed a bug in LambdaRestrictionStrategy where named @ steps were considered lambda. Came up with a different way to check lambdas in .toString(). Works for Groovy, Java, and Python.


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

Branch: refs/heads/TINKERPOP-1784
Commit: beae74c43505d1f7732f92a500dc58fc4b142af1
Parents: 1cd042b
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Mon Oct 2 15:23:33 2017 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Mon Oct 2 15:23:33 2017 -0600

----------------------------------------------------------------------
 CHANGELOG.asciidoc                                    |  1 +
 .../verification/LambdaRestrictionStrategy.java       | 14 +++++++-------
 .../verification/LambdaRestrictionStrategyTest.java   |  6 ++++++
 3 files changed, 14 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/beae74c4/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index e48dfb5..f1ad017 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -23,6 +23,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 [[release-3-2-7]]
 === TinkerPop 3.2.7 (Release Date: NOT OFFICIALLY RELEASED YET)
 
+* Fixed a bug in `LambdaRestrictionStrategy` where named steps with `@` were being considered lambdas.
 * `ReferenceVertex` was missing its `label()` string. `ReferenceElement` now supports all label handling.
 * Added `GraphHelper.cloneElements(Graph original, Graph clone)` to the `gremlin-test` module to quickly clone a graph.
 * Bump to GMavenPlus 1.6.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/beae74c4/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/LambdaRestrictionStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/LambdaRestrictionStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/LambdaRestrictionStrategy.java
index 33b29ff..134a852 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/LambdaRestrictionStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/LambdaRestrictionStrategy.java
@@ -61,19 +61,19 @@ public final class LambdaRestrictionStrategy extends AbstractTraversalStrategy<T
                 throw new VerificationException("The provided traversal contains a lambda step: " + step, traversal);
             if (step instanceof ComparatorHolder) {
                 for (final Pair<Traversal.Admin<Object, Comparable>, Comparator<Comparable>> comparator : ((ComparatorHolder<Object, Comparable>) step).getComparators()) {
-                    final String comparatorString = comparator.toString();
-                    if (comparatorString.contains("$") || comparatorString.contains("@"))
+                    if (hasLambda(comparator.toString()))
                         throw new VerificationException("The provided step contains a lambda comparator: " + step, traversal);
                 }
             }
-            if (step instanceof SackValueStep) {
-                final String sackString = ((SackValueStep) step).getSackFunction().toString();
-                if (sackString.contains("$") || sackString.contains("@"))
-                    throw new VerificationException("The provided step contains a lambda bi-function: " + step, traversal);
-            }
+            if (step instanceof SackValueStep && hasLambda(((SackValueStep) step).getSackFunction().toString()))
+                throw new VerificationException("The provided step contains a lambda bi-function: " + step, traversal);
         }
     }
 
+    private final boolean hasLambda(final String objectString) {
+        return objectString.contains("$") || objectString.toLowerCase().contains("lambda");
+    }
+
     public static LambdaRestrictionStrategy instance() {
         return INSTANCE;
     }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/beae74c4/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/LambdaRestrictionStrategyTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/LambdaRestrictionStrategyTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/LambdaRestrictionStrategyTest.java
index 9bb251c..1804ddf 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/LambdaRestrictionStrategyTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/LambdaRestrictionStrategyTest.java
@@ -24,8 +24,10 @@ import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies;
 import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.finalization.ProfileStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversalStrategies;
 import org.apache.tinkerpop.gremlin.structure.Column;
+import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.T;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -34,6 +36,7 @@ import org.junit.runners.Parameterized;
 import java.util.Arrays;
 
 import static org.apache.tinkerpop.gremlin.process.traversal.Operator.sum;
+import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.outE;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
@@ -63,6 +66,8 @@ public class LambdaRestrictionStrategyTest {
                 //
                 {"sack(sum).by('age')", __.sack(sum).by("age"), true},
                 {"sack{a,b -> a+b}.by('age')", __.sack((a, b) -> (int) a + (int) b).by("age"), false},
+                //
+                {"order().by(outE('rating').values('stars').mean()).profile()", __.order().by(outE("ratings").values("stars").mean()).profile(), true}
         });
     }
 
@@ -78,6 +83,7 @@ public class LambdaRestrictionStrategyTest {
     @Test
     public void shouldBeVerifiedIllegal() {
         final TraversalStrategies strategies = new DefaultTraversalStrategies();
+        strategies.addStrategies(ProfileStrategy.instance());
         strategies.addStrategies(LambdaRestrictionStrategy.instance());
         traversal.asAdmin().setStrategies(strategies);
         if (allow) {


[24/47] tinkerpop git commit: TINKERPOP-1784 Added some more vertex features

Posted by sp...@apache.org.
TINKERPOP-1784 Added some more vertex features


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

Branch: refs/heads/TINKERPOP-1784
Commit: b0423f5a801ba8193aa48e33a5aab2ea4638cd79
Parents: 20de593
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Sep 29 13:26:27 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Oct 16 11:19:30 2017 -0400

----------------------------------------------------------------------
 gremlin-test/features/map/Vertex.feature | 105 ++++++++++++++++++++++++++
 1 file changed, 105 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b0423f5a/gremlin-test/features/map/Vertex.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/map/Vertex.feature b/gremlin-test/features/map/Vertex.feature
index 9aa506c..1905f3a 100644
--- a/gremlin-test/features/map/Vertex.feature
+++ b/gremlin-test/features/map/Vertex.feature
@@ -169,3 +169,108 @@ Feature: Step - V(), E(), out(), in(), both(), inE(), outE(), bothE()
       | e[josh-created->lop] |
       | e[josh-created->ripple] |
       | e[marko-knows->josh] |
+
+  Scenario: g_VX1X_outE_inV
+    Given the modern graph
+    And using the parameter v1 is "v[marko]"
+    And the traversal of
+      """
+      g.V(v1).both()
+      """
+    When iterated to list
+    Then the result should be unordered
+      | v[vadas] |
+      | v[josh] |
+      | v[lop] |
+
+  Scenario: g_VX2X_inE_outV
+    Given the modern graph
+    And using the parameter v2 is "v[vadas]"
+    And the traversal of
+      """
+      g.V(v2).inE().outV()
+      """
+    When iterated to list
+    Then the result should be unordered
+      | v[marko] |
+
+  Scenario: g_V_outE_hasXweight_1X_outV
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().outE().has("weight",1.0).outV()
+      """
+    When iterated to list
+    Then the result should be unordered
+      | v[marko] |
+      | v[josh] |
+
+  Scenario: g_V_out_outE_inV_inE_inV_both_name
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().out().outE().inV().inE().inV().both().values("name")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | marko |
+      | marko |
+      | marko |
+      | josh |
+      | josh |
+      | josh |
+      | josh |
+      | peter |
+      | peter |
+      | peter |
+
+  Scenario: g_VX1X_outEXknowsX_bothV_name
+    Given the modern graph
+    And using the parameter v1 is "v[marko]"
+    And the traversal of
+      """
+      g.V(v1).outE("knows").bothV().values("name")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | marko |
+      | marko |
+      | josh |
+      | vadas |
+
+  Scenario: g_VX1X_outE_otherV
+    Given the modern graph
+    And using the parameter v1 is "v[marko]"
+    And the traversal of
+      """
+      g.V(v1).outE().otherV()
+      """
+    When iterated to list
+    Then the result should be unordered
+      | v[vadas] |
+      | v[josh] |
+      | v[lop] |
+
+  Scenario: g_VX4X_bothE_otherV
+    Given the modern graph
+    And using the parameter v4 is "v[josh]"
+    And the traversal of
+      """
+      g.V(v4).bothE().otherV()
+      """
+    When iterated to list
+    Then the result should be unordered
+      | v[marko] |
+      | v[ripple] |
+      | v[lop] |
+
+  Scenario: g_VX4X_bothE_hasXweight_lt_1X_otherV
+    Given the modern graph
+    And using the parameter v4 is "v[josh]"
+    And the traversal of
+      """
+      g.V(v4).bothE().has("weight", P.lt(1.0)).otherV()
+      """
+    When iterated to list
+    Then the result should be unordered
+      | v[lop] |
\ No newline at end of file


[44/47] tinkerpop git commit: TINKERPOP-1784 Define traversals without shorthand

Posted by sp...@apache.org.
TINKERPOP-1784 Define traversals without shorthand

Sorta made the decision to be explicit in how traversals are defined in .feature files. Shying away from using shorthand static imports which will make it more explicit for those trying to implement the tests.


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

Branch: refs/heads/TINKERPOP-1784
Commit: a1a07134f57e5bb165157907352de468b04c6bf2
Parents: bd5e028
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Oct 10 15:18:55 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Oct 16 11:19:31 2017 -0400

----------------------------------------------------------------------
 gremlin-python/src/main/jython/radish/feature_steps.py | 13 +++----------
 gremlin-test/features/branch/Branch.feature            |  6 +++---
 gremlin-test/features/map/Count.feature                |  8 ++++----
 gremlin-test/features/map/Select.feature               |  2 +-
 gremlin-test/features/sideEffect/GroupCount.feature    |  8 ++++----
 5 files changed, 15 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a1a07134/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 0d52d75..3c25258 100644
--- a/gremlin-python/src/main/jython/radish/feature_steps.py
+++ b/gremlin-python/src/main/jython/radish/feature_steps.py
@@ -58,17 +58,10 @@ def translate_traversal(step):
          "Column": Column,
          "Direction": Direction,
          "Order": Order,
-         "P": P, "gt": P.gt,
-         "Pick": Pick, "any": Pick.any,
+         "P": P,
+         "Pick": Pick,
          "Scope": Scope,
-         "T": T,
-         "as_": __.as_,
-         "bothE": __.bothE,
-         "in_": __.in_,
-         "label": __.label,
-         "out": __.out,
-         "repeat": __.repeat,
-         "values": __.values}
+         "T": T}
 
     if hasattr(step.context, "traversal_params"):
         b.update(step.context.traversal_params)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a1a07134/gremlin-test/features/branch/Branch.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/branch/Branch.feature b/gremlin-test/features/branch/Branch.feature
index d12fc0f..93562c8 100644
--- a/gremlin-test/features/branch/Branch.feature
+++ b/gremlin-test/features/branch/Branch.feature
@@ -22,7 +22,7 @@ Feature: Step - branch()
     And using the parameter l1 is "c[it.get().label() == 'person' ? 'a' : 'b']"
     And the traversal of
       """
-      g.V().branch(l1).option("a", values("age")).option("b", values("lang")).option("b", values("name"))
+      g.V().branch(l1).option("a", __.values("age")).option("b", __.values("lang")).option("b", __.values("name"))
       """
     When iterated to list
     Then the result should be unordered
@@ -39,7 +39,7 @@ Feature: Step - branch()
     Given the modern graph
     And the traversal of
       """
-      g.V().branch(label().is("person").count()).option(1L, values("age")).option(0L, values("lang")).option(0L, values("name"))
+      g.V().branch(__.label().is("person").count()).option(1L, __.values("age")).option(0L, __.values("lang")).option(0L, __.values("name"))
       """
     When iterated to list
     Then the result should be unordered
@@ -56,7 +56,7 @@ Feature: Step - branch()
     Given the modern graph
     And the traversal of
       """
-      g.V().branch(label().is("person").count()).option(1L, values("age")).option(0L, values("lang")).option(0L, values("name")).option(any, label())
+      g.V().branch(__.label().is("person").count()).option(1L, __.values("age")).option(0L, __.values("lang")).option(0L, __.values("name")).option(Pick.any, __.label())
       """
     When iterated to list
     Then the result should be unordered

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a1a07134/gremlin-test/features/map/Count.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/map/Count.feature b/gremlin-test/features/map/Count.feature
index 5faa975..6053605 100644
--- a/gremlin-test/features/map/Count.feature
+++ b/gremlin-test/features/map/Count.feature
@@ -71,7 +71,7 @@ Feature: Step - count()
     Given the modern graph
     And the traversal of
       """
-      g.V().where(in("knows").out("created").count().is(0)).values("name")
+      g.V().where(__.in("knows").out("created").count().is(0)).values("name")
       """
     When iterated to list
     Then the result should be unordered
@@ -84,7 +84,7 @@ Feature: Step - count()
     Given the grateful graph
     And the traversal of
       """
-      g.V().repeat(out()).times(8).count()
+      g.V().repeat(__.out()).times(8).count()
       """
     When iterated to list
     Then the result should be ordered
@@ -94,7 +94,7 @@ Feature: Step - count()
     Given the grateful graph
     And the traversal of
       """
-      g.V().repeat(out()).times(5).as("a").out("writtenBy").as("b").select("a", "b").count()
+      g.V().repeat(__.out()).times(5).as("a").out("writtenBy").as("b").select("a", "b").count()
       """
     When iterated to list
     Then the result should be ordered
@@ -104,7 +104,7 @@ Feature: Step - count()
     Given the grateful graph
     And the traversal of
       """
-      g.V().repeat(out()).times(3).count()
+      g.V().repeat(__.out()).times(3).count()
       """
     When iterated to list
     Then the result should be ordered

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a1a07134/gremlin-test/features/map/Select.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/map/Select.feature b/gremlin-test/features/map/Select.feature
index 9df72a8..f29a436 100644
--- a/gremlin-test/features/map/Select.feature
+++ b/gremlin-test/features/map/Select.feature
@@ -260,7 +260,7 @@ Feature: Step - select()
     Given the modern graph
     And the traversal of
       """
-      g.V().out("created").union(as("project").in("created").has("name", "marko").select("project"),as("project").in("created").in("knows").has("name", "marko").select("project")).groupCount().by("name")
+      g.V().out("created").union(__.as("project").in("created").has("name", "marko").select("project"), __.as("project").in("created").in("knows").has("name", "marko").select("project")).groupCount().by("name")
       """
     When iterated to list
     Then the result should be unordered

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a1a07134/gremlin-test/features/sideEffect/GroupCount.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/sideEffect/GroupCount.feature b/gremlin-test/features/sideEffect/GroupCount.feature
index b767001..28eb675 100644
--- a/gremlin-test/features/sideEffect/GroupCount.feature
+++ b/gremlin-test/features/sideEffect/GroupCount.feature
@@ -61,7 +61,7 @@ Feature: Step - groupCount()
     Given the modern graph
     And the traversal of
       """
-      g.V().repeat(out().groupCount("a").by("name")).times(2).cap("a")
+      g.V().repeat(__.out().groupCount("a").by("name")).times(2).cap("a")
       """
     When iterated to list
     Then the result should be ordered
@@ -71,7 +71,7 @@ Feature: Step - groupCount()
     Given the modern graph
     And the traversal of
       """
-      g.V().both().groupCount("a").by(T.label).as("b").barrier().where(__.select("a").select("software").is(gt(2))).select("b").values("name")
+      g.V().both().groupCount("a").by(T.label).as("b").barrier().where(__.select("a").select("software").is(P.gt(2))).select("b").values("name")
       """
     When iterated to list
     Then the result should be unordered
@@ -92,7 +92,7 @@ Feature: Step - groupCount()
     Given the modern graph
     And the traversal of
       """
-      g.V().union(out("knows"), out("created").in("created")).groupCount().select(Column.values).unfold().sum()
+      g.V().union(__.out("knows"), __.out("created").in("created")).groupCount().select(Column.values).unfold().sum()
       """
     When iterated to list
     Then the result should be ordered
@@ -122,7 +122,7 @@ Feature: Step - groupCount()
     Given the modern graph
     And the traversal of
       """
-      g.V().union(repeat(out()).times(2).groupCount("m").by("lang"),repeat(in()).times(2).groupCount("m").by("name")).cap("m")
+      g.V().union(__.repeat(__.out()).times(2).groupCount("m").by("lang"),__.repeat(__.in()).times(2).groupCount("m").by("name")).cap("m")
       """
     When iterated to list
     Then the result should be ordered


[06/47] tinkerpop git commit: Merge branch 'TINKERPOP-1795' into tp32

Posted by sp...@apache.org.
Merge branch 'TINKERPOP-1795' into tp32


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

Branch: refs/heads/TINKERPOP-1784
Commit: a278edd85cfff9028004cc37c95ecac1219bb954
Parents: b3e301e beae74c
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Wed Oct 4 07:29:17 2017 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Wed Oct 4 07:29:17 2017 -0600

----------------------------------------------------------------------
 CHANGELOG.asciidoc                                    |  1 +
 .../verification/LambdaRestrictionStrategy.java       | 14 +++++++-------
 .../verification/LambdaRestrictionStrategyTest.java   |  6 ++++++
 3 files changed, 14 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a278edd8/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --cc CHANGELOG.asciidoc
index 5ea3034,f1ad017..ec54cc2
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@@ -23,10 -23,8 +23,11 @@@ image::https://raw.githubusercontent.co
  [[release-3-2-7]]
  === TinkerPop 3.2.7 (Release Date: NOT OFFICIALLY RELEASED YET)
  
 +* Truncate the script in error logs and error return messages for "Method code too large" errors in Gremlin Server.
+ * Fixed a bug in `LambdaRestrictionStrategy` where named steps with `@` were being considered lambdas.
  * `ReferenceVertex` was missing its `label()` string. `ReferenceElement` now supports all label handling.
 +* Fixed a bug where bytecode containing lambdas would randomly select a traversal source from bindings.
 +* Deprecated `GremlinScriptEngine.eval()` methods and replaced them with new overloads that include the specific `TraversalSource` to bind to.
  * Added `GraphHelper.cloneElements(Graph original, Graph clone)` to the `gremlin-test` module to quickly clone a graph.
  * Bump to GMavenPlus 1.6.
  * Added better error message for illegal use of `repeat()`-step.


[17/47] tinkerpop git commit: TINKERPOP-1784 Added coin() gherkin tests and refactored python

Posted by sp...@apache.org.
TINKERPOP-1784 Added coin() gherkin tests and refactored python


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

Branch: refs/heads/TINKERPOP-1784
Commit: ac0dd78a5465207f2d54c71506af3a7e12acb81e
Parents: 84fb552
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Sep 20 18:38:49 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Oct 16 11:19:29 2017 -0400

----------------------------------------------------------------------
 .../main/jython/radish/count_features_step.py   | 50 -------------
 .../src/main/jython/radish/feature_steps.py     | 77 ++++++++++++++++++++
 gremlin-test/features/map/Coin.feature          | 42 +++++++++++
 gremlin-test/features/map/Count.feature         | 46 ++++++------
 4 files changed, 144 insertions(+), 71 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ac0dd78a/gremlin-python/src/main/jython/radish/count_features_step.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/radish/count_features_step.py b/gremlin-python/src/main/jython/radish/count_features_step.py
deleted file mode 100644
index ec04551..0000000
--- a/gremlin-python/src/main/jython/radish/count_features_step.py
+++ /dev/null
@@ -1,50 +0,0 @@
-'''
-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.
-'''
-
-from gremlin_python.structure.graph import Graph
-from gremlin_python.process.graph_traversal import __
-from gremlin_python.process.traversal import Scope
-from radish import before, given, when, then
-
-out = __.out
-
-
-@given("the {graphName:w} graph")
-def choose_graph(step, graphName):
-    # only have modern atm but graphName would be used to select the right one
-    step.context.g = Graph().traversal().withRemote(step.context.remote_conn_modern)
-
-
-@given("the traversal of")
-def translate_traversal(step):
-    g = step.context.g
-    step.context.traversal = eval(step.text, {"g": g, "Scope": Scope})
-
-
-@when("iterating")
-def iterate_the_traversal(step):
-    step.context.result = step.context.traversal.toList()
-
-
-@then("the result should be {number:d}")
-def assert_single_result_of_number(step, number):
-    assert len(step.context.result) == 1
-    assert step.context.result[0] == number
-
-

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ac0dd78a/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
new file mode 100644
index 0000000..61297ff
--- /dev/null
+++ b/gremlin-python/src/main/jython/radish/feature_steps.py
@@ -0,0 +1,77 @@
+'''
+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.
+'''
+
+from gremlin_python.structure.graph import Graph
+from gremlin_python.process.graph_traversal import __
+from gremlin_python.process.traversal import Scope
+from radish import before, given, when, then
+
+out = __.out
+
+
+@given("the {graphName:w} graph")
+def choose_graph(step, graphName):
+    # only have modern atm but graphName would be used to select the right one
+    step.context.g = Graph().traversal().withRemote(step.context.remote_conn_modern)
+
+
+@given("the traversal of")
+def translate_traversal(step):
+    g = step.context.g
+    step.context.traversal = eval(step.text, {"g": g, "Scope": Scope})
+
+
+@when("iterated to list")
+def iterate_the_traversal(step):
+    step.context.result = step.context.traversal.toList()
+
+
+@then("the result should be {characterized_as:w}")
+def assert_result(step, characterized_as):
+    if characterized_as == "empty":
+        assert len(step.context.result) == 0
+    elif characterized_as == "ordered":
+        data = step.table
+    
+        # results from traversal should have the same number of entries as the feature data table
+        assert len(step.context.result) == len(data)
+
+        # assert the results by type where the first column will hold the type and the second column
+        # the data to assert. the contents of the second column will be dependent on the type specified
+        # in te first column
+        for ix, line in enumerate(data):
+            if line[0] == "numeric":
+                assert long(step.context.result[ix]) == long(line[1])
+            elif line[0] == "string":
+                assert str(step.context.result[ix]) == str(line[1])
+            else:
+                assert step.context.result[ix] == line[1]
+    elif characterized_as == "unordered":
+        data = step.table
+
+        # results from traversal should have the same number of entries as the feature data table
+        assert len(step.context.result) == len(data)
+
+
+
+@then("the results should be empty")
+def assert_result(step):
+    assert len(step.context.result) == 0
+
+

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ac0dd78a/gremlin-test/features/map/Coin.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/map/Coin.feature b/gremlin-test/features/map/Coin.feature
new file mode 100644
index 0000000..b21bd70
--- /dev/null
+++ b/gremlin-test/features/map/Coin.feature
@@ -0,0 +1,42 @@
+# 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 - coin()
+
+  Scenario: Use coin at 1.0
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().coin(1.0)
+      """
+    When iterated to list
+    Then the result should be unordered as
+      | vertex | person   |
+      | vertex | person   |
+      | vertex | person   |
+      | vertex | person   |
+      | vertex | software |
+      | vertex | software |
+
+  Scenario: Use coin at 0.0
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().coin(0.0)
+      """
+    When iterated to list
+    Then the result should be empty
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ac0dd78a/gremlin-test/features/map/Count.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/map/Count.feature b/gremlin-test/features/map/Count.feature
index 383eecf..316976e 100644
--- a/gremlin-test/features/map/Count.feature
+++ b/gremlin-test/features/map/Count.feature
@@ -15,40 +15,44 @@
 # specific language governing permissions and limitations
 # under the License.
 
-Feature: Count Step
+Feature: Step - count()
 
   Scenario: Count all vertices
     Given the modern graph
     And the traversal of
-    """
-    g.V().count()
-    """
-    When iterating
-    Then the result should be 6
+      """
+      g.V().count()
+      """
+    When iterated to list
+    Then the result should be ordered
+      | numeric | 6 |
 
   Scenario: Count vertices after traversing both() twice
     Given the modern graph
     And the traversal of
-    """
-    g.V().both().both().count()
-    """
-    When iterating
-    Then the result should be 30
+      """
+      g.V().both().both().count()
+      """
+    When iterated to list
+    Then the result should be ordered
+      | numeric | 30 |
 
   Scenario: Count local
     Given the modern graph
     And the traversal of
-    """
-    g.V().fold().count(Scope.local)
-    """
-    When iterating
-    Then the result should be 6
+      """
+      g.V().fold().count(Scope.local)
+      """
+    When iterated to list
+    Then the result should be ordered
+      | numeric | 6 |
 
   Scenario: Count no vertices
     Given the modern graph
     And the traversal of
-    """
-    g.V().has("no").count()
-    """
-    When iterating
-    Then the result should be 0
\ No newline at end of file
+      """
+      g.V().has("no").count()
+      """
+    When iterated to list
+    Then the result should be ordered
+      | numeric | 0 |
\ No newline at end of file


[27/47] tinkerpop git commit: TINKERPOP-1784 Added test for select in GLV tests

Posted by sp...@apache.org.
TINKERPOP-1784 Added test for select in GLV tests

Included infrastructure for validating maps and refactored other related code.


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

Branch: refs/heads/TINKERPOP-1784
Commit: 5210453a866a920b2443e0fc7520b61164ec07c0
Parents: 769e8ae
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Sat Sep 23 07:12:07 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Oct 16 11:19:30 2017 -0400

----------------------------------------------------------------------
 .../src/main/jython/radish/feature_steps.py     | 76 ++++++++++++--------
 gremlin-test/features/map/Select.feature        | 30 ++++++++
 2 files changed, 75 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5210453a/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 35103f3..8ef0f1b 100644
--- a/gremlin-python/src/main/jython/radish/feature_steps.py
+++ b/gremlin-python/src/main/jython/radish/feature_steps.py
@@ -32,14 +32,27 @@ def choose_graph(step, graph_name):
     step.context.g = Graph().traversal().withRemote(step.context.remote_conn[graph_name])
 
 
+@given("using the parameter {param_name:w} is {param:QuotedString}")
+def add_parameter(step, param_name, param):
+    if not hasattr(step.context, "traversal_params"):
+        step.context.traversal_params = {}
+
+    step.context.traversal_params[param_name.encode('utf-8')] = __convert(param, step.context)
+
+
 @given("the traversal of")
 def translate_traversal(step):
     g = step.context.g
-    step.context.traversal = eval(step.text, {"g": g,
-                                              "Column": Column,
-                                              "P": P,
-                                              "Scope": Scope,
-                                              "bothE": __.bothE})
+    b = {"g": g,
+         "Column": Column,
+         "P": P,
+         "Scope": Scope,
+         "bothE": __.bothE}
+
+    if hasattr(step.context, "traversal_params"):
+        b.update(step.context.traversal_params)
+
+    step.context.traversal = eval(step.text, b)
 
 
 @when("iterated to list")
@@ -47,18 +60,32 @@ def iterate_the_traversal(step):
     step.context.result = step.context.traversal.toList()
 
 
-def __convert(m, ctx):
-    # transform string map keys from the test spec to numbers when it encounters the appropriate patterns
-    n = {}
-    for key, value in m.items():
-        if re.match("d\[.*\]", key):
-            n[long(key[2:-1])] = value
-        elif re.match("v\[.*\]", key):
-            n[ctx.lookup["modern"][key[2:-1]]] = value
-        else:
-            n[key] = value
+@then("the result should be {characterized_as:w}")
+def assert_result(step, characterized_as):
+    if characterized_as == "empty":
+        assert_that(len(step.context.result), equal_to(0))
+    elif characterized_as == "ordered":
+        __ordered_assertion(step)
+    elif characterized_as == "unordered":
+        __unordered_assertion(step)
+    else:
+        raise ValueError("unknown data characterization of " + characterized_as)
+
 
-    return n
+def __convert(val, ctx):
+    if isinstance(val, dict):
+        n = {}
+        for key, value in val.items():
+            n[__convert(key, ctx)] = __convert(value, ctx)
+        return n
+    elif isinstance(val, (str, unicode)) and re.match("d\[.*\]", val):
+        return long(val[2:-1])
+    elif isinstance(val, (str, unicode)) and re.match("v\[.*\]", val):
+        return ctx.lookup["modern"][val[2:-1]]
+    elif isinstance(val, unicode):
+        return val.encode('utf-8')
+    else:
+        return str(val)
 
 
 def __ordered_assertion(step):
@@ -108,23 +135,10 @@ def __unordered_assertion(step):
             assert_that(v, is_in(results_to_test))
             results_to_test.remove(v)
         elif line[0] == "map":
-            val = __convert(json.load(line[1]), step.context)
+            val = __convert(json.loads(line[1]), step.context)
             assert_that(val, is_in(results_to_test))
             results_to_test.remove(val)
         else:
             raise ValueError("unknown type of " + line[0])
 
-    assert_that(len(results_to_test), is_(0))
-
-    
-@then("the result should be {characterized_as:w}")
-def assert_result(step, characterized_as):
-    if characterized_as == "empty":
-        assert_that(len(step.context.result), equal_to(0))
-    elif characterized_as == "ordered":
-        __ordered_assertion(step)
-    elif characterized_as == "unordered":
-        __unordered_assertion(step)
-    else:
-        raise ValueError("unknown data characterization of " + characterized_as)
-
+    assert_that(len(results_to_test), is_(0))
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5210453a/gremlin-test/features/map/Select.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/map/Select.feature b/gremlin-test/features/map/Select.feature
new file mode 100644
index 0000000..e64417a
--- /dev/null
+++ b/gremlin-test/features/map/Select.feature
@@ -0,0 +1,30 @@
+# 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 - select()
+
+  Scenario: Select vertices
+    Given the modern graph
+    And using the parameter v1 is "v[marko]"
+    And the traversal of
+      """
+      g.V(v1).as_("a").out("knows").as_("b").select("a", "b")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | map | {"a": "v[marko]", "b": "v[vadas]"} |
+      | map | {"a": "v[marko]", "b": "v[josh]"} |
\ No newline at end of file


[21/47] tinkerpop git commit: TINKERPOP-1784 Initial implementation of a new language agnostic test suite

Posted by sp...@apache.org.
TINKERPOP-1784 Initial implementation of a new language agnostic test suite

Uses Gherkin to write test specifications that will be implemented by the various GLVs. Provided a basic implementation for gremlin-python.


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

Branch: refs/heads/TINKERPOP-1784
Commit: f4e4d5532e0eb5a67d01ecfa07a40a428f7edd37
Parents: c13bf94
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Sep 14 15:44:32 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Oct 16 11:19:29 2017 -0400

----------------------------------------------------------------------
 gremlin-python/pom.xml                          | 19 +++++++
 .../main/jython/radish/count_features_step.py   | 59 ++++++++++++++++++++
 .../src/main/jython/radish/terrain.py           | 31 ++++++++++
 gremlin-python/src/main/jython/setup.py         |  3 +-
 gremlin-test/features/Count.feature             | 54 ++++++++++++++++++
 5 files changed, 165 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f4e4d553/gremlin-python/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-python/pom.xml b/gremlin-python/pom.xml
index 379a114..4ab5f37 100644
--- a/gremlin-python/pom.xml
+++ b/gremlin-python/pom.xml
@@ -341,6 +341,10 @@ limitations under the License.
                                               failonerror="true">
                                             <arg line="install wheel"/>
                                         </exec>
+                                        <exec dir="${project.build.directory}/python2" executable="env/bin/pip"
+                                              failonerror="true">
+                                            <arg line="install radish-bdd"/>
+                                        </exec>
                                         <exec dir="${project.build.directory}/python3" executable="virtualenv"
                                               failonerror="true">
                                             <arg line="--python=python3 env"/>
@@ -349,6 +353,10 @@ limitations under the License.
                                               failonerror="true">
                                             <arg line="install wheel"/>
                                         </exec>
+                                        <exec dir="${project.build.directory}/python3" executable="env/bin/pip"
+                                              failonerror="true">
+                                            <arg line="install radish-bdd"/>
+                                        </exec>
                                         <exec dir="${project.build.directory}/python-packaged" executable="virtualenv"
                                               failonerror="true">
                                             <arg line="--python=python3 env"/>
@@ -438,6 +446,17 @@ limitations under the License.
                                             <env key="PYTHONPATH" value=""/>
                                             <arg line="setup.py test"/>
                                         </exec>
+                                        <!-- radish seems to like all dependencies in place -->
+                                        <exec executable="env/bin/python" dir="${project.build.directory}/python2"
+                                              failonerror="true">
+                                            <env key="PYTHONPATH" value=""/>
+                                            <arg line="setup.py install"/>
+                                        </exec>
+                                        <exec executable="env/bin/radish" dir="${project.build.directory}/python2"
+                                              failonerror="true">
+                                            <env key="PYTHONPATH" value=""/>
+                                            <arg line="-b ${project.build.directory}/python2/radish ${project.basedir}/../gremlin-test/features/"/>
+                                        </exec>                                                                  
                                     </target>
                                 </configuration>
                             </execution>

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f4e4d553/gremlin-python/src/main/jython/radish/count_features_step.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/radish/count_features_step.py b/gremlin-python/src/main/jython/radish/count_features_step.py
new file mode 100644
index 0000000..324c29c
--- /dev/null
+++ b/gremlin-python/src/main/jython/radish/count_features_step.py
@@ -0,0 +1,59 @@
+'''
+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.
+'''
+
+from gremlin_python.structure.graph import Graph
+from gremlin_python.process.graph_traversal import __
+from gremlin_python.process.traversal import Scope
+from radish import before, given, when, then
+
+out = __.out
+
+
+@given("the {graphName:w} graph")
+def choose_graph(step, graphName):
+    # only have modern atm but graphName would be used to select the right one
+    step.context.g = Graph().traversal().withRemote(step.context.remote_conn_modern)
+
+
+@given("the traversal of")
+def translate_traversal(step):
+    g = step.context.g
+    if step.text == "g.V().count()":
+        step.context.traversal = g.V().count()
+    elif step.text == "g.V().both().both().count()":
+        step.context.traversal = g.V().both().both().count()
+    elif step.text == "g.V().fold().count(Scope.local)":
+        step.context.traversal = g.V().fold().count(Scope.local)
+    elif step.text == "g.V().has(\"no\").count()":
+        step.context.traversal = g.V().has("no").count()
+    else:
+        raise ValueError("Gremlin translation to python not found - missing: " + step.text)
+
+
+@when("iterating")
+def iterate_the_traversal(step):
+    step.context.result = step.context.traversal.toList()
+
+
+@then("the result should be {number:d}")
+def assert_single_result_of_number(step, number):
+    assert len(step.context.result) == 1
+    assert step.context.result[0] == number
+
+

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f4e4d553/gremlin-python/src/main/jython/radish/terrain.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/radish/terrain.py b/gremlin-python/src/main/jython/radish/terrain.py
new file mode 100644
index 0000000..389f39c
--- /dev/null
+++ b/gremlin-python/src/main/jython/radish/terrain.py
@@ -0,0 +1,31 @@
+'''
+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.
+'''
+
+from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection
+from radish import before, after
+
+
+@before.each_scenario
+def prepare_traversal_source(scenario):
+    scenario.context.remote_conn_modern = DriverRemoteConnection('ws://localhost:45940/gremlin', 'g')
+
+
+@after.each_scenario
+def close_traversal_source(scenario):
+    scenario.context.remote_conn_modern.close()

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f4e4d553/gremlin-python/src/main/jython/setup.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/setup.py b/gremlin-python/src/main/jython/setup.py
index 1804a0d..73b5000 100644
--- a/gremlin-python/src/main/jython/setup.py
+++ b/gremlin-python/src/main/jython/setup.py
@@ -70,7 +70,8 @@ setup(
     ],
     tests_require=[
         'pytest',
-        'mock'
+        'mock',
+        'radish-bdd'
     ],
     install_requires=install_requires,
     classifiers=[

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f4e4d553/gremlin-test/features/Count.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/Count.feature b/gremlin-test/features/Count.feature
new file mode 100644
index 0000000..383eecf
--- /dev/null
+++ b/gremlin-test/features/Count.feature
@@ -0,0 +1,54 @@
+# 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: Count Step
+
+  Scenario: Count all vertices
+    Given the modern graph
+    And the traversal of
+    """
+    g.V().count()
+    """
+    When iterating
+    Then the result should be 6
+
+  Scenario: Count vertices after traversing both() twice
+    Given the modern graph
+    And the traversal of
+    """
+    g.V().both().both().count()
+    """
+    When iterating
+    Then the result should be 30
+
+  Scenario: Count local
+    Given the modern graph
+    And the traversal of
+    """
+    g.V().fold().count(Scope.local)
+    """
+    When iterating
+    Then the result should be 6
+
+  Scenario: Count no vertices
+    Given the modern graph
+    And the traversal of
+    """
+    g.V().has("no").count()
+    """
+    When iterating
+    Then the result should be 0
\ No newline at end of file


[34/47] tinkerpop git commit: TINKERPOP-1784 Added more select() tests

Posted by sp...@apache.org.
TINKERPOP-1784 Added more select() tests


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

Branch: refs/heads/TINKERPOP-1784
Commit: 2a2a6434647999e63ddcdf20232d98fc8a4afd74
Parents: 2e604d5
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Oct 5 09:23:09 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Oct 16 11:19:30 2017 -0400

----------------------------------------------------------------------
 gremlin-test/features/map/Select.feature | 89 +++++++++++++++++++++++++--
 1 file changed, 85 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2a2a6434/gremlin-test/features/map/Select.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/map/Select.feature b/gremlin-test/features/map/Select.feature
index 9166954..13114d5 100644
--- a/gremlin-test/features/map/Select.feature
+++ b/gremlin-test/features/map/Select.feature
@@ -17,14 +17,95 @@
 
 Feature: Step - select()
 
-  Scenario: Select vertices
+  Scenario: get_g_VX1X_asXaX_outXknowsX_asXbX_selectXa_bX
     Given the modern graph
-    And using the parameter v1 is "v[marko]"
+    And using the parameter v1Id is "v[marko].id"
     And the traversal of
       """
-      g.V(v1).as("a").out("knows").as("b").select("a", "b")
+      g.V(v1Id).as("a").out("knows").as("b").select("a", "b")
       """
     When iterated to list
     Then the result should be unordered
       | m[{"a": "v[marko]", "b": "v[vadas]"}] |
-      | m[{"a": "v[marko]", "b": "v[josh]"}] |
\ No newline at end of file
+      | m[{"a": "v[marko]", "b": "v[josh]"}] |
+
+  Scenario: g_VX1X_asXaX_outXknowsX_asXbX_selectXa_bX_byXnameX
+    Given the modern graph
+    And using the parameter v1Id is "v[marko].id"
+    And the traversal of
+      """
+      g.V(v1Id).as("a").out("knows").as("b").select("a", "b").by("name")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | m[{"a": "marko", "b": "vadas"}] |
+      | m[{"a": "marko", "b": "josh"}] |
+
+  Scenario: g_VX1X_asXaX_outXknowsX_asXbX_selectXaX
+    Given the modern graph
+    And using the parameter v1Id is "v[marko].id"
+    And the traversal of
+      """
+      g.V(v1Id).as("a").out("knows").as("b").select("a")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | v[marko] |
+      | v[marko] |
+
+  Scenario: g_VX1X_asXaX_outXknowsX_asXbX_selectXaX_byXnameX
+    Given the modern graph
+    And using the parameter v1Id is "v[marko].id"
+    And the traversal of
+      """
+      g.V(v1Id).as("a").out("knows").as("b").select("a").by("name")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | marko |
+      | marko |
+
+  Scenario: g_V_asXaX_out_asXbX_selectXa_bX_byXnameX
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().as("a").out().as("b").select("a", "b").by("name")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | m[{"a": "marko", "b": "lop"}] |
+      | m[{"a": "marko", "b": "vadas"}] |
+      | m[{"a": "marko", "b": "josh"}] |
+      | m[{"a": "josh", "b": "ripple"}] |
+      | m[{"a": "josh", "b": "lop"}] |
+      | m[{"a": "peter", "b": "lop"}] |
+
+  Scenario: g_V_asXaX_out_aggregateXxX_asXbX_selectXa_bX_byXnameX
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().as("a").out().aggregate("x").as("b").select("a", "b").by("name")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | m[{"a": "marko", "b": "lop"}] |
+      | m[{"a": "marko", "b": "vadas"}] |
+      | m[{"a": "marko", "b": "josh"}] |
+      | m[{"a": "josh", "b": "ripple"}] |
+      | m[{"a": "josh", "b": "lop"}] |
+      | m[{"a": "peter", "b": "lop"}] |
+
+  Scenario: g_V_asXaX_name_order_asXbX_selectXa_bX_byXnameX_by_XitX
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().as("a").values("name").order().as("b").select("a", "b").by("name").by()
+      """
+    When iterated to list
+    Then the result should be unordered
+      | m[{"a": "marko", "b": "marko"}] |
+      | m[{"a": "vadas", "b": "vadas"}] |
+      | m[{"a": "josh", "b": "josh"}] |
+      | m[{"a": "ripple", "b": "ripple"}] |
+      | m[{"a": "lop", "b": "lop"}] |
+      | m[{"a": "peter", "b": "peter"}] |
\ No newline at end of file


[46/47] tinkerpop git commit: TINKERPOP-1784 Added Choose tests to .feature files

Posted by sp...@apache.org.
TINKERPOP-1784 Added Choose tests to .feature files


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

Branch: refs/heads/TINKERPOP-1784
Commit: 6bb5c099c34eaf57ab810657f4dcd78633fecb86
Parents: 757232a
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Oct 11 10:52:15 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Oct 16 11:19:31 2017 -0400

----------------------------------------------------------------------
 .../src/main/jython/radish/feature_steps.py     |   6 +-
 gremlin-test/features/branch/Choose.feature     | 118 +++++++++++++++++++
 .../gremlin/process/FeatureCoverageTest.java    |   2 +
 3 files changed, 124 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6bb5c099/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 68eeeaf..a34bb8d 100644
--- a/gremlin-python/src/main/jython/radish/feature_steps.py
+++ b/gremlin-python/src/main/jython/radish/feature_steps.py
@@ -25,6 +25,7 @@ from gremlin_python.process.traversal import P, Scope, Column, Order, Direction,
 from radish import given, when, then
 from hamcrest import *
 
+regex_and = re.compile(r"([(.,\s])and\(")
 regex_as = re.compile(r"([(.,\s])as\(")
 regex_in = re.compile(r"([(.,\s])in\(")
 regex_is = re.compile(r"([(.,\s])is\(")
@@ -66,7 +67,7 @@ def translate_traversal(step):
     if hasattr(step.context, "traversal_params"):
         b.update(step.context.traversal_params)
 
-    print __translate(step.text)
+    print __translate(step.text + " - " + str(b))
     step.context.traversal = eval(__translate(step.text), b)
 
 
@@ -118,7 +119,7 @@ def __convert(val, ctx):
         return ctx.lookup_e["modern"][val[2:-1]]
     elif isinstance(val, str) and re.match("^m\[.*\]$", val):         # parse json as a map
         return __convert(json.loads(val[2:-1]), ctx)
-    elif isinstance(val, str) and re.match("^c\[.*\]$", val):         # parse lambda
+    elif isinstance(val, str) and re.match("^c\[.*\]$", val):         # parse lambda/closure
         return lambda: (val[2:-1], "gremlin-groovy")
     else:
         return val
@@ -145,6 +146,7 @@ def __table_assertion(data, result, ctx, ordered):
 
 def __translate(traversal):
     replaced = traversal.replace("\n", "")
+    replaced = regex_and.sub(r"\1and_(", replaced)
     replaced = regex_as.sub(r"\1as_(", replaced)
     replaced = regex_is.sub(r"\1is_(", replaced)
     return regex_in.sub(r"\1in_(", replaced)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6bb5c099/gremlin-test/features/branch/Choose.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/branch/Choose.feature b/gremlin-test/features/branch/Choose.feature
new file mode 100644
index 0000000..de70485
--- /dev/null
+++ b/gremlin-test/features/branch/Choose.feature
@@ -0,0 +1,118 @@
+# 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 - choose()
+
+  Scenario: g_V_chooseXout_countX_optionX2L__nameX_optionX3L__valueMapX
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().choose(__.out().count()).
+        option(2L, __.values("name")).
+        option(3L, __.valueMap())
+      """
+    When iterated to list
+    Then the result should be unordered
+      | m[{"name":["marko"], "age":[29]}] |
+      | josh |
+
+  Scenario: g_V_chooseXlabel_eqXpersonX__outXknowsX__inXcreatedXX_name
+    Given the modern graph
+    And using the parameter l1 is "c[it.label() == 'person']"
+    And the traversal of
+      """
+      g.V().choose(l1, __.out("knows"), __.in("created")).values("name")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | josh |
+      | vadas |
+      | josh |
+      | josh |
+      | marko |
+      | peter |
+
+  Scenario: g_V_chooseXhasLabelXpersonX_and_outXcreatedX__outXknowsX__identityX_name
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().choose(__.hasLabel("person").and().out("created"),
+                   __.out("knows"),
+                   __.identity()).
+        values("name")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | lop |
+      | ripple |
+      | josh |
+      | vadas |
+      | vadas |
+
+  Scenario: g_V_chooseXlabelX_optionXblah__outXknowsXX_optionXbleep__outXcreatedXX_optionXnone__identityX_name
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().choose(__.label()).
+             option("blah", __.out("knows")).
+             option("bleep", __.out("created")).
+             option(Pick.none, __.identity()).
+        values("name")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | marko |
+      | vadas |
+      | peter |
+      | josh |
+      | lop |
+      | ripple |
+
+  Scenario: g_V_chooseXoutXknowsX_count_isXgtX0XX__outXknowsXX_name
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().choose(__.out("knows").count().is(P.gt(0)),
+                   __.out("knows")).
+        values("name")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | vadas |
+      | josh |
+      | vadas |
+      | josh |
+      | peter |
+      | lop  |
+      | ripple |
+
+  Scenario: g_V_hasLabelXpersonX_asXp1X_chooseXoutEXknowsX__outXknowsXX_asXp2X_selectXp1_p2X_byXnameX
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().hasLabel("person").as("p1").
+        choose(__.outE("knows"), __.out("knows")).as("p2").
+        select("p1", "p2").
+          by("name")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | m[{"p1":"marko", "p2":"vadas"}] |
+      | m[{"p1":"marko", "p2":"josh"}] |
+      | m[{"p1":"vadas", "p2":"vadas"}] |
+      | m[{"p1":"josh", "p2":"josh"}] |
+      | m[{"p1":"peter", "p2":"peter"}] |

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6bb5c099/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 be01613..4ee540e 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
@@ -19,6 +19,7 @@
 package org.apache.tinkerpop.gremlin.process;
 
 import org.apache.tinkerpop.gremlin.process.traversal.step.branch.BranchTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.branch.ChooseTest;
 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.VertexTest;
@@ -58,6 +59,7 @@ public class FeatureCoverageTest {
         // TEMPORARY while test framework is under development - all tests should ultimately be included
         final List<Class<?>> temp = Arrays.asList(
                 BranchTest.class,
+                ChooseTest.class,
                 CoinTest.class,
                 CountTest.class,
                 GroupCountTest.class,


[37/47] tinkerpop git commit: TINKERPOP-1784 Added edge assertion support

Posted by sp...@apache.org.
TINKERPOP-1784 Added edge assertion support


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

Branch: refs/heads/TINKERPOP-1784
Commit: fb3fc7fe62f1904c310d7de2243447a6aab4ab71
Parents: 672faea
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Sep 27 16:18:14 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Oct 16 11:19:30 2017 -0400

----------------------------------------------------------------------
 .../src/main/jython/radish/feature_steps.py     |  28 +++--
 .../src/main/jython/radish/terrain.py           |  29 ++++-
 gremlin-test/features/map/Vertex.feature        | 111 +++++++++++++++++++
 3 files changed, 160 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/fb3fc7fe/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 989e781..2154536 100644
--- a/gremlin-python/src/main/jython/radish/feature_steps.py
+++ b/gremlin-python/src/main/jython/radish/feature_steps.py
@@ -28,6 +28,7 @@ from hamcrest import *
 regex_as = re.compile(r"\.as\(")
 regex_in = re.compile(r"\.in\(")
 
+
 @given("the {graph_name:w} graph")
 def choose_graph(step, graph_name):
     # only have modern atm but graphName would be used to select the right one
@@ -75,17 +76,23 @@ def assert_result(step, characterized_as):
 
 
 def __convert(val, ctx):
-    if isinstance(val, dict):
+    if isinstance(val, dict):                                                    # convert dictionary keys/values
         n = {}
         for key, value in val.items():
             n[__convert(key, ctx)] = __convert(value, ctx)
         return n
-    elif isinstance(val, (str, unicode)) and re.match("^d\[.*\]$", val):
+    elif isinstance(val, (str, unicode)) and re.match("^l\[.*\]$", val):         # parse list
+        return list(map((lambda x: __convert(x, ctx)), val[2:-1].split(",")))
+    elif isinstance(val, (str, unicode)) and re.match("^d\[.*\]$", val):         # parse numeric
         return long(val[2:-1])
-    elif isinstance(val, (str, unicode)) and re.match("^v\[.*\]\.id$", val):
-        return ctx.lookup["modern"][val[2:-4]].id
-    elif isinstance(val, (str, unicode)) and re.match("^v\[.*\]$", val):
-        return ctx.lookup["modern"][val[2:-1]]
+    elif isinstance(val, (str, unicode)) and re.match("^v\[.*\]\.id$", val):     # parse vertex id
+        return ctx.lookup_v["modern"][val[2:-4]].id
+    elif isinstance(val, (str, unicode)) and re.match("^v\[.*\]$", val):         # parse vertex
+        return ctx.lookup_v["modern"][val[2:-1]]
+    elif isinstance(val, (str, unicode)) and re.match("^e\[.*\]\.id$", val):     # parse edge id
+        return ctx.lookup_e["modern"][val[2:-4]].id
+    elif isinstance(val, (str, unicode)) and re.match("^e\[.*\]$", val):         # parse edge
+        return ctx.lookup_e["modern"][val[2:-1]]
     elif isinstance(val, unicode):
         return val.encode('utf-8')
     else:
@@ -108,6 +115,8 @@ def __ordered_assertion(step):
             assert_that(str(step.context.result[ix]), equal_to(str(line[1])))
         elif line[0] == "vertex":
             assert_that(step.context.result[ix].label, equal_to(line[1]))
+        elif line[0] == "edge":
+            assert_that(step.context.result[ix].label, equal_to(line[1]))
         elif line[0] == "map":
             assert_that(__convert(step.context.result[ix], step.context), json.loads(line[1]))
         else:
@@ -135,9 +144,14 @@ def __unordered_assertion(step):
             results_to_test.remove(val)
         elif line[0] == "vertex":
             val = str(line[1])
-            v = step.context.lookup["modern"][val]
+            v = step.context.lookup_v["modern"][val]
             assert_that(v, is_in(results_to_test))
             results_to_test.remove(v)
+        elif line[0] == "edge":
+            val = str(line[1])
+            e = step.context.lookup_e["modern"][val]
+            assert_that(e, is_in(results_to_test))
+            results_to_test.remove(e)
         elif line[0] == "map":
             val = __convert(json.loads(line[1]), step.context)
             assert_that(val, is_in(results_to_test))

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/fb3fc7fe/gremlin-python/src/main/jython/radish/terrain.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/radish/terrain.py b/gremlin-python/src/main/jython/radish/terrain.py
index 59ec8d0..303f64d 100644
--- a/gremlin-python/src/main/jython/radish/terrain.py
+++ b/gremlin-python/src/main/jython/radish/terrain.py
@@ -17,11 +17,18 @@ specific language governing permissions and limitations
 under the License.
 '''
 
+import re
 from gremlin_python.structure.graph import Graph
 from gremlin_python.process.graph_traversal import __
 from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection
 from radish import before, after
 
+outV = __.outV
+label = __.label
+inV = __.inV
+project = __.project
+tail = __.tail
+
 
 @before.each_scenario
 def prepare_traversal_source(scenario):
@@ -30,7 +37,27 @@ def prepare_traversal_source(scenario):
     g = Graph().traversal().withRemote(remote)
 
     # hold a map of name/vertex for use in asserting results
-    scenario.context.lookup = {"modern": g.V().group().by('name').by(__.tail()).next()}
+    scenario.context.lookup_v = {"modern": g.V().group().by('name').by(tail()).next()}
+
+    # hold a map of the "name"/edge for use in asserting results - "name" in this context is in the form of
+    # outgoingV-label->incomingV
+    projection_of_edges = g.E().group().\
+        by(project("o", "l", "i").
+           by(outV().values("name")).
+           by(label()).
+           by(inV().values("name"))).\
+        by(tail()).next()
+    edges = {}
+
+    # in GraphSON 3.0 the "key" will be a dictionary and this can work more nicely - right now it's stuck as
+    # a string and has to be parsed
+    for key, value in projection_of_edges.items():
+        o = re.search("o=(.+?)[,\}]", key).group(1)
+        l = re.search("l=(.+?)[,\}]", key).group(1)
+        i = re.search("i=(.+?)[,\}]", key).group(1)
+        edges[o + "-" + l + "->" + i] = value
+
+    scenario.context.lookup_e = {"modern": edges}
 
 
 @after.each_scenario

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/fb3fc7fe/gremlin-test/features/map/Vertex.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/map/Vertex.feature b/gremlin-test/features/map/Vertex.feature
new file mode 100644
index 0000000..fbd4168
--- /dev/null
+++ b/gremlin-test/features/map/Vertex.feature
@@ -0,0 +1,111 @@
+# 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 - V(), E(), out(), in(), both(), inE(), outE(), bothE()
+
+  Scenario: g_VXlistX1_2_3XX_name
+    Given the modern graph
+    And using the parameter vx is "l[v[marko],v[vadas],v[lop]]"
+    And the traversal of
+      """
+      g.V(vx).values("name")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | string | marko |
+      | string | vadas |
+      | string | lop |
+
+  Scenario: g_VXlistXv1_v2_v3XX_name
+    Given the modern graph
+    And using the parameter vx is "l[v[marko].id,v[vadas].id,v[lop].id]"
+    And the traversal of
+      """
+      g.V(vx).values("name")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | string | marko |
+      | string | vadas |
+      | string | lop |
+
+  Scenario: g_V
+    Given the modern graph
+    And the traversal of
+      """
+      g.V()
+      """
+    When iterated to list
+    Then the result should be unordered
+      | vertex | marko |
+      | vertex | vadas |
+      | vertex | lop |
+      | vertex | josh |
+      | vertex | ripple |
+      | vertex | peter |
+
+  Scenario: g_VX1X_out
+    Given the modern graph
+    And using the parameter v1 is "v[marko]"
+    And the traversal of
+      """
+      g.V(v1).out()
+      """
+    When iterated to list
+    Then the result should be unordered
+      | vertex | vadas |
+      | vertex | lop |
+      | vertex | josh |
+
+  Scenario: g_VX2X_in
+    Given the modern graph
+    And using the parameter v1 is "v[vadas]"
+    And the traversal of
+      """
+      g.V(v1).in()
+      """
+    When iterated to list
+    Then the result should be unordered
+      | vertex | marko |
+
+  Scenario: g_VX4X_both
+    Given the modern graph
+    And using the parameter v1 is "v[josh]"
+    And the traversal of
+      """
+      g.V(v1).both()
+      """
+    When iterated to list
+    Then the result should be unordered
+      | vertex | marko |
+      | vertex | lop |
+      | vertex | ripple |
+
+  Scenario: g_E
+    Given the modern graph
+    And the traversal of
+      """
+      g.E()
+      """
+    When iterated to list
+    Then the result should be unordered
+      | edge | marko-created->lop |
+      | edge | marko-knows->josh |
+      | edge | marko-knows->vadas |
+      | edge | peter-created->lop |
+      | edge | josh-created->lop |
+      | edge | josh-created->ripple |
\ No newline at end of file


[20/47] tinkerpop git commit: TINKERPOP-1784 Use python eval() to setup test traversals

Posted by sp...@apache.org.
TINKERPOP-1784 Use python eval() to setup test traversals


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

Branch: refs/heads/TINKERPOP-1784
Commit: b835a6093c900030de23bdbfd088a22fcc5a8050
Parents: f4e4d55
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Sep 20 13:32:54 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Oct 16 11:19:29 2017 -0400

----------------------------------------------------------------------
 .../src/main/jython/radish/count_features_step.py        | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b835a609/gremlin-python/src/main/jython/radish/count_features_step.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/radish/count_features_step.py b/gremlin-python/src/main/jython/radish/count_features_step.py
index 324c29c..ec04551 100644
--- a/gremlin-python/src/main/jython/radish/count_features_step.py
+++ b/gremlin-python/src/main/jython/radish/count_features_step.py
@@ -34,16 +34,7 @@ def choose_graph(step, graphName):
 @given("the traversal of")
 def translate_traversal(step):
     g = step.context.g
-    if step.text == "g.V().count()":
-        step.context.traversal = g.V().count()
-    elif step.text == "g.V().both().both().count()":
-        step.context.traversal = g.V().both().both().count()
-    elif step.text == "g.V().fold().count(Scope.local)":
-        step.context.traversal = g.V().fold().count(Scope.local)
-    elif step.text == "g.V().has(\"no\").count()":
-        step.context.traversal = g.V().has("no").count()
-    else:
-        raise ValueError("Gremlin translation to python not found - missing: " + step.text)
+    step.context.traversal = eval(step.text, {"g": g, "Scope": Scope})
 
 
 @when("iterating")


[32/47] tinkerpop git commit: TINKERPOP-1784 Add all tests for groupCount()

Posted by sp...@apache.org.
TINKERPOP-1784 Add all tests for groupCount()


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

Branch: refs/heads/TINKERPOP-1784
Commit: 2e604d5fdef0c7bd4d13637a535b4bebdf22ca5b
Parents: 012c7c7
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Oct 3 15:48:49 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Oct 16 11:19:30 2017 -0400

----------------------------------------------------------------------
 .../src/main/jython/radish/feature_steps.py     |   8 +-
 .../features/sideEffect/GroupCount.feature      | 100 +++++++++++++++++++
 2 files changed, 106 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2e604d5f/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 11cc86e..16120f6 100644
--- a/gremlin-python/src/main/jython/radish/feature_steps.py
+++ b/gremlin-python/src/main/jython/radish/feature_steps.py
@@ -21,7 +21,7 @@ import json
 import re
 from gremlin_python.structure.graph import Graph
 from gremlin_python.process.graph_traversal import __
-from gremlin_python.process.traversal import P, Scope, Column, Direction
+from gremlin_python.process.traversal import P, Scope, Column, Direction, T
 from radish import given, when, then
 from hamcrest import *
 
@@ -54,13 +54,17 @@ def add_parameter(step, param_name, param):
 def translate_traversal(step):
     g = step.context.g
     b = {"g": g,
+         "__": __,
          "Column": Column,
          "Direction": Direction,
          "P": P,
+         "gt": P.gt,
          "Scope": Scope,
+         "T": T,
          "bothE": __.bothE,
          "in_": __.in_,
-         "out": __.out}
+         "out": __.out,
+         "repeat": __.repeat}
 
     if hasattr(step.context, "traversal_params"):
         b.update(step.context.traversal_params)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2e604d5f/gremlin-test/features/sideEffect/GroupCount.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/sideEffect/GroupCount.feature b/gremlin-test/features/sideEffect/GroupCount.feature
index 3fb363e..b767001 100644
--- a/gremlin-test/features/sideEffect/GroupCount.feature
+++ b/gremlin-test/features/sideEffect/GroupCount.feature
@@ -37,6 +37,106 @@ Feature: Step - groupCount()
     Then the result should be ordered
       | m[{"ripple": 1, "lop": 3}] |
 
+  Scenario: g_V_outXcreatedX_groupCountXaX_byXnameX_capXaX
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().out("created").groupCount("a").by("name").cap("a")
+      """
+    When iterated to list
+    Then the result should be ordered
+      | m[{"ripple": 1, "lop": 3}] |
+
+  Scenario: g_V_outXcreatedX_name_groupCountXaX_capXaX
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().out("created").values("name").groupCount("a").cap("a")
+      """
+    When iterated to list
+    Then the result should be ordered
+      | m[{"ripple": 1, "lop": 3}] |
+
+  Scenario: g_V_repeatXout_groupCountXaX_byXnameXX_timesX2X_capXaX
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().repeat(out().groupCount("a").by("name")).times(2).cap("a")
+      """
+    When iterated to list
+    Then the result should be ordered
+      | m[{"ripple":2, "lop": 4, "josh": 1, "vadas": 1}] |
+
+  Scenario: g_V_both_groupCountXaX_byXlabelX_asXbX_barrier_whereXselectXaX_selectXsoftwareX_isXgtX2XXX_selectXbX_name
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().both().groupCount("a").by(T.label).as("b").barrier().where(__.select("a").select("software").is(gt(2))).select("b").values("name")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | lop |
+      | lop |
+      | lop |
+      | peter |
+      | marko |
+      | marko |
+      | marko |
+      | ripple |
+      | vadas |
+      | josh |
+      | josh |
+      | josh |
+
+  Scenario: g_V_unionXoutXknowsX__outXcreatedX_inXcreatedXX_groupCount_selectXvaluesX_unfold_sum
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().union(out("knows"), out("created").in("created")).groupCount().select(Column.values).unfold().sum()
+      """
+    When iterated to list
+    Then the result should be ordered
+      | d[12] |
+
+  Scenario: g_V_hasXnoX_groupCount
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().has("no").groupCount()
+      """
+    When iterated to list
+    Then the result should be ordered
+      | m[{}] |
+
+  Scenario: g_V_hasXnoX_groupCountXaX_capXaX
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().has("no").groupCount("a").cap("a")
+      """
+    When iterated to list
+    Then the result should be ordered
+      | m[{}] |
+
+  Scenario: g_V_unionXrepeatXoutX_timesX2X_groupCountXmX_byXlangXX__repeatXinX_timesX2X_groupCountXmX_byXnameXX_capXmX
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().union(repeat(out()).times(2).groupCount("m").by("lang"),repeat(in()).times(2).groupCount("m").by("name")).cap("m")
+      """
+    When iterated to list
+    Then the result should be ordered
+      | m[{"marko": 2, "java": 2}] |
+
+  Scenario: g_V_outXcreatedX_groupCountXxX_capXxX
+    Given an unsupported test
+    Then nothing should happen because
+      """
+      The result returned is not supported under GraphSON 2.x and therefore cannot be properly asserted. More
+      specifically it has vertex keys which basically get toString()'d under GraphSON 2.x. This test can be supported
+      with GraphSON 3.x.
+      """
+
   Scenario: g_V_groupCount_byXbothE_countX
     Given an unsupported test
     Then nothing should happen because


[08/47] tinkerpop git commit: TINKERPOP-1650 * Updated setKeepLabels calls to make defensive copies of their input to avoid corruption. * Added a new test to PathRetractionStrategyTest for WhereStep.

Posted by sp...@apache.org.
TINKERPOP-1650
* Updated setKeepLabels calls to make defensive copies of their input to avoid corruption.
* Added a new test to PathRetractionStrategyTest for WhereStep.


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

Branch: refs/heads/TINKERPOP-1784
Commit: 73a982c7c13bc00893f34c65beec6419a56c76bc
Parents: a278edd
Author: Ted Wilmes <tw...@gmail.com>
Authored: Tue Oct 10 13:46:13 2017 -0500
Committer: Ted Wilmes <tw...@gmail.com>
Committed: Tue Oct 10 13:46:13 2017 -0500

----------------------------------------------------------------------
 CHANGELOG.asciidoc                                            | 1 +
 .../gremlin/process/traversal/step/PathProcessor.java         | 2 +-
 .../process/traversal/step/filter/DedupGlobalStep.java        | 4 ++--
 .../gremlin/process/traversal/step/filter/PathFilterStep.java | 5 +++--
 .../process/traversal/step/filter/WherePredicateStep.java     | 4 ++--
 .../process/traversal/step/filter/WhereTraversalStep.java     | 2 +-
 .../gremlin/process/traversal/step/map/MatchStep.java         | 4 ++--
 .../gremlin/process/traversal/step/map/PathStep.java          | 5 +++--
 .../gremlin/process/traversal/step/map/SelectOneStep.java     | 5 +++--
 .../gremlin/process/traversal/step/map/SelectStep.java        | 4 ++--
 .../gremlin/process/traversal/step/map/TreeStep.java          | 5 +++--
 .../process/traversal/step/sideEffect/TreeSideEffectStep.java | 5 +++--
 .../strategy/optimization/PathRetractionStrategy.java         | 7 ++++---
 .../strategy/optimization/PathRetractionStrategyTest.java     | 6 +++++-
 14 files changed, 35 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/73a982c7/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index ec54cc2..2f6069d 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -43,6 +43,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 * Fixed a bug in `Neo4jGremlinPlugin` that prevented it from loading properly in the `GremlinPythonScriptEngine`.
 * Fixed a bug in `ComputerVerificationStrategy` where child traversals were being analyzed prior to compilation.
 * Fixed a bug that prevented Gremlin from ordering lists and streams made of mixed number types.
+* Fixed a bug where `keepLabels` were being corrupted because a defensive copy was not being made when they were being set by `PathRetractionStrategy`. 
 
 [[release-3-2-6]]
 === TinkerPop 3.2.6 (Release Date: August 21, 2017)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/73a982c7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/PathProcessor.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/PathProcessor.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/PathProcessor.java
index 0c8ed47..8a5843a 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/PathProcessor.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/PathProcessor.java
@@ -60,7 +60,7 @@ public interface PathProcessor {
         return max;
     }
 
-    public void setKeepLabels(final Set<String> labels);
+    public void setKeepLabels(final Set<String> keepLabels);
 
     public Set<String> getKeepLabels();
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/73a982c7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/DedupGlobalStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/DedupGlobalStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/DedupGlobalStep.java
index 96bd0be..b4f70d9 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/DedupGlobalStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/DedupGlobalStep.java
@@ -223,8 +223,8 @@ public final class DedupGlobalStep<S> extends FilterStep<S> implements Traversal
     }
 
     @Override
-    public void setKeepLabels(Set<String> labels) {
-        this.keepLabels = labels;
+    public void setKeepLabels(Set<String> keepLabels) {
+        this.keepLabels = new HashSet<>(keepLabels);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/73a982c7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/PathFilterStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/PathFilterStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/PathFilterStep.java
index 4fe5953..16e3f0f 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/PathFilterStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/PathFilterStep.java
@@ -33,6 +33,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalUtil;
 import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
 
 import java.util.Collections;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
@@ -123,8 +124,8 @@ public final class PathFilterStep<S> extends FilterStep<S> implements FromToModu
     }
 
     @Override
-    public void setKeepLabels(final Set<String> labels) {
-        this.keepLabels = labels;
+    public void setKeepLabels(final Set<String> keepLabels) {
+        this.keepLabels = new HashSet<>(keepLabels);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/73a982c7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WherePredicateStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WherePredicateStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WherePredicateStep.java
index 1b248af..240a4cc 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WherePredicateStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WherePredicateStep.java
@@ -151,8 +151,8 @@ public final class WherePredicateStep<S> extends FilterStep<S> implements Scopin
     }
 
     @Override
-    public void setKeepLabels(final Set<String> labels) {
-        this.keepLabels = labels;
+    public void setKeepLabels(final Set<String> keepLabels) {
+        this.keepLabels = new HashSet<>(keepLabels);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/73a982c7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WhereTraversalStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WhereTraversalStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WhereTraversalStep.java
index 476ce11..384bbce 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WhereTraversalStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WhereTraversalStep.java
@@ -139,7 +139,7 @@ public final class WhereTraversalStep<S> extends FilterStep<S> implements Traver
 
     @Override
     public void setKeepLabels(final Set<String> keepLabels) {
-        this.keepLabels = keepLabels;
+        this.keepLabels = new HashSet<>(keepLabels);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/73a982c7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/MatchStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/MatchStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/MatchStep.java
index 039c1c7..8e2207a 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/MatchStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/MatchStep.java
@@ -183,8 +183,8 @@ public final class MatchStep<S, E> extends ComputerAwareStep<S, Map<String, E>>
     }
 
     @Override
-    public void setKeepLabels(final Set<String> labels) {
-        this.keepLabels = new HashSet<>(labels);
+    public void setKeepLabels(final Set<String> keepLabels) {
+        this.keepLabels = new HashSet<>(keepLabels);
         if (null != this.dedupLabels)
             this.keepLabels.addAll(this.dedupLabels);
     }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/73a982c7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PathStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PathStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PathStep.java
index 2c96261..b49a1e4 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PathStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PathStep.java
@@ -31,6 +31,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalRing;
 import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalUtil;
 import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
 
+import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
@@ -108,8 +109,8 @@ public final class PathStep<S> extends MapStep<S, Path> implements TraversalPare
     }
 
     @Override
-    public void setKeepLabels(final Set<String> labels) {
-        this.keepLabels = labels;
+    public void setKeepLabels(final Set<String> keepLabels) {
+        this.keepLabels = new HashSet<>(keepLabels);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/73a982c7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectOneStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectOneStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectOneStep.java
index 34b8148..eb6f7c6 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectOneStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectOneStep.java
@@ -31,6 +31,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalUtil;
 import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
 
 import java.util.Collections;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
@@ -116,8 +117,8 @@ public final class SelectOneStep<S, E> extends MapStep<S, E> implements Traversa
     }
 
     @Override
-    public void setKeepLabels(final Set<String> labels) {
-        this.keepLabels = labels;
+    public void setKeepLabels(final Set<String> keepLabels) {
+        this.keepLabels = new HashSet<>(keepLabels);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/73a982c7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectStep.java
index 167fa47..875cf93 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectStep.java
@@ -142,8 +142,8 @@ public final class SelectStep<S, E> extends MapStep<S, Map<String, E>> implement
     }
 
     @Override
-    public void setKeepLabels(final Set<String> labels) {
-        this.keepLabels = labels;
+    public void setKeepLabels(final Set<String> keepLabels) {
+        this.keepLabels = new HashSet<>(keepLabels);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/73a982c7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/TreeStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/TreeStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/TreeStep.java
index ac1fa07..41310aa 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/TreeStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/TreeStep.java
@@ -33,6 +33,7 @@ import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
 import org.apache.tinkerpop.gremlin.util.function.TreeSupplier;
 
 import java.io.Serializable;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 import java.util.function.BinaryOperator;
@@ -113,8 +114,8 @@ public final class TreeStep<S> extends ReducingBarrierStep<S, Tree> implements T
     }
 
     @Override
-    public void setKeepLabels(final Set<String> labels) {
-        this.keepLabels = labels;
+    public void setKeepLabels(final Set<String> keepLabels) {
+        this.keepLabels = new HashSet<>(keepLabels);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/73a982c7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/TreeSideEffectStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/TreeSideEffectStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/TreeSideEffectStep.java
index 15756d2..2d43ddc 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/TreeSideEffectStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/TreeSideEffectStep.java
@@ -33,6 +33,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalUtil;
 import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
 import org.apache.tinkerpop.gremlin.util.function.TreeSupplier;
 
+import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 import java.util.function.Supplier;
@@ -123,8 +124,8 @@ public final class TreeSideEffectStep<S> extends SideEffectStep<S> implements Si
     }
 
     @Override
-    public void setKeepLabels(final Set<String> labels) {
-        this.keepLabels = labels;
+    public void setKeepLabels(final Set<String> keepLabels) {
+        this.keepLabels = new HashSet<>(keepLabels);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/73a982c7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/PathRetractionStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/PathRetractionStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/PathRetractionStrategy.java
index 304161e..a079a1c 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/PathRetractionStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/PathRetractionStrategy.java
@@ -120,7 +120,7 @@ public final class PathRetractionStrategy extends AbstractTraversalStrategy<Trav
                     pathProcessor.getKeepLabels().addAll(((MatchStep) currentStep).getMatchEndLabels());
                 } else {
                     if (pathProcessor.getKeepLabels() == null)
-                        pathProcessor.setKeepLabels(new HashSet<>(keepLabels));
+                        pathProcessor.setKeepLabels(keepLabels);
                     else
                         pathProcessor.getKeepLabels().addAll(new HashSet<>(keepLabels));
                 }
@@ -242,10 +242,11 @@ public final class PathRetractionStrategy extends AbstractTraversalStrategy<Trav
     }
 
     private void addLabels(final PathProcessor s, final Set<String> keepLabels) {
+        final Set<String> labelsCopy = new HashSet<>(keepLabels);
         if (null == s.getKeepLabels())
-            s.setKeepLabels(new HashSet<>(keepLabels));
+            s.setKeepLabels(labelsCopy);
         else
-            s.getKeepLabels().addAll(new HashSet<>(keepLabels));
+            s.getKeepLabels().addAll(labelsCopy);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/73a982c7/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/PathRetractionStrategyTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/PathRetractionStrategyTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/PathRetractionStrategyTest.java
index f42a914..67264ae 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/PathRetractionStrategyTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/PathRetractionStrategyTest.java
@@ -31,6 +31,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.step.TraversalParent;
 import org.apache.tinkerpop.gremlin.process.traversal.traverser.TraverserRequirement;
 import org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversalStrategies;
 
+import org.apache.tinkerpop.gremlin.structure.T;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
@@ -210,7 +211,10 @@ public class PathRetractionStrategyTest {
                         "[[[a, b]], [[a, b]], [[a, b]], [[[a, b]]], [[a, b]]]", null},
                 {__.V().as("a").out().where(neq("a")).program(labeledPathVertexProgram), PATH_RETRACTION_STRATEGY_DISABLED, null},
                 {__.V().as("a").out().where(neq("a")).program(pathVertexProgram).select("a"), PATH_RETRACTION_STRATEGY_DISABLED, null},
-                {__.V().as("a").out().program(emptyRequirementsVertexProgram).select("a"), "[[]]", null}
+                {__.V().as("a").out().program(emptyRequirementsVertexProgram).select("a"), "[[]]", null},
+                {__.V().as("a").out().as("b").where(__.as("b").in().count().is(eq(3)).or().where(
+                        __.as("b").out("created").and().as("b").has(T.label, "person"))).select("a", "b"),
+                        "[[a, b], [[[a, b]]], []]", null}
         });
     }
 }
\ No newline at end of file


[03/47] tinkerpop git commit: add three missing config

Posted by sp...@apache.org.
add three missing config

1. keyCertChainFile
2. keyFile
3. keyPassword


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

Branch: refs/heads/TINKERPOP-1784
Commit: 3cdaaea5ee192b1875dd86217f864d30df287243
Parents: 7b0bd95
Author: Ranger Tsao <ca...@gmail.com>
Authored: Tue Oct 3 22:44:12 2017 +0800
Committer: Ranger Tsao <ca...@gmail.com>
Committed: Tue Oct 3 22:44:12 2017 +0800

----------------------------------------------------------------------
 .../org/apache/tinkerpop/gremlin/driver/Settings.java     |  9 +++++++++
 .../org/apache/tinkerpop/gremlin/driver/SettingsTest.java | 10 ++++++++--
 2 files changed, 17 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3cdaaea5/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Settings.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Settings.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Settings.java
index 41a697c..8a2517d 100644
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Settings.java
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Settings.java
@@ -169,6 +169,15 @@ final class Settings {
             if (connectionPoolConf.containsKey("enableSsl"))
                 cpSettings.enableSsl = connectionPoolConf.getBoolean("enableSsl");
 
+            if (connectionPoolConf.containsKey("keyCertChainFile"))
+                cpSettings.keyCertChainFile = connectionPoolConf.getString("keyCertChainFile");
+
+            if (connectionPoolConf.containsKey("keyFile"))
+                cpSettings.keyFile = connectionPoolConf.getString("keyFile");
+
+            if (connectionPoolConf.containsKey("keyPassword"))
+                cpSettings.keyPassword = connectionPoolConf.getString("keyPassword");
+
             if (connectionPoolConf.containsKey("trustCertChainFile"))
                 cpSettings.trustCertChainFile = connectionPoolConf.getString("trustCertChainFile");
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3cdaaea5/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/SettingsTest.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/SettingsTest.java b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/SettingsTest.java
index a6a2298..c373879 100644
--- a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/SettingsTest.java
+++ b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/SettingsTest.java
@@ -18,14 +18,14 @@
  */
 package org.apache.tinkerpop.gremlin.driver;
 
+import static org.junit.Assert.assertEquals;
+
 import org.apache.commons.configuration.BaseConfiguration;
 import org.apache.commons.configuration.Configuration;
 import org.junit.Test;
 
 import java.util.Arrays;
 
-import static org.junit.Assert.assertEquals;
-
 /**
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
@@ -45,6 +45,9 @@ public class SettingsTest {
         conf.setProperty("serializer.className", "my.serializers.MySerializer");
         conf.setProperty("serializer.config.any", "thing");
         conf.setProperty("connectionPool.enableSsl", true);
+        conf.setProperty("connectionPool.keyCertChainFile", "X.509");
+        conf.setProperty("connectionPool.keyFile", "PKCS#8");
+        conf.setProperty("connectionPool.keyPassword", "password1");
         conf.setProperty("connectionPool.trustCertChainFile", "pem");
         conf.setProperty("connectionPool.minSize", 100);
         conf.setProperty("connectionPool.maxSize", 200);
@@ -71,6 +74,9 @@ public class SettingsTest {
         assertEquals("my.serializers.MySerializer", settings.serializer.className);
         assertEquals("thing", settings.serializer.config.get("any"));
         assertEquals(true, settings.connectionPool.enableSsl);
+        assertEquals("X.509", settings.connectionPool.keyCertChainFile);
+        assertEquals("PKCS#8", settings.connectionPool.keyFile);
+        assertEquals("password1", settings.connectionPool.keyPassword);
         assertEquals("pem", settings.connectionPool.trustCertChainFile);
         assertEquals(100, settings.connectionPool.minSize);
         assertEquals(200, settings.connectionPool.maxSize);


[04/47] tinkerpop git commit: Do not strong-freeze dependencies

Posted by sp...@apache.org.
Do not strong-freeze dependencies


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

Branch: refs/heads/TINKERPOP-1784
Commit: 64479b3a6c70a006a3493153525c22e271a34b53
Parents: 9f501cd
Author: Alan Boudreault <al...@alanb.ca>
Authored: Tue Oct 3 14:12:48 2017 -0400
Committer: Alan Boudreault <al...@alanb.ca>
Committed: Tue Oct 3 14:12:48 2017 -0400

----------------------------------------------------------------------
 gremlin-python/src/main/jython/setup.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/64479b3a/gremlin-python/src/main/jython/setup.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/setup.py b/gremlin-python/src/main/jython/setup.py
index e6ab493..1804a0d 100644
--- a/gremlin-python/src/main/jython/setup.py
+++ b/gremlin-python/src/main/jython/setup.py
@@ -45,13 +45,13 @@ from gremlin_python import __version__
 version = __version__.version
 
 install_requires = [
-    'aenum==1.4.5',
-    'tornado==4.4.1',
-    'six==1.10.0'
+    'aenum>=1.4.5',
+    'tornado>=4.4.1',
+    'six>=1.10.0'
 ]
 
 if sys.version_info < (3,2):
-    install_requires += ['futures==3.0.5']
+    install_requires += ['futures>=3.0.5']
 
 setup(
     name='gremlinpython',


[09/47] tinkerpop git commit: Merge branch 'TINKERPOP-1650' into tp32

Posted by sp...@apache.org.
Merge branch 'TINKERPOP-1650' into tp32


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

Branch: refs/heads/TINKERPOP-1784
Commit: 1fa01ef7014b6f2b3044ee6fc673e18d318acb09
Parents: dd48dcc 73a982c
Author: Ted Wilmes <tw...@gmail.com>
Authored: Wed Oct 11 14:19:16 2017 -0500
Committer: Ted Wilmes <tw...@gmail.com>
Committed: Wed Oct 11 14:19:16 2017 -0500

----------------------------------------------------------------------
 CHANGELOG.asciidoc                                            | 1 +
 .../gremlin/process/traversal/step/PathProcessor.java         | 2 +-
 .../process/traversal/step/filter/DedupGlobalStep.java        | 4 ++--
 .../gremlin/process/traversal/step/filter/PathFilterStep.java | 5 +++--
 .../process/traversal/step/filter/WherePredicateStep.java     | 4 ++--
 .../process/traversal/step/filter/WhereTraversalStep.java     | 2 +-
 .../gremlin/process/traversal/step/map/MatchStep.java         | 4 ++--
 .../gremlin/process/traversal/step/map/PathStep.java          | 5 +++--
 .../gremlin/process/traversal/step/map/SelectOneStep.java     | 5 +++--
 .../gremlin/process/traversal/step/map/SelectStep.java        | 4 ++--
 .../gremlin/process/traversal/step/map/TreeStep.java          | 5 +++--
 .../process/traversal/step/sideEffect/TreeSideEffectStep.java | 5 +++--
 .../strategy/optimization/PathRetractionStrategy.java         | 7 ++++---
 .../strategy/optimization/PathRetractionStrategyTest.java     | 6 +++++-
 14 files changed, 35 insertions(+), 24 deletions(-)
----------------------------------------------------------------------



[23/47] tinkerpop git commit: TINKERPOP-1784 Included grateful graph and cached remotes/data

Posted by sp...@apache.org.
TINKERPOP-1784 Included grateful graph and cached remotes/data

Tests should be faster now that remotes and data are cached for the toy graphs.


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

Branch: refs/heads/TINKERPOP-1784
Commit: 20de593abfe84ebef61b973c3c1d2941b16dc0c2
Parents: 9bc2edf
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Sep 29 11:54:33 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Oct 16 11:19:30 2017 -0400

----------------------------------------------------------------------
 .../src/main/jython/radish/terrain.py           | 66 +++++++++++++++-----
 1 file changed, 49 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/20de593a/gremlin-python/src/main/jython/radish/terrain.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/radish/terrain.py b/gremlin-python/src/main/jython/radish/terrain.py
index e88272b..5897852 100644
--- a/gremlin-python/src/main/jython/radish/terrain.py
+++ b/gremlin-python/src/main/jython/radish/terrain.py
@@ -21,7 +21,7 @@ import re
 from gremlin_python.structure.graph import Graph
 from gremlin_python.process.graph_traversal import __
 from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection
-from radish import before, after
+from radish import before, after, world
 
 outV = __.outV
 label = __.label
@@ -30,16 +30,38 @@ project = __.project
 tail = __.tail
 
 
-@before.each_scenario
-def prepare_traversal_source(scenario):
-    scenario.context.remote_conn = {}
-    scenario.context.lookup_v = {}
-    scenario.context.lookup_e = {}
+@before.all
+def prepare_static_traversal_source(features, marker):
+    # as the various traversal sources for testing do not change their data, there is no need to re-create remotes
+    # and client side lookup data over and over. it can be created once for all tests and be reused.
+    cache = {}
+    for graph_name in (("modern", "gmodern"), ("classic", "gclassic"), ("crew", "gcrew"), ("grateful", "ggrateful")):
+        cache[graph_name[0]] = {}
+        remote = __create_remote(graph_name[1])
+        cache[graph_name[0]]["remote_conn"] = __create_remote(graph_name[1])
+        cache[graph_name[0]]["lookup_v"] = __create_lookup_v(remote)
+        cache[graph_name[0]]["lookup_e"] = __create_lookup_e(remote)
+
+    # store the cache on the global context so that remotes can be shutdown cleanly at the end of the tests
+    world.cache = cache
+
+    # iterate each feature and apply the cached remotes/lookups to each scenario context so that they are
+    # accessible to the feature steps for test logic
+    for feature in features:
+        for scenario in feature.all_scenarios:
+            scenario.context.remote_conn = {}
+            scenario.context.lookup_v = {}
+            scenario.context.lookup_e = {}
 
-    __prepare(scenario, "modern", "gmodern")
-    __prepare(scenario, "classic", "gclassic")
-    __prepare(scenario, "crew", "gcrew")
+            for graph_name in ("modern", "classic", "crew", "grateful"):
+                scenario.context.remote_conn[graph_name] = cache[graph_name]["remote_conn"]
+                scenario.context.lookup_v[graph_name] = cache[graph_name]["lookup_v"]
+                scenario.context.lookup_e[graph_name] = cache[graph_name]["lookup_e"]
 
+
+@before.each_scenario
+def prepare_traversal_source(scenario):
+    # some tests create data - create a fresh remote to the empty graph and clear that graph prior to each test
     remote = DriverRemoteConnection('ws://localhost:45940/gremlin', "ggraph")
     scenario.context.remote_conn["empty"] = remote
     g = Graph().traversal().withRemote(remote)
@@ -48,18 +70,28 @@ def prepare_traversal_source(scenario):
 
 @after.each_scenario
 def close_traversal_source(scenario):
-    scenario.context.remote_conn["modern"].close()
-    scenario.context.remote_conn["classic"].close()
-    scenario.context.remote_conn["crew"].close()
+    scenario.context.remote_conn["empty"].close()
 
 
-def __prepare(scenario, graph_name, server_graph_name):
-    remote = DriverRemoteConnection('ws://localhost:45940/gremlin', server_graph_name)
-    scenario.context.remote_conn[graph_name] = remote
+@after.all
+def close_static_traversal_source(features, marker):
+    for key, value in world.cache.iteritems():
+        value["remote_conn"].close()
+
+
+def __create_remote(server_graph_name):
+    return DriverRemoteConnection('ws://localhost:45940/gremlin', server_graph_name)
+
+
+def __create_lookup_v(remote):
     g = Graph().traversal().withRemote(remote)
 
     # hold a map of name/vertex for use in asserting results
-    scenario.context.lookup_v[graph_name] = g.V().group().by('name').by(tail()).next()
+    return g.V().group().by('name').by(tail()).next()
+
+
+def __create_lookup_e(remote):
+    g = Graph().traversal().withRemote(remote)
 
     # hold a map of the "name"/edge for use in asserting results - "name" in this context is in the form of
     # outgoingV-label->incomingV
@@ -79,4 +111,4 @@ def __prepare(scenario, graph_name, server_graph_name):
         i = re.search("i=(.+?)[,\}]", key).group(1)
         edges[o + "-" + l + "->" + i] = value
 
-    scenario.context.lookup_e[graph_name] = edges
+    return edges


[41/47] tinkerpop git commit: TINKERPOP-1784 Add support for the various toy graphs

Posted by sp...@apache.org.
TINKERPOP-1784 Add support for the various toy graphs


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

Branch: refs/heads/TINKERPOP-1784
Commit: 9bc2edfb0f66bb3e2c6e1ac282ec30b9b0153bed
Parents: 1427506
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Sep 29 10:29:38 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Oct 16 11:19:30 2017 -0400

----------------------------------------------------------------------
 gremlin-python/pom.xml                          |  6 ++-
 .../src/main/jython/radish/feature_steps.py     |  2 +-
 .../src/main/jython/radish/terrain.py           | 39 +++++++++++++------
 .../remote/gremlin-server-integration.yaml      |  7 +---
 .../server/gremlin-server-integration.yaml      |  7 +---
 .../server/gremlin-server-performance.yaml      |  7 +---
 .../src/test/scripts/generate-all.groovy        | 40 ++++++++++++++++++++
 .../src/test/scripts/test-server-start.groovy   | 24 ++++++++++--
 .../test/scripts/tinkergraph-empty.properties   | 20 ++++++++++
 9 files changed, 117 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9bc2edfb/gremlin-python/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-python/pom.xml b/gremlin-python/pom.xml
index cabaec9..1833233 100644
--- a/gremlin-python/pom.xml
+++ b/gremlin-python/pom.xml
@@ -521,12 +521,16 @@ limitations under the License.
                                             <value>${skipTests}</value>
                                         </property>
                                         <property>
+                                            <name>python</name>
+                                            <value>true</value>
+                                        </property>
+                                        <property>
                                             <name>gremlinServerDir</name>
                                             <value>${gremlin.server.dir}</value>
                                         </property>
                                         <property>
                                             <name>settingsFile</name>
-                                            <value>${gremlin.server.dir}/conf/gremlin-server-modern-py.yaml</value>
+                                            <value>${gremlin.server.dir}/src/test/resources/org/apache/tinkerpop/gremlin/driver/remote/gremlin-server-integration.yaml</value>
                                         </property>
                                         <property>
                                             <name>executionName</name>

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9bc2edfb/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 e3b82c3..a298d6c 100644
--- a/gremlin-python/src/main/jython/radish/feature_steps.py
+++ b/gremlin-python/src/main/jython/radish/feature_steps.py
@@ -40,7 +40,7 @@ def add_parameter(step, param_name, param):
     if not hasattr(step.context, "traversal_params"):
         step.context.traversal_params = {}
 
-    step.context.traversal_params[param_name.encode('utf-8')] = __convert(param, step.context)
+    step.context.traversal_params[param_name] = __convert(param, step.context)
 
 
 @given("the traversal of")

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9bc2edfb/gremlin-python/src/main/jython/radish/terrain.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/radish/terrain.py b/gremlin-python/src/main/jython/radish/terrain.py
index 303f64d..e88272b 100644
--- a/gremlin-python/src/main/jython/radish/terrain.py
+++ b/gremlin-python/src/main/jython/radish/terrain.py
@@ -32,20 +32,42 @@ tail = __.tail
 
 @before.each_scenario
 def prepare_traversal_source(scenario):
-    remote = DriverRemoteConnection('ws://localhost:45940/gremlin', 'g')
-    scenario.context.remote_conn = {"modern": remote}
+    scenario.context.remote_conn = {}
+    scenario.context.lookup_v = {}
+    scenario.context.lookup_e = {}
+
+    __prepare(scenario, "modern", "gmodern")
+    __prepare(scenario, "classic", "gclassic")
+    __prepare(scenario, "crew", "gcrew")
+
+    remote = DriverRemoteConnection('ws://localhost:45940/gremlin', "ggraph")
+    scenario.context.remote_conn["empty"] = remote
+    g = Graph().traversal().withRemote(remote)
+    g.V().drop().iterate()
+
+
+@after.each_scenario
+def close_traversal_source(scenario):
+    scenario.context.remote_conn["modern"].close()
+    scenario.context.remote_conn["classic"].close()
+    scenario.context.remote_conn["crew"].close()
+
+
+def __prepare(scenario, graph_name, server_graph_name):
+    remote = DriverRemoteConnection('ws://localhost:45940/gremlin', server_graph_name)
+    scenario.context.remote_conn[graph_name] = remote
     g = Graph().traversal().withRemote(remote)
 
     # hold a map of name/vertex for use in asserting results
-    scenario.context.lookup_v = {"modern": g.V().group().by('name').by(tail()).next()}
+    scenario.context.lookup_v[graph_name] = g.V().group().by('name').by(tail()).next()
 
     # hold a map of the "name"/edge for use in asserting results - "name" in this context is in the form of
     # outgoingV-label->incomingV
-    projection_of_edges = g.E().group().\
+    projection_of_edges = g.E().group(). \
         by(project("o", "l", "i").
            by(outV().values("name")).
            by(label()).
-           by(inV().values("name"))).\
+           by(inV().values("name"))). \
         by(tail()).next()
     edges = {}
 
@@ -57,9 +79,4 @@ def prepare_traversal_source(scenario):
         i = re.search("i=(.+?)[,\}]", key).group(1)
         edges[o + "-" + l + "->" + i] = value
 
-    scenario.context.lookup_e = {"modern": edges}
-
-
-@after.each_scenario
-def close_traversal_source(scenario):
-    scenario.context.remote_conn["modern"].close()
+    scenario.context.lookup_e[graph_name] = edges

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9bc2edfb/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/driver/remote/gremlin-server-integration.yaml
----------------------------------------------------------------------
diff --git a/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/driver/remote/gremlin-server-integration.yaml b/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/driver/remote/gremlin-server-integration.yaml
index 96db32f..d1e7ba6 100644
--- a/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/driver/remote/gremlin-server-integration.yaml
+++ b/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/driver/remote/gremlin-server-integration.yaml
@@ -41,12 +41,7 @@ serializers:
 processors:
   - { className: org.apache.tinkerpop.gremlin.server.op.session.SessionOpProcessor, config: { sessionTimeout: 28800000 }}
 metrics: {
-  consoleReporter: {enabled: true, interval: 180000},
-  csvReporter: {enabled: true, interval: 180000, fileName: /tmp/gremlin-server-metrics.csv},
-  jmxReporter: {enabled: true},
-  slf4jReporter: {enabled: true, interval: 180000},
-  gangliaReporter: {enabled: false, interval: 180000, addressingMode: MULTICAST},
-  graphiteReporter: {enabled: false, interval: 180000}}
+  slf4jReporter: {enabled: true, interval: 180000}}
 strictTransactionManagement: false
 maxInitialLineLength: 4096
 maxHeaderSize: 8192

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9bc2edfb/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/server/gremlin-server-integration.yaml
----------------------------------------------------------------------
diff --git a/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/server/gremlin-server-integration.yaml b/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/server/gremlin-server-integration.yaml
index 18ac22e..f80c38a 100644
--- a/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/server/gremlin-server-integration.yaml
+++ b/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/server/gremlin-server-integration.yaml
@@ -37,12 +37,7 @@ serializers:
 processors:
   - { className: org.apache.tinkerpop.gremlin.server.op.session.SessionOpProcessor, config: { sessionTimeout: 28800000 }}
 metrics: {
-  consoleReporter: {enabled: true, interval: 180000},
-  csvReporter: {enabled: true, interval: 180000, fileName: /tmp/gremlin-server-metrics.csv},
-  jmxReporter: {enabled: true},
-  slf4jReporter: {enabled: true, interval: 180000},
-  gangliaReporter: {enabled: false, interval: 180000, addressingMode: MULTICAST},
-  graphiteReporter: {enabled: false, interval: 180000}}
+  slf4jReporter: {enabled: true, interval: 180000}}
 strictTransactionManagement: false
 maxInitialLineLength: 4096
 maxHeaderSize: 8192

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9bc2edfb/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/server/gremlin-server-performance.yaml
----------------------------------------------------------------------
diff --git a/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/server/gremlin-server-performance.yaml b/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/server/gremlin-server-performance.yaml
index 330a643..d30635d 100644
--- a/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/server/gremlin-server-performance.yaml
+++ b/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/server/gremlin-server-performance.yaml
@@ -34,12 +34,7 @@ serializers:
 processors:
   - { className: org.apache.tinkerpop.gremlin.server.op.session.SessionOpProcessor, config: { sessionTimeout: 28800000 }}
 metrics: {
-  consoleReporter: {enabled: true, interval: 180000},
-  csvReporter: {enabled: true, interval: 180000, fileName: /tmp/gremlin-server-metrics.csv},
-  jmxReporter: {enabled: true},
-  slf4jReporter: {enabled: true, interval: 180000},
-  gangliaReporter: {enabled: false, interval: 180000, addressingMode: MULTICAST},
-  graphiteReporter: {enabled: false, interval: 180000}}
+  slf4jReporter: {enabled: true, interval: 180000}}
 strictTransactionManagement: false
 maxInitialLineLength: 4096
 maxHeaderSize: 8192

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9bc2edfb/gremlin-server/src/test/scripts/generate-all.groovy
----------------------------------------------------------------------
diff --git a/gremlin-server/src/test/scripts/generate-all.groovy b/gremlin-server/src/test/scripts/generate-all.groovy
new file mode 100644
index 0000000..b6be405
--- /dev/null
+++ b/gremlin-server/src/test/scripts/generate-all.groovy
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ */
+
+// an init script that returns a Map allows explicit setting of global bindings.
+def globals = [:]
+
+// Generates the modern graph into an "empty" TinkerGraph via LifeCycleHook.
+// Note that the name of the key in the "global" map is unimportant.
+globals << [hook : [
+  onStartUp: { ctx ->
+    TinkerFactory.generateClassic(classic)
+    TinkerFactory.generateModern(modern)
+    TinkerFactory.generateTheCrew(crew)
+    grateful.io(gryo()).readGraph('data/grateful-dead.kryo')
+  }
+] as LifeCycleHook]
+
+// add default TraversalSource instances for each graph instance
+globals << [gclassic : classic.traversal()]
+globals << [gmodern : modern.traversal()]
+globals << [gcrew : crew.traversal()]
+globals << [ggraph : graph.traversal()]
+globals << [g : modern.traversal()]
+globals << [ggrateful : grateful.traversal()]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9bc2edfb/gremlin-server/src/test/scripts/test-server-start.groovy
----------------------------------------------------------------------
diff --git a/gremlin-server/src/test/scripts/test-server-start.groovy b/gremlin-server/src/test/scripts/test-server-start.groovy
index 8ea08a9..d793d26 100644
--- a/gremlin-server/src/test/scripts/test-server-start.groovy
+++ b/gremlin-server/src/test/scripts/test-server-start.groovy
@@ -25,8 +25,16 @@ if (Boolean.parseBoolean(skipTests)) return
 
 log.info("Starting Gremlin Server instances for native testing of ${executionName}")
 def settings = Settings.read("${settingsFile}")
-settings.graphs.graph = gremlinServerDir + "/conf/tinkergraph-empty.properties"
-settings.scriptEngines["gremlin-groovy"].scripts = [gremlinServerDir + "/scripts/generate-modern.groovy"]
+settings.graphs.graph = gremlinServerDir + "/src/test/scripts/tinkergraph-empty.properties"
+settings.graphs.classic = gremlinServerDir + "/src/test/scripts/tinkergraph-empty.properties"
+settings.graphs.modern = gremlinServerDir + "/src/test/scripts/tinkergraph-empty.properties"
+settings.graphs.crew = gremlinServerDir + "/src/test/scripts/tinkergraph-empty.properties"
+settings.graphs.grateful = gremlinServerDir + "/src/test/scripts/tinkergraph-empty.properties"
+settings.scriptEngines["gremlin-groovy"].scripts = [gremlinServerDir + "/src/test/scripts/generate-all.groovy"]
+if (Boolean.parseBoolean(python)) {
+    settings.scriptEngines["gremlin-python"] = new Settings.ScriptEngineSettings()
+    settings.scriptEngines["gremlin-jython"] = new Settings.ScriptEngineSettings()
+}
 settings.port = 45940
 
 def server = new GremlinServer(settings)
@@ -36,8 +44,16 @@ project.setContextValue("gremlin.server", server)
 log.info("Gremlin Server with no authentication started on port 45940")
 
 def settingsSecure = Settings.read("${settingsFile}")
-settingsSecure.graphs.graph = gremlinServerDir + "/conf/tinkergraph-empty.properties"
-settingsSecure.scriptEngines["gremlin-groovy"].scripts = [gremlinServerDir + "/scripts/generate-modern.groovy"]
+settings.graphs.graph = gremlinServerDir + "/src/test/scripts/tinkergraph-empty.properties"
+settings.graphs.classic = gremlinServerDir + "/src/test/scripts/tinkergraph-empty.properties"
+settings.graphs.modern = gremlinServerDir + "/src/test/scripts/tinkergraph-empty.properties"
+settings.graphs.crew = gremlinServerDir + "/src/test/scripts/tinkergraph-empty.properties"
+settings.graphs.grateful = gremlinServerDir + "/src/test/scripts/tinkergraph-empty.properties"
+settingsSecure.scriptEngines["gremlin-groovy"].scripts = [gremlinServerDir + "/src/test/scripts/generate-all.groovy"]
+if (Boolean.parseBoolean(python)) {
+    settingsSecure.scriptEngines["gremlin-python"] = new Settings.ScriptEngineSettings()
+    settingsSecure.scriptEngines["gremlin-jython"] = new Settings.ScriptEngineSettings()
+}
 settingsSecure.port = 45941
 settingsSecure.authentication.className = SimpleAuthenticator.class.name
 settingsSecure.authentication.config = [credentialsDb: gremlinServerDir + "/conf/tinkergraph-credentials.properties", credentialsDbLocation: gremlinServerDir + "/data/credentials.kryo"]

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9bc2edfb/gremlin-server/src/test/scripts/tinkergraph-empty.properties
----------------------------------------------------------------------
diff --git a/gremlin-server/src/test/scripts/tinkergraph-empty.properties b/gremlin-server/src/test/scripts/tinkergraph-empty.properties
new file mode 100644
index 0000000..211b9e4
--- /dev/null
+++ b/gremlin-server/src/test/scripts/tinkergraph-empty.properties
@@ -0,0 +1,20 @@
+# 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.
+gremlin.graph=org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph
+gremlin.tinkergraph.vertexIdManager=INTEGER
+gremlin.tinkergraph.edgeIdManager=INTEGER
+gremlin.tinkergraph.vertexPropertyIdManager=INTEGER
\ No newline at end of file


[40/47] tinkerpop git commit: TINKERPOP-1784 Deleted some dead code

Posted by sp...@apache.org.
TINKERPOP-1784 Deleted some dead code


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

Branch: refs/heads/TINKERPOP-1784
Commit: 1427506d78b1f30743125fdb24bd6408cea189c0
Parents: a44ce91
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Sep 28 15:30:54 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Oct 16 11:19:30 2017 -0400

----------------------------------------------------------------------
 .../src/main/jython/radish/feature_steps.py           | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1427506d/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 2db5922..e3b82c3 100644
--- a/gremlin-python/src/main/jython/radish/feature_steps.py
+++ b/gremlin-python/src/main/jython/radish/feature_steps.py
@@ -76,12 +76,12 @@ def assert_result(step, characterized_as):
 
 
 def __convert(val, ctx):
-    if isinstance(val, dict):                                                    # convert dictionary keys/values
+    if isinstance(val, dict):                                         # convert dictionary keys/values
         n = {}
         for key, value in val.items():
             n[__convert(key, ctx)] = __convert(value, ctx)
         return n
-    elif isinstance(val, unicode):
+    elif isinstance(val, unicode):                                    # stupid unicode/string nonsense in py 2/x
         return __convert(val.encode('utf-8'), ctx)
     elif isinstance(val, str) and re.match("^l\[.*\]$", val):         # parse list
         return list(map((lambda x: __convert(x, ctx)), val[2:-1].split(",")))
@@ -100,16 +100,6 @@ def __convert(val, ctx):
     else:
         return val
 
-#
-# def __ordered_assertion(data, result, ctx):
-#     # results from traversal should have the same number of entries as the feature data table
-#     assert_that(len(result), equal_to(len(data)))
-#
-#     # assert the results in order they are expected in the data from the features file
-#     for ix, line in enumerate(data):
-#         assert_that(result[ix], equal_to(__convert(line[0], ctx)))
-#
-
 
 def __table_assertion(data, result, ctx, ordered):
     # results from traversal should have the same number of entries as the feature data table


[16/47] tinkerpop git commit: TINKERPOP-1784 Expanded GLV test framework a bit further

Posted by sp...@apache.org.
TINKERPOP-1784 Expanded GLV test framework a bit further

Developed methods for vertices/maps and a way to assert unordered results.


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

Branch: refs/heads/TINKERPOP-1784
Commit: cca112badafff2673b9fe83d0b4aea3b571ceff3
Parents: ac0dd78
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Sep 22 10:52:20 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Oct 16 11:19:29 2017 -0400

----------------------------------------------------------------------
 gremlin-python/pom.xml                          | 14 +---
 .../src/main/jython/radish/feature_steps.py     | 87 ++++++++++++++++----
 .../src/main/jython/radish/terrain.py           | 11 ++-
 gremlin-python/src/main/jython/setup.py         |  3 +-
 gremlin-test/features/filter/Coin.feature       | 43 ++++++++++
 gremlin-test/features/filter/Has.feature        | 30 +++++++
 gremlin-test/features/map/Coin.feature          | 42 ----------
 .../features/sideEffect/GroupCount.feature      | 29 +++++++
 .../step/sideEffect/GroupCountTest.java         |  2 +-
 9 files changed, 187 insertions(+), 74 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/cca112ba/gremlin-python/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-python/pom.xml b/gremlin-python/pom.xml
index 4ab5f37..cabaec9 100644
--- a/gremlin-python/pom.xml
+++ b/gremlin-python/pom.xml
@@ -339,11 +339,7 @@ limitations under the License.
                                         </exec>
                                         <exec dir="${project.build.directory}/python2" executable="env/bin/pip"
                                               failonerror="true">
-                                            <arg line="install wheel"/>
-                                        </exec>
-                                        <exec dir="${project.build.directory}/python2" executable="env/bin/pip"
-                                              failonerror="true">
-                                            <arg line="install radish-bdd"/>
+                                            <arg line="install wheel radish-bdd PyHamcrest"/>
                                         </exec>
                                         <exec dir="${project.build.directory}/python3" executable="virtualenv"
                                               failonerror="true">
@@ -351,11 +347,7 @@ limitations under the License.
                                         </exec>
                                         <exec dir="${project.build.directory}/python3" executable="env/bin/pip"
                                               failonerror="true">
-                                            <arg line="install wheel"/>
-                                        </exec>
-                                        <exec dir="${project.build.directory}/python3" executable="env/bin/pip"
-                                              failonerror="true">
-                                            <arg line="install radish-bdd"/>
+                                            <arg line="install wheel radish-bdd PyHamcrest"/>
                                         </exec>
                                         <exec dir="${project.build.directory}/python-packaged" executable="virtualenv"
                                               failonerror="true">
@@ -455,7 +447,7 @@ limitations under the License.
                                         <exec executable="env/bin/radish" dir="${project.build.directory}/python2"
                                               failonerror="true">
                                             <env key="PYTHONPATH" value=""/>
-                                            <arg line="-b ${project.build.directory}/python2/radish ${project.basedir}/../gremlin-test/features/"/>
+                                            <arg line="-b ${project.build.directory}/python2/radish ${project.basedir}/../gremlin-test/features/"/> <!-- -no-line-jump -->
                                         </exec>                                                                  
                                     </target>
                                 </configuration>

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/cca112ba/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 61297ff..069768d 100644
--- a/gremlin-python/src/main/jython/radish/feature_steps.py
+++ b/gremlin-python/src/main/jython/radish/feature_steps.py
@@ -17,24 +17,36 @@ specific language governing permissions and limitations
 under the License.
 '''
 
-from gremlin_python.structure.graph import Graph
+import json
+from gremlin_python.structure.graph import Graph, Vertex, Edge
 from gremlin_python.process.graph_traversal import __
-from gremlin_python.process.traversal import Scope
-from radish import before, given, when, then
+from gremlin_python.process.traversal import P, Scope
+from radish import given, when, then, custom_type, register_custom_type, TypeBuilder
+from hamcrest import *
 
 out = __.out
 
 
-@given("the {graphName:w} graph")
-def choose_graph(step, graphName):
+@custom_type('words', r'\w+')
+def parse_word(text):
+    return str(text)
+
+
+register_custom_type(WordList=TypeBuilder.with_many(parse_word, listsep=','))
+
+
+@given("the {graph_name:w} graph")
+def choose_graph(step, graph_name):
     # only have modern atm but graphName would be used to select the right one
-    step.context.g = Graph().traversal().withRemote(step.context.remote_conn_modern)
+    step.context.g = Graph().traversal().withRemote(step.context.remote_conn[graph_name])
 
 
 @given("the traversal of")
 def translate_traversal(step):
     g = step.context.g
-    step.context.traversal = eval(step.text, {"g": g, "Scope": Scope})
+    step.context.traversal = eval(step.text, {"g": g,
+                                              "P": P,
+                                              "Scope": Scope})
 
 
 @when("iterated to list")
@@ -45,33 +57,74 @@ def iterate_the_traversal(step):
 @then("the result should be {characterized_as:w}")
 def assert_result(step, characterized_as):
     if characterized_as == "empty":
-        assert len(step.context.result) == 0
+        assert_that(len(step.context.result), equal_to(0))
     elif characterized_as == "ordered":
         data = step.table
     
         # results from traversal should have the same number of entries as the feature data table
-        assert len(step.context.result) == len(data)
+        assert_that(len(step.context.result), equal_to(len(data)))
 
         # assert the results by type where the first column will hold the type and the second column
         # the data to assert. the contents of the second column will be dependent on the type specified
-        # in te first column
+        # in the first column
         for ix, line in enumerate(data):
             if line[0] == "numeric":
-                assert long(step.context.result[ix]) == long(line[1])
+                assert_that(long(step.context.result[ix]), equal_to(long(line[1])))
             elif line[0] == "string":
-                assert str(step.context.result[ix]) == str(line[1])
+                assert_that(str(step.context.result[ix]), equal_to(str(line[1])))
+            elif line[0] == "vertex":
+                assert_that(step.context.result[ix].label, equal_to(line[1]))
+            elif line[0] == "map":
+                assert_that(step.context.result[ix], json.loads(line[1]))
             else:
-                assert step.context.result[ix] == line[1]
+                raise ValueError("unknown type of " + line[0])
     elif characterized_as == "unordered":
         data = step.table
 
         # results from traversal should have the same number of entries as the feature data table
-        assert len(step.context.result) == len(data)
+        assert_that(len(step.context.result), equal_to(len(data)))
+
+        results_to_test = list(step.context.result)
+
+        for line in data:
+            if line[0] == "numeric":
+                val = long(line[1])
+                assert_that(val, is_in(list(map(long, results_to_test))))
+                results_to_test.remove(val)
+            elif line[0] == "string":
+                val = str(line[1])
+                assert_that(val, is_in(list(map(str, results_to_test))))
+                results_to_test.remove(val)
+            elif line[0] == "vertex":
+                val = str(line[1])
+                v = step.context.lookup["modern"][val]
+                assert_that(v, is_in(results_to_test))
+                results_to_test.remove(v)
+            elif line[0] == "map":
+                val = json.load(line[1])
+                assert_that(val, is_in(results_to_test))
+                results_to_test.remove(val)
+            else:
+                raise ValueError("unknown type of " + line[0])
+
+        assert_that(len(results_to_test), is_(0))
+    else:
+        raise ValueError("unknown data characterization of " + characterized_as)
 
 
+@then("the number of results should be {number:d}")
+def assert_number_of_results(step, number):
+    assert_that(len(step.context.result), equal_to(number))
 
-@then("the results should be empty")
-def assert_result(step):
-    assert len(step.context.result) == 0
 
+@then("the results should all be {element_type:w}")
+def assert_elements(step, element_type):
+    if element_type == "vertices":
+        t = Vertex
+    elif element_type == "edges":
+        t = Edge
+    else:
+        raise ValueError("unknown element type of " + element_type)
 
+    for r in step.context.result:
+        assert_that(r, instance_of(t))

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/cca112ba/gremlin-python/src/main/jython/radish/terrain.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/radish/terrain.py b/gremlin-python/src/main/jython/radish/terrain.py
index 389f39c..59ec8d0 100644
--- a/gremlin-python/src/main/jython/radish/terrain.py
+++ b/gremlin-python/src/main/jython/radish/terrain.py
@@ -17,15 +17,22 @@ specific language governing permissions and limitations
 under the License.
 '''
 
+from gremlin_python.structure.graph import Graph
+from gremlin_python.process.graph_traversal import __
 from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection
 from radish import before, after
 
 
 @before.each_scenario
 def prepare_traversal_source(scenario):
-    scenario.context.remote_conn_modern = DriverRemoteConnection('ws://localhost:45940/gremlin', 'g')
+    remote = DriverRemoteConnection('ws://localhost:45940/gremlin', 'g')
+    scenario.context.remote_conn = {"modern": remote}
+    g = Graph().traversal().withRemote(remote)
+
+    # hold a map of name/vertex for use in asserting results
+    scenario.context.lookup = {"modern": g.V().group().by('name').by(__.tail()).next()}
 
 
 @after.each_scenario
 def close_traversal_source(scenario):
-    scenario.context.remote_conn_modern.close()
+    scenario.context.remote_conn["modern"].close()

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/cca112ba/gremlin-python/src/main/jython/setup.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/setup.py b/gremlin-python/src/main/jython/setup.py
index 73b5000..9a66c81 100644
--- a/gremlin-python/src/main/jython/setup.py
+++ b/gremlin-python/src/main/jython/setup.py
@@ -71,7 +71,8 @@ setup(
     tests_require=[
         'pytest',
         'mock',
-        'radish-bdd'
+        'radish-bdd',
+        'PyHamcrest'
     ],
     install_requires=install_requires,
     classifiers=[

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/cca112ba/gremlin-test/features/filter/Coin.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/filter/Coin.feature b/gremlin-test/features/filter/Coin.feature
new file mode 100644
index 0000000..1b88f58
--- /dev/null
+++ b/gremlin-test/features/filter/Coin.feature
@@ -0,0 +1,43 @@
+# 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 - coin()
+
+  Scenario: Use coin at 1.0
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().coin(1.0)
+      """
+    When iterated to list
+    Then the result should be unordered
+      | vertex | marko  |
+      | vertex | vadas  |
+      | vertex | lop    |
+      | vertex | josh   |
+      | vertex | ripple |
+      | vertex | peter  |
+
+
+  Scenario: Use coin at 0.0
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().coin(0.0)
+      """
+    When iterated to list
+    Then the result should be empty
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/cca112ba/gremlin-test/features/filter/Has.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/filter/Has.feature b/gremlin-test/features/filter/Has.feature
new file mode 100644
index 0000000..0bb82e0
--- /dev/null
+++ b/gremlin-test/features/filter/Has.feature
@@ -0,0 +1,30 @@
+# 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 - has()
+
+  Scenario: Use has() with P.gt()
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().has("age", P.gt(30))
+      """
+    When iterated to list
+    Then the result should be unordered
+      | vertex | josh   |
+      | vertex | peter  |
+

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/cca112ba/gremlin-test/features/map/Coin.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/map/Coin.feature b/gremlin-test/features/map/Coin.feature
deleted file mode 100644
index b21bd70..0000000
--- a/gremlin-test/features/map/Coin.feature
+++ /dev/null
@@ -1,42 +0,0 @@
-# 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 - coin()
-
-  Scenario: Use coin at 1.0
-    Given the modern graph
-    And the traversal of
-      """
-      g.V().coin(1.0)
-      """
-    When iterated to list
-    Then the result should be unordered as
-      | vertex | person   |
-      | vertex | person   |
-      | vertex | person   |
-      | vertex | person   |
-      | vertex | software |
-      | vertex | software |
-
-  Scenario: Use coin at 0.0
-    Given the modern graph
-    And the traversal of
-      """
-      g.V().coin(0.0)
-      """
-    When iterated to list
-    Then the result should be empty
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/cca112ba/gremlin-test/features/sideEffect/GroupCount.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/sideEffect/GroupCount.feature b/gremlin-test/features/sideEffect/GroupCount.feature
new file mode 100644
index 0000000..1789b32
--- /dev/null
+++ b/gremlin-test/features/sideEffect/GroupCount.feature
@@ -0,0 +1,29 @@
+# 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 - groupCount()
+
+  Scenario: Use has() with P.gt()
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().out("created").groupCount().by("name")
+      """
+    When iterated to list
+    Then the result should be ordered
+      | map | {"ripple": 1, "lop": 3} |
+

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/cca112ba/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/GroupCountTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/GroupCountTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/GroupCountTest.java
index 9bd515c..34011ac 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/GroupCountTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/GroupCountTest.java
@@ -94,7 +94,7 @@ public abstract class GroupCountTest extends AbstractGremlinProcessTest {
         checkSideEffects(traversal.asAdmin().getSideEffects(), "a", HashMap.class);
     }
 
-    private static void assertCommonA(Traversal<Vertex, Map<String, Long>> traversal) {
+    private static void assertCommonA(final Traversal<Vertex, Map<String, Long>> traversal) {
         final Map<String, Long> map = traversal.next();
         assertEquals(map.size(), 2);
         assertEquals(Long.valueOf(3l), map.get("lop"));


[45/47] tinkerpop git commit: TINKERPOP-1784 Added multi-line support in the .feature files

Posted by sp...@apache.org.
TINKERPOP-1784 Added multi-line support in the .feature files


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

Branch: refs/heads/TINKERPOP-1784
Commit: 757232a7db9d4802d2e71636d73c3434f0f24ddc
Parents: a1a0713
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Oct 10 15:39:40 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Oct 16 11:19:31 2017 -0400

----------------------------------------------------------------------
 .../src/main/jython/radish/feature_steps.py     |  3 +-
 gremlin-test/features/branch/Branch.feature     | 19 +++++-
 gremlin-test/features/map/Count.feature         |  7 ++-
 gremlin-test/features/map/Select.feature        | 65 +++++++++++++++-----
 .../features/sideEffect/GroupCount.feature      | 33 ++++++++--
 5 files changed, 102 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/757232a7/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 3c25258..68eeeaf 100644
--- a/gremlin-python/src/main/jython/radish/feature_steps.py
+++ b/gremlin-python/src/main/jython/radish/feature_steps.py
@@ -144,6 +144,7 @@ def __table_assertion(data, result, ctx, ordered):
 
 
 def __translate(traversal):
-    replaced = regex_as.sub(r"\1as_(", traversal)
+    replaced = traversal.replace("\n", "")
+    replaced = regex_as.sub(r"\1as_(", replaced)
     replaced = regex_is.sub(r"\1is_(", replaced)
     return regex_in.sub(r"\1in_(", replaced)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/757232a7/gremlin-test/features/branch/Branch.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/branch/Branch.feature b/gremlin-test/features/branch/Branch.feature
index 93562c8..49864e0 100644
--- a/gremlin-test/features/branch/Branch.feature
+++ b/gremlin-test/features/branch/Branch.feature
@@ -22,7 +22,11 @@ Feature: Step - branch()
     And using the parameter l1 is "c[it.get().label() == 'person' ? 'a' : 'b']"
     And the traversal of
       """
-      g.V().branch(l1).option("a", __.values("age")).option("b", __.values("lang")).option("b", __.values("name"))
+      g.V().
+        branch(l1).
+          option("a", __.values("age")).
+          option("b", __.values("lang")).
+          option("b", __.values("name"))
       """
     When iterated to list
     Then the result should be unordered
@@ -39,7 +43,11 @@ Feature: Step - branch()
     Given the modern graph
     And the traversal of
       """
-      g.V().branch(__.label().is("person").count()).option(1L, __.values("age")).option(0L, __.values("lang")).option(0L, __.values("name"))
+      g.V().
+        branch(__.label().is("person").count()).
+          option(1L, __.values("age")).
+          option(0L, __.values("lang")).
+          option(0L, __.values("name"))
       """
     When iterated to list
     Then the result should be unordered
@@ -56,7 +64,12 @@ Feature: Step - branch()
     Given the modern graph
     And the traversal of
       """
-      g.V().branch(__.label().is("person").count()).option(1L, __.values("age")).option(0L, __.values("lang")).option(0L, __.values("name")).option(Pick.any, __.label())
+      g.V().
+        branch(__.label().is("person").count()).
+          option(1L, __.values("age")).
+          option(0L, __.values("lang")).
+          option(0L, __.values("name")).
+          option(Pick.any, __.label())
       """
     When iterated to list
     Then the result should be unordered

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/757232a7/gremlin-test/features/map/Count.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/map/Count.feature b/gremlin-test/features/map/Count.feature
index 6053605..7f708ee 100644
--- a/gremlin-test/features/map/Count.feature
+++ b/gremlin-test/features/map/Count.feature
@@ -94,7 +94,12 @@ Feature: Step - count()
     Given the grateful graph
     And the traversal of
       """
-      g.V().repeat(__.out()).times(5).as("a").out("writtenBy").as("b").select("a", "b").count()
+      g.V().
+        repeat(__.out()).
+          times(5).as("a").
+        out("writtenBy").as("b").
+        select("a", "b").
+        count()
       """
     When iterated to list
     Then the result should be ordered

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/757232a7/gremlin-test/features/map/Select.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/map/Select.feature b/gremlin-test/features/map/Select.feature
index f29a436..74cd4ec 100644
--- a/gremlin-test/features/map/Select.feature
+++ b/gremlin-test/features/map/Select.feature
@@ -34,7 +34,8 @@ Feature: Step - select()
     And using the parameter v1Id is "v[marko].id"
     And the traversal of
       """
-      g.V(v1Id).as("a").out("knows").as("b").select("a", "b").by("name")
+      g.V(v1Id).as("a").out("knows").as("b").
+        select("a", "b").by("name")
       """
     When iterated to list
     Then the result should be unordered
@@ -58,7 +59,8 @@ Feature: Step - select()
     And using the parameter v1Id is "v[marko].id"
     And the traversal of
       """
-      g.V(v1Id).as("a").out("knows").as("b").select("a").by("name")
+      g.V(v1Id).as("a").out("knows").as("b").
+        select("a").by("name")
       """
     When iterated to list
     Then the result should be unordered
@@ -69,7 +71,8 @@ Feature: Step - select()
     Given the modern graph
     And the traversal of
       """
-      g.V().as("a").out().as("b").select("a", "b").by("name")
+      g.V().as("a").out().as("b").
+        select("a", "b").by("name")
       """
     When iterated to list
     Then the result should be unordered
@@ -84,7 +87,8 @@ Feature: Step - select()
     Given the modern graph
     And the traversal of
       """
-      g.V().as("a").out().aggregate("x").as("b").select("a", "b").by("name")
+      g.V().as("a").out().aggregate("x").as("b").
+        select("a", "b").by("name")
       """
     When iterated to list
     Then the result should be unordered
@@ -99,7 +103,11 @@ Feature: Step - select()
     Given the modern graph
     And the traversal of
       """
-      g.V().as("a").values("name").order().as("b").select("a", "b").by("name").by()
+      g.V().as("a").
+        values("name").
+        order().as("b").
+        select("a", "b").
+          by("name").by()
       """
     When iterated to list
     Then the result should be unordered
@@ -114,7 +122,13 @@ Feature: Step - select()
     Given the crew graph
     And the traversal of
       """
-      g.V().has("name", "gremlin").inE("uses").order().by("skill", Order.incr).as("a").outV().as("b").select("a", "b").by("skill").by("name")
+      g.V().has("name", "gremlin").
+        inE("uses").
+        order().by("skill", Order.incr).as("a").
+        outV().as("b").
+        select("a", "b").
+          by("skill").
+          by("name")
       """
     When iterated to list
     Then the result should be unordered
@@ -147,7 +161,9 @@ Feature: Step - select()
     Given the modern graph
     And the traversal of
       """
-      g.V().hasLabel("person").as("p").map(__.bothE().label().groupCount()).as("r").select("p", "r")
+      g.V().hasLabel("person").as("p").
+        map(__.bothE().label().groupCount()).as("r").
+        select("p", "r")
       """
     When iterated to list
     Then the result should be unordered
@@ -160,7 +176,12 @@ Feature: Step - select()
     Given the modern graph
     And the traversal of
       """
-      g.V().choose(__.outE().count().is(0L), __.as("a"), __.as("b")).choose(__.select("a"), __.select("a"), __.select("b"))
+      g.V().choose(__.outE().count().is(0L),
+                   __.as("a"),
+                   __.as("b")).
+            choose(__.select("a"),
+                   __.select("a"),
+                   __.select("b"))
       """
     When iterated to list
     Then the result should be unordered
@@ -201,7 +222,9 @@ Feature: Step - select()
     And using the parameter v4Id is "v[josh].id"
     And the traversal of
       """
-      g.V(v4Id).out().as("here").has("lang", "java").select("here").values("name")
+      g.V(v4Id).out().as("here").
+        has("lang", "java").
+        select("here").values("name")
       """
     When iterated to list
     Then the result should be unordered
@@ -213,7 +236,9 @@ Feature: Step - select()
     And using the parameter v1Id is "v[marko].id"
     And the traversal of
       """
-      g.V(v1Id).outE().as("here").inV().has("name", "vadas").select("here")
+      g.V(v1Id).outE().as("here").
+        inV().has("name", "vadas").
+        select("here")
       """
     When iterated to list
     Then the result should be unordered
@@ -224,7 +249,10 @@ Feature: Step - select()
     And using the parameter v1Id is "v[marko].id"
     And the traversal of
       """
-      g.V(v1Id).outE("knows").has("weight", 1.0).as("here").inV().has("name", "josh").select("here")
+      g.V(v1Id).outE("knows").
+        has("weight", 1.0).as("here").
+        inV().has("name", "josh").
+        select("here")
       """
     When iterated to list
     Then the result should be unordered
@@ -235,7 +263,10 @@ Feature: Step - select()
     And using the parameter v1Id is "v[marko].id"
     And the traversal of
       """
-      g.V(v1Id).outE("knows").as("here").has("weight", 1.0).as("fake").inV().has("name", "josh").select("here")
+      g.V(v1Id).outE("knows").as("here").
+        has("weight", 1.0).as("fake").
+        inV().has("name", "josh").
+        select("here")
       """
     When iterated to list
     Then the result should be unordered
@@ -245,7 +276,9 @@ Feature: Step - select()
     Given the modern graph
     And the traversal of
       """
-      g.V().as("here").out().values("name").select("here")
+      g.V().as("here").
+        out().values("name").
+        select("here")
       """
     When iterated to list
     Then the result should be unordered
@@ -260,7 +293,11 @@ Feature: Step - select()
     Given the modern graph
     And the traversal of
       """
-      g.V().out("created").union(__.as("project").in("created").has("name", "marko").select("project"), __.as("project").in("created").in("knows").has("name", "marko").select("project")).groupCount().by("name")
+      g.V().out("created").
+        union(__.as("project").in("created").has("name", "marko").select("project"),
+              __.as("project").in("created").in("knows").has("name", "marko").select("project")).
+        groupCount().
+          by("name")
       """
     When iterated to list
     Then the result should be unordered

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/757232a7/gremlin-test/features/sideEffect/GroupCount.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/sideEffect/GroupCount.feature b/gremlin-test/features/sideEffect/GroupCount.feature
index 28eb675..35ac8d3 100644
--- a/gremlin-test/features/sideEffect/GroupCount.feature
+++ b/gremlin-test/features/sideEffect/GroupCount.feature
@@ -41,7 +41,10 @@ Feature: Step - groupCount()
     Given the modern graph
     And the traversal of
       """
-      g.V().out("created").groupCount("a").by("name").cap("a")
+      g.V().out("created").
+        groupCount("a").
+          by("name").
+        cap("a")
       """
     When iterated to list
     Then the result should be ordered
@@ -51,7 +54,9 @@ Feature: Step - groupCount()
     Given the modern graph
     And the traversal of
       """
-      g.V().out("created").values("name").groupCount("a").cap("a")
+      g.V().out("created").values("name").
+        groupCount("a").
+        cap("a")
       """
     When iterated to list
     Then the result should be ordered
@@ -61,7 +66,10 @@ Feature: Step - groupCount()
     Given the modern graph
     And the traversal of
       """
-      g.V().repeat(__.out().groupCount("a").by("name")).times(2).cap("a")
+      g.V().
+        repeat(__.out().groupCount("a").by("name")).
+          times(2).
+        cap("a")
       """
     When iterated to list
     Then the result should be ordered
@@ -71,7 +79,14 @@ Feature: Step - groupCount()
     Given the modern graph
     And the traversal of
       """
-      g.V().both().groupCount("a").by(T.label).as("b").barrier().where(__.select("a").select("software").is(P.gt(2))).select("b").values("name")
+      g.V().both().
+        groupCount("a").
+          by(T.label).as("b").
+        barrier().
+        where(__.select("a").
+              select("software").
+              is(P.gt(2))).
+        select("b").values("name")
       """
     When iterated to list
     Then the result should be unordered
@@ -92,7 +107,12 @@ Feature: Step - groupCount()
     Given the modern graph
     And the traversal of
       """
-      g.V().union(__.out("knows"), __.out("created").in("created")).groupCount().select(Column.values).unfold().sum()
+      g.V().union(__.out("knows"),
+                  __.out("created").in("created")).
+        groupCount().
+        select(Column.values).
+        unfold().
+        sum()
       """
     When iterated to list
     Then the result should be ordered
@@ -122,7 +142,8 @@ Feature: Step - groupCount()
     Given the modern graph
     And the traversal of
       """
-      g.V().union(__.repeat(__.out()).times(2).groupCount("m").by("lang"),__.repeat(__.in()).times(2).groupCount("m").by("name")).cap("m")
+      g.V().union(__.repeat(__.out()).times(2).groupCount("m").by("lang"),
+                  __.repeat(__.in()).times(2).groupCount("m").by("name")).cap("m")
       """
     When iterated to list
     Then the result should be ordered


[07/47] tinkerpop git commit: Merge branch 'TINKERPOP-1796' into tp32 This closes #727

Posted by sp...@apache.org.
Merge branch 'TINKERPOP-1796' into tp32
This closes #727


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

Branch: refs/heads/TINKERPOP-1784
Commit: dd48dcc0f7d3230a072afa8908830892193d6c0b
Parents: a278edd 3cdaaea
Author: Robert Dale <ro...@gmail.com>
Authored: Tue Oct 10 12:58:30 2017 -0400
Committer: Robert Dale <ro...@gmail.com>
Committed: Tue Oct 10 12:58:30 2017 -0400

----------------------------------------------------------------------
 .../org/apache/tinkerpop/gremlin/driver/Settings.java     |  9 +++++++++
 .../org/apache/tinkerpop/gremlin/driver/SettingsTest.java | 10 ++++++++--
 2 files changed, 17 insertions(+), 2 deletions(-)
----------------------------------------------------------------------



[15/47] tinkerpop git commit: TINKERPOP-1784 Added some basic support to convert vertex string to a vertex object

Posted by sp...@apache.org.
TINKERPOP-1784 Added some basic support to convert vertex string to a vertex object

This might be the pattern to use across the board. We'll see if there is a better idea floating about though so may not be final.


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

Branch: refs/heads/TINKERPOP-1784
Commit: 1b9d99299f0fe8810483816aae44a1ec1a994f9e
Parents: cca112b
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Sep 22 12:56:08 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Oct 16 11:19:29 2017 -0400

----------------------------------------------------------------------
 .../src/main/jython/radish/feature_steps.py     | 44 ++++++++------------
 .../features/sideEffect/GroupCount.feature      | 11 ++++-
 2 files changed, 27 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1b9d9929/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 069768d..f67a4c2 100644
--- a/gremlin-python/src/main/jython/radish/feature_steps.py
+++ b/gremlin-python/src/main/jython/radish/feature_steps.py
@@ -18,21 +18,25 @@ under the License.
 '''
 
 import json
-from gremlin_python.structure.graph import Graph, Vertex, Edge
+import re
+from gremlin_python.structure.graph import Graph
 from gremlin_python.process.graph_traversal import __
-from gremlin_python.process.traversal import P, Scope
-from radish import given, when, then, custom_type, register_custom_type, TypeBuilder
+from gremlin_python.process.traversal import P, Scope, Column
+from radish import given, when, then
 from hamcrest import *
 
 out = __.out
 
 
-@custom_type('words', r'\w+')
-def parse_word(text):
-    return str(text)
+def convert(m, ctx):
+    n = {}
+    for key, value in m.items():
+        if isinstance(key, str) and re.match("v\[.*\]", key):
+            n[ctx.lookup["modern"][key[2:-1]]] = value
+        else:
+            n[key] = value
 
-
-register_custom_type(WordList=TypeBuilder.with_many(parse_word, listsep=','))
+    return n
 
 
 @given("the {graph_name:w} graph")
@@ -45,6 +49,7 @@ def choose_graph(step, graph_name):
 def translate_traversal(step):
     g = step.context.g
     step.context.traversal = eval(step.text, {"g": g,
+                                              "Column": Column,
                                               "P": P,
                                               "Scope": Scope})
 
@@ -75,7 +80,7 @@ def assert_result(step, characterized_as):
             elif line[0] == "vertex":
                 assert_that(step.context.result[ix].label, equal_to(line[1]))
             elif line[0] == "map":
-                assert_that(step.context.result[ix], json.loads(line[1]))
+                assert_that(convert(step.context.result[ix], step.context), json.loads(line[1]))
             else:
                 raise ValueError("unknown type of " + line[0])
     elif characterized_as == "unordered":
@@ -86,6 +91,8 @@ def assert_result(step, characterized_as):
 
         results_to_test = list(step.context.result)
 
+        # finds a match in the results for each line of data to assert and then removes that item
+        # from the list - in the end there should be no items left over and each will have been asserted
         for line in data:
             if line[0] == "numeric":
                 val = long(line[1])
@@ -101,7 +108,7 @@ def assert_result(step, characterized_as):
                 assert_that(v, is_in(results_to_test))
                 results_to_test.remove(v)
             elif line[0] == "map":
-                val = json.load(line[1])
+                val = convert(json.load(line[1]), step.context)
                 assert_that(val, is_in(results_to_test))
                 results_to_test.remove(val)
             else:
@@ -111,20 +118,3 @@ def assert_result(step, characterized_as):
     else:
         raise ValueError("unknown data characterization of " + characterized_as)
 
-
-@then("the number of results should be {number:d}")
-def assert_number_of_results(step, number):
-    assert_that(len(step.context.result), equal_to(number))
-
-
-@then("the results should all be {element_type:w}")
-def assert_elements(step, element_type):
-    if element_type == "vertices":
-        t = Vertex
-    elif element_type == "edges":
-        t = Edge
-    else:
-        raise ValueError("unknown element type of " + element_type)
-
-    for r in step.context.result:
-        assert_that(r, instance_of(t))

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1b9d9929/gremlin-test/features/sideEffect/GroupCount.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/sideEffect/GroupCount.feature b/gremlin-test/features/sideEffect/GroupCount.feature
index 1789b32..d8d5b51 100644
--- a/gremlin-test/features/sideEffect/GroupCount.feature
+++ b/gremlin-test/features/sideEffect/GroupCount.feature
@@ -17,7 +17,7 @@
 
 Feature: Step - groupCount()
 
-  Scenario: Use has() with P.gt()
+  Scenario: Group count vertices that have incoming created edges by their name
     Given the modern graph
     And the traversal of
       """
@@ -27,3 +27,12 @@ Feature: Step - groupCount()
     Then the result should be ordered
       | map | {"ripple": 1, "lop": 3} |
 
+  Scenario: Group count vertices, cap to retrieve the map and unfold it to group count again
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().both().groupCount("a").out().cap("a").select(Column.keys).unfold().both().groupCount("a").cap("a")
+      """
+    When iterated to list
+    Then the result should be ordered
+      | map | {"v[marko]": 6, "v[vadas]": 2, "v[lop]": 6, "v[josh]": 6, "v[ripple]": 2, "v[peter]": 2} |
\ No newline at end of file


[29/47] tinkerpop git commit: TINKERPOP-1784 Added do nothings for unsupported tests

Posted by sp...@apache.org.
TINKERPOP-1784 Added do nothings for unsupported tests


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

Branch: refs/heads/TINKERPOP-1784
Commit: 00c3b9726448f7d03ce7705a82e15f941ddfdcdf
Parents: 4983fe4
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Sun Oct 1 07:28:31 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Oct 16 11:19:30 2017 -0400

----------------------------------------------------------------------
 .../src/main/jython/radish/feature_steps.py     |  2 +-
 gremlin-test/features/map/Vertex.feature        |  5 ++-
 .../features/sideEffect/GroupCount.feature      | 39 +++++++++-----------
 3 files changed, 23 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/00c3b972/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 340f84a..5b11ca1 100644
--- a/gremlin-python/src/main/jython/radish/feature_steps.py
+++ b/gremlin-python/src/main/jython/radish/feature_steps.py
@@ -82,7 +82,7 @@ def assert_result(step, characterized_as):
         raise ValueError("unknown data characterization of " + characterized_as)
 
 
-@then("nothing should happen")
+@then("nothing should happen because")
 def nothing_happening(step):
     return
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/00c3b972/gremlin-test/features/map/Vertex.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/map/Vertex.feature b/gremlin-test/features/map/Vertex.feature
index 37e398b..1c9849e 100644
--- a/gremlin-test/features/map/Vertex.feature
+++ b/gremlin-test/features/map/Vertex.feature
@@ -420,7 +420,10 @@ Feature: Step - V(), E(), out(), in(), both(), inE(), outE(), bothE()
 
   Scenario: g_VX1_2_3_4X_name
     Given an unsupported test
-    Then nothing should happen
+    Then nothing should happen because
+      """
+      the test manipulates a static dataset which is not supported by the language of the feature files"
+      """
 
   Scenario: g_V_hasLabelXpersonX_V_hasLabelXsoftwareX_name
     Given the modern graph

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/00c3b972/gremlin-test/features/sideEffect/GroupCount.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/sideEffect/GroupCount.feature b/gremlin-test/features/sideEffect/GroupCount.feature
index bfb7363..d68a964 100644
--- a/gremlin-test/features/sideEffect/GroupCount.feature
+++ b/gremlin-test/features/sideEffect/GroupCount.feature
@@ -17,7 +17,7 @@
 
 Feature: Step - groupCount()
 
-  Scenario: Group count vertices that have incoming created edges by their name
+  Scenario: g_V_outXcreatedX_groupCount_byXnameX
     Given the modern graph
     And the traversal of
       """
@@ -27,23 +27,20 @@ Feature: Step - groupCount()
     Then the result should be ordered
       | m[{"ripple": 1, "lop": 3}] |
 
-# NOT SUPPORTED UNTIL GRAPHSON 3.X WHICH HAS SUPPORT FOR NON-STRING KEYS
-#  Scenario: Edge count distribution
-#    Given the modern graph
-#    And the traversal of
-#      """
-#      g.V().groupCount().by(bothE().count())
-#      """
-#    When iterated to list
-#    Then the result should be ordered
-#      | m[{"d[1]": 3, "d[3]": 3}] |
-#
-#  Scenario: Group count vertices, cap to retrieve the map and unfold it to group count again
-#    Given the modern graph
-#    And the traversal of
-#      """
-#      g.V().both().groupCount("a").out().cap("a").select(Column.keys).unfold().both().groupCount("a").cap("a")
-#      """
-#    When iterated to list
-#    Then the result should be ordered
-#      | m[{"v[marko]": 6, "v[vadas]": 2, "v[lop]": 6, "v[josh]": 6, "v[ripple]": 2, "v[peter]": 2}] |
\ No newline at end of file
+  Scenario: g_V_groupCount_byXbothE_countX
+    Given an unsupported test
+    Then nothing should happen because
+      """
+      The result returned is not supported under GraphSON 2.x and therefore cannot be properly asserted. More
+      specifically it has vertex keys which basically get toString()'d under GraphSON 2.x. This test can be supported
+      with GraphSON 3.x.
+      """
+
+  Scenario: g_V_both_groupCountXaX_out_capXaX_selectXkeysX_unfold_both_groupCountXaX_capXaX
+    Given an unsupported test
+    Then nothing should happen because
+      """
+      The result returned is not supported under GraphSON 2.x and therefore cannot be properly asserted. More
+      specifically it has vertex keys which basically get toString()'d under GraphSON 2.x. This test can be supported
+      with GraphSON 3.x.
+      """
\ No newline at end of file


[13/47] tinkerpop git commit: Added some javadoc on Scoping as taken from the mailing list

Posted by sp...@apache.org.
Added some javadoc on Scoping as taken from the mailing list


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

Branch: refs/heads/TINKERPOP-1784
Commit: ea10316e744476b12a68a07491d0db2b028ec65c
Parents: 5e4ae46
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Oct 16 07:32:09 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Oct 16 07:32:09 2017 -0400

----------------------------------------------------------------------
 .../gremlin/process/traversal/step/Scoping.java | 71 ++++++++++++++++++++
 1 file changed, 71 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ea10316e/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Scoping.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Scoping.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Scoping.java
index 683e661..65cac93 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Scoping.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Scoping.java
@@ -30,6 +30,77 @@ import java.util.Set;
  * This interface is implemented by {@link Step} implementations that access labeled path steps, side-effects or
  * {@code Map} values by key, such as {@code select('a')} step. Note that a step like {@code project()} is non-scoping
  * because while it creates a {@code Map} it does not introspect them.
+ * <p/>
+ * There are four types of scopes:
+ * <ol>
+ *   <li>Current scope</li> — the current data referenced by the traverser (“path head”).
+ *   <li>Path scope</li> — a particular piece of data in the path of the traverser (“path history”).
+ *   <li>Side-effect scope</li> — a particular piece of data in the global traversal blackboard.
+ *   <li>Map scope</li> — a particular piece of data in the current scope map (“map value by key”).
+ * </ol>
+ *
+ * The current scope refers to the current object referenced by the traverser. That is, the {@code traverser.get()}
+ * object. Another way to think about the current scope is to think in terms of the path of the traverser where the
+ * current scope is the head of the path. With the math()-step, the variable {@code _} refers to the current scope.
+ *
+ * <pre>
+ * {@code
+ * gremlin> g.V().values("age").math("sin _")
+ * ==>-0.6636338842129675
+ * ==>0.956375928404503
+ * ==>0.5514266812416906
+ * ==>-0.428182669496151
+ * }
+ * </pre>
+ *
+ * The path scope refers to data previously seen by the traverser. That is, data in the traverser’s path history.
+ * Paths can be accessed by {@code path()}, however, individual parts of the path can be labeled using {@code as()}
+ * and accessed later via the path label name. Thus, in the traversal below, “a” and “b” refer to objects previously
+ * traversed by the traverser.
+ *
+ * <pre>
+ * {@code
+ * gremlin> g.V().as("a").out("knows").as("b”).
+ * math("a / b").by("age")
+ * ==>1.0740740740740742
+ * ==>0.90625
+ * }
+ * </pre>
+ *
+ * The side-effect scope refers objects in the global side-effects of the traversal. Side-effects are not local to the
+ * traverser, but instead, global to the traversal. In the traversal below you can see how “x” is being referenced in
+ * the math()-step and thus, the side-effect data is being used.
+ *
+ * <pre>
+ * {@code
+ * gremlin> g.withSideEffect("x",100).V().values("age").math("_ / x")
+ * ==>0.29
+ * ==>0.27
+ * ==>0.32
+ * ==>0.35
+ * }
+ * </pre>
+ *
+ * Map scope refers to objects within the current map object. Thus, its like current scope, but a bit “deeper.” In the
+ * traversal below the {@code project()}-step generates a map with keys “a” and “b”. The subsequent {@code math()}-step
+ * is then able to access the “a” and “b” values in the respective map and use them for the division operation.
+ *
+ * <pre>
+ * {@code gremlin>
+ * g.V().hasLabel("person”).
+ * project("a","b”).
+ *   by("age”).
+ *   by(bothE().count()).
+ * math("a / b")
+ * ==>9.666666666666666
+ * ==>27.0
+ * ==>10.666666666666666
+ * ==>35.0
+ * }
+ * </pre>
+ *
+ * Scoping is all about variable data access and forms the fundamental interface for access to the memory structures
+ * of Gremlin.
  *
  * @author Marko A. Rodriguez (http://markorodriguez.com)
  * @author Stephen Mallette (http://stephen.genoprime.com)


[22/47] tinkerpop git commit: TINKERPOP-1784 Added more select() tests

Posted by sp...@apache.org.
TINKERPOP-1784 Added more select() tests


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

Branch: refs/heads/TINKERPOP-1784
Commit: b582a22677d3facd68b56b644cf604a2eb1fa67f
Parents: 2a2a643
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Oct 5 11:49:19 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Oct 16 11:19:30 2017 -0400

----------------------------------------------------------------------
 .../src/main/jython/radish/feature_steps.py     |  10 +-
 gremlin-test/features/map/Select.feature        | 158 ++++++++++++++++++-
 2 files changed, 163 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b582a226/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 16120f6..a2efb67 100644
--- a/gremlin-python/src/main/jython/radish/feature_steps.py
+++ b/gremlin-python/src/main/jython/radish/feature_steps.py
@@ -21,13 +21,13 @@ import json
 import re
 from gremlin_python.structure.graph import Graph
 from gremlin_python.process.graph_traversal import __
-from gremlin_python.process.traversal import P, Scope, Column, Direction, T
+from gremlin_python.process.traversal import P, Scope, Column, Order, Direction, T
 from radish import given, when, then
 from hamcrest import *
 
-regex_as = re.compile(r"([(.])as\(")
-regex_in = re.compile(r"([(.])in\(")
-regex_is = re.compile(r"([(.])is\(")
+regex_as = re.compile(r"([(.,\s])as\(")
+regex_in = re.compile(r"([(.,\s])in\(")
+regex_is = re.compile(r"([(.,\s])is\(")
 
 
 @given("the {graph_name:w} graph")
@@ -57,10 +57,12 @@ def translate_traversal(step):
          "__": __,
          "Column": Column,
          "Direction": Direction,
+         "Order": Order,
          "P": P,
          "gt": P.gt,
          "Scope": Scope,
          "T": T,
+         "as_": __.as_,
          "bothE": __.bothE,
          "in_": __.in_,
          "out": __.out,

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b582a226/gremlin-test/features/map/Select.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/map/Select.feature b/gremlin-test/features/map/Select.feature
index 13114d5..9df72a8 100644
--- a/gremlin-test/features/map/Select.feature
+++ b/gremlin-test/features/map/Select.feature
@@ -108,4 +108,160 @@ Feature: Step - select()
       | m[{"a": "josh", "b": "josh"}] |
       | m[{"a": "ripple", "b": "ripple"}] |
       | m[{"a": "lop", "b": "lop"}] |
-      | m[{"a": "peter", "b": "peter"}] |
\ No newline at end of file
+      | m[{"a": "peter", "b": "peter"}] |
+
+  Scenario: g_V_hasXname_gremlinX_inEXusesX_order_byXskill_incrX_asXaX_outV_asXbX_selectXa_bX_byXskillX_byXnameX
+    Given the crew graph
+    And the traversal of
+      """
+      g.V().has("name", "gremlin").inE("uses").order().by("skill", Order.incr).as("a").outV().as("b").select("a", "b").by("skill").by("name")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | m[{"a": 3, "b": "matthias"}] |
+      | m[{"a": 4, "b": "marko"}] |
+      | m[{"a": 5, "b": "stephen"}] |
+      | m[{"a": 5, "b": "daniel"}] |
+
+  Scenario: g_V_hasXname_isXmarkoXX_asXaX_selectXaX
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().has("name", __.is("marko")).as("a").select("a")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | v[marko] |
+
+  Scenario: g_V_label_groupCount_asXxX_selectXxX
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().label().groupCount().as("x").select("x")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | m[{"software": 2, "person": 4}] |
+
+  Scenario: g_V_hasLabelXpersonX_asXpX_mapXbothE_label_groupCountX_asXrX_selectXp_rX
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().hasLabel("person").as("p").map(__.bothE().label().groupCount()).as("r").select("p", "r")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | m[{"p": "v[marko]", "r": {"created": 1, "knows": 2}}] |
+      | m[{"p": "v[vadas]", "r": {"knows": 1}}] |
+      | m[{"p": "v[josh]", "r": {"created": 2, "knows": 1}}] |
+      | m[{"p": "v[peter]", "r": {"created": 1}}] |
+
+  Scenario: g_V_chooseXoutE_count_isX0X__asXaX__asXbXX_chooseXselectXaX__selectXaX__selectXbXX
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().choose(__.outE().count().is(0L), __.as("a"), __.as("b")).choose(__.select("a"), __.select("a"), __.select("b"))
+      """
+    When iterated to list
+    Then the result should be unordered
+      | v[marko] |
+      | v[vadas] |
+      | v[lop] |
+      | v[josh] |
+      | v[ripple] |
+      | v[peter] |
+
+  Scenario: g_VX1X_asXhereX_out_selectXhereX
+    Given the modern graph
+    And using the parameter v1Id is "v[marko].id"
+    And the traversal of
+      """
+      g.V(v1Id).as("here").out().select("here")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | v[marko] |
+      | v[marko] |
+      | v[marko] |
+
+  Scenario: g_VX4X_out_asXhereX_hasXlang_javaX_selectXhereX
+    Given the modern graph
+    And using the parameter v4Id is "v[josh].id"
+    And the traversal of
+      """
+      g.V(v4Id).as("here").out().select("here")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | v[josh] |
+      | v[josh] |
+
+  Scenario: g_VX4X_out_asXhereX_hasXlang_javaX_selectXhereX_name
+    Given the modern graph
+    And using the parameter v4Id is "v[josh].id"
+    And the traversal of
+      """
+      g.V(v4Id).out().as("here").has("lang", "java").select("here").values("name")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | ripple |
+      | lop |
+
+  Scenario: g_VX1X_outE_asXhereX_inV_hasXname_vadasX_selectXhereX
+    Given the modern graph
+    And using the parameter v1Id is "v[marko].id"
+    And the traversal of
+      """
+      g.V(v1Id).outE().as("here").inV().has("name", "vadas").select("here")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | e[marko-knows->vadas] |
+
+  Scenario: g_VX1X_outEXknowsX_hasXweight_1X_asXhereX_inV_hasXname_joshX_selectXhereX
+    Given the modern graph
+    And using the parameter v1Id is "v[marko].id"
+    And the traversal of
+      """
+      g.V(v1Id).outE("knows").has("weight", 1.0).as("here").inV().has("name", "josh").select("here")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | e[marko-knows->josh] |
+
+  Scenario: g_VX1X_outEXknowsX_asXhereX_hasXweight_1X_asXfakeX_inV_hasXname_joshX_selectXhereX
+    Given the modern graph
+    And using the parameter v1Id is "v[marko].id"
+    And the traversal of
+      """
+      g.V(v1Id).outE("knows").as("here").has("weight", 1.0).as("fake").inV().has("name", "josh").select("here")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | e[marko-knows->josh] |
+
+  Scenario: g_V_asXhereXout_name_selectXhereX
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().as("here").out().values("name").select("here")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | v[marko] |
+      | v[marko] |
+      | v[marko] |
+      | v[josh] |
+      | v[josh] |
+      | v[peter] |
+
+  Scenario: g_V_outXcreatedX_unionXasXprojectX_inXcreatedX_hasXname_markoX_selectXprojectX__asXprojectX_inXcreatedX_inXknowsX_hasXname_markoX_selectXprojectXX_groupCount_byXnameX
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().out("created").union(as("project").in("created").has("name", "marko").select("project"),as("project").in("created").in("knows").has("name", "marko").select("project")).groupCount().by("name")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | m[{"ripple": 1, "lop": 6}] |
\ No newline at end of file