You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by da...@apache.org on 2016/10/07 15:06:41 UTC

[01/36] tinkerpop git commit: Tweaked `gremlin.sh` so that it can be started from anywhere. [Forced Update!]

Repository: tinkerpop
Updated Branches:
  refs/heads/TINKERPOP-1458 a80b7cde7 -> 5d70a4636 (forced update)


Tweaked `gremlin.sh` so that it can be started from anywhere.

Removed all shell scripts that just forwarded the command to another script and added symbolic links instead.


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

Branch: refs/heads/TINKERPOP-1458
Commit: 9e0244ef4275cf7d782949352a0185e4e5bda253
Parents: 0070d3d
Author: Daniel Kuppitz <da...@hotmail.com>
Authored: Wed Sep 28 22:13:56 2016 +0200
Committer: Daniel Kuppitz <da...@hotmail.com>
Committed: Thu Sep 29 11:44:16 2016 +0200

----------------------------------------------------------------------
 bin/gremlin.sh                          | 23 +---------------------
 docs/src/dev/developer/release.asciidoc |  4 +++-
 gremlin-console/bin/gremlin.sh          | 25 +-----------------------
 gremlin-console/src/main/bin/gremlin.sh | 29 ++++++++++++++++------------
 4 files changed, 22 insertions(+), 59 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9e0244ef/bin/gremlin.sh
----------------------------------------------------------------------
diff --git a/bin/gremlin.sh b/bin/gremlin.sh
deleted file mode 100755
index 512f71f..0000000
--- a/bin/gremlin.sh
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/bash
-#
-#
-# 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.
-#
-
-`dirname $0`/../gremlin-console/bin/gremlin.sh $@
diff --git a/bin/gremlin.sh b/bin/gremlin.sh
new file mode 120000
index 0000000..e99f01d
--- /dev/null
+++ b/bin/gremlin.sh
@@ -0,0 +1 @@
+../gremlin-console/bin/gremlin.sh
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9e0244ef/docs/src/dev/developer/release.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/dev/developer/release.asciidoc b/docs/src/dev/developer/release.asciidoc
index f9baa94..b066dd0 100644
--- a/docs/src/dev/developer/release.asciidoc
+++ b/docs/src/dev/developer/release.asciidoc
@@ -75,11 +75,13 @@ might be high.
 .. `mvn verify -DskipPerformanceTests=false`
 . `bin/publish-docs.sh <username>` - note that under a release candidate the documentation is published as SNAPSHOT
 . `mvn versions:set -DnewVersion=xx.yy.zz -DgenerateBackupPoms=false` to update the project files to reference a non-SNAPSHOT version
+. `pushd gremlin-console/bin; ln -fs ../target/apache-tinkerpop-gremlin-console-xx.yy.zz-standalone/bin/gremlin.sh gremlin.sh; popd`
 . `git diff` and review the updated files (expect all `pom.xml` files and this README)
 . `git commit -a -m "TinkerPop xx.yy.zz release"` and `git push`
 . `git tag -a -m "TinkerPop xx.yy.zz release" xx.yy.zz` and `git push --tags`
 . `mvn clean install`
 . `mvn versions:set -DnewVersion=xx.yy.zz-SNAPSHOT -DgenerateBackupPoms=false` to go back to SNAPSHOT
+. `pushd gremlin-console/bin; ln -fs ../target/apache-tinkerpop-gremlin-console-xx.yy.zz-SNAPSHOT-standalone/bin/gremlin.sh gremlin.sh; popd`
 . `git commit -a -m "Returned to xx.yy.zz-SNAPSHOT"` and `git push`
 . Announce the release candidate to `dev` mailing list and await feedback
 . Repeat as required or proceed to the next phase
@@ -267,4 +269,4 @@ The Central Maven repo has sync'd as well:
 https://repo1.maven.org/maven2/org/apache/tinkerpop/tinkerpop/xx.yy.zz/
 
 [include the release line logo image]
-----
\ No newline at end of file
+----

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9e0244ef/gremlin-console/bin/gremlin.sh
----------------------------------------------------------------------
diff --git a/gremlin-console/bin/gremlin.sh b/gremlin-console/bin/gremlin.sh
deleted file mode 100755
index d0d3240..0000000
--- a/gremlin-console/bin/gremlin.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/bash
-#
-#
-# 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.
-#
-
-OPTS=$@
-set JAVA_OPTIONS="-Dtinkerpop.ext=/../target/apache-tinkerpop-gremlin-*-standalone/ext -Dlog4j.configuration=conf/log4j-console.properties -Dgremlin.log4j.level=$GREMLIN_LOG_LEVEL"
-`dirname $0`/../target/apache-tinkerpop-gremlin-*-standalone/bin/gremlin.sh $OPTS
diff --git a/gremlin-console/bin/gremlin.sh b/gremlin-console/bin/gremlin.sh
new file mode 120000
index 0000000..5825879
--- /dev/null
+++ b/gremlin-console/bin/gremlin.sh
@@ -0,0 +1 @@
+../target/apache-tinkerpop-gremlin-console-3.1.5-SNAPSHOT-standalone/bin/gremlin.sh
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9e0244ef/gremlin-console/src/main/bin/gremlin.sh
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/bin/gremlin.sh b/gremlin-console/src/main/bin/gremlin.sh
index fe28773..dfcd325 100755
--- a/gremlin-console/src/main/bin/gremlin.sh
+++ b/gremlin-console/src/main/bin/gremlin.sh
@@ -23,7 +23,19 @@ set -e
 set -u
 
 DIR="$( cd -P "$( dirname "$0" )" && pwd )"
-SYSTEM_EXT_DIR="${DIR}/../ext"
+
+SOURCE="${BASH_SOURCE[0]}"
+while [ -h "$SOURCE" ]; do
+  DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
+  SOURCE="$(readlink "$SOURCE")"
+  [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
+done
+
+WORKING_DIR="$( cd -P "${DIR}/.." && pwd )"
+SYSTEM_EXT_DIR="${WORKING_DIR}/ext"
+
+pushd ${WORKING_DIR} > /dev/null
+
 JAVA_OPTIONS=${JAVA_OPTIONS:-}
 
 if [ ! -z "${JAVA_OPTIONS}" ]; then
@@ -36,21 +48,12 @@ fi
 
 case `uname` in
   CYGWIN*)
-    CP="`dirname $0`"/../conf
-    CP="$CP":$( echo `dirname $0`/../lib/*.jar . | sed 's/ /;/g')
+    CP="$CP";$( echo lib/*.jar . | sed 's/ /;/g')
     ;;
   *)
-    CP="`dirname $0`"/../conf
-    CP="$CP":$( echo `dirname $0`/../lib/*.jar . | sed 's/ /:/g')
+    CP="$CP":$( echo lib/*.jar . | sed 's/ /:/g')
 esac
 
-SOURCE="${BASH_SOURCE[0]}"
-while [ -h "$SOURCE" ]; do
-  DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
-  SOURCE="$(readlink "$SOURCE")"
-  [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
-done
-
 CP=$CP:$( find -L "${SYSTEM_EXT_DIR}" "${USER_EXT_DIR:-${SYSTEM_EXT_DIR}}" -mindepth 1 -maxdepth 1 -type d | \
           sort -u | sed 's/$/\/plugin\/*/' | tr '\n' ':' )
 
@@ -111,3 +114,5 @@ fi
 
 # Start the JVM, execute the application, and return its exit code
 exec $JAVA $JAVA_OPTIONS $MAIN_CLASS "$@"
+
+popd > /dev/null


[07/36] tinkerpop git commit: updated gremlin-variants.asciidoc with new withStrategy()/withoutStrategy() method discussion. Built docs. Success.

Posted by da...@apache.org.
updated gremlin-variants.asciidoc with new withStrategy()/withoutStrategy() method discussion. Built docs. Success.


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

Branch: refs/heads/TINKERPOP-1458
Commit: 20dec2076b79441c7dcf06827014ace72fcaea6c
Parents: 95557bf
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Tue Oct 4 12:15:31 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Tue Oct 4 12:15:31 2016 -0600

----------------------------------------------------------------------
 docs/src/reference/gremlin-variants.asciidoc     | 19 +++++++++++++++++++
 .../gremlin/groovy/jsr223/GroovyTranslator.java  |  5 ++++-
 .../gremlin/python/jsr223/PythonTranslator.java  |  3 +++
 .../driver/test_driver_remote_connection.py      |  2 +-
 4 files changed, 27 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/20dec207/docs/src/reference/gremlin-variants.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/gremlin-variants.asciidoc b/docs/src/reference/gremlin-variants.asciidoc
index bf9df2e..1d4099e 100644
--- a/docs/src/reference/gremlin-variants.asciidoc
+++ b/docs/src/reference/gremlin-variants.asciidoc
@@ -224,6 +224,25 @@ in statically typed languages where bindings need to have the same typing as the
 it is possible to use the `withBindings()`-model as Gremlin-Python's `Bindings.of()` simply returns a 2-tuple of `(str,object)`
 (see <<connecting-via-remotegraph,`Bindings`>>).
 
+Traversal Strategies
+~~~~~~~~~~~~~~~~~~~~
+
+In order to add and remove <<traversalstrategy,traversal strategies>> from a traversal source, the `withStrategy()` and
+`withoutStrategy()` steps should be used.
+
+[gremlin-python,modern]
+----
+g = g.withStrategy('org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SubgraphStrategy','vertices',__.hasLabel('person'),'edges',__.has('weight',gt(0.5)))
+g.V().name.toList()
+g.V().outE().valueMap(True).toList()
+g = g.withoutStrategy('org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SubgraphStrategy')
+g.V().name.toList()
+g.V().outE().valueMap(True).toList()
+----
+
+IMPORTANT: While Gremlin is language agnostic, the executing traversal machine typically is not. Thus, strategies are
+traversal machine dependent and identified by the class name in the traversal machine's implementation language.
+
 The Lambda Solution
 ~~~~~~~~~~~~~~~~~~~
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/20dec207/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
index facb24f..aba78bb 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
@@ -19,6 +19,7 @@
 
 package org.apache.tinkerpop.gremlin.groovy.jsr223;
 
+import org.apache.tinkerpop.gremlin.process.computer.Computer;
 import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
 import org.apache.tinkerpop.gremlin.process.traversal.P;
 import org.apache.tinkerpop.gremlin.process.traversal.SackFunctions;
@@ -79,7 +80,7 @@ public final class GroovyTranslator implements Translator.ScriptTranslator {
         final StringBuilder traversalScript = new StringBuilder(start);
         for (final Bytecode.Instruction instruction : bytecode.getInstructions()) {
             final String methodName = instruction.getOperator();
-            if (IS_TESTING && methodName.equals(TraversalSource.Symbols.withStrategies))
+            if(IS_TESTING && methodName.equals(TraversalSource.Symbols.withStrategies))
                 continue;
             if (0 == instruction.getArguments().length)
                 traversalScript.append(".").append(methodName).append("()");
@@ -126,6 +127,8 @@ public final class GroovyTranslator implements Translator.ScriptTranslator {
             return ((Enum) object).getDeclaringClass().getSimpleName() + "." + object.toString();
         else if (object instanceof Element)
             return convertToString(((Element) object).id()); // hack
+        else if (object instanceof Computer)
+            return "";
         else if (object instanceof Lambda) {
             final String lambdaString = ((Lambda) object).getLambdaScript().trim();
             return lambdaString.startsWith("{") ? lambdaString : "{" + lambdaString + "}";

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/20dec207/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonTranslator.java
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonTranslator.java b/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonTranslator.java
index 19302e8..4744649 100644
--- a/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonTranslator.java
+++ b/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonTranslator.java
@@ -19,6 +19,7 @@
 
 package org.apache.tinkerpop.gremlin.python.jsr223;
 
+import org.apache.tinkerpop.gremlin.process.computer.Computer;
 import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
 import org.apache.tinkerpop.gremlin.process.traversal.Operator;
 import org.apache.tinkerpop.gremlin.process.traversal.P;
@@ -157,6 +158,8 @@ public class PythonTranslator implements Translator.ScriptTranslator {
             return convertToString(((Element) object).id()); // hack
         else if (object instanceof Bytecode)
             return this.internalTranslate("__", (Bytecode) object);
+        else if (object instanceof Computer)
+            return "";
         else if (object instanceof Lambda)
             return convertLambdaToString((Lambda) object);
         else

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/20dec207/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py b/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
index 81ee886..9914197 100644
--- a/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
+++ b/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
@@ -72,7 +72,7 @@ class TestDriverRemoteConnection(TestCase):
         assert 1 == g.V().label().dedup().count().next()
         assert "person" == g.V().label().dedup().next()
         #
-        g = g.withComputer("workers", 4, "vertices", __.has("name", "marko"))
+        g = g.withoutStrategy("org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SubgraphStrategy").withComputer("workers", 4, "vertices", __.has("name", "marko"), "edges", __.limit(0))
         assert 1 == g.V().count().next()
         assert 0 == g.E().count().next()
         assert "person" == g.V().label().next()


[36/36] tinkerpop git commit: removed extra lines

Posted by da...@apache.org.
removed extra lines


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

Branch: refs/heads/TINKERPOP-1458
Commit: 871f6f660875333d271af62da152b67c77ac0126
Parents: e540aab
Author: davebshow <da...@gmail.com>
Authored: Wed Oct 5 18:06:02 2016 -0400
Committer: davebshow <da...@gmail.com>
Committed: Fri Oct 7 11:06:08 2016 -0400

----------------------------------------------------------------------
 .../tinkerpop/gremlin/server/GremlinServerIntegrateTest.java      | 3 ---
 1 file changed, 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/871f6f66/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
index 1c4d19e..f810ebc 100644
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
@@ -914,6 +914,3 @@ public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegration
         assertThat(error, is(true));
     }
 }
-
-
-


[02/36] tinkerpop git commit: Fixed unbound variable errors.

Posted by da...@apache.org.
Fixed unbound variable errors.


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

Branch: refs/heads/TINKERPOP-1458
Commit: f09e5a0a18984fc175c8a8670b06862eeae6262a
Parents: 9e0244e
Author: Daniel Kuppitz <da...@hotmail.com>
Authored: Thu Sep 29 13:39:22 2016 +0200
Committer: Daniel Kuppitz <da...@hotmail.com>
Committed: Thu Sep 29 13:39:22 2016 +0200

----------------------------------------------------------------------
 gremlin-console/src/main/bin/gremlin.sh | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f09e5a0a/gremlin-console/src/main/bin/gremlin.sh
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/bin/gremlin.sh b/gremlin-console/src/main/bin/gremlin.sh
index dfcd325..e47d94e 100755
--- a/gremlin-console/src/main/bin/gremlin.sh
+++ b/gremlin-console/src/main/bin/gremlin.sh
@@ -22,13 +22,14 @@
 set -e
 set -u
 
-DIR="$( cd -P "$( dirname "$0" )" && pwd )"
-
-SOURCE="${BASH_SOURCE[0]}"
-while [ -h "$SOURCE" ]; do
-  DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
-  SOURCE="$(readlink "$SOURCE")"
-  [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
+cd $(dirname $0)
+DIR=`pwd`
+
+SCRIPT_NAME=`basename $0`
+while [ -h "${SCRIPT_NAME}" ]; do
+  SOURCE="$(readlink "${SCRIPT_NAME}")"
+  DIR="$( cd -P "$( dirname "${SOURCE}" )" && pwd )"
+  cd ${DIR}
 done
 
 WORKING_DIR="$( cd -P "${DIR}/.." && pwd )"
@@ -48,10 +49,10 @@ fi
 
 case `uname` in
   CYGWIN*)
-    CP="$CP";$( echo lib/*.jar . | sed 's/ /;/g')
+    CP="${CP:-}";$( echo lib/*.jar . | sed 's/ /;/g')
     ;;
   *)
-    CP="$CP":$( echo lib/*.jar . | sed 's/ /:/g')
+    CP="${CP:-}":$( echo lib/*.jar . | sed 's/ /:/g')
 esac
 
 CP=$CP:$( find -L "${SYSTEM_EXT_DIR}" "${USER_EXT_DIR:-${SYSTEM_EXT_DIR}}" -mindepth 1 -maxdepth 1 -type d | \


[22/36] tinkerpop git commit: updated the docs on BarrierStep as they discuss LazyBarrierStrategy as a non-default strategy.

Posted by da...@apache.org.
updated the docs on BarrierStep as they discuss LazyBarrierStrategy as a non-default strategy.


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

Branch: refs/heads/TINKERPOP-1458
Commit: c6b49f2e9b309862f614eb0174ae377f4b75e264
Parents: dbc905c
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Fri Oct 7 07:17:41 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Fri Oct 7 07:17:41 2016 -0600

----------------------------------------------------------------------
 docs/src/reference/the-traversal.asciidoc | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c6b49f2e/docs/src/reference/the-traversal.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/the-traversal.asciidoc b/docs/src/reference/the-traversal.asciidoc
index 55963f4..9cbbe6c 100644
--- a/docs/src/reference/the-traversal.asciidoc
+++ b/docs/src/reference/the-traversal.asciidoc
@@ -339,32 +339,34 @@ made more salient on a larger graph. Therefore, the example below leverages the
 ----
 graph = TinkerGraph.open()
 graph.io(graphml()).readGraph('data/grateful-dead.xml')
-g = graph.traversal()
-clockWithResult(1){g.V().both().both().both().count().next()} <1>
-clockWithResult(1){g.V().repeat(both()).times(3).count().next()} <2>
-clockWithResult(1){g.V().both().barrier().both().barrier().both().barrier().count().next()} <3>
+g = graph.traversal().withoutStrategies(LazyBarrierStrategy) <1>
+clockWithResult(1){g.V().both().both().both().count().next()} <2>
+clockWithResult(1){g.V().repeat(both()).times(3).count().next()} <3>
+clockWithResult(1){g.V().both().barrier().both().barrier().both().barrier().count().next()} <4>
 ----
 
-<1> A non-bulking traversal where each traverser is processed.
-<2> Each traverser entering `repeat()` has its recursion bulked.
-<3> A bulking traversal where implicit traversers are not processed.
+<1> Explicitly remove `LazyBarrierStrategy` which yields a bulking optimization.
+<2> A non-bulking traversal where each traverser is processed.
+<3> Each traverser entering `repeat()` has its recursion bulked.
+<4> A bulking traversal where implicit traversers are not processed.
 
 If `barrier()` is provided an integer argument, then the barrier will only hold `n`-number of unique traversers in its
 barrier before draining the aggregated traversers to the next step. This is useful in the aforementioned bulking
-optimization scenario, but reduces the risk of an out-of-memory exception.
+optimization scenario with the added benefit of reducing the risk of an out-of-memory exception.
 
-The non-default `LazyBarrierStrategy` inserts `barrier()`-steps in a traversal where appropriate in order to gain the
+`LazyBarrierStrategy` inserts `barrier()`-steps into a traversal where appropriate in order to gain the
 "bulking optimization."
 
 [gremlin-groovy]
 ----
 graph = TinkerGraph.open()
 graph.io(graphml()).readGraph('data/grateful-dead.xml')
-g = graph.traversal().withStrategies(LazyBarrierStrategy.instance())
+g = graph.traversal() <1>
 clockWithResult(1){g.V().both().both().both().count().next()}
-g.V().both().both().both().count().iterate().toString()  <1>
+g.V().both().both().both().count().iterate().toString()  <2>
 ----
 
+<1> `LazyBarrierStrategy` is a default strategy and thus, does not need to be explicitly activated.
 <1> With `LazyBarrierStrategy` activated, `barrier()` steps are automatically inserted where appropriate.
 
 [[by-step]]


[14/36] tinkerpop git commit: Merge branch 'TINKERPOP-1455'

Posted by da...@apache.org.
Merge branch 'TINKERPOP-1455'


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

Branch: refs/heads/TINKERPOP-1458
Commit: 8e4f3e0e4dd98fb8d7d55eeefaf601b85278c8cb
Parents: d43d4e0 894ff3d
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Thu Oct 6 11:27:58 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Thu Oct 6 11:27:58 2016 -0600

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |  10 ++
 docs/src/reference/gremlin-variants.asciidoc    |  19 +++
 .../upgrade/release-3.2.x-incubating.asciidoc   |  73 +++++++++++
 .../gremlin/jsr223/JavaTranslator.java          |  58 ++++++---
 .../gremlin/process/computer/Computer.java      |  59 +++++++++
 .../computer/util/GraphComputerHelper.java      |  25 ++++
 .../gremlin/process/traversal/Bindings.java     |   5 +
 .../gremlin/process/traversal/Bytecode.java     |  72 ++++++++---
 .../process/traversal/TraversalSource.java      | 111 +++++++++++------
 .../process/traversal/TraversalStrategy.java    |  13 ++
 .../dsl/graph/GraphTraversalSource.java         |  39 ++++--
 .../strategy/decoration/ElementIdStrategy.java  |  27 ++++-
 .../decoration/HaltedTraverserStrategy.java     |  23 ++++
 .../strategy/decoration/PartitionStrategy.java  |  79 ++++++++++--
 .../strategy/decoration/SubgraphStrategy.java   |  53 ++++++--
 .../finalization/MatchAlgorithmStrategy.java    |  24 ++++
 .../StandardVerificationStrategy.java           |   1 +
 .../gremlin/jsr223/JavaTranslatorTest.java      |  68 +++++++++++
 .../gremlin/process/traversal/BytecodeTest.java |  42 +++++++
 .../dsl/graph/GraphTraversalSourceTest.java     |  28 +++++
 .../groovy/jsr223/GroovyTranslatorTest.java     |  37 +++++-
 .../gremlin/groovy/jsr223/GroovyTranslator.java |  39 ++++--
 .../python/TraversalSourceGenerator.groovy      |  17 ++-
 .../jsr223/GremlinJythonScriptEngine.java       |   9 +-
 .../gremlin/python/jsr223/PythonTranslator.java |  30 ++++-
 .../jython/gremlin_python/process/traversal.py  |  17 ++-
 .../gremlin_python/structure/io/graphson.py     |   5 +-
 .../driver/test_driver_remote_connection.py     |  25 +++-
 .../python/jsr223/JythonTranslatorTest.java     |  34 ++++++
 .../PartitionStrategyProcessTest.java           | 121 +++++++++----------
 .../decoration/SubgraphStrategyProcessTest.java |  48 ++++----
 .../process/TinkerGraphComputerProvider.java    |  10 +-
 .../TinkerGraphGroovyTranslatorProvider.java    |   3 +
 .../TinkerGraphJavaTranslatorProvider.java      |   3 +
 .../decoration/HaltedTraverserStrategyTest.java |  10 +-
 35 files changed, 1017 insertions(+), 220 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8e4f3e0e/CHANGELOG.asciidoc
----------------------------------------------------------------------


[03/36] tinkerpop git commit: Added missing steps in PMC VOTE section.

Posted by da...@apache.org.
Added missing steps in PMC VOTE section.


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

Branch: refs/heads/TINKERPOP-1458
Commit: bac5b0d02613c2fb323e0a1460cfe414f833241c
Parents: f09e5a0
Author: Daniel Kuppitz <da...@hotmail.com>
Authored: Thu Sep 29 13:50:12 2016 +0200
Committer: Daniel Kuppitz <da...@hotmail.com>
Committed: Thu Sep 29 13:50:12 2016 +0200

----------------------------------------------------------------------
 docs/src/dev/developer/release.asciidoc | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bac5b0d0/docs/src/dev/developer/release.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/dev/developer/release.asciidoc b/docs/src/dev/developer/release.asciidoc
index b066dd0..1bf67a9 100644
--- a/docs/src/dev/developer/release.asciidoc
+++ b/docs/src/dev/developer/release.asciidoc
@@ -109,6 +109,7 @@ current release was under development as this new release will have those change
 .. Update the release date.
 .. Update the link to `CHANGELOG.asciidoc` - this link may already be correct but will not exist until the repository is tagged.
 . `mvn versions:set -DnewVersion=xx.yy.zz -DgenerateBackupPoms=false` to update project files to reference the non-SNAPSHOT version
+. `pushd gremlin-console/bin; ln -fs ../target/apache-tinkerpop-gremlin-console-xx.yy.zz-standalone/bin/gremlin.sh gremlin.sh; popd`
 . `git diff` and review the updated files (expect all `pom.xml` files and this README)
 . `git commit -a -m "TinkerPop xx.yy.zz release"` and push
 . `mvn clean install` - need to build first so that the right version of the console is used with `bin/publish-docs.sh`
@@ -135,6 +136,7 @@ for generating javadoc and without that the binary distributions won't contain t
 . Prepare Git administration tasks. Note that this work can be performed at the release manager's discretion. It may be wise to wait until a successful VOTE is eminent before reopening development. Apply the following steps as needed per release branch:
 .. Make the appropriate branching changes as required by the release and bump the version to `SNAPSHOT` with
 `mvn versions:set -DnewVersion=xx.yy.zz-SNAPSHOT -DgenerateBackupPoms=false`.
+.. `pushd gremlin-console/bin; ln -fs ../target/apache-tinkerpop-gremlin-console-xx.yy.zz-SNAPSHOT-standalone/bin/gremlin.sh gremlin.sh; popd`
 .. Update CHANGELOG and upgrade docs to have the appropriate headers for the next version.
 .. `mvn clean install -DskipTests` - need to build first so that the right version of the console is used with `bin/publish-docs.sh`
 .. `mvn deploy` - deploy the new `SNAPSHOT`


[31/36] tinkerpop git commit: updated driver to cache side effects locally

Posted by da...@apache.org.
updated driver to cache side effects locally


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

Branch: refs/heads/TINKERPOP-1458
Commit: e540aabe2f420da55f6a5ac49fadc605a8596294
Parents: 8e67ddc
Author: davebshow <da...@gmail.com>
Authored: Wed Oct 5 18:00:27 2016 -0400
Committer: davebshow <da...@gmail.com>
Committed: Fri Oct 7 11:05:44 2016 -0400

----------------------------------------------------------------------
 .../gremlin_python/driver/remote_connection.py  | 26 ++++++++++----
 .../driver/test_driver_remote_connection.py     | 38 +++++++++++++++++---
 2 files changed, 53 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e540aabe/gremlin-python/src/main/jython/gremlin_python/driver/remote_connection.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/gremlin_python/driver/remote_connection.py b/gremlin-python/src/main/jython/gremlin_python/driver/remote_connection.py
index 3e7293f..46fb760 100644
--- a/gremlin-python/src/main/jython/gremlin_python/driver/remote_connection.py
+++ b/gremlin-python/src/main/jython/gremlin_python/driver/remote_connection.py
@@ -58,18 +58,32 @@ class RemoteTraversal(Traversal):
 
 class RemoteTraversalSideEffects(TraversalSideEffects):
     def __init__(self, keys_lambda, value_lambda, close_lambda):
-        self.keys_lambda = keys_lambda
-        self.value_lambda = value_lambda
-        self.close_lambda = close_lambda
+        self._keys_lambda = keys_lambda
+        self._value_lambda = value_lambda
+        self._close_lambda = close_lambda
+        self._keys = set()
+        self._side_effects = {}
+        self._closed = False
 
     def keys(self):
-        return self.keys_lambda()
+        if not self._closed:
+            self._keys = self._keys_lambda()
+        return self._keys
 
     def get(self, key):
-        return self.value_lambda(key)
+        if not self._side_effects.get(key):
+            if not self._closed:
+                results = self._value_lambda(key)
+                self._side_effects[key] = results
+                self._keys.add(key)
+            else:
+                return None
+        return self._side_effects[key]
 
     def close(self):
-        return self.close_lambda()
+        results = self._close_lambda()
+        self._closed = True
+        return results
 
 
 class RemoteStrategy(TraversalStrategy):

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e540aabe/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py b/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
index 13cf51d..8b51c20 100644
--- a/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
+++ b/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
@@ -140,11 +140,39 @@ class TestDriverRemoteConnection(TestCase):
             raise Exception("Accessing a non-existent key should throw an error")
         except KeyError:
             pass
-        result = t.side_effects.close()
-        assert not result
-        with pytest.raises(KeyError):
-            x = t.side_effects['m']
-        connection.close()
+
+    def test_side_effect_close(self):
+        connection = DriverRemoteConnection('ws://localhost:8182/gremlin', 'g')
+        g = Graph().traversal().withRemote(connection)
+        t = g.V().aggregate('a').aggregate('b')
+        t.toList()
+
+        # The 'a' key should return some side effects
+        results = t.side_effects.get('a')
+        assert results
+
+        # Close result is None
+        results = t.side_effects.close()
+        assert not results
+
+        # Shouldn't get any new info from server
+        # 'b' isn't in local cache
+        results = t.side_effects.get('b')
+        assert not results
+
+        # But 'a' should still be cached locally
+        results = t.side_effects.get('a')
+        assert results
+
+        # 'a' should have been added to local keys cache, but not 'b'
+        results = t.side_effects.keys()
+        assert len(results) == 1
+        a, = results
+        assert a == 'a'
+
+        # Try to get 'b' directly from server, should throw error
+        with pytest.raises(Exception):
+            t.side_effects.value_lambda('b')
 
 
 if __name__ == '__main__':


[11/36] tinkerpop git commit: changed the deprecated note.

Posted by da...@apache.org.
changed the deprecated note.


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

Branch: refs/heads/TINKERPOP-1458
Commit: 523ca1a4211b151e6a473de7476578ced73a3d39
Parents: 71c7bec
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Wed Oct 5 07:09:35 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Wed Oct 5 07:09:35 2016 -0600

----------------------------------------------------------------------
 .../process/traversal/strategy/decoration/PartitionStrategy.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/523ca1a4/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategy.java
index ef424c7..1fa4105 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategy.java
@@ -404,7 +404,7 @@ public final class PartitionStrategy extends AbstractTraversalStrategy<Traversal
          * Specifies the partition of the graph to read from.  It is possible to assign multiple partition keys so
          * as to read from multiple partitions at the same time.
          *
-         * @deprecated Since 3.2.3. Use {@link Builder#readPartitions} instead
+         * @deprecated As of release 3.2.3, replaced by {@link Builder#readPartitions(List)}.
          */
         @Deprecated
         public Builder addReadPartition(final String readPartition) {


[09/36] tinkerpop git commit: LazyBarrierStrategy is now a default strategy and is smart about labels, retractions, flatMaps, barriers, etc. In short, all the queries that were given to it are either equal in speed or faster.

Posted by da...@apache.org.
LazyBarrierStrategy is now a default strategy and is smart about labels, retractions, flatMaps, barriers, etc. In short, all the queries that were given to it are either equal in speed or faster.


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

Branch: refs/heads/TINKERPOP-1458
Commit: 5f0e8438c92555b79e7387c10a9ce915b29c8840
Parents: 8ab682f
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Tue Oct 4 16:50:48 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Tue Oct 4 16:50:48 2016 -0600

----------------------------------------------------------------------
 .../process/traversal/TraversalStrategies.java  |   3 +-
 .../finalization/LazyBarrierStrategy.java       | 108 -------------------
 .../optimization/LazyBarrierStrategy.java       | 103 ++++++++++++++++++
 .../tinkerpop/gremlin/util/CoreImports.java     |   2 +-
 .../finalization/LazyBarrierStrategyTest.java   |  74 -------------
 .../optimization/LazyBarrierStrategyTest.java   | 101 +++++++++++++++++
 .../process/traversal/step/map/ProfileTest.java |  38 +++++--
 7 files changed, 234 insertions(+), 195 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5f0e8438/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategies.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategies.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategies.java
index a01eef6..407d16e 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategies.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategies.java
@@ -24,9 +24,9 @@ import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.Connec
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.finalization.ProfileStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.AdjacentToIncidentStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.FilterRankingStrategy;
-import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.IdentityRemovalStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.IncidentToAdjacentStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.InlineFilterStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.LazyBarrierStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.MatchPredicateStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.OrderLimitStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.PathProcessorStrategy;
@@ -211,6 +211,7 @@ public interface TraversalStrategies extends Serializable, Cloneable {
                     RepeatUnrollStrategy.instance(),
                     RangeByIsCountStrategy.instance(),
                     PathRetractionStrategy.instance(),
+                    LazyBarrierStrategy.instance(),
                     ProfileStrategy.instance(),
                     StandardVerificationStrategy.instance());
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5f0e8438/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/finalization/LazyBarrierStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/finalization/LazyBarrierStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/finalization/LazyBarrierStrategy.java
deleted file mode 100644
index 9bc3cdf..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/finalization/LazyBarrierStrategy.java
+++ /dev/null
@@ -1,108 +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.process.traversal.strategy.finalization;
-
-import org.apache.tinkerpop.gremlin.process.traversal.Step;
-import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
-import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
-import org.apache.tinkerpop.gremlin.process.traversal.step.Barrier;
-import org.apache.tinkerpop.gremlin.process.traversal.step.HasContainerHolder;
-import org.apache.tinkerpop.gremlin.process.traversal.step.filter.FilterStep;
-import org.apache.tinkerpop.gremlin.process.traversal.step.map.EdgeVertexStep;
-import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep;
-import org.apache.tinkerpop.gremlin.process.traversal.step.map.NoOpBarrierStep;
-import org.apache.tinkerpop.gremlin.process.traversal.step.map.VertexStep;
-import org.apache.tinkerpop.gremlin.process.traversal.strategy.AbstractTraversalStrategy;
-import org.apache.tinkerpop.gremlin.process.traversal.traverser.TraverserRequirement;
-import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;
-
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public final class LazyBarrierStrategy extends AbstractTraversalStrategy<TraversalStrategy.FinalizationStrategy> implements TraversalStrategy.FinalizationStrategy {
-
-    private static final LazyBarrierStrategy INSTANCE = new LazyBarrierStrategy();
-    private static final Set<Class<? extends FinalizationStrategy>> PRIORS = new HashSet<>();
-    private static final Set<Class<? extends FinalizationStrategy>> POSTS = new HashSet<>();
-
-    private static final int REQUIRED_DEPTH = 2;
-    private static final int BIG_START_SIZE = 5;
-    protected static final int MAX_BARRIER_SIZE = 10000;
-
-    static {
-        POSTS.add(ProfileStrategy.class);
-    }
-
-
-    private LazyBarrierStrategy() {
-    }
-
-    @Override
-    public void apply(final Traversal.Admin<?, ?> traversal) {
-        if (TraversalHelper.onGraphComputer(traversal))
-            return;
-
-        if (traversal.getTraverserRequirements().contains(TraverserRequirement.PATH))
-            return;
-
-        int depth = 0;
-        for (final Step<?, ?> step : traversal.getSteps()) {
-            if (step instanceof VertexStep)
-                depth++;
-        }
-
-        if (depth > REQUIRED_DEPTH) {
-            boolean bigStart = false;
-            char foundVertexStep = 'x';
-            for (int i = 0; i < traversal.getSteps().size() - 1; i++) {
-                final Step<?, ?> step = traversal.getSteps().get(i);
-                if (i == 0)
-                    bigStart = step instanceof GraphStep && (((GraphStep) step).getIds().length >= BIG_START_SIZE || (((GraphStep) step).getIds().length == 0 && step instanceof HasContainerHolder && ((HasContainerHolder) step).getHasContainers().isEmpty()));
-                else if ('v' == foundVertexStep || bigStart) {
-                    if (!(step instanceof FilterStep) && !(step instanceof Barrier) && !(step instanceof VertexStep && ((VertexStep) step).returnsEdge())) {
-                        TraversalHelper.insertAfterStep(new NoOpBarrierStep<>(traversal, MAX_BARRIER_SIZE), step, traversal);
-                    }
-                }
-
-                if ('x' == foundVertexStep && step instanceof VertexStep)
-                    foundVertexStep = ((VertexStep) step).returnsVertex() ? 'v' : 'e';
-                else if ('e' == foundVertexStep && step instanceof EdgeVertexStep)
-                    foundVertexStep = 'v';
-            }
-        }
-    }
-
-
-    @Override
-    public Set<Class<? extends FinalizationStrategy>> applyPrior() {
-        return PRIORS;
-    }
-
-    @Override
-    public Set<Class<? extends FinalizationStrategy>> applyPost() {
-        return POSTS;
-    }
-
-    public static LazyBarrierStrategy instance() {
-        return INSTANCE;
-    }
-}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5f0e8438/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/LazyBarrierStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/LazyBarrierStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/LazyBarrierStrategy.java
new file mode 100644
index 0000000..f6f9021
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/LazyBarrierStrategy.java
@@ -0,0 +1,103 @@
+/*
+ *  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.traversal.strategy.optimization;
+
+import org.apache.tinkerpop.gremlin.process.traversal.Step;
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.step.Barrier;
+import org.apache.tinkerpop.gremlin.process.traversal.step.PathProcessor;
+import org.apache.tinkerpop.gremlin.process.traversal.step.filter.HasStep;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.FlatMapStep;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.NoOpBarrierStep;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.VertexStep;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.AbstractTraversalStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.traverser.TraverserRequirement;
+import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public final class LazyBarrierStrategy extends AbstractTraversalStrategy<TraversalStrategy.OptimizationStrategy> implements TraversalStrategy.OptimizationStrategy {
+
+    private static final LazyBarrierStrategy INSTANCE = new LazyBarrierStrategy();
+    private static final Set<Class<? extends OptimizationStrategy>> PRIORS = new HashSet<>(Arrays.asList(
+            RangeByIsCountStrategy.class,
+            PathRetractionStrategy.class,
+            IncidentToAdjacentStrategy.class,
+            AdjacentToIncidentStrategy.class,
+            FilterRankingStrategy.class,
+            InlineFilterStrategy.class,
+            MatchPredicateStrategy.class));
+
+    private static final int BIG_START_SIZE = 5;
+    protected static final int MAX_BARRIER_SIZE = 10000;
+
+    private LazyBarrierStrategy() {
+    }
+
+    @Override
+    public void apply(final Traversal.Admin<?, ?> traversal) {
+        if (TraversalHelper.onGraphComputer(traversal) ||
+                traversal.getTraverserRequirements().contains(TraverserRequirement.PATH))
+            return;
+
+        boolean foundFlatMap = false;
+        boolean labeledPath = false;
+        for (int i = 0; i < traversal.getSteps().size() - 1; i++) {
+            final Step<?, ?> step = traversal.getSteps().get(i);
+
+            if (step instanceof PathProcessor) {
+                final Set<String> keepLabels = ((PathProcessor) step).getKeepLabels();
+                if (null == keepLabels || keepLabels.isEmpty())
+                    labeledPath = false;
+            }
+            if (step instanceof FlatMapStep &&
+                    !(step instanceof VertexStep && ((VertexStep) step).returnsEdge()) ||
+                    (step instanceof GraphStep &&
+                            (((GraphStep) step).getIds().length >= BIG_START_SIZE ||
+                                    (((GraphStep) step).getIds().length == 0 && !(step.getNextStep() instanceof HasStep))))) {
+                if (foundFlatMap && !labeledPath && !(step.getNextStep() instanceof Barrier)) {
+                    final Step noOpBarrierStep = new NoOpBarrierStep<>(traversal, MAX_BARRIER_SIZE);
+                    TraversalHelper.copyLabels(step, noOpBarrierStep, true);
+                    TraversalHelper.insertAfterStep(noOpBarrierStep, step, traversal);
+                } else
+                    foundFlatMap = true;
+            }
+            if (!step.getLabels().isEmpty())
+                labeledPath = true;
+
+        }
+    }
+
+
+    @Override
+    public Set<Class<? extends OptimizationStrategy>> applyPrior() {
+        return PRIORS;
+    }
+
+    public static LazyBarrierStrategy instance() {
+        return INSTANCE;
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5f0e8438/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/CoreImports.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/CoreImports.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/CoreImports.java
index 6dd1164..1c76f0e 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/CoreImports.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/CoreImports.java
@@ -50,7 +50,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.EventS
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.HaltedTraverserStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.PartitionStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SubgraphStrategy;
-import org.apache.tinkerpop.gremlin.process.traversal.strategy.finalization.LazyBarrierStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.LazyBarrierStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.finalization.MatchAlgorithmStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.finalization.ProfileStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.AdjacentToIncidentStrategy;

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5f0e8438/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/finalization/LazyBarrierStrategyTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/finalization/LazyBarrierStrategyTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/finalization/LazyBarrierStrategyTest.java
deleted file mode 100644
index 97f8c7f..0000000
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/finalization/LazyBarrierStrategyTest.java
+++ /dev/null
@@ -1,74 +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.process.traversal.strategy.finalization;
-
-import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
-import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies;
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
-import org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversalStrategies;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-
-import java.util.Arrays;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-@RunWith(Parameterized.class)
-public class LazyBarrierStrategyTest {
-
-    @Parameterized.Parameters(name = "{0}")
-    public static Iterable<Object[]> data() {
-        return generateTestParameters();
-    }
-
-    @Parameterized.Parameter(value = 0)
-    public Traversal original;
-
-    @Parameterized.Parameter(value = 1)
-    public Traversal optimized;
-
-    void applyAdjacentToIncidentStrategy(final Traversal traversal) {
-        final TraversalStrategies strategies = new DefaultTraversalStrategies();
-        strategies.addStrategies(LazyBarrierStrategy.instance());
-        traversal.asAdmin().setStrategies(strategies);
-        traversal.asAdmin().applyStrategies();
-    }
-
-    @Test
-    public void doTest() {
-        applyAdjacentToIncidentStrategy(original);
-        assertEquals(optimized, original);
-    }
-
-    @Parameterized.Parameters(name = "{0}")
-    public static Iterable<Object[]> generateTestParameters() {
-        final int size = LazyBarrierStrategy.MAX_BARRIER_SIZE;
-        return Arrays.asList(new Traversal[][]{
-                {__.out().count(), __.out().count()},
-                {__.out().out().count(), __.out().out().count()},
-                {__.out().out().out().count(), __.out().out().barrier(size).out().barrier(size).count()},
-                {__.outE().inV().outE().inV().outE().inV().groupCount(), __.outE().inV().outE().inV().barrier(size).outE().inV().barrier(size).groupCount()},
-                {__.out().out().has("age", 32).out().count(), __.out().out().barrier(size).has("age", 32).out().barrier(size).count()},
-        });
-    }
-}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5f0e8438/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/LazyBarrierStrategyTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/LazyBarrierStrategyTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/LazyBarrierStrategyTest.java
new file mode 100644
index 0000000..314cfeb
--- /dev/null
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/LazyBarrierStrategyTest.java
@@ -0,0 +1,101 @@
+/*
+ *  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.traversal.strategy.optimization;
+
+import org.apache.tinkerpop.gremlin.process.traversal.P;
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies;
+import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
+import org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversalStrategies;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+@RunWith(Parameterized.class)
+public class LazyBarrierStrategyTest {
+
+    @Parameterized.Parameters(name = "{0}")
+    public static Iterable<Object[]> data() {
+        return generateTestParameters();
+    }
+
+    @Parameterized.Parameter(value = 0)
+    public Traversal original;
+
+    @Parameterized.Parameter(value = 1)
+    public Traversal optimized;
+
+    @Parameterized.Parameter(value = 2)
+    public Collection<TraversalStrategy> otherStrategies;
+
+    @Test
+    public void doTest() {
+        final TraversalStrategies strategies = new DefaultTraversalStrategies();
+        strategies.addStrategies(LazyBarrierStrategy.instance());
+        for (final TraversalStrategy strategy : this.otherStrategies) {
+            strategies.addStrategies(strategy);
+        }
+        this.original.asAdmin().setStrategies(strategies);
+        this.original.asAdmin().applyStrategies();
+        assertEquals(this.optimized, this.original);
+    }
+
+    @Parameterized.Parameters(name = "{0}")
+    public static Iterable<Object[]> generateTestParameters() {
+        final int SIZE = LazyBarrierStrategy.MAX_BARRIER_SIZE;
+        return Arrays.asList(new Object[][]{
+                {__.out().count(), __.out().count(), Collections.emptyList()},
+                {__.out().out().count(), __.out().out().count(), Collections.emptyList()},
+                {__.out().out().out().count(), __.out().out().barrier(SIZE).out().count(), Collections.emptyList()},
+                {__.out().out().out().out().count(), __.out().out().barrier(SIZE).out().barrier(SIZE).out().count(), Collections.emptyList()},
+                {__.out().out().out().count(), __.out().out().barrier(SIZE).outE().count(), Arrays.asList(RangeByIsCountStrategy.instance(), AdjacentToIncidentStrategy.instance())},
+                {__.out().out().out().count().is(P.gt(10)), __.out().out().barrier(SIZE).outE().limit(11).count().is(P.gt(10)), Arrays.asList(RangeByIsCountStrategy.instance(), AdjacentToIncidentStrategy.instance())},
+                {__.outE().inV().outE().inV().outE().inV().groupCount(), __.outE().inV().outE().inV().barrier(SIZE).outE().inV().groupCount(), Collections.emptyList()},
+                {__.outE().inV().outE().inV().outE().inV().groupCount(), __.out().out().barrier(SIZE).out().groupCount(), Collections.singletonList(IncidentToAdjacentStrategy.instance())},
+                {__.out().out().has("age", 32).out().count(), __.out().out().barrier(SIZE).has("age", 32).out().count(), Collections.emptyList()},
+                {__.V().out().out().has("age", 32).out().count(), __.V().out().barrier(SIZE).out().barrier(SIZE).has("age", 32).out().count(), Collections.emptyList()},
+                {__.V().out().has("age", 32).out().count(), __.V().out().barrier(SIZE).has("age", 32).out().count(), Collections.emptyList()},
+                {__.V().out().has("age", 32).V().out().count(), __.V().out().barrier(SIZE).has("age", 32).V().barrier(SIZE).out().count(), Collections.emptyList()},
+                {__.repeat(__.out()).times(4), __.repeat(__.out()).times(4), Collections.emptyList()},
+                {__.repeat(__.out()).times(4), __.out().barrier(5000).out().barrier(5000).out().barrier(5000).out().barrier(5000), Collections.singletonList(RepeatUnrollStrategy.instance())},
+                {__.out().out().as("a").select("a").out(), __.out().out().barrier(SIZE).as("a").select("a").out(), Collections.emptyList()},
+                {__.out().out().as("a").select("a").out(), __.out().out().barrier(SIZE).as("a").select("a").barrier(2500).out(), Collections.singletonList(PathRetractionStrategy.instance())},
+                {__.out().out().as("a").out().select("a").out(), __.out().out().barrier(SIZE).as("a").out().select("a").barrier(2500).out(), Collections.singletonList(PathRetractionStrategy.instance())},
+                {__.out().out().out().limit(10).out(), __.out().out().barrier(SIZE).out().limit(10).out(), Collections.emptyList()},
+                {__.V().out().in().where(P.neq("a")), __.V().out().barrier(SIZE).in().barrier(SIZE).where(P.neq("a")), Collections.emptyList()},
+                {__.V().as("a").out().in().where(P.neq("a")), __.V().as("a").out().in().where(P.neq("a")), Collections.emptyList()},
+                {__.out().out().in().where(P.neq("a")), __.out().out().barrier(SIZE).in().barrier(SIZE).where(P.neq("a")), Collections.emptyList()},
+                {__.out().as("a").out().in().where(P.neq("a")), __.out().as("a").out().in().where(P.neq("a")), Collections.emptyList()},
+                {__.out().as("a").out().in().where(P.neq("a")).out().out(), __.out().as("a").out().in().where(P.neq("a")).barrier(2500).out().barrier(SIZE).out(), Collections.singletonList(PathRetractionStrategy.instance())},
+                {__.out().as("a").out().as("b").in().where(P.neq("a")).out().out(), __.out().as("a").out().as("b").in().where(P.neq("a")).barrier(2500).out().barrier(SIZE).out(), Collections.singletonList(PathRetractionStrategy.instance())},
+                {__.out().as("a").out().as("b").in().where(P.neq("a")).out().select("b").out(), __.out().as("a").out().as("b").in().where(P.neq("a")).barrier(2500).out().select("b").barrier(2500).out(), Collections.singletonList(PathRetractionStrategy.instance())},
+                {__.out().as("a").out().as("b").in().where(P.neq("a")).out().select("b").out().out(), __.out().as("a").out().as("b").in().where(P.neq("a")).barrier(2500).out().select("b").barrier(2500).out().barrier(SIZE).out(), Collections.singletonList(PathRetractionStrategy.instance())},
+        });
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5f0e8438/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ProfileTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ProfileTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ProfileTest.java
index 548e7ab..927f91d 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ProfileTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ProfileTest.java
@@ -32,6 +32,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
 import org.apache.tinkerpop.gremlin.process.traversal.step.Profiling;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.ProfileStep;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.LazyBarrierStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.RangeByIsCountStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.RepeatUnrollStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ComputerVerificationStrategy;
@@ -92,6 +93,7 @@ public abstract class ProfileTest extends AbstractGremlinProcessTest {
     @LoadGraphWith(MODERN)
     public void modern_V_out_out_profile() {
         final Traversal<Vertex, TraversalMetrics> traversal = get_g_V_out_out_profile();
+        traversal.asAdmin().getStrategies().removeStrategies(LazyBarrierStrategy.class);
         printTraversalForm(traversal);
         validate_g_V_out_out_profile_modern(traversal, traversal.next());
     }
@@ -100,6 +102,7 @@ public abstract class ProfileTest extends AbstractGremlinProcessTest {
     @LoadGraphWith(MODERN)
     public void modern_V_out_out_profileXmetricsX() {
         final Traversal<Vertex, Vertex> traversal = get_g_V_out_out_profileXmetricsX();
+        traversal.asAdmin().getStrategies().removeStrategies(LazyBarrierStrategy.class);
         printTraversalForm(traversal);
         traversal.iterate();
         validate_g_V_out_out_profile_modern(traversal, traversal.asAdmin().getSideEffects().<TraversalMetrics>get(METRICS_KEY));
@@ -135,6 +138,7 @@ public abstract class ProfileTest extends AbstractGremlinProcessTest {
     @LoadGraphWith(GRATEFUL)
     public void grateful_V_out_out_profile() {
         final Traversal<Vertex, TraversalMetrics> traversal = get_g_V_out_out_profile();
+        traversal.asAdmin().getStrategies().removeStrategies(LazyBarrierStrategy.class);
         printTraversalForm(traversal);
         final TraversalMetrics traversalMetrics = traversal.next();
         validate_g_V_out_out_profile_grateful(traversalMetrics);
@@ -144,6 +148,7 @@ public abstract class ProfileTest extends AbstractGremlinProcessTest {
     @LoadGraphWith(GRATEFUL)
     public void grateful_V_out_out_profileXmetricsX() {
         final Traversal<Vertex, Vertex> traversal = get_g_V_out_out_profileXmetricsX();
+        traversal.asAdmin().getStrategies().removeStrategies(LazyBarrierStrategy.class);
         printTraversalForm(traversal);
         traversal.iterate();
         final TraversalMetrics traversalMetrics = traversal.asAdmin().getSideEffects().<TraversalMetrics>get(METRICS_KEY);
@@ -185,6 +190,7 @@ public abstract class ProfileTest extends AbstractGremlinProcessTest {
     @IgnoreEngine(TraversalEngine.Type.COMPUTER)
     public void g_V_sideEffectXThread_sleepX10XX_sideEffectXThread_sleepX5XX_profile() {
         final Traversal<Vertex, TraversalMetrics> traversal = get_g_V_sideEffectXThread_sleepX10XX_sideEffectXThread_sleepX5XX_profile();
+        traversal.asAdmin().getStrategies().removeStrategies(LazyBarrierStrategy.class);
         printTraversalForm(traversal);
         TraversalMetrics traversalMetrics = traversal.next();
         assertEquals("There should be 8 steps in this traversal (counting injected profile steps).", 8, traversal.asAdmin().getSteps().size());
@@ -196,6 +202,7 @@ public abstract class ProfileTest extends AbstractGremlinProcessTest {
     @IgnoreEngine(TraversalEngine.Type.COMPUTER)
     public void g_V_sideEffectXThread_sleepX10XX_sideEffectXThread_sleepX5XX_profileXmetricsX() {
         final Traversal<Vertex, Vertex> traversal = get_g_V_sideEffectXThread_sleepX10XX_sideEffectXThread_sleepX5XX_profileXmetricsX();
+        traversal.asAdmin().getStrategies().removeStrategies(LazyBarrierStrategy.class);
         printTraversalForm(traversal);
         traversal.iterate();
         assertEquals("There should be 7 steps in this traversal (counting injected profile steps).", 7, traversal.asAdmin().getSteps().size());
@@ -230,6 +237,7 @@ public abstract class ProfileTest extends AbstractGremlinProcessTest {
     @LoadGraphWith(MODERN)
     public void g_V_repeat_both_profile() {
         final Traversal<Vertex, TraversalMetrics> traversal = get_g_V_repeatXbothX_timesX3X_profile();
+        traversal.asAdmin().getStrategies().removeStrategies(LazyBarrierStrategy.class);
         printTraversalForm(traversal);
 
         final TraversalMetrics traversalMetrics = traversal.next();
@@ -242,6 +250,7 @@ public abstract class ProfileTest extends AbstractGremlinProcessTest {
     @LoadGraphWith(MODERN)
     public void g_V_repeat_both_profileXmetricsX() {
         final Traversal<Vertex, Vertex> traversal = get_g_V_repeatXbothX_timesX3X_profileXmetricsX();
+        traversal.asAdmin().getStrategies().removeStrategies(LazyBarrierStrategy.class);
         printTraversalForm(traversal);
         traversal.iterate();
         final TraversalMetrics traversalMetrics = traversal.asAdmin().getSideEffects().<TraversalMetrics>get(METRICS_KEY);
@@ -307,6 +316,7 @@ public abstract class ProfileTest extends AbstractGremlinProcessTest {
     @LoadGraphWith(MODERN)
     public void g_V_whereXinXcreatedX_count_isX1XX_name_profile() {
         final Traversal<Vertex, TraversalMetrics> traversal = get_g_V_whereXinXcreatedX_count_isX1XX_name_profile();
+        traversal.asAdmin().getStrategies().removeStrategies(LazyBarrierStrategy.class);
         printTraversalForm(traversal);
         final TraversalMetrics traversalMetrics = traversal.next();
         validate_g_V_whereXinXcreatedX_count_isX1XX_name_profile(traversal, traversalMetrics);
@@ -316,6 +326,7 @@ public abstract class ProfileTest extends AbstractGremlinProcessTest {
     @LoadGraphWith(MODERN)
     public void g_V_whereXinXcreatedX_count_isX1XX_name_profileXmetricsX() {
         final Traversal<Vertex, String> traversal = get_g_V_whereXinXcreatedX_count_isX1XX_name_profileXmetricsX();
+        traversal.asAdmin().getStrategies().removeStrategies(LazyBarrierStrategy.class);
         printTraversalForm(traversal);
         traversal.iterate();
         final TraversalMetrics traversalMetrics = traversal.asAdmin().getSideEffects().<TraversalMetrics>get(METRICS_KEY);
@@ -353,13 +364,14 @@ public abstract class ProfileTest extends AbstractGremlinProcessTest {
     @Test
     @LoadGraphWith(MODERN)
     public void testProfileStrategyCallback() {
-        final Traversal<Vertex, TraversalMetrics> t = get_g_V_out_out_profile();
-        MockStep mockStep = new MockStep(t.asAdmin());
-        t.asAdmin().addStep(3, mockStep);
-        TraversalMetrics traversalMetrics = t.next();
+        final Traversal<Vertex, TraversalMetrics> traversal = get_g_V_out_out_profile();
+        traversal.asAdmin().getStrategies().removeStrategies(LazyBarrierStrategy.class);
+        MockStep mockStep = new MockStep(traversal.asAdmin());
+        traversal.asAdmin().addStep(3, mockStep);
+        TraversalMetrics traversalMetrics = traversal.next();
         assertTrue(mockStep.callbackCalled);
 
-        if (!onGraphComputer(t.asAdmin())) {
+        if (!onGraphComputer(traversal.asAdmin())) {
             assertEquals(100, traversalMetrics.getMetrics(3).getCount("bogusCount").longValue());
         }
     }
@@ -367,14 +379,15 @@ public abstract class ProfileTest extends AbstractGremlinProcessTest {
     @Test
     @LoadGraphWith(MODERN)
     public void testProfileStrategyCallbackSideEffect() {
-        final Traversal<Vertex, Vertex> t = get_g_V_out_out_profileXmetricsX();
-        MockStep mockStep = new MockStep(t.asAdmin());
-        t.asAdmin().addStep(3, mockStep);
-        t.iterate();
+        final Traversal<Vertex, Vertex> traversal = get_g_V_out_out_profileXmetricsX();
+        traversal.asAdmin().getStrategies().removeStrategies(LazyBarrierStrategy.class);
+        MockStep mockStep = new MockStep(traversal.asAdmin());
+        traversal.asAdmin().addStep(3, mockStep);
+        traversal.iterate();
         assertTrue(mockStep.callbackCalled);
 
-        if (!onGraphComputer(t.asAdmin())) {
-            final TraversalMetrics traversalMetrics = t.asAdmin().getSideEffects().<TraversalMetrics>get(METRICS_KEY);
+        if (!onGraphComputer(traversal.asAdmin())) {
+            final TraversalMetrics traversalMetrics = traversal.asAdmin().getSideEffects().<TraversalMetrics>get(METRICS_KEY);
             assertEquals(100, traversalMetrics.getMetrics(3).getCount("bogusCount").longValue());
         }
     }
@@ -383,6 +396,7 @@ public abstract class ProfileTest extends AbstractGremlinProcessTest {
     @LoadGraphWith(MODERN)
     public void g_V_matchXa_created_b__b_in_count_isXeqX1XXX_selectXa_bX_profile() {
         final Traversal<Vertex, TraversalMetrics> traversal = get_g_V_matchXa_created_b__b_in_count_isXeqX1XXX_selectXa_bX_profile();
+        traversal.asAdmin().getStrategies().removeStrategies(LazyBarrierStrategy.class);
         printTraversalForm(traversal);
         traversal.iterate();
     }
@@ -391,6 +405,7 @@ public abstract class ProfileTest extends AbstractGremlinProcessTest {
     @LoadGraphWith(MODERN)
     public void g_V_matchXa_created_b__b_in_count_isXeqX1XXX_selectXa_bX_profileXmetricsX() {
         final Traversal<Vertex, Map<String, String>> traversal = get_g_V_matchXa_created_b__b_in_count_isXeqX1XXX_selectXa_bX_profileXmetricsX();
+        traversal.asAdmin().getStrategies().removeStrategies(LazyBarrierStrategy.class);
         printTraversalForm(traversal);
         traversal.iterate();
     }
@@ -400,6 +415,7 @@ public abstract class ProfileTest extends AbstractGremlinProcessTest {
     @IgnoreEngine(TraversalEngine.Type.STANDARD)
     public void g_V_hasLabelXpersonX_pageRank_byXrankX_byXbothEX_rank_profile() {
         final Traversal<Vertex, TraversalMetrics> traversal = get_g_V_hasLabelXpersonX_pageRank_byXrankX_byXbothEX_rank_profile();
+        traversal.asAdmin().getStrategies().removeStrategies(LazyBarrierStrategy.class);
         //printTraversalForm(traversal);
         try {
             traversal.iterate();


[33/36] tinkerpop git commit: fixed java code as per @spmallette review

Posted by da...@apache.org.
fixed java code as per @spmallette review


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

Branch: refs/heads/TINKERPOP-1458
Commit: 5d70a4636ec589f022874b26ed3d60f6914507f7
Parents: a50cd4d
Author: davebshow <da...@gmail.com>
Authored: Thu Oct 6 20:21:37 2016 -0400
Committer: davebshow <da...@gmail.com>
Committed: Fri Oct 7 11:06:08 2016 -0400

----------------------------------------------------------------------
 .../driver/remote/DriverRemoteTraversalSideEffects.java       | 7 +++++--
 .../tinkerpop/gremlin/server/GremlinServerIntegrateTest.java  | 4 ++--
 2 files changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5d70a463/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/remote/DriverRemoteTraversalSideEffects.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/remote/DriverRemoteTraversalSideEffects.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/remote/DriverRemoteTraversalSideEffects.java
index 642db13..1de1766 100644
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/remote/DriverRemoteTraversalSideEffects.java
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/remote/DriverRemoteTraversalSideEffects.java
@@ -68,7 +68,7 @@ public class DriverRemoteTraversalSideEffects extends AbstractRemoteTraversalSid
                 try {
                     final Result result = client.submitAsync(msg).get().one();
                     sideEffects.put(key, null == result ? null : result.getObject());
-                    if (keys.isEmpty())
+                    if (keys.equals(Collections.emptySet()))
                         keys = new HashSet<>();
                     keys.add(key);
                 } catch (Exception ex) {
@@ -97,7 +97,10 @@ public class DriverRemoteTraversalSideEffects extends AbstractRemoteTraversalSid
                     .addArg(Tokens.ARGS_HOST, host)
                     .processor("traversal").create();
             try {
-                keys = client.submitAsync(msg).get().all().get().stream().map(r -> r.getString()).collect(Collectors.toSet());
+                if (keys.equals(Collections.emptySet()))
+                    keys = new HashSet<>();
+
+                client.submitAsync(msg).get().all().get().forEach(r -> keys.add(r.getString()));
             } catch (Exception ex) {
                 final Throwable root = ExceptionUtils.getRootCause(ex);
                 final String exMsg = null == root ? "" : root.getMessage();

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5d70a463/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
index f810ebc..9bc6cd9 100644
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
@@ -894,9 +894,9 @@ public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegration
         // Try to get side effect from server
         final Cluster cluster = Cluster.build("localhost").create();
         final Client client = cluster.connect();
-        Field field = DriverRemoteTraversalSideEffects.class.getDeclaredField("serverSideEffect");
+        final Field field = DriverRemoteTraversalSideEffects.class.getDeclaredField("serverSideEffect");
         field.setAccessible(true);
-        UUID serverSideEffectId = (UUID) field.get(se);
+        final UUID serverSideEffectId = (UUID) field.get(se);
         final Map<String, String> aliases = new HashMap<>();
         aliases.put("g", "g");
         final RequestMessage msg = RequestMessage.build(Tokens.OPS_GATHER)


[08/36] tinkerpop git commit: dah. bug that showed up in Jenkins testing.

Posted by da...@apache.org.
dah. bug that showed up in Jenkins testing.


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

Branch: refs/heads/TINKERPOP-1458
Commit: 71c7bece0a47878e81161667096b1eeab8a0f420
Parents: 20dec20
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Tue Oct 4 14:35:55 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Tue Oct 4 14:35:55 2016 -0600

----------------------------------------------------------------------
 .../gremlin/tinkergraph/process/TinkerGraphComputerProvider.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/71c7bece/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/TinkerGraphComputerProvider.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/TinkerGraphComputerProvider.java b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/TinkerGraphComputerProvider.java
index 3144211..139384f 100644
--- a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/TinkerGraphComputerProvider.java
+++ b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/TinkerGraphComputerProvider.java
@@ -39,7 +39,7 @@ public class TinkerGraphComputerProvider extends TinkerGraphProvider {
     public GraphTraversalSource traversal(final Graph graph) {
         return RANDOM.nextBoolean() ?
                 graph.traversal().withComputer(
-                        "workers", RANDOM.nextInt(4) + 1,
+                        "workers", RANDOM.nextInt(Runtime.getRuntime().availableProcessors()) + 1,
                         "graphComputer", RANDOM.nextBoolean() ?
                                 GraphComputer.class.getCanonicalName() :
                                 TinkerGraphComputer.class.getCanonicalName()) :


[25/36] tinkerpop git commit: fixed side effect methods and updated tests

Posted by da...@apache.org.
fixed side effect methods and updated tests


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

Branch: refs/heads/TINKERPOP-1458
Commit: 8e67ddc0d1ad8f263d8ae8b7797492efe052dd2b
Parents: 1dab852
Author: davebshow <da...@gmail.com>
Authored: Wed Oct 5 17:59:15 2016 -0400
Committer: davebshow <da...@gmail.com>
Committed: Fri Oct 7 11:05:00 2016 -0400

----------------------------------------------------------------------
 .../DriverRemoteTraversalSideEffects.java       |  6 ++++-
 .../DriverRemoteTraversalSideEffectsTest.java   | 24 ++++++++++++++++++--
 .../server/GremlinServerIntegrateTest.java      | 18 +++++++++------
 3 files changed, 38 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8e67ddc0/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/remote/DriverRemoteTraversalSideEffects.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/remote/DriverRemoteTraversalSideEffects.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/remote/DriverRemoteTraversalSideEffects.java
index d2fced5..2dece11 100644
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/remote/DriverRemoteTraversalSideEffects.java
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/remote/DriverRemoteTraversalSideEffects.java
@@ -28,6 +28,7 @@ import org.apache.tinkerpop.gremlin.process.remote.traversal.AbstractRemoteTrave
 
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
 import java.util.UUID;
@@ -67,10 +68,13 @@ public class DriverRemoteTraversalSideEffects extends AbstractRemoteTraversalSid
                 try {
                     final Result result = client.submitAsync(msg).get().one();
                     sideEffects.put(key, null == result ? null : result.getObject());
+                    if (keys.isEmpty())
+                        keys = new HashSet<>();
                     keys.add(key);
                 } catch (Exception ex) {
                     final Throwable root = ExceptionUtils.getRootCause(ex);
-                    if (root.getMessage().equals("Could not find side-effects for " + serverSideEffect + "."))
+                    final String exMsg = null == root ? "" : root.getMessage();
+                    if (exMsg.equals("Could not find side-effects for " + serverSideEffect + "."))
                         sideEffects.put(key, null);
                     else
                         throw new RuntimeException("Could not get keys", root);

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8e67ddc0/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/remote/DriverRemoteTraversalSideEffectsTest.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/remote/DriverRemoteTraversalSideEffectsTest.java b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/remote/DriverRemoteTraversalSideEffectsTest.java
index d4c5618..368ca92 100644
--- a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/remote/DriverRemoteTraversalSideEffectsTest.java
+++ b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/remote/DriverRemoteTraversalSideEffectsTest.java
@@ -29,6 +29,7 @@ import java.util.UUID;
 import java.util.concurrent.CompletableFuture;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
 import static org.mockito.Matchers.any;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.times;
@@ -63,10 +64,29 @@ public class DriverRemoteTraversalSideEffectsTest extends AbstractResultQueueTes
     }
 
     @Test
-    public void shouldNotContactRemoteMoreThanOnceForClose() throws Exception {
+    public void shoudlNotContactRemoteForGetAfterCloseIsCalled() throws Exception {
         final Client client = mock(Client.class);
         mockClientForCall(client);
         mockClientForCall(client);
+        final UUID sideEffectKey = UUID.fromString("31dec2c6-b214-4a6f-a68b-996608dce0d9");
+        final TraversalSideEffects sideEffects = new DriverRemoteTraversalSideEffects(client, sideEffectKey, null);
+
+        assertNotNull(sideEffects.get("a"));
+        sideEffects.close();
+
+        // Side effect 'a' should be cached locally
+        assertNotNull(sideEffects.get("a"));
+        assertNotNull(sideEffects.get("a"));
+        assertNotNull(sideEffects.get("a"));
+
+        // Once for get and once for close
+        verify(client, times(2)).submitAsync(any(RequestMessage.class));
+    }
+
+    @Test
+    public void shouldNotContactRemoteMoreThanOnceForClose() throws Exception {
+        final Client client = mock(Client.class);
+        mockClientForCall(client);
 
         final UUID sideEffectKey = UUID.fromString("31dec2c6-b214-4a6f-a68b-996608dce0d9");
         final TraversalSideEffects sideEffects = new DriverRemoteTraversalSideEffects(client, sideEffectKey, null);
@@ -79,7 +99,7 @@ public class DriverRemoteTraversalSideEffectsTest extends AbstractResultQueueTes
 
         assertEquals(0, sideEffects.keys().size());
 
-        // once for the keys and once for the close message
+        // once for the close message
         verify(client, times(1)).submitAsync(any(RequestMessage.class));
     }
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8e67ddc0/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
index 61bf994..1c4d19e 100644
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
@@ -52,6 +52,7 @@ import org.apache.tinkerpop.gremlin.groovy.jsr223.customizer.TimedInterruptCusto
 import org.apache.tinkerpop.gremlin.process.remote.RemoteGraph;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
+import org.apache.tinkerpop.gremlin.process.traversal.step.util.BulkSet;
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.T;
 import org.apache.tinkerpop.gremlin.server.channel.NioChannelizer;
@@ -850,9 +851,9 @@ public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegration
         assertEquals(2, sideEffectKeys.size());
 
         // Get side effects
-        final List aSideEffects = se.get("a");
+        final BulkSet aSideEffects = se.get("a");
         assertThat(aSideEffects.isEmpty(), is(false));
-        final List bSideEffects = se.get("b");
+        final BulkSet bSideEffects = se.get("b");
         assertThat(bSideEffects.isEmpty(), is(false));
 
         // Should get local keys/side effects after close
@@ -861,10 +862,10 @@ public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegration
         final Set<String> localSideEffectKeys = se.keys();
         assertEquals(2, localSideEffectKeys.size());
 
-        final List localASideEffects = se.get("a");
+        final BulkSet localASideEffects = se.get("a");
         assertThat(localASideEffects.isEmpty(), is(false));
 
-        final List localBSideEffects = se.get("b");
+        final BulkSet localBSideEffects = se.get("b");
         assertThat(localBSideEffects.isEmpty(), is(false));
     }
 
@@ -877,7 +878,7 @@ public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegration
         final GraphTraversal traversal = g.V().aggregate("a").aggregate("b");
         traversal.iterate();
         final DriverRemoteTraversalSideEffects se = (DriverRemoteTraversalSideEffects) traversal.asAdmin().getSideEffects();
-        final List sideEffects = se.get("a");
+        final BulkSet sideEffects = se.get("a");
         assertThat(sideEffects.isEmpty(), is(false));
         se.close();
 
@@ -887,7 +888,7 @@ public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegration
         // Earlier keys should be cached locally
         final Set<String> localSideEffectKeys = se.keys();
         assertEquals(1, localSideEffectKeys.size());
-        final List localSideEffects = se.get("a");
+        final BulkSet localSideEffects = se.get("a");
         assertThat(localSideEffects.isEmpty(), is(false));
 
         // Try to get side effect from server
@@ -896,13 +897,16 @@ public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegration
         Field field = DriverRemoteTraversalSideEffects.class.getDeclaredField("serverSideEffect");
         field.setAccessible(true);
         UUID serverSideEffectId = (UUID) field.get(se);
+        final Map<String, String> aliases = new HashMap<>();
+        aliases.put("g", "g");
         final RequestMessage msg = RequestMessage.build(Tokens.OPS_GATHER)
                 .addArg(Tokens.ARGS_SIDE_EFFECT, serverSideEffectId)
                 .addArg(Tokens.ARGS_SIDE_EFFECT_KEY, "b")
+                .addArg(Tokens.ARGS_ALIASES, aliases)
                 .processor("traversal").create();
         boolean error;
         try {
-            client.submitAsync(msg).get();
+            client.submitAsync(msg).get().one();
             error = false;
         } catch (Exception ex) {
             error = true;


[05/36] tinkerpop git commit: first push. We now have TraversalSource.withStrategy(String, Object...) and TraversalSource.withoutStrategy(String). Added a test case to Gremlin-Python that uses SubgraphStrategy and it works :).

Posted by da...@apache.org.
first push. We now have TraversalSource.withStrategy(String, Object...) and TraversalSource.withoutStrategy(String). Added a test case to Gremlin-Python that uses SubgraphStrategy and it works :).


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

Branch: refs/heads/TINKERPOP-1458
Commit: e6e59e417f119c1b71a43141fce04cb212bc0a58
Parents: 8ab682f
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Tue Oct 4 08:37:07 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Tue Oct 4 08:37:07 2016 -0600

----------------------------------------------------------------------
 .../process/traversal/TraversalSource.java      | 52 +++++++++++++++++++-
 .../dsl/graph/GraphTraversalSource.java         | 10 ++++
 .../strategy/decoration/SubgraphStrategy.java   | 18 ++++++-
 .../dsl/graph/GraphTraversalSourceTest.java     | 23 +++++++++
 .../gremlin/groovy/jsr223/GroovyTranslator.java |  8 +--
 .../gremlin/python/jsr223/PythonTranslator.java |  3 +-
 .../gremlin_python/process/graph_traversal.py   |  8 +++
 .../driver/test_driver_remote_connection.py     | 16 +++++-
 .../decoration/SubgraphStrategyProcessTest.java | 40 ++++++---------
 9 files changed, 144 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e6e59e41/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalSource.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalSource.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalSource.java
index 0d690e9..8d5cf93 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalSource.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalSource.java
@@ -19,20 +19,24 @@
 package org.apache.tinkerpop.gremlin.process.traversal;
 
 import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.MapConfiguration;
 import org.apache.commons.configuration.PropertiesConfiguration;
 import org.apache.tinkerpop.gremlin.process.computer.Computer;
 import org.apache.tinkerpop.gremlin.process.computer.GraphComputer;
 import org.apache.tinkerpop.gremlin.process.computer.traversal.strategy.decoration.VertexProgramStrategy;
 import org.apache.tinkerpop.gremlin.process.remote.RemoteConnection;
-import org.apache.tinkerpop.gremlin.process.remote.traversal.strategy.decoration.RemoteStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SackStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SideEffectStrategy;
 import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.util.ElementHelper;
 import org.apache.tinkerpop.gremlin.util.function.ConstantSupplier;
 
 import java.io.Serializable;
 import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.Optional;
 import java.util.function.BinaryOperator;
 import java.util.function.Function;
@@ -94,11 +98,57 @@ public interface TraversalSource extends Cloneable, AutoCloseable {
         public static final String withComputer = "withComputer";
         public static final String withSideEffect = "withSideEffect";
         public static final String withRemote = "withRemote";
+        public static final String withStrategy = "withStrategy";
+        public static final String withoutStrategy = "withoutStrategy";
     }
 
     /////////////////////////////
 
     /**
+     * Add a {@link TraversalStrategy} to the traversal source given the strategy name and key/value pair creation arguments.
+     *
+     * @param strategyName   the name of the strategy (the full class name)
+     * @param namedArguments key/value pair arguments where the even indices are string keys
+     * @return a new traversal source with updated strategies
+     */
+    public default TraversalSource withStrategy(final String strategyName, final Object... namedArguments) {
+        ElementHelper.legalPropertyKeyValueArray(namedArguments);
+        final Map<String, Object> configuration = new HashMap<>();
+        for (int i = 0; i < namedArguments.length; i = i + 2) {
+            configuration.put((String) namedArguments[i], namedArguments[i + 1]);
+        }
+        try {
+            final TraversalStrategy<?> traversalStrategy = (TraversalStrategy) ((0 == namedArguments.length) ?
+                    Class.forName(strategyName).getMethod("instance").invoke(null) :
+                    Class.forName(strategyName).getMethod("create", Configuration.class).invoke(null, new MapConfiguration(configuration)));
+            final TraversalSource clone = this.clone();
+            clone.getStrategies().addStrategies(traversalStrategy);
+            clone.getBytecode().addSource(Symbols.withStrategy, strategyName, namedArguments);
+            return clone;
+        } catch (final ClassNotFoundException | NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
+            throw new IllegalArgumentException(e.getMessage(), e);
+        }
+    }
+
+    /**
+     * Remove a {@link TraversalStrategy} from the travesal source given the strategy name.
+     *
+     * @param strategyName the name of the strategy (the full class name)
+     * @return a new traversal source with updated strategies
+     */
+    @SuppressWarnings({"unchecked", "varargs"})
+    public default TraversalSource withoutStrategy(final String strategyName) {
+        try {
+            final TraversalSource clone = this.clone();
+            clone.getStrategies().removeStrategies((Class<TraversalStrategy>) Class.forName(strategyName));
+            clone.getBytecode().addSource(TraversalSource.Symbols.withoutStrategy, strategyName);
+            return clone;
+        } catch (final ClassNotFoundException e) {
+            throw new IllegalArgumentException(e.getMessage(), e);
+        }
+    }
+
+    /**
      * Add an arbitrary collection of {@link TraversalStrategy} instances to the traversal source.
      *
      * @param traversalStrategies a colleciton of traversal strategies to add

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e6e59e41/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSource.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSource.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSource.java
index 0525f8d..bf2da7e 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSource.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSource.java
@@ -142,6 +142,16 @@ public class GraphTraversalSource implements TraversalSource {
     }
 
     @Override
+    public GraphTraversalSource withStrategy(final String strategyName, final Object... nameArguments) {
+        return (GraphTraversalSource) TraversalSource.super.withStrategy(strategyName, nameArguments);
+    }
+
+    @Override
+    public GraphTraversalSource withoutStrategy(final String strategyName) {
+        return (GraphTraversalSource) TraversalSource.super.withoutStrategy(strategyName);
+    }
+
+    @Override
     public GraphTraversalSource withStrategies(final TraversalStrategy... traversalStrategies) {
         return (GraphTraversalSource) TraversalSource.super.withStrategies(traversalStrategies);
     }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e6e59e41/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategy.java
index 0187969..097299f 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategy.java
@@ -18,6 +18,7 @@
  */
 package org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration;
 
+import org.apache.commons.configuration.Configuration;
 import org.apache.tinkerpop.gremlin.process.traversal.Step;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
@@ -120,7 +121,7 @@ public final class SubgraphStrategy extends AbstractTraversalStrategy<TraversalS
     }
 
     private static void applyCriterion(final List<Step> stepsToApplyCriterionAfter, final Traversal.Admin traversal,
-                                final Traversal.Admin<? extends Element, ?> criterion) {
+                                       final Traversal.Admin<? extends Element, ?> criterion) {
         for (final Step<?, ?> step : stepsToApplyCriterionAfter) {
             // re-assign the step label to the criterion because the label should apply seamlessly after the filter
             final Step filter = new TraversalFilterStep<>(traversal, criterion.clone());
@@ -290,6 +291,21 @@ public final class SubgraphStrategy extends AbstractTraversalStrategy<TraversalS
         return this.vertexPropertyCriterion;
     }
 
+    public static SubgraphStrategy create(final Configuration configuration) {
+        final Builder builder = SubgraphStrategy.build();
+        configuration.getKeys().forEachRemaining(key -> {
+            if (key.equals("vertices") || key.equals("vertexCriterion"))
+                builder.vertices((Traversal) configuration.getProperty(key));
+            else if (key.equals("edges") || key.equals("edgeCriterion"))
+                builder.edges((Traversal) configuration.getProperty(key));
+            else if (key.equals("vertexProperties"))
+                builder.vertexProperties((Traversal) configuration.getProperty(key));
+            else
+                throw new IllegalArgumentException("The following configuration is unknown: " + key + ":" + configuration.getProperty(key));
+        });
+        return builder.create();
+    }
+
     public static Builder build() {
         return new Builder();
     }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e6e59e41/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSourceTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSourceTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSourceTest.java
index f9cf1df..7604ab5 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSourceTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSourceTest.java
@@ -19,9 +19,13 @@
 package org.apache.tinkerpop.gremlin.process.traversal.dsl.graph;
 
 import org.apache.tinkerpop.gremlin.process.remote.RemoteConnection;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SubgraphStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy;
 import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph;
 import org.junit.Test;
 
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
@@ -50,4 +54,23 @@ public class GraphTraversalSourceTest {
         verify(mock1, times(1)).close();
         verify(mock2, times(1)).close();
     }
+
+    @Test
+    public void shouldSupportStringBasedStrategies() throws Exception {
+        GraphTraversalSource g = EmptyGraph.instance().traversal();
+        assertFalse(g.getStrategies().getStrategy(SubgraphStrategy.class).isPresent());
+        g = g.withStrategy(SubgraphStrategy.class.getCanonicalName(),
+                "vertices", __.hasLabel("person"),
+                "vertexProperties", __.limit(0),
+                "edges", __.hasLabel("knows"));
+        assertTrue(g.getStrategies().getStrategy(SubgraphStrategy.class).isPresent());
+        g = g.withoutStrategy(SubgraphStrategy.class.getCanonicalName());
+        assertFalse(g.getStrategies().getStrategy(SubgraphStrategy.class).isPresent());
+        //
+        assertFalse(g.getStrategies().getStrategy(ReadOnlyStrategy.class).isPresent());
+        g = g.withStrategy(ReadOnlyStrategy.class.getCanonicalName());
+        assertTrue(g.getStrategies().getStrategy(ReadOnlyStrategy.class).isPresent());
+        g = g.withoutStrategy(ReadOnlyStrategy.class.getCanonicalName());
+        assertFalse(g.getStrategies().getStrategy(ReadOnlyStrategy.class).isPresent());
+    }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e6e59e41/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
index 4b93881..88ca626 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
@@ -24,7 +24,6 @@ import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
 import org.apache.tinkerpop.gremlin.process.traversal.P;
 import org.apache.tinkerpop.gremlin.process.traversal.SackFunctions;
 import org.apache.tinkerpop.gremlin.process.traversal.Translator;
-import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.util.ConnectiveP;
 import org.apache.tinkerpop.gremlin.process.traversal.util.OrP;
 import org.apache.tinkerpop.gremlin.structure.Element;
@@ -78,15 +77,12 @@ public final class GroovyTranslator implements Translator.ScriptTranslator {
         final StringBuilder traversalScript = new StringBuilder(start);
         for (final Bytecode.Instruction instruction : bytecode.getInstructions()) {
             final String methodName = instruction.getOperator();
-            if (methodName.equals(TraversalSource.Symbols.withStrategies))
-                continue;
-            final Object[] arguments = instruction.getArguments();
-            if (0 == arguments.length)
+            if (0 == instruction.getArguments().length)
                 traversalScript.append(".").append(methodName).append("()");
             else {
                 traversalScript.append(".");
                 String temp = methodName + "(";
-                for (final Object object : arguments) {
+                for (final Object object : instruction.getArguments()) {
                     temp = temp + convertToString(object) + ",";
                 }
                 traversalScript.append(temp.substring(0, temp.length() - 1)).append(")");

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e6e59e41/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonTranslator.java
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonTranslator.java b/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonTranslator.java
index 90d29e8..1a84e26 100644
--- a/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonTranslator.java
+++ b/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonTranslator.java
@@ -60,6 +60,7 @@ public class PythonTranslator implements Translator.ScriptTranslator {
 
     private final String traversalSource;
     private final boolean importStatics;
+    private static final boolean isTesting = Boolean.valueOf(System.getProperty("is.testing", "false"));
 
     PythonTranslator(final String traversalSource, final boolean importStatics) {
         this.traversalSource = traversalSource;
@@ -101,7 +102,7 @@ public class PythonTranslator implements Translator.ScriptTranslator {
         for (final Bytecode.Instruction instruction : bytecode.getInstructions()) {
             final String methodName = instruction.getOperator();
             final Object[] arguments = instruction.getArguments();
-            if (methodName.equals(TraversalSource.Symbols.withStrategies))
+            if (isTesting && methodName.equals(TraversalSource.Symbols.withStrategies))
                 continue;
             else if (0 == arguments.length)
                 traversalScript.append(".").append(SymbolHelper.toPython(methodName)).append("()");

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e6e59e41/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py b/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py
index 35b9b71..46b6dee 100644
--- a/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py
+++ b/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py
@@ -57,10 +57,18 @@ class GraphTraversalSource(object):
     source = GraphTraversalSource(self.graph, TraversalStrategies(self.traversal_strategies), Bytecode(self.bytecode))
     source.bytecode.add_source("withStrategies", *args)
     return source
+  def withStrategy(self, *args):
+    source = GraphTraversalSource(self.graph, TraversalStrategies(self.traversal_strategies), Bytecode(self.bytecode))
+    source.bytecode.add_source("withStrategy", *args)
+    return source
   def withoutStrategies(self, *args):
     source = GraphTraversalSource(self.graph, TraversalStrategies(self.traversal_strategies), Bytecode(self.bytecode))
     source.bytecode.add_source("withoutStrategies", *args)
     return source
+  def withoutStrategy(self, *args):
+    source = GraphTraversalSource(self.graph, TraversalStrategies(self.traversal_strategies), Bytecode(self.bytecode))
+    source.bytecode.add_source("withoutStrategy", *args)
+    return source
   def withRemote(self, remote_connection):
     source = GraphTraversalSource(self.graph, TraversalStrategies(self.traversal_strategies), Bytecode(self.bytecode))
     source.traversal_strategies.add_strategies([RemoteStrategy(remote_connection)])

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e6e59e41/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py b/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
index b0efcf1..f0ca27f 100644
--- a/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
+++ b/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
@@ -26,6 +26,7 @@ from gremlin_python import statics
 from gremlin_python.statics import long
 from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection
 from gremlin_python.process.traversal import Traverser
+from gremlin_python.process.graph_traversal import __
 from gremlin_python.structure.graph import Graph
 from gremlin_python.structure.graph import Vertex
 
@@ -59,6 +60,19 @@ class TestDriverRemoteConnection(TestCase):
         g.V().out().profile().next()
         connection.close()
 
+    def test_strategies(self):
+        statics.load_statics(globals())
+        connection = DriverRemoteConnection('ws://localhost:8182/gremlin', 'g')
+        g = Graph().traversal().withRemote(connection).withStrategy(
+            "org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SubgraphStrategy",
+            "vertices", __.hasLabel("person"),
+            "edges", __.hasLabel("created"))
+        assert 4 == g.V().count().next()
+        assert 0 == g.E().count().next()
+        assert 1 == g.V().label().dedup().count().next()
+        assert "person" == g.V().label().dedup().next()
+        connection.close()
+
     def test_side_effects(self):
         statics.load_statics(globals())
         connection = DriverRemoteConnection('ws://localhost:8182/gremlin', 'g')
@@ -104,7 +118,7 @@ class TestDriverRemoteConnection(TestCase):
         assert 3 == n["lop"]
         assert 1 == n["ripple"]
         #
-        t = g.withSideEffect('m',32).V().map(lambda: "x: x.sideEffects('m')")
+        t = g.withSideEffect('m', 32).V().map(lambda: "x: x.sideEffects('m')")
         results = t.toSet()
         assert 1 == len(results)
         assert 32 == list(results)[0]

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e6e59e41/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategyProcessTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategyProcessTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategyProcessTest.java
index 1a854bd..2a79c3c 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategyProcessTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategyProcessTest.java
@@ -31,7 +31,6 @@ import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.Inli
 import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;
 import org.apache.tinkerpop.gremlin.structure.Column;
 import org.apache.tinkerpop.gremlin.structure.Edge;
-import org.apache.tinkerpop.gremlin.structure.T;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -66,8 +65,7 @@ public class SubgraphStrategyProcessTest extends AbstractGremlinProcessTest {
     public void shouldFilterVertexCriterion() throws Exception {
         final Traversal<Vertex, ?> vertexCriterion = has("name", P.within("josh", "lop", "ripple"));
 
-        final SubgraphStrategy strategy = SubgraphStrategy.build().vertexCriterion(vertexCriterion).create();
-        final GraphTraversalSource sg = create(strategy);
+        final GraphTraversalSource sg = g.withStrategies(SubgraphStrategy.build().vertexCriterion(vertexCriterion).create());
 
         // three vertices are included in the subgraph
         assertEquals(6, g.V().count().next().longValue());
@@ -154,7 +152,7 @@ public class SubgraphStrategyProcessTest extends AbstractGremlinProcessTest {
         );
 
         final SubgraphStrategy strategy = SubgraphStrategy.build().edgeCriterion(edgeCriterion).create();
-        final GraphTraversalSource sg = create(strategy);
+        final GraphTraversalSource sg = g.withStrategies(strategy);
 
         // all vertices are here
         assertEquals(6, g.V().count().next().longValue());
@@ -261,8 +259,8 @@ public class SubgraphStrategyProcessTest extends AbstractGremlinProcessTest {
                 has("weight", 1.0d).hasLabel("created") // 10
         );
 
-        final SubgraphStrategy strategy = SubgraphStrategy.build().edgeCriterion(edgeCriterion).vertexCriterion(vertexCriterion).create();
-        final GraphTraversalSource sg = create(strategy);
+        final SubgraphStrategy strategy = SubgraphStrategy.build().edges(edgeCriterion).vertices(vertexCriterion).create();
+        final GraphTraversalSource sg = g.withStrategies(strategy);
 
         // three vertices are included in the subgraph
         assertEquals(6, g.V().count().next().longValue());
@@ -337,8 +335,7 @@ public class SubgraphStrategyProcessTest extends AbstractGremlinProcessTest {
         // this will exclude "peter"
         final Traversal<Vertex, ?> vertexCriterion = has("name", P.within("ripple", "josh", "marko"));
 
-        final SubgraphStrategy strategy = SubgraphStrategy.build().vertexCriterion(vertexCriterion).create();
-        final GraphTraversalSource sg = create(strategy);
+        final GraphTraversalSource sg = g.withStrategies(SubgraphStrategy.build().vertexCriterion(vertexCriterion).create());
 
         assertEquals(9, g.V().as("a").out().in().as("b").dedup("a", "b").count().next().intValue());
         assertEquals(2, sg.V().as("a").out().in().as("b").dedup("a", "b").count().next().intValue());
@@ -352,8 +349,7 @@ public class SubgraphStrategyProcessTest extends AbstractGremlinProcessTest {
     public void shouldGetExcludedVertex() throws Exception {
         final Traversal<Vertex, ?> vertexCriterion = has("name", P.within("josh", "lop", "ripple"));
 
-        final SubgraphStrategy strategy = SubgraphStrategy.build().vertexCriterion(vertexCriterion).create();
-        final GraphTraversalSource sg = create(strategy);
+        final GraphTraversalSource sg = g.withStrategies(SubgraphStrategy.build().vertexCriterion(vertexCriterion).create());
 
         sg.V(convertToVertexId("marko")).next();
     }
@@ -367,8 +363,7 @@ public class SubgraphStrategyProcessTest extends AbstractGremlinProcessTest {
                 has("weight", 1.0d).hasLabel("created") // 10
         );
 
-        final SubgraphStrategy strategy = SubgraphStrategy.build().edgeCriterion(edgeCriterion).create();
-        final GraphTraversalSource sg = create(strategy);
+        final GraphTraversalSource sg = g.withStrategies(SubgraphStrategy.build().edges(edgeCriterion).create());
 
         sg.E(sg.E(convertToEdgeId("marko", "knows", "vadas")).next()).next();
     }
@@ -376,48 +371,45 @@ public class SubgraphStrategyProcessTest extends AbstractGremlinProcessTest {
     @Test
     @LoadGraphWith(CREW)
     public void shouldFilterVertexProperties() throws Exception {
-        GraphTraversalSource sg = create(SubgraphStrategy.build().vertexProperties(has("startTime", P.gt(2005))).create());
+        GraphTraversalSource sg = g.withStrategy(SubgraphStrategy.class.getCanonicalName(), "vertexProperties", __.has("startTime", P.gt(2005)));
         checkResults(Arrays.asList("purcellville", "baltimore", "oakland", "seattle", "aachen"), sg.V().properties("location").value());
         checkResults(Arrays.asList("purcellville", "baltimore", "oakland", "seattle", "aachen"), sg.V().values("location"));
         if (sg.getStrategies().getStrategy(InlineFilterStrategy.class).isPresent())
             assertFalse(TraversalHelper.hasStepOfAssignableClassRecursively(TraversalFilterStep.class, sg.V().properties("location").value().iterate().asAdmin()));
         // check to make sure edge properties are not analyzed
-        sg = create(SubgraphStrategy.build().vertexProperties(has("startTime", P.gt(2005))).create());
+        sg = g.withStrategies(SubgraphStrategy.build().vertexProperties(has("startTime", P.gt(2005))).create());
         checkResults(Arrays.asList("purcellville", "baltimore", "oakland", "seattle", "aachen"), sg.V().as("a").properties("location").as("b").select("a").outE().properties().select("b").value().dedup());
         checkResults(Arrays.asList("purcellville", "baltimore", "oakland", "seattle", "aachen"), sg.V().as("a").values("location").as("b").select("a").outE().properties().select("b").dedup());
         if (sg.getStrategies().getStrategy(InlineFilterStrategy.class).isPresent())
             assertFalse(TraversalHelper.hasStepOfAssignableClassRecursively(TraversalFilterStep.class, sg.V().as("a").values("location").as("b").select("a").outE().properties().select("b").dedup().iterate().asAdmin()));
         //
-        sg = create(SubgraphStrategy.build().vertices(has("name", P.neq("stephen"))).vertexProperties(has("startTime", P.gt(2005))).create());
+        sg = g.withStrategies(SubgraphStrategy.build().vertices(has("name", P.neq("stephen"))).vertexProperties(has("startTime", P.gt(2005))).create());
         checkResults(Arrays.asList("baltimore", "oakland", "seattle", "aachen"), sg.V().properties("location").value());
         checkResults(Arrays.asList("baltimore", "oakland", "seattle", "aachen"), sg.V().values("location"));
         //
-        sg = create(SubgraphStrategy.build().vertices(has("name", P.not(P.within("stephen", "daniel")))).vertexProperties(has("startTime", P.gt(2005))).create());
+        sg = g.withStrategies(SubgraphStrategy.build().vertices(has("name", P.not(P.within("stephen", "daniel")))).vertexProperties(has("startTime", P.gt(2005))).create());
         checkResults(Arrays.asList("baltimore", "oakland", "seattle"), sg.V().properties("location").value());
         checkResults(Arrays.asList("baltimore", "oakland", "seattle"), sg.V().values("location"));
         //
-        sg = create(SubgraphStrategy.build().vertices(has("name", P.eq("matthias"))).vertexProperties(has("startTime", P.gte(2014))).create());
+        sg = g.withStrategies(SubgraphStrategy.build().vertices(has("name", P.eq("matthias"))).vertexProperties(has("startTime", P.gte(2014))).create());
         checkResults(makeMapList(1, "seattle", 1L), sg.V().groupCount().by("location"));
         //
-        sg = create(SubgraphStrategy.build().vertices(has("location")).vertexProperties(hasNot("endTime")).create());
+        sg = g.withStrategies(SubgraphStrategy.build().vertices(has("location")).vertexProperties(hasNot("endTime")).create());
         checkOrderedResults(Arrays.asList("aachen", "purcellville", "santa fe", "seattle"), sg.V().order().by("location", Order.incr).values("location"));
         //
-        sg = create(SubgraphStrategy.build().vertices(has("location")).vertexProperties(hasNot("endTime")).create());
+        sg = g.withStrategy(SubgraphStrategy.class.getCanonicalName(), "vertices", __.has("location"), "vertexProperties", __.hasNot("endTime"));
         checkResults(Arrays.asList("aachen", "purcellville", "santa fe", "seattle"), sg.V().valueMap("location").select(Column.values).unfold().unfold());
         checkResults(Arrays.asList("aachen", "purcellville", "santa fe", "seattle"), sg.V().propertyMap("location").select(Column.values).unfold().unfold().value());
         //
-        sg = create(SubgraphStrategy.build().edges(__.<Edge>hasLabel("uses").has("skill", 5)).create());
+        sg = g.withStrategies(SubgraphStrategy.build().edges(__.<Edge>hasLabel("uses").has("skill", 5)).create());
         checkResults(Arrays.asList(5, 5, 5), sg.V().outE().valueMap().select(Column.values).unfold());
         checkResults(Arrays.asList(5, 5, 5), sg.V().outE().propertyMap().select(Column.values).unfold().value());
         //
-        sg = create(SubgraphStrategy.build().vertexProperties(__.hasNot("skill")).create());
+        sg = g.withStrategies(SubgraphStrategy.build().vertexProperties(__.hasNot("skill")).create());
         checkResults(Arrays.asList(3, 3, 3, 4, 4, 5, 5, 5), sg.V().outE("uses").values("skill"));
         checkResults(Arrays.asList(3, 3, 3, 4, 4, 5, 5, 5), sg.V().as("a").properties().select("a").dedup().outE().values("skill"));
         checkResults(Arrays.asList(3, 3, 3, 4, 4, 5, 5, 5), sg.V().as("a").properties().select("a").dedup().outE().properties("skill").as("b").identity().select("b").by(__.value()));
     }
 
 
-    private GraphTraversalSource create(final SubgraphStrategy strategy) {
-        return graphProvider.traversal(graph, strategy);
-    }
 }


[10/36] tinkerpop git commit: ProfileTests and LazyBArrierStrategy don't play well with each other because ProfileTests expect certain bulks/counts/etc. Thus, if testing and there is ProfileStep, then the strategy is not applied.

Posted by da...@apache.org.
ProfileTests and LazyBArrierStrategy don't play well with each other because ProfileTests expect certain bulks/counts/etc. Thus, if testing and there is ProfileStep, then the strategy is not applied.


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

Branch: refs/heads/TINKERPOP-1458
Commit: 658630a9785952cada916377bb06283e9e85c6c4
Parents: 5f0e843
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Tue Oct 4 17:11:51 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Tue Oct 4 17:11:51 2016 -0600

----------------------------------------------------------------------
 .../optimization/LazyBarrierStrategy.java       |  9 +++--
 .../optimization/LazyBarrierStrategyTest.java   |  1 +
 .../process/traversal/step/map/ProfileTest.java | 38 ++++++--------------
 3 files changed, 19 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/658630a9/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/LazyBarrierStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/LazyBarrierStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/LazyBarrierStrategy.java
index f6f9021..176921e 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/LazyBarrierStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/LazyBarrierStrategy.java
@@ -28,6 +28,8 @@ import org.apache.tinkerpop.gremlin.process.traversal.step.map.FlatMapStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.NoOpBarrierStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.VertexStep;
+import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.ProfileSideEffectStep;
+import org.apache.tinkerpop.gremlin.process.traversal.step.util.ProfileStep;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.AbstractTraversalStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.traverser.TraverserRequirement;
 import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;
@@ -41,6 +43,7 @@ import java.util.Set;
  */
 public final class LazyBarrierStrategy extends AbstractTraversalStrategy<TraversalStrategy.OptimizationStrategy> implements TraversalStrategy.OptimizationStrategy {
 
+    private final boolean IS_TESTING = Boolean.valueOf(System.getProperty("is.testing", "false"));
     private static final LazyBarrierStrategy INSTANCE = new LazyBarrierStrategy();
     private static final Set<Class<? extends OptimizationStrategy>> PRIORS = new HashSet<>(Arrays.asList(
             RangeByIsCountStrategy.class,
@@ -60,7 +63,9 @@ public final class LazyBarrierStrategy extends AbstractTraversalStrategy<Travers
     @Override
     public void apply(final Traversal.Admin<?, ?> traversal) {
         if (TraversalHelper.onGraphComputer(traversal) ||
-                traversal.getTraverserRequirements().contains(TraverserRequirement.PATH))
+                traversal.getTraverserRequirements().contains(TraverserRequirement.PATH) ||
+                (IS_TESTING && (TraversalHelper.hasStepOfAssignableClass(ProfileStep.class, TraversalHelper.getRootTraversal(traversal))) ||
+                        TraversalHelper.hasStepOfAssignableClass(ProfileSideEffectStep.class, TraversalHelper.getRootTraversal(traversal)))) // necessary cause ProfileTest analyzes counts
             return;
 
         boolean foundFlatMap = false;
@@ -70,7 +75,7 @@ public final class LazyBarrierStrategy extends AbstractTraversalStrategy<Travers
 
             if (step instanceof PathProcessor) {
                 final Set<String> keepLabels = ((PathProcessor) step).getKeepLabels();
-                if (null == keepLabels || keepLabels.isEmpty())
+                if (null != keepLabels && keepLabels.isEmpty()) // if no more path data, then start barrier'ing again
                     labeledPath = false;
             }
             if (step instanceof FlatMapStep &&

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/658630a9/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/LazyBarrierStrategyTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/LazyBarrierStrategyTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/LazyBarrierStrategyTest.java
index 314cfeb..f21c64a 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/LazyBarrierStrategyTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/LazyBarrierStrategyTest.java
@@ -94,6 +94,7 @@ public class LazyBarrierStrategyTest {
                 {__.out().as("a").out().in().where(P.neq("a")), __.out().as("a").out().in().where(P.neq("a")), Collections.emptyList()},
                 {__.out().as("a").out().in().where(P.neq("a")).out().out(), __.out().as("a").out().in().where(P.neq("a")).barrier(2500).out().barrier(SIZE).out(), Collections.singletonList(PathRetractionStrategy.instance())},
                 {__.out().as("a").out().as("b").in().where(P.neq("a")).out().out(), __.out().as("a").out().as("b").in().where(P.neq("a")).barrier(2500).out().barrier(SIZE).out(), Collections.singletonList(PathRetractionStrategy.instance())},
+                {__.out().as("a").out().as("b").in().where(P.neq("a")).out().out(), __.out().as("a").out().as("b").in().where(P.neq("a")).out().out(), Collections.emptyList()},
                 {__.out().as("a").out().as("b").in().where(P.neq("a")).out().select("b").out(), __.out().as("a").out().as("b").in().where(P.neq("a")).barrier(2500).out().select("b").barrier(2500).out(), Collections.singletonList(PathRetractionStrategy.instance())},
                 {__.out().as("a").out().as("b").in().where(P.neq("a")).out().select("b").out().out(), __.out().as("a").out().as("b").in().where(P.neq("a")).barrier(2500).out().select("b").barrier(2500).out().barrier(SIZE).out(), Collections.singletonList(PathRetractionStrategy.instance())},
         });

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/658630a9/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ProfileTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ProfileTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ProfileTest.java
index 927f91d..548e7ab 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ProfileTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ProfileTest.java
@@ -32,7 +32,6 @@ import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
 import org.apache.tinkerpop.gremlin.process.traversal.step.Profiling;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.ProfileStep;
-import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.LazyBarrierStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.RangeByIsCountStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.RepeatUnrollStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ComputerVerificationStrategy;
@@ -93,7 +92,6 @@ public abstract class ProfileTest extends AbstractGremlinProcessTest {
     @LoadGraphWith(MODERN)
     public void modern_V_out_out_profile() {
         final Traversal<Vertex, TraversalMetrics> traversal = get_g_V_out_out_profile();
-        traversal.asAdmin().getStrategies().removeStrategies(LazyBarrierStrategy.class);
         printTraversalForm(traversal);
         validate_g_V_out_out_profile_modern(traversal, traversal.next());
     }
@@ -102,7 +100,6 @@ public abstract class ProfileTest extends AbstractGremlinProcessTest {
     @LoadGraphWith(MODERN)
     public void modern_V_out_out_profileXmetricsX() {
         final Traversal<Vertex, Vertex> traversal = get_g_V_out_out_profileXmetricsX();
-        traversal.asAdmin().getStrategies().removeStrategies(LazyBarrierStrategy.class);
         printTraversalForm(traversal);
         traversal.iterate();
         validate_g_V_out_out_profile_modern(traversal, traversal.asAdmin().getSideEffects().<TraversalMetrics>get(METRICS_KEY));
@@ -138,7 +135,6 @@ public abstract class ProfileTest extends AbstractGremlinProcessTest {
     @LoadGraphWith(GRATEFUL)
     public void grateful_V_out_out_profile() {
         final Traversal<Vertex, TraversalMetrics> traversal = get_g_V_out_out_profile();
-        traversal.asAdmin().getStrategies().removeStrategies(LazyBarrierStrategy.class);
         printTraversalForm(traversal);
         final TraversalMetrics traversalMetrics = traversal.next();
         validate_g_V_out_out_profile_grateful(traversalMetrics);
@@ -148,7 +144,6 @@ public abstract class ProfileTest extends AbstractGremlinProcessTest {
     @LoadGraphWith(GRATEFUL)
     public void grateful_V_out_out_profileXmetricsX() {
         final Traversal<Vertex, Vertex> traversal = get_g_V_out_out_profileXmetricsX();
-        traversal.asAdmin().getStrategies().removeStrategies(LazyBarrierStrategy.class);
         printTraversalForm(traversal);
         traversal.iterate();
         final TraversalMetrics traversalMetrics = traversal.asAdmin().getSideEffects().<TraversalMetrics>get(METRICS_KEY);
@@ -190,7 +185,6 @@ public abstract class ProfileTest extends AbstractGremlinProcessTest {
     @IgnoreEngine(TraversalEngine.Type.COMPUTER)
     public void g_V_sideEffectXThread_sleepX10XX_sideEffectXThread_sleepX5XX_profile() {
         final Traversal<Vertex, TraversalMetrics> traversal = get_g_V_sideEffectXThread_sleepX10XX_sideEffectXThread_sleepX5XX_profile();
-        traversal.asAdmin().getStrategies().removeStrategies(LazyBarrierStrategy.class);
         printTraversalForm(traversal);
         TraversalMetrics traversalMetrics = traversal.next();
         assertEquals("There should be 8 steps in this traversal (counting injected profile steps).", 8, traversal.asAdmin().getSteps().size());
@@ -202,7 +196,6 @@ public abstract class ProfileTest extends AbstractGremlinProcessTest {
     @IgnoreEngine(TraversalEngine.Type.COMPUTER)
     public void g_V_sideEffectXThread_sleepX10XX_sideEffectXThread_sleepX5XX_profileXmetricsX() {
         final Traversal<Vertex, Vertex> traversal = get_g_V_sideEffectXThread_sleepX10XX_sideEffectXThread_sleepX5XX_profileXmetricsX();
-        traversal.asAdmin().getStrategies().removeStrategies(LazyBarrierStrategy.class);
         printTraversalForm(traversal);
         traversal.iterate();
         assertEquals("There should be 7 steps in this traversal (counting injected profile steps).", 7, traversal.asAdmin().getSteps().size());
@@ -237,7 +230,6 @@ public abstract class ProfileTest extends AbstractGremlinProcessTest {
     @LoadGraphWith(MODERN)
     public void g_V_repeat_both_profile() {
         final Traversal<Vertex, TraversalMetrics> traversal = get_g_V_repeatXbothX_timesX3X_profile();
-        traversal.asAdmin().getStrategies().removeStrategies(LazyBarrierStrategy.class);
         printTraversalForm(traversal);
 
         final TraversalMetrics traversalMetrics = traversal.next();
@@ -250,7 +242,6 @@ public abstract class ProfileTest extends AbstractGremlinProcessTest {
     @LoadGraphWith(MODERN)
     public void g_V_repeat_both_profileXmetricsX() {
         final Traversal<Vertex, Vertex> traversal = get_g_V_repeatXbothX_timesX3X_profileXmetricsX();
-        traversal.asAdmin().getStrategies().removeStrategies(LazyBarrierStrategy.class);
         printTraversalForm(traversal);
         traversal.iterate();
         final TraversalMetrics traversalMetrics = traversal.asAdmin().getSideEffects().<TraversalMetrics>get(METRICS_KEY);
@@ -316,7 +307,6 @@ public abstract class ProfileTest extends AbstractGremlinProcessTest {
     @LoadGraphWith(MODERN)
     public void g_V_whereXinXcreatedX_count_isX1XX_name_profile() {
         final Traversal<Vertex, TraversalMetrics> traversal = get_g_V_whereXinXcreatedX_count_isX1XX_name_profile();
-        traversal.asAdmin().getStrategies().removeStrategies(LazyBarrierStrategy.class);
         printTraversalForm(traversal);
         final TraversalMetrics traversalMetrics = traversal.next();
         validate_g_V_whereXinXcreatedX_count_isX1XX_name_profile(traversal, traversalMetrics);
@@ -326,7 +316,6 @@ public abstract class ProfileTest extends AbstractGremlinProcessTest {
     @LoadGraphWith(MODERN)
     public void g_V_whereXinXcreatedX_count_isX1XX_name_profileXmetricsX() {
         final Traversal<Vertex, String> traversal = get_g_V_whereXinXcreatedX_count_isX1XX_name_profileXmetricsX();
-        traversal.asAdmin().getStrategies().removeStrategies(LazyBarrierStrategy.class);
         printTraversalForm(traversal);
         traversal.iterate();
         final TraversalMetrics traversalMetrics = traversal.asAdmin().getSideEffects().<TraversalMetrics>get(METRICS_KEY);
@@ -364,14 +353,13 @@ public abstract class ProfileTest extends AbstractGremlinProcessTest {
     @Test
     @LoadGraphWith(MODERN)
     public void testProfileStrategyCallback() {
-        final Traversal<Vertex, TraversalMetrics> traversal = get_g_V_out_out_profile();
-        traversal.asAdmin().getStrategies().removeStrategies(LazyBarrierStrategy.class);
-        MockStep mockStep = new MockStep(traversal.asAdmin());
-        traversal.asAdmin().addStep(3, mockStep);
-        TraversalMetrics traversalMetrics = traversal.next();
+        final Traversal<Vertex, TraversalMetrics> t = get_g_V_out_out_profile();
+        MockStep mockStep = new MockStep(t.asAdmin());
+        t.asAdmin().addStep(3, mockStep);
+        TraversalMetrics traversalMetrics = t.next();
         assertTrue(mockStep.callbackCalled);
 
-        if (!onGraphComputer(traversal.asAdmin())) {
+        if (!onGraphComputer(t.asAdmin())) {
             assertEquals(100, traversalMetrics.getMetrics(3).getCount("bogusCount").longValue());
         }
     }
@@ -379,15 +367,14 @@ public abstract class ProfileTest extends AbstractGremlinProcessTest {
     @Test
     @LoadGraphWith(MODERN)
     public void testProfileStrategyCallbackSideEffect() {
-        final Traversal<Vertex, Vertex> traversal = get_g_V_out_out_profileXmetricsX();
-        traversal.asAdmin().getStrategies().removeStrategies(LazyBarrierStrategy.class);
-        MockStep mockStep = new MockStep(traversal.asAdmin());
-        traversal.asAdmin().addStep(3, mockStep);
-        traversal.iterate();
+        final Traversal<Vertex, Vertex> t = get_g_V_out_out_profileXmetricsX();
+        MockStep mockStep = new MockStep(t.asAdmin());
+        t.asAdmin().addStep(3, mockStep);
+        t.iterate();
         assertTrue(mockStep.callbackCalled);
 
-        if (!onGraphComputer(traversal.asAdmin())) {
-            final TraversalMetrics traversalMetrics = traversal.asAdmin().getSideEffects().<TraversalMetrics>get(METRICS_KEY);
+        if (!onGraphComputer(t.asAdmin())) {
+            final TraversalMetrics traversalMetrics = t.asAdmin().getSideEffects().<TraversalMetrics>get(METRICS_KEY);
             assertEquals(100, traversalMetrics.getMetrics(3).getCount("bogusCount").longValue());
         }
     }
@@ -396,7 +383,6 @@ public abstract class ProfileTest extends AbstractGremlinProcessTest {
     @LoadGraphWith(MODERN)
     public void g_V_matchXa_created_b__b_in_count_isXeqX1XXX_selectXa_bX_profile() {
         final Traversal<Vertex, TraversalMetrics> traversal = get_g_V_matchXa_created_b__b_in_count_isXeqX1XXX_selectXa_bX_profile();
-        traversal.asAdmin().getStrategies().removeStrategies(LazyBarrierStrategy.class);
         printTraversalForm(traversal);
         traversal.iterate();
     }
@@ -405,7 +391,6 @@ public abstract class ProfileTest extends AbstractGremlinProcessTest {
     @LoadGraphWith(MODERN)
     public void g_V_matchXa_created_b__b_in_count_isXeqX1XXX_selectXa_bX_profileXmetricsX() {
         final Traversal<Vertex, Map<String, String>> traversal = get_g_V_matchXa_created_b__b_in_count_isXeqX1XXX_selectXa_bX_profileXmetricsX();
-        traversal.asAdmin().getStrategies().removeStrategies(LazyBarrierStrategy.class);
         printTraversalForm(traversal);
         traversal.iterate();
     }
@@ -415,7 +400,6 @@ public abstract class ProfileTest extends AbstractGremlinProcessTest {
     @IgnoreEngine(TraversalEngine.Type.STANDARD)
     public void g_V_hasLabelXpersonX_pageRank_byXrankX_byXbothEX_rank_profile() {
         final Traversal<Vertex, TraversalMetrics> traversal = get_g_V_hasLabelXpersonX_pageRank_byXrankX_byXbothEX_rank_profile();
-        traversal.asAdmin().getStrategies().removeStrategies(LazyBarrierStrategy.class);
         //printTraversalForm(traversal);
         try {
             traversal.iterate();


[21/36] tinkerpop git commit: Updated symbolic link to gremlin.sh

Posted by da...@apache.org.
Updated symbolic link to gremlin.sh


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

Branch: refs/heads/TINKERPOP-1458
Commit: dbc905c44f7479250589420890f0fa44b8be5588
Parents: abc9d7a
Author: Daniel Kuppitz <da...@hotmail.com>
Authored: Fri Oct 7 15:03:41 2016 +0200
Committer: Daniel Kuppitz <da...@hotmail.com>
Committed: Fri Oct 7 15:03:41 2016 +0200

----------------------------------------------------------------------
 gremlin-console/bin/gremlin.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/dbc905c4/gremlin-console/bin/gremlin.sh
----------------------------------------------------------------------
diff --git a/gremlin-console/bin/gremlin.sh b/gremlin-console/bin/gremlin.sh
index 5825879..60e8426 120000
--- a/gremlin-console/bin/gremlin.sh
+++ b/gremlin-console/bin/gremlin.sh
@@ -1 +1 @@
-../target/apache-tinkerpop-gremlin-console-3.1.5-SNAPSHOT-standalone/bin/gremlin.sh
\ No newline at end of file
+../target/apache-tinkerpop-gremlin-console-3.2.3-SNAPSHOT-standalone/bin/gremlin.sh
\ No newline at end of file


[20/36] tinkerpop git commit: removed a GremlinServer test that assumes a particular traverser count. This shouldn't be assumed given that Gremlin does not guarantee traversers counts nor ordering. Thus, any tests that assume such things without explicit

Posted by da...@apache.org.
removed a GremlinServer test that assumes a particular traverser count. This shouldn't be assumed given that Gremlin does not guarantee traversers counts nor ordering. Thus, any tests that assume such things without explicit steps that dictate such matters (e.g. barrier() and order()) should not exist. This is why ProfileTest (looking scornfully at you @rjbriody) is the bane of our existence. It assumes not only traverser counts, but also traversal step structure. Daaaaaaah.


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

Branch: refs/heads/TINKERPOP-1458
Commit: abc9d7af0a1cd7d6809ca4c04792467a8b209d94
Parents: a829e9d
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Fri Oct 7 06:19:42 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Fri Oct 7 06:19:42 2016 -0600

----------------------------------------------------------------------
 .../gremlin/server/GremlinResultSetIntegrateTest.java   | 12 ------------
 1 file changed, 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/abc9d7af/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinResultSetIntegrateTest.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinResultSetIntegrateTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinResultSetIntegrateTest.java
index d149d7c..3c1efef 100644
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinResultSetIntegrateTest.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinResultSetIntegrateTest.java
@@ -93,18 +93,6 @@ public class GremlinResultSetIntegrateTest extends AbstractGremlinServerIntegrat
     }
 
     @Test
-    public void shouldHandleVertexResultFromTraversal() throws Exception {
-        final Graph graph = TinkerGraph.open();
-        final GraphTraversalSource g = graph.traversal();
-        final Client aliased = client.alias("g");
-        final ResultSet resultSet = aliased.submit(g.V().both().both());
-        final List<Result> results = resultSet.all().get();
-
-        assertThat(results.get(0).getObject(), CoreMatchers.instanceOf(Traverser.class));
-        assertEquals(30, results.size());
-    }
-
-    @Test
     public void shouldHandleVertexResultFromTraversalBulked() throws Exception {
         final Graph graph = TinkerGraph.open();
         final GraphTraversalSource g = graph.traversal();


[17/36] tinkerpop git commit: Merge branch 'TINKERPOP-1488'

Posted by da...@apache.org.
Merge branch 'TINKERPOP-1488'


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

Branch: refs/heads/TINKERPOP-1458
Commit: 3caa2a99a9bbc2ead5561cd3554d82ea78e5d76f
Parents: c1206f0 aa3cd93
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Thu Oct 6 15:40:15 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Thu Oct 6 15:40:15 2016 -0600

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |   1 +
 .../process/traversal/TraversalStrategies.java  |   3 +-
 .../finalization/LazyBarrierStrategy.java       |  31 +++---
 .../optimization/LazyBarrierStrategy.java       | 108 +++++++++++++++++++
 .../tinkerpop/gremlin/util/CoreImports.java     |   2 +-
 .../finalization/LazyBarrierStrategyTest.java   |  74 -------------
 .../optimization/LazyBarrierStrategyTest.java   | 102 ++++++++++++++++++
 7 files changed, 231 insertions(+), 90 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3caa2a99/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --cc CHANGELOG.asciidoc
index 6826ca8,6a21b7d..cda6d8c
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@@ -26,16 -26,7 +26,17 @@@ image::https://raw.githubusercontent.co
  TinkerPop 3.2.3 (Release Date: NOT OFFICIALLY RELEASED YET)
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  
 +* Fixed a `Set`, `List`, `Map` bug in the various `Translators` where such collections were not being internally translated.
 +* Fixed a `Bytecode` bug where nested structures (map, list, set) were not being analyzed for bindings and bytecode conversions.
 +* Fixed a `String` bug in `GroovyTranslator` and `PythonTranslator` where if the string has double-quotes it now uses """ """.
 +* Added a default `TraversalStrategy.getConfiguration()` which returns the configuration needed to construct the strategy.
 +* Gremlin-Java `TraversalStrategy` and `Computer` instances are now converted to `Map`-representations in `Bytecode`.
 +* `Computer` instances can be created with `Computer.create(Configuration)` and accessed via `Computer.getConf()`.
 +* Every `TraversalStrategy` can be created via a `Configuration` and a static `MyStrategy.create(Configuration)`.
 +* Added `TraversalSource.withComputer(Map<String,Object>)` for better language variant support.
 +* Added `TraversalSource.withStrategies(Map<String,Object>...)`/`withoutStrategies(String...)` for better language variant support.
 +* Added `PartitionStrategy.Builder.readPartitions()` and deprecated `PartitionStrategy.Builder.addPartition()`.
+ * A new version of `LazyBarrierStrategy` has been created and added to the default strategies.
  * `FilterRankStrategy` now propagates labels "right" over non-`Scoping` filters.
  * Fixed a bug in `ConnectiveP` where nested equivalent connectives should be inlined.
  * Fixed a bug in `IncidentToAdjacentStrategy` where `TreeStep` traversals were allowed.


[06/36] tinkerpop git commit: added static create(Configuration) methods to all Builder-based strategies except EventStrategy as that requires Java objects :(. Deprecated PartitionStrategy.Builder.addReadParition() in favor of readParitions(String...). C

Posted by da...@apache.org.
added static create(Configuration) methods to all Builder-based strategies except EventStrategy as that requires Java objects :(. Deprecated PartitionStrategy.Builder.addReadParition() in favor of readParitions(String...). Computer now has a Configuration-based constructor and corresponding withComputer(Object...) arguments.


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

Branch: refs/heads/TINKERPOP-1458
Commit: 95557bf3aac279282e3f3779d68ce195bd4ca058
Parents: e6e59e4
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Tue Oct 4 10:26:12 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Tue Oct 4 10:26:12 2016 -0600

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |   3 +
 .../upgrade/release-3.2.x-incubating.asciidoc   |  44 ++++++++
 .../gremlin/process/computer/Computer.java      |  30 +++++
 .../process/traversal/TraversalSource.java      |  32 ++++++
 .../dsl/graph/GraphTraversalSource.java         |   5 +
 .../strategy/decoration/ElementIdStrategy.java  |  16 ++-
 .../decoration/HaltedTraverserStrategy.java     |   9 ++
 .../strategy/decoration/PartitionStrategy.java  |  62 +++++++++--
 .../strategy/decoration/SubgraphStrategy.java   |   2 +-
 .../gremlin/groovy/jsr223/GroovyTranslator.java |  10 +-
 .../gremlin/python/jsr223/PythonTranslator.java |   7 +-
 .../driver/test_driver_remote_connection.py     |   6 +
 .../PartitionStrategyProcessTest.java           | 109 ++++++++++---------
 .../process/TinkerGraphComputerProvider.java    |   7 +-
 .../decoration/HaltedTraverserStrategyTest.java |   5 +-
 15 files changed, 269 insertions(+), 78 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/95557bf3/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index dc2b03b..35ff317 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,6 +26,9 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 TinkerPop 3.2.3 (Release Date: NOT OFFICIALLY RELEASED YET)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+* Added `TraversalSource.withComputer(Object...)` for better language variant support.
+* Added `PartitionStrategy.Builder.readPartitions()` and deprecated `PartitionStrategy.Builder.addPartition()`.
+* Added `TraversalSource.withStrategy(String,Object...)`/`withoutStrategy(String)` for better language variant support.
 * `FilterRankStrategy` now propagates labels "right" over non-`Scoping` filters.
 * Fixed a bug in `ConnectiveP` where nested equivalent connectives should be inlined.
 * Fixed a bug in `IncidentToAdjacentStrategy` where `TreeStep` traversals were allowed.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/95557bf3/docs/src/upgrade/release-3.2.x-incubating.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/upgrade/release-3.2.x-incubating.asciidoc b/docs/src/upgrade/release-3.2.x-incubating.asciidoc
index 49790af..983c63e 100644
--- a/docs/src/upgrade/release-3.2.x-incubating.asciidoc
+++ b/docs/src/upgrade/release-3.2.x-incubating.asciidoc
@@ -158,6 +158,50 @@ Upgrading for Providers
 Graph System Providers
 ^^^^^^^^^^^^^^^^^^^^^^
 
+Configurable Strategies
++++++++++++++++++++++++
+
+`TraversalSource.withStrategies()` and `TraversalSource.withoutStrategies()` use Java objects. In order to make strategy
+manipulation possible from Gremlin language variants like Gremlin-Python, it is important to support non-JVM-based versions
+of these methods. As such, `TraversalSource.withStrategy(String,Object...)` and `TraversalSource.withoutStrategy(String)`
+were added.
+
+If the provider has non-configurable `TraversalStrategy` classes, those classes should expose a static `instance()`-method.
+This is typical and thus, backwards compatible. However, if the provider has a `TraversalStrategy` that can be configured
+(e.g. via a `Builder`), then it should expose a static `create(Configuration)`-method, where the keys of the configuration
+are the method names of the `Builder` and the values are the method arguments. For instance, for Gremlin-Python to create
+a `SubgraphStrategy`, it does the following:
+
+[source,python]
+----
+g = Graph().traversal().withRemote(connection).
+        withStrategy('org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SubgraphStrategy',
+            'vertices', __.hasLabel('person'),
+            'edges', __.has('weight',gt(0.5))
+---
+
+`SubgraphStrategy.create(Configuration)`-method is defined as:
+
+[source,java]
+----
+public static SubgraphStrategy create(final Configuration configuration) {
+    final Builder builder = SubgraphStrategy.build();
+    configuration.getKeys().forEachRemaining(key -> {
+        if (key.equals("vertices") || key.equals("vertexCriterion"))
+            builder.vertices((Traversal) configuration.getProperty(key));
+        else if (key.equals("edges") || key.equals("edgeCriterion"))
+            builder.edges((Traversal) configuration.getProperty(key));
+        else if (key.equals("vertexProperties"))
+            builder.vertexProperties((Traversal) configuration.getProperty(key));
+        else
+            throw new IllegalArgumentException("The following " + SubgraphStrategy.class.getSimpleName() + " configuration is unknown: " + key + ":" + configuration.getProperty(key));
+        });
+        return builder.create();
+    }
+----
+
+See: link:https://issues.apache.org/jira/browse/TINKERPOP-1455[TINKERPOP-1455]
+
 Deprecated elementNotFound
 ++++++++++++++++++++++++++
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/95557bf3/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/Computer.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/Computer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/Computer.java
index 8fca818..fdeac0b 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/Computer.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/Computer.java
@@ -19,13 +19,16 @@
 
 package org.apache.tinkerpop.gremlin.process.computer;
 
+import org.apache.commons.configuration.Configuration;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.structure.Edge;
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
 
 import java.io.Serializable;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.function.Function;
 
@@ -46,6 +49,33 @@ public final class Computer implements Function<Graph, GraphComputer>, Serializa
         this.graphComputerClass = graphComputerClass;
     }
 
+    public static Computer compute(final Configuration configuration) {
+        try {
+            final Computer computer = new Computer(configuration.containsKey("graphComputer") ?
+                    (Class) Class.forName(configuration.getString("graphComputer")) :
+                    GraphComputer.class);
+            for (final String key : (List<String>) IteratorUtils.asList(configuration.getKeys())) {
+                if (key.equals("graphComputer")) {
+                    // do nothing
+                } else if (key.equals("workers"))
+                    computer.workers = configuration.getInt(key);
+                else if (key.equals("persist"))
+                    computer.persist = GraphComputer.Persist.valueOf(configuration.getString(key));
+                else if (key.equals("result"))
+                    computer.resultGraph = GraphComputer.ResultGraph.valueOf(configuration.getString(key));
+                else if (key.equals("vertices"))
+                    computer.vertices = (Traversal) configuration.getProperty(key);
+                else if (key.equals("edges"))
+                    computer.edges = (Traversal) configuration.getProperty(key);
+                else
+                    computer.configuration.put(key, configuration.getProperty(key));
+            }
+            return computer;
+        } catch (final ClassNotFoundException e) {
+            throw new IllegalArgumentException(e.getMessage(), e);
+        }
+    }
+
     public static Computer compute() {
         return new Computer(GraphComputer.class);
     }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/95557bf3/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalSource.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalSource.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalSource.java
index 8d5cf93..a31b875 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalSource.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalSource.java
@@ -189,6 +189,38 @@ public interface TraversalSource extends Cloneable, AutoCloseable {
     }
 
     /**
+     * Configure a {@link GraphComputer} to be used for the execution of subsequently spawned traversal.
+     *
+     * @param namedArguments key/value pair arguments where the even indices are string keys
+     * @return a new traversal source with updated strategies
+     */
+    public default TraversalSource withComputer(final Object... namedArguments) {
+        if (namedArguments.length == 1) {
+            if (namedArguments[0] instanceof Class)
+                return this.withComputer((Class<? extends GraphComputer>) namedArguments[1]);
+            else if (namedArguments[0] instanceof Computer)
+                return this.withComputer((Computer) namedArguments[1]);
+        }
+        ElementHelper.legalPropertyKeyValueArray(namedArguments);
+        final Map<String, Object> configuration = new HashMap<>();
+        for (int i = 0; i < namedArguments.length; i = i + 2) {
+            configuration.put((String) namedArguments[i], namedArguments[i + 1]);
+        }
+        final Computer computer = Computer.compute(new MapConfiguration(configuration));
+        final List<TraversalStrategy<?>> graphComputerStrategies = TraversalStrategies.GlobalCache.getStrategies(computer.apply(this.getGraph()).getClass()).toList();
+        final TraversalStrategy[] traversalStrategies = new TraversalStrategy[graphComputerStrategies.size() + 1];
+        traversalStrategies[0] = new VertexProgramStrategy(computer);
+        for (int i = 0; i < graphComputerStrategies.size(); i++) {
+            traversalStrategies[i + 1] = graphComputerStrategies.get(i);
+        }
+        ///
+        final TraversalSource clone = this.clone();
+        clone.getStrategies().addStrategies(traversalStrategies);
+        clone.getBytecode().addSource(TraversalSource.Symbols.withComputer, computer);
+        return clone;
+    }
+
+    /**
      * Add a {@link Function} that will generate a {@link GraphComputer} from the {@link Graph} that will be used to execute the traversal.
      * This adds a {@link VertexProgramStrategy} to the strategies.
      *

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/95557bf3/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSource.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSource.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSource.java
index bf2da7e..2bd4bdf 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSource.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSource.java
@@ -127,6 +127,11 @@ public class GraphTraversalSource implements TraversalSource {
     }
 
     @Override
+    public GraphTraversalSource withComputer(final Object... namedArguments) {
+        return (GraphTraversalSource) TraversalSource.super.withComputer(namedArguments);
+    }
+
+    @Override
     public GraphTraversalSource withComputer(final Computer computer) {
         return (GraphTraversalSource) TraversalSource.super.withComputer(computer);
     }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/95557bf3/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/ElementIdStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/ElementIdStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/ElementIdStrategy.java
index 40ac805..396de49 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/ElementIdStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/ElementIdStrategy.java
@@ -18,6 +18,7 @@
  */
 package org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration;
 
+import org.apache.commons.configuration.Configuration;
 import org.apache.tinkerpop.gremlin.process.traversal.P;
 import org.apache.tinkerpop.gremlin.process.traversal.Parameterizing;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
@@ -27,9 +28,9 @@ import org.apache.tinkerpop.gremlin.process.traversal.step.filter.HasStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.AddEdgeStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.AddVertexStartStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.AddVertexStep;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.IdStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.PropertiesStep;
-import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.AbstractTraversalStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;
@@ -150,4 +151,17 @@ public final class ElementIdStrategy extends AbstractTraversalStrategy<Traversal
             return new ElementIdStrategy(idPropertyKey, idMaker);
         }
     }
+
+    public static ElementIdStrategy create(final Configuration configuration) {
+        final ElementIdStrategy.Builder builder = ElementIdStrategy.build();
+        configuration.getKeys().forEachRemaining(key -> {
+            if (key.equals("idPropertyKey"))
+                builder.idPropertyKey((String) configuration.getProperty(key));
+            else if (key.equals("idMaker"))
+                builder.idMaker((Supplier) configuration.getProperty(key));
+            else
+                throw new IllegalArgumentException("The following " + ElementIdStrategy.class.getSimpleName() + " configuration is unknown: " + key + ":" + configuration.getProperty(key));
+        });
+        return builder.create();
+    }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/95557bf3/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/HaltedTraverserStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/HaltedTraverserStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/HaltedTraverserStrategy.java
index 1a2c207..cd5119b 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/HaltedTraverserStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/HaltedTraverserStrategy.java
@@ -19,6 +19,7 @@
 
 package org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration;
 
+import org.apache.commons.configuration.Configuration;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
@@ -58,6 +59,14 @@ public final class HaltedTraverserStrategy extends AbstractTraversalStrategy<Tra
         return traverser;
     }
 
+    public static HaltedTraverserStrategy create(final Configuration configuration) {
+        try {
+            return new HaltedTraverserStrategy(Class.forName((String) configuration.getProperty("haltedTraverserFactory")));
+        } catch (final ClassNotFoundException e) {
+            throw new IllegalArgumentException(e.getMessage(), e);
+        }
+    }
+
     ////////////
 
     public static HaltedTraverserStrategy detached() {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/95557bf3/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategy.java
index 58e641b..ef424c7 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategy.java
@@ -18,6 +18,7 @@
  */
 package org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration;
 
+import org.apache.commons.configuration.Configuration;
 import org.apache.tinkerpop.gremlin.process.traversal.P;
 import org.apache.tinkerpop.gremlin.process.traversal.Parameterizing;
 import org.apache.tinkerpop.gremlin.process.traversal.Step;
@@ -33,12 +34,12 @@ import org.apache.tinkerpop.gremlin.process.traversal.step.map.AddVertexStartSte
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.AddVertexStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.EdgeOtherVertexStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.EdgeVertexStep;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.LambdaMapStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.PropertiesStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.PropertyMapStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.VertexStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.AddPropertyStep;
-import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.Parameters;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.AbstractTraversalStrategy;
@@ -53,6 +54,7 @@ import org.apache.tinkerpop.gremlin.structure.util.ElementHelper;
 
 import java.io.Serializable;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -83,7 +85,7 @@ public final class PartitionStrategy extends AbstractTraversalStrategy<Traversal
         this.writePartition = builder.writePartition;
         this.partitionKey = builder.partitionKey;
         this.readPartitions = Collections.unmodifiableSet(builder.readPartitions);
-        this.includeMetaProperties  = builder.includeMetaProperties;
+        this.includeMetaProperties = builder.includeMetaProperties;
     }
 
     public String getWritePartition() {
@@ -190,8 +192,8 @@ public final class PartitionStrategy extends AbstractTraversalStrategy<Traversal
         }
 
         final List<Step> stepsToInsertPropertyMutations = traversal.getSteps().stream().filter(step ->
-            step instanceof AddEdgeStep || step instanceof AddVertexStep ||
-                    step instanceof AddVertexStartStep || (includeMetaProperties && step instanceof AddPropertyStep)
+                step instanceof AddEdgeStep || step instanceof AddVertexStep ||
+                        step instanceof AddVertexStartStep || (includeMetaProperties && step instanceof AddPropertyStep)
         ).collect(Collectors.toList());
 
         stepsToInsertPropertyMutations.forEach(step -> {
@@ -271,11 +273,11 @@ public final class PartitionStrategy extends AbstractTraversalStrategy<Traversal
      * {@link VertexProperty} it applies a filter based on the current partitioning.  If is not a
      * {@link VertexProperty} the property is simply passed through.
      */
-    public final class MapPropertiesFilter implements Function<Traverser<Map<String,List<Property>>>, Map<String,List<Property>>>, Serializable {
+    public final class MapPropertiesFilter implements Function<Traverser<Map<String, List<Property>>>, Map<String, List<Property>>>, Serializable {
         @Override
         public Map<String, List<Property>> apply(final Traverser<Map<String, List<Property>>> mapTraverser) {
-            final Map<String,List<Property>> values = mapTraverser.get();
-            final Map<String,List<Property>> filtered = new HashMap<>();
+            final Map<String, List<Property>> values = mapTraverser.get();
+            final Map<String, List<Property>> filtered = new HashMap<>();
 
             // note the final filter that removes the partitionKey from the outgoing Map
             values.entrySet().forEach(p -> {
@@ -302,11 +304,11 @@ public final class PartitionStrategy extends AbstractTraversalStrategy<Traversal
     /**
      * Takes a {@link Map} of a {@link List} of {@link Property} objects and unwraps the {@link Property#value()}.
      */
-    public final class MapPropertiesConverter implements Function<Traverser<Map<String,List<Property>>>, Map<String,List<Property>>>, Serializable {
+    public final class MapPropertiesConverter implements Function<Traverser<Map<String, List<Property>>>, Map<String, List<Property>>>, Serializable {
         @Override
         public Map<String, List<Property>> apply(final Traverser<Map<String, List<Property>>> mapTraverser) {
-            final Map<String,List<Property>> values = mapTraverser.get();
-            final Map<String,List<Property>> converted = new HashMap<>();
+            final Map<String, List<Property>> values = mapTraverser.get();
+            final Map<String, List<Property>> converted = new HashMap<>();
 
             values.entrySet().forEach(p -> {
                 final List l = p.getValue().stream().map(property -> property.value()).collect(Collectors.toList());
@@ -322,13 +324,31 @@ public final class PartitionStrategy extends AbstractTraversalStrategy<Traversal
         }
     }
 
+    public static PartitionStrategy create(final Configuration configuration) {
+        final PartitionStrategy.Builder builder = PartitionStrategy.build();
+        configuration.getKeys().forEachRemaining(key -> {
+            if (key.equals("includeMetaProperties"))
+                builder.includeMetaProperties((Boolean) configuration.getProperty(key));
+            else if (key.equals("writePartition"))
+                builder.writePartition((String) configuration.getProperty(key));
+            else if (key.equals("partitionKey"))
+                builder.partitionKey((String) configuration.getProperty(key));
+            else if (key.equals("readPartitions"))
+                builder.readPartitions((List<String>) configuration.getProperty(key));
+            else
+                throw new IllegalArgumentException("The following " + PartitionStrategy.class.getSimpleName() + " configuration is unknown: " + key + ":" + configuration.getProperty(key));
+        });
+        return builder.create();
+    }
+
     public final static class Builder {
         private String writePartition;
         private String partitionKey;
         private Set<String> readPartitions = new HashSet<>();
         private boolean includeMetaProperties = false;
 
-        Builder() { }
+        Builder() {
+        }
 
         /**
          * Set to {@code true} if the {@link VertexProperty} instances should get assigned to partitions.  This
@@ -367,6 +387,26 @@ public final class PartitionStrategy extends AbstractTraversalStrategy<Traversal
          * Specifies the partition of the graph to read from.  It is possible to assign multiple partition keys so
          * as to read from multiple partitions at the same time.
          */
+        public Builder readPartitions(final List<String> readPartitions) {
+            this.readPartitions.addAll(readPartitions);
+            return this;
+        }
+
+        /**
+         * Specifies the partition of the graph to read from.  It is possible to assign multiple partition keys so
+         * as to read from multiple partitions at the same time.
+         */
+        public Builder readPartitions(final String... readPartitions) {
+            return this.readPartitions(Arrays.asList(readPartitions));
+        }
+
+        /**
+         * Specifies the partition of the graph to read from.  It is possible to assign multiple partition keys so
+         * as to read from multiple partitions at the same time.
+         *
+         * @deprecated Since 3.2.3. Use {@link Builder#readPartitions} instead
+         */
+        @Deprecated
         public Builder addReadPartition(final String readPartition) {
             this.readPartitions.add(readPartition);
             return this;

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/95557bf3/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategy.java
index 097299f..bccff9b 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategy.java
@@ -301,7 +301,7 @@ public final class SubgraphStrategy extends AbstractTraversalStrategy<TraversalS
             else if (key.equals("vertexProperties"))
                 builder.vertexProperties((Traversal) configuration.getProperty(key));
             else
-                throw new IllegalArgumentException("The following configuration is unknown: " + key + ":" + configuration.getProperty(key));
+                throw new IllegalArgumentException("The following " + SubgraphStrategy.class.getSimpleName() + " configuration is unknown: " + key + ":" + configuration.getProperty(key));
         });
         return builder.create();
     }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/95557bf3/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
index 88ca626..facb24f 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
@@ -19,11 +19,11 @@
 
 package org.apache.tinkerpop.gremlin.groovy.jsr223;
 
-import org.apache.tinkerpop.gremlin.process.computer.Computer;
 import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
 import org.apache.tinkerpop.gremlin.process.traversal.P;
 import org.apache.tinkerpop.gremlin.process.traversal.SackFunctions;
 import org.apache.tinkerpop.gremlin.process.traversal.Translator;
+import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.util.ConnectiveP;
 import org.apache.tinkerpop.gremlin.process.traversal.util.OrP;
 import org.apache.tinkerpop.gremlin.structure.Element;
@@ -39,6 +39,8 @@ import java.util.List;
  */
 public final class GroovyTranslator implements Translator.ScriptTranslator {
 
+    private static final boolean IS_TESTING = Boolean.valueOf(System.getProperty("is.testing", "false"));
+
     private final String traversalSource;
 
     private GroovyTranslator(final String traversalSource) {
@@ -77,6 +79,8 @@ public final class GroovyTranslator implements Translator.ScriptTranslator {
         final StringBuilder traversalScript = new StringBuilder(start);
         for (final Bytecode.Instruction instruction : bytecode.getInstructions()) {
             final String methodName = instruction.getOperator();
+            if (IS_TESTING && methodName.equals(TraversalSource.Symbols.withStrategies))
+                continue;
             if (0 == instruction.getArguments().length)
                 traversalScript.append(".").append(methodName).append("()");
             else {
@@ -122,9 +126,7 @@ public final class GroovyTranslator implements Translator.ScriptTranslator {
             return ((Enum) object).getDeclaringClass().getSimpleName() + "." + object.toString();
         else if (object instanceof Element)
             return convertToString(((Element) object).id()); // hack
-        else if (object instanceof Computer) { // TODO: blow out
-            return "";
-        } else if (object instanceof Lambda) {
+        else if (object instanceof Lambda) {
             final String lambdaString = ((Lambda) object).getLambdaScript().trim();
             return lambdaString.startsWith("{") ? lambdaString : "{" + lambdaString + "}";
         } else if (object instanceof Bytecode)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/95557bf3/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonTranslator.java
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonTranslator.java b/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonTranslator.java
index 1a84e26..19302e8 100644
--- a/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonTranslator.java
+++ b/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonTranslator.java
@@ -19,7 +19,6 @@
 
 package org.apache.tinkerpop.gremlin.python.jsr223;
 
-import org.apache.tinkerpop.gremlin.process.computer.Computer;
 import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
 import org.apache.tinkerpop.gremlin.process.traversal.Operator;
 import org.apache.tinkerpop.gremlin.process.traversal.P;
@@ -52,6 +51,7 @@ import java.util.stream.Stream;
  */
 public class PythonTranslator implements Translator.ScriptTranslator {
 
+    private static final boolean IS_TESTING = Boolean.valueOf(System.getProperty("is.testing", "false"));
     private static final Set<String> STEP_NAMES = Stream.of(GraphTraversal.class.getMethods()).filter(method -> Traversal.class.isAssignableFrom(method.getReturnType())).map(Method::getName).collect(Collectors.toSet());
     private static final Set<String> NO_STATIC = Stream.of(T.values(), Operator.values())
             .flatMap(arg -> IteratorUtils.stream(new ArrayIterator<>(arg)))
@@ -60,7 +60,6 @@ public class PythonTranslator implements Translator.ScriptTranslator {
 
     private final String traversalSource;
     private final boolean importStatics;
-    private static final boolean isTesting = Boolean.valueOf(System.getProperty("is.testing", "false"));
 
     PythonTranslator(final String traversalSource, final boolean importStatics) {
         this.traversalSource = traversalSource;
@@ -102,7 +101,7 @@ public class PythonTranslator implements Translator.ScriptTranslator {
         for (final Bytecode.Instruction instruction : bytecode.getInstructions()) {
             final String methodName = instruction.getOperator();
             final Object[] arguments = instruction.getArguments();
-            if (isTesting && methodName.equals(TraversalSource.Symbols.withStrategies))
+            if (IS_TESTING && methodName.equals(TraversalSource.Symbols.withStrategies))
                 continue;
             else if (0 == arguments.length)
                 traversalScript.append(".").append(SymbolHelper.toPython(methodName)).append("()");
@@ -158,8 +157,6 @@ public class PythonTranslator implements Translator.ScriptTranslator {
             return convertToString(((Element) object).id()); // hack
         else if (object instanceof Bytecode)
             return this.internalTranslate("__", (Bytecode) object);
-        else if (object instanceof Computer)
-            return "";
         else if (object instanceof Lambda)
             return convertLambdaToString((Lambda) object);
         else

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/95557bf3/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py b/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
index f0ca27f..81ee886 100644
--- a/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
+++ b/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
@@ -71,6 +71,12 @@ class TestDriverRemoteConnection(TestCase):
         assert 0 == g.E().count().next()
         assert 1 == g.V().label().dedup().count().next()
         assert "person" == g.V().label().dedup().next()
+        #
+        g = g.withComputer("workers", 4, "vertices", __.has("name", "marko"))
+        assert 1 == g.V().count().next()
+        assert 0 == g.E().count().next()
+        assert "person" == g.V().label().next()
+        assert "marko" == g.V().name.next()
         connection.close()
 
     def test_side_effects(self):

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/95557bf3/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategyProcessTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategyProcessTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategyProcessTest.java
index 79fd859..168e4fe 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategyProcessTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategyProcessTest.java
@@ -18,7 +18,6 @@
  */
 package org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration;
 
-import org.apache.commons.lang.exception.ExceptionUtils;
 import org.apache.tinkerpop.gremlin.FeatureRequirement;
 import org.apache.tinkerpop.gremlin.FeatureRequirementSet;
 import org.apache.tinkerpop.gremlin.process.AbstractGremlinProcessTest;
@@ -31,6 +30,7 @@ import org.apache.tinkerpop.gremlin.structure.VertexProperty;
 import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
 import org.junit.Test;
 
+import java.util.Arrays;
 import java.util.List;
 import java.util.NoSuchElementException;
 import java.util.stream.Collectors;
@@ -39,7 +39,11 @@ import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.Matchers.containsInAnyOrder;
 import static org.hamcrest.core.IsInstanceOf.instanceOf;
 import static org.hamcrest.core.StringStartsWith.startsWith;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
 
 /**
  * @author Stephen Mallette (http://stephen.genoprime.com)
@@ -51,8 +55,8 @@ public class PartitionStrategyProcessTest extends AbstractGremlinProcessTest {
     @FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY)
     public void shouldAppendPartitionToVertex() {
         final PartitionStrategy partitionStrategy = PartitionStrategy.build()
-                .partitionKey(partition).writePartition("A").addReadPartition("A").create();
-        final Vertex v = create(partitionStrategy).addV().property("any", "thing").next();
+                .partitionKey(partition).writePartition("A").readPartitions("A").create();
+        final Vertex v = g.withStrategies(partitionStrategy).addV().property("any", "thing").next();
 
         assertNotNull(v);
         assertEquals("thing", v.property("any").value());
@@ -65,8 +69,8 @@ public class PartitionStrategyProcessTest extends AbstractGremlinProcessTest {
     public void shouldAppendPartitionToVertexProperty() {
         final PartitionStrategy partitionStrategy = PartitionStrategy.build()
                 .includeMetaProperties(true)
-                .partitionKey(partition).writePartition("A").addReadPartition("A").create();
-        final Vertex v = create(partitionStrategy).addV().property("any", "thing").next();
+                .partitionKey(partition).writePartition("A").readPartitions("A").create();
+        final Vertex v = g.withStrategies(partitionStrategy).addV().property("any", "thing").next();
 
         assertNotNull(v);
         assertEquals("thing", v.property("any").value());
@@ -81,8 +85,8 @@ public class PartitionStrategyProcessTest extends AbstractGremlinProcessTest {
     public void shouldAppendPartitionToVertexPropertyOverMultiProperty() {
         final PartitionStrategy partitionStrategy = PartitionStrategy.build()
                 .includeMetaProperties(true)
-                .partitionKey(partition).writePartition("A").addReadPartition("A").create();
-        final Vertex v = create(partitionStrategy).addV().property(VertexProperty.Cardinality.list, "any", "thing")
+                .partitionKey(partition).writePartition("A").readPartitions("A").create();
+        final Vertex v = g.withStrategies(partitionStrategy).addV().property(VertexProperty.Cardinality.list, "any", "thing")
                 .property(VertexProperty.Cardinality.list, "any", "more").next();
 
         assertNotNull(v);
@@ -97,8 +101,8 @@ public class PartitionStrategyProcessTest extends AbstractGremlinProcessTest {
     public void shouldNotAppendPartitionToVertexProperty() {
         final PartitionStrategy partitionStrategy = PartitionStrategy.build()
                 .includeMetaProperties(false)
-                .partitionKey(partition).writePartition("A").addReadPartition("A").create();
-        final Vertex v = create(partitionStrategy).addV().property("any", "thing").next();
+                .partitionKey(partition).writePartition("A").readPartitions("A").create();
+        final Vertex v = g.withStrategies(partitionStrategy).addV().property("any", "thing").next();
 
         assertNotNull(v);
         assertEquals("thing", v.property("any").value());
@@ -111,19 +115,19 @@ public class PartitionStrategyProcessTest extends AbstractGremlinProcessTest {
     @FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY)
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_META_PROPERTIES)
     public void shouldAppendPartitionToAllVertexProperties() {
-        final GraphTraversalSource gOverA = create(PartitionStrategy.build()
+        final GraphTraversalSource gOverA = g.withStrategies(PartitionStrategy.build()
                 .includeMetaProperties(true)
                 .partitionKey(partition).writePartition("A").addReadPartition("A").create());
 
-        final GraphTraversalSource gOverB = create(PartitionStrategy.build()
+        final GraphTraversalSource gOverB = g.withStrategies(PartitionStrategy.build()
                 .includeMetaProperties(true)
                 .partitionKey(partition).writePartition("B").addReadPartition("B").create());
 
-        final GraphTraversalSource gOverAB = create(PartitionStrategy.build()
+        final GraphTraversalSource gOverAB = g.withStrategies(PartitionStrategy.build()
                 .includeMetaProperties(true)
                 .partitionKey(partition).writePartition("B").addReadPartition("B").addReadPartition("A").create());
 
-        final Vertex v = gOverA.addV().property("any", "thing").property("some","thing").next();
+        final Vertex v = gOverA.addV().property("any", "thing").property("some", "thing").next();
 
         assertNotNull(v);
         assertEquals("thing", v.property("any").value());
@@ -173,7 +177,7 @@ public class PartitionStrategyProcessTest extends AbstractGremlinProcessTest {
     @FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY)
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_META_PROPERTIES)
     public void shouldHidePartitionKeyForValues() {
-        final GraphTraversalSource gOverA = create(PartitionStrategy.build()
+        final GraphTraversalSource gOverA = g.withStrategies(PartitionStrategy.build()
                 .includeMetaProperties(true)
                 .partitionKey(partition).writePartition("A").addReadPartition("A").create());
         final Vertex v = gOverA.addV().property("any", "thing").next();
@@ -191,9 +195,9 @@ public class PartitionStrategyProcessTest extends AbstractGremlinProcessTest {
     @FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY)
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_META_PROPERTIES)
     public void shouldHidePartitionKeyForValuesWithEmptyKeys() {
-        final GraphTraversalSource gOverA = create(PartitionStrategy.build()
+        final GraphTraversalSource gOverA = g.withStrategies(PartitionStrategy.build()
                 .includeMetaProperties(true)
-                .partitionKey(partition).writePartition("A").addReadPartition("A").create());
+                .partitionKey(partition).writePartition("A").readPartitions("A").create());
         final Vertex v = gOverA.addV().property("any", "thing").next();
 
         assertEquals(1l, (long) gOverA.V(v).values().count().next());
@@ -204,7 +208,7 @@ public class PartitionStrategyProcessTest extends AbstractGremlinProcessTest {
     @FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY)
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_META_PROPERTIES)
     public void shouldHidePartitionKeyForProperties() {
-        final GraphTraversalSource gOverA = create(PartitionStrategy.build()
+        final GraphTraversalSource gOverA = g.withStrategies(PartitionStrategy.build()
                 .includeMetaProperties(true)
                 .partitionKey(partition).writePartition("A").addReadPartition("A").create());
         final Vertex v = gOverA.addV().property("any", "thing").next();
@@ -221,9 +225,9 @@ public class PartitionStrategyProcessTest extends AbstractGremlinProcessTest {
     @FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY)
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_META_PROPERTIES)
     public void shouldHidePartitionKeyForPropertiesWithEmptyKeys() {
-        final GraphTraversalSource gOverA = create(PartitionStrategy.build()
+        final GraphTraversalSource gOverA = g.withStrategies(PartitionStrategy.build()
                 .includeMetaProperties(true)
-                .partitionKey(partition).writePartition("A").addReadPartition("A").create());
+                .partitionKey(partition).writePartition("A").readPartitions("A").create());
         final Vertex v = gOverA.addV().property("any", "thing").next();
 
         assertEquals(1l, (long) gOverA.V(v).properties().count().next());
@@ -234,9 +238,9 @@ public class PartitionStrategyProcessTest extends AbstractGremlinProcessTest {
     @FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY)
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_META_PROPERTIES)
     public void shouldHidePartitionKeyForPropertyMap() {
-        final GraphTraversalSource gOverA = create(PartitionStrategy.build()
+        final GraphTraversalSource gOverA = g.withStrategies(PartitionStrategy.build()
                 .includeMetaProperties(true)
-                .partitionKey(partition).writePartition("A").addReadPartition("A").create());
+                .partitionKey(partition).writePartition("A").readPartitions("A").create());
         final Vertex v = gOverA.addV().property("any", "thing").next();
 
         gOverA.V(v).propertyMap(partition).next();
@@ -246,7 +250,7 @@ public class PartitionStrategyProcessTest extends AbstractGremlinProcessTest {
     @FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY)
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_META_PROPERTIES)
     public void shouldHidePartitionKeyForPropertyMapWithEmptyKeys() {
-        final GraphTraversalSource gOverA = create(PartitionStrategy.build()
+        final GraphTraversalSource gOverA = g.withStrategies(PartitionStrategy.build()
                 .includeMetaProperties(true)
                 .partitionKey(partition).writePartition("A").addReadPartition("A").create());
         final Vertex v = gOverA.addV().property("any", "thing").next();
@@ -255,10 +259,11 @@ public class PartitionStrategyProcessTest extends AbstractGremlinProcessTest {
         assertEquals("thing", ((List<VertexProperty>) gOverA.V(v).propertyMap().next().get("any")).get(0).value());
     }
 
+    @Test
     @FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY)
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_META_PROPERTIES)
     public void shouldHidePartitionKeyForValueMap() {
-        final GraphTraversalSource gOverA = create(PartitionStrategy.build()
+        final GraphTraversalSource gOverA = g.withStrategies(PartitionStrategy.build()
                 .includeMetaProperties(true)
                 .partitionKey(partition).writePartition("A").addReadPartition("A").create());
         final Vertex v = gOverA.addV().property("any", "thing").next();
@@ -267,8 +272,7 @@ public class PartitionStrategyProcessTest extends AbstractGremlinProcessTest {
             gOverA.V(v).valueMap(partition).next();
             fail("Should have thrown exception");
         } catch (Exception ex) {
-            final Throwable root = ExceptionUtils.getRootCause(ex);
-            assertThat(root.getMessage(), startsWith("Cannot explicitly request the partitionKey in the traversal"));
+
         }
     }
 
@@ -276,7 +280,7 @@ public class PartitionStrategyProcessTest extends AbstractGremlinProcessTest {
     @FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY)
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_META_PROPERTIES)
     public void shouldHidePartitionKeyForValueMapWithEmptyKeys() {
-        final GraphTraversalSource gOverA = create(PartitionStrategy.build()
+        final GraphTraversalSource gOverA = g.withStrategies(PartitionStrategy.build()
                 .includeMetaProperties(true)
                 .partitionKey(partition).writePartition("A").addReadPartition("A").create());
         final Vertex v = gOverA.addV().property("any", "thing").next();
@@ -290,7 +294,7 @@ public class PartitionStrategyProcessTest extends AbstractGremlinProcessTest {
     public void shouldAppendPartitionToEdge() {
         final PartitionStrategy partitionStrategy = PartitionStrategy.build()
                 .partitionKey(partition).writePartition("A").addReadPartition("A").create();
-        final GraphTraversalSource source = create(partitionStrategy);
+        final GraphTraversalSource source = g.withStrategies(partitionStrategy);
         final Vertex v1 = source.addV().property("any", "thing").next();
         final Vertex v2 = source.addV().property("some", "thing").next();
         final Edge e = source.withSideEffect("v2", v2).V(v1.id()).addE("connectsTo").from("v2").property("every", "thing").next();
@@ -314,19 +318,19 @@ public class PartitionStrategyProcessTest extends AbstractGremlinProcessTest {
     public void shouldWriteVerticesToMultiplePartitions() {
         final PartitionStrategy partitionStrategyAA = PartitionStrategy.build()
                 .partitionKey(partition).writePartition("A").addReadPartition("A").create();
-        final GraphTraversalSource sourceAA = create(partitionStrategyAA);
+        final GraphTraversalSource sourceAA = g.withStrategies(partitionStrategyAA);
 
         final PartitionStrategy partitionStrategyBA = PartitionStrategy.build()
                 .partitionKey(partition).writePartition("B").addReadPartition("A").create();
-        final GraphTraversalSource sourceBA = create(partitionStrategyBA);
+        final GraphTraversalSource sourceBA = g.withStrategies(partitionStrategyBA);
 
         final PartitionStrategy partitionStrategyBB = PartitionStrategy.build()
                 .partitionKey(partition).writePartition("B").addReadPartition("B").create();
-        final GraphTraversalSource sourceBB = create(partitionStrategyBB);
+        final GraphTraversalSource sourceBB = g.withStrategies(partitionStrategyBB);
 
         final PartitionStrategy partitionStrategyBAB = PartitionStrategy.build()
-                .partitionKey(partition).writePartition("B").addReadPartition("A").addReadPartition("B").create();
-        final GraphTraversalSource sourceBAB = create(partitionStrategyBAB);
+                .partitionKey(partition).writePartition("B").readPartitions("A", "B").create();
+        final GraphTraversalSource sourceBAB = g.withStrategies(partitionStrategyBAB);
 
 
         final Vertex vA = sourceAA.addV().property("any", "a").next();
@@ -351,11 +355,11 @@ public class PartitionStrategyProcessTest extends AbstractGremlinProcessTest {
     public void shouldThrowExceptionOnVInDifferentPartition() {
         final PartitionStrategy partitionStrategyAA = PartitionStrategy.build()
                 .partitionKey(partition).writePartition("A").addReadPartition("A").create();
-        final GraphTraversalSource sourceAA = create(partitionStrategyAA);
+        final GraphTraversalSource sourceAA = g.withStrategies(partitionStrategyAA);
 
         final PartitionStrategy partitionStrategyA = PartitionStrategy.build()
                 .partitionKey(partition).writePartition("A").create();
-        final GraphTraversalSource sourceA = create(partitionStrategyA);
+        final GraphTraversalSource sourceA = g.withStrategies(partitionStrategyA);
 
         final Vertex vA = sourceAA.addV().property("any", "a").next();
         assertEquals(vA.id(), sourceAA.V(vA.id()).id().next());
@@ -373,11 +377,11 @@ public class PartitionStrategyProcessTest extends AbstractGremlinProcessTest {
     public void shouldThrowExceptionOnEInDifferentPartition() {
         final PartitionStrategy partitionStrategyAA = PartitionStrategy.build()
                 .partitionKey(partition).writePartition("A").addReadPartition("A").create();
-        final GraphTraversalSource sourceAA = create(partitionStrategyAA);
+        final GraphTraversalSource sourceAA = g.withStrategies(partitionStrategyAA);
 
         final PartitionStrategy partitionStrategyA = PartitionStrategy.build()
                 .partitionKey(partition).writePartition("A").create();
-        final GraphTraversalSource sourceA = create(partitionStrategyA);
+        final GraphTraversalSource sourceA = g.withStrategies(partitionStrategyA);
 
         final Vertex vA = sourceAA.addV().property("any", "a").next();
         final Edge e = sourceAA.withSideEffect("vA", vA).V(vA.id()).addE("knows").to("vA").next();
@@ -396,24 +400,24 @@ public class PartitionStrategyProcessTest extends AbstractGremlinProcessTest {
     @FeatureRequirementSet(FeatureRequirementSet.Package.SIMPLE)
     public void shouldWriteToMultiplePartitions() {
         final PartitionStrategy partitionStrategyAA = PartitionStrategy.build()
-                .partitionKey(partition).writePartition("A").addReadPartition("A").create();
-        final GraphTraversalSource sourceAA = create(partitionStrategyAA);
+                .partitionKey(partition).writePartition("A").readPartitions("A").create();
+        final GraphTraversalSource sourceAA = g.withStrategies(partitionStrategyAA);
 
         final PartitionStrategy partitionStrategyBA = PartitionStrategy.build()
-                .partitionKey(partition).writePartition("B").addReadPartition("A").create();
-        final GraphTraversalSource sourceBA = create(partitionStrategyBA);
+                .partitionKey(partition).writePartition("B").readPartitions("A").create();
+        final GraphTraversalSource sourceBA = g.withStrategies(partitionStrategyBA);
 
         final PartitionStrategy partitionStrategyCAB = PartitionStrategy.build()
                 .partitionKey(partition).writePartition("C").addReadPartition("A").addReadPartition("B").create();
-        final GraphTraversalSource sourceCAB = create(partitionStrategyCAB);
+        final GraphTraversalSource sourceCAB = g.withStrategies(partitionStrategyCAB);
 
         final PartitionStrategy partitionStrategyC = PartitionStrategy.build()
                 .partitionKey(partition).writePartition("C").create();
-        final GraphTraversalSource sourceC = create(partitionStrategyC);
+        final GraphTraversalSource sourceC = g.withStrategies(partitionStrategyC);
 
         final PartitionStrategy partitionStrategyCA = PartitionStrategy.build()
-                .partitionKey(partition).writePartition("C").addReadPartition("A").create();
-        final GraphTraversalSource sourceCA = create(partitionStrategyCA);
+                .partitionKey(partition).writePartition("C").readPartitions("A").create();
+        final GraphTraversalSource sourceCA = g.withStrategies(partitionStrategyCA);
 
         final PartitionStrategy partitionStrategyCABC = PartitionStrategy.build()
                 .partitionKey(partition)
@@ -421,15 +425,18 @@ public class PartitionStrategyProcessTest extends AbstractGremlinProcessTest {
                 .addReadPartition("A")
                 .addReadPartition("B")
                 .addReadPartition("C").create();
-        final GraphTraversalSource sourceCABC = create(partitionStrategyCABC);
+        final GraphTraversalSource sourceCABC = g.withStrategy(PartitionStrategy.class.getCanonicalName(),
+                "writePartition", "C",
+                "partitionKey", partition,
+                "readPartitions", Arrays.asList("A", "B", "C"));
 
         final PartitionStrategy partitionStrategyCC = PartitionStrategy.build()
                 .partitionKey(partition).writePartition("C").addReadPartition("C").create();
-        final GraphTraversalSource sourceCC = create(partitionStrategyCC);
+        final GraphTraversalSource sourceCC = g.withStrategies(partitionStrategyCC);
 
         final PartitionStrategy partitionStrategyCBC = PartitionStrategy.build()
-                .partitionKey(partition).writePartition("C").addReadPartition("C").addReadPartition("B").create();
-        final GraphTraversalSource sourceCBC = create(partitionStrategyCBC);
+                .partitionKey(partition).writePartition("C").readPartitions(Arrays.asList("B", "C")).create();
+        final GraphTraversalSource sourceCBC = g.withStrategies(partitionStrategyCBC);
 
         final Vertex vA = sourceAA.addV().property("any", "a").next();
         final Vertex vAA = sourceAA.addV().property("any", "aa").next();
@@ -480,8 +487,4 @@ public class PartitionStrategyProcessTest extends AbstractGremlinProcessTest {
         assertEquals(vC.id(), sourceCBC.E(eAtovC.id()).inV().id().next());
         assertFalse(sourceCBC.E(eAtovC.id()).outV().hasNext());
     }
-
-    private GraphTraversalSource create(final PartitionStrategy strategy) {
-        return graphProvider.traversal(graph, strategy);
-    }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/95557bf3/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/TinkerGraphComputerProvider.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/TinkerGraphComputerProvider.java b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/TinkerGraphComputerProvider.java
index ccea43c..3144211 100644
--- a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/TinkerGraphComputerProvider.java
+++ b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/TinkerGraphComputerProvider.java
@@ -19,6 +19,7 @@
 package org.apache.tinkerpop.gremlin.tinkergraph.process;
 
 import org.apache.tinkerpop.gremlin.GraphProvider;
+import org.apache.tinkerpop.gremlin.process.computer.GraphComputer;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.tinkergraph.TinkerGraphProvider;
@@ -37,7 +38,11 @@ public class TinkerGraphComputerProvider extends TinkerGraphProvider {
     @Override
     public GraphTraversalSource traversal(final Graph graph) {
         return RANDOM.nextBoolean() ?
-                graph.traversal().withComputer() :
+                graph.traversal().withComputer(
+                        "workers", RANDOM.nextInt(4) + 1,
+                        "graphComputer", RANDOM.nextBoolean() ?
+                                GraphComputer.class.getCanonicalName() :
+                                TinkerGraphComputer.class.getCanonicalName()) :
                 graph.traversal(GraphTraversalSource.computer());
     }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/95557bf3/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/traversal/strategy/decoration/HaltedTraverserStrategyTest.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/traversal/strategy/decoration/HaltedTraverserStrategyTest.java b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/traversal/strategy/decoration/HaltedTraverserStrategyTest.java
index 0943391..fd3dfaa 100644
--- a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/traversal/strategy/decoration/HaltedTraverserStrategyTest.java
+++ b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/traversal/strategy/decoration/HaltedTraverserStrategyTest.java
@@ -19,10 +19,11 @@
 
 package org.apache.tinkerpop.gremlin.tinkergraph.process.traversal.strategy.decoration;
 
-import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.HaltedTraverserStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.HaltedTraverserStrategy;
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedEdge;
+import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedFactory;
 import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedPath;
 import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedProperty;
 import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex;
@@ -58,7 +59,7 @@ public class HaltedTraverserStrategyTest {
     @Test
     public void shouldReturnDetachedElements() {
         final Graph graph = TinkerFactory.createModern();
-        final GraphTraversalSource g = graph.traversal().withComputer().withStrategies(HaltedTraverserStrategy.detached());
+        final GraphTraversalSource g = graph.traversal().withComputer().withStrategy(HaltedTraverserStrategy.class.getCanonicalName(), "haltedTraverserFactory", DetachedFactory.class.getCanonicalName());
         g.V().out().forEachRemaining(vertex -> assertEquals(DetachedVertex.class, vertex.getClass()));
         g.V().out().properties("name").forEachRemaining(vertexProperty -> assertEquals(DetachedVertexProperty.class, vertexProperty.getClass()));
         g.V().out().values("name").forEachRemaining(value -> assertEquals(String.class, value.getClass()));


[18/36] tinkerpop git commit: Merge branch 'TINKERPOP-1158' into tp31

Posted by da...@apache.org.
Merge branch 'TINKERPOP-1158' into tp31


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

Branch: refs/heads/TINKERPOP-1458
Commit: e97b56d610507ac2429060c94b8b4605129b9426
Parents: ffe0b1f d1f4c57
Author: Daniel Kuppitz <da...@hotmail.com>
Authored: Thu Oct 6 23:58:06 2016 +0200
Committer: Daniel Kuppitz <da...@hotmail.com>
Committed: Thu Oct 6 23:58:06 2016 +0200

----------------------------------------------------------------------
 bin/gremlin.sh                          | 23 +----------------------
 docs/src/dev/developer/release.asciidoc |  6 +++++-
 gremlin-console/bin/gremlin.sh          | 25 +------------------------
 gremlin-console/src/main/bin/gremlin.sh | 28 +++++++++++++++-------------
 4 files changed, 22 insertions(+), 60 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e97b56d6/docs/src/dev/developer/release.asciidoc
----------------------------------------------------------------------


[30/36] tinkerpop git commit: added integration tests for DriverRemoteTraversalSideEffects methods

Posted by da...@apache.org.
added integration tests for DriverRemoteTraversalSideEffects methods


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

Branch: refs/heads/TINKERPOP-1458
Commit: 1dab852d7baaf34f4ebc6c667746c5a11a839c7b
Parents: 504a99d
Author: davebshow <da...@gmail.com>
Authored: Wed Oct 5 15:01:59 2016 -0400
Committer: davebshow <da...@gmail.com>
Committed: Fri Oct 7 11:05:00 2016 -0400

----------------------------------------------------------------------
 .../server/GremlinServerIntegrateTest.java      | 79 ++++++++++++++++++--
 1 file changed, 73 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1dab852d/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
index e6e0021..61bf994 100644
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
@@ -38,6 +38,7 @@ import org.apache.tinkerpop.gremlin.driver.message.RequestMessage;
 import org.apache.tinkerpop.gremlin.driver.message.ResponseMessage;
 import org.apache.tinkerpop.gremlin.driver.message.ResponseStatusCode;
 import org.apache.tinkerpop.gremlin.driver.remote.DriverRemoteConnection;
+import org.apache.tinkerpop.gremlin.driver.remote.DriverRemoteTraversalSideEffects;
 import org.apache.tinkerpop.gremlin.driver.ser.Serializers;
 import org.apache.tinkerpop.gremlin.driver.simple.NioClient;
 import org.apache.tinkerpop.gremlin.driver.simple.SimpleClient;
@@ -55,6 +56,7 @@ import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.T;
 import org.apache.tinkerpop.gremlin.server.channel.NioChannelizer;
 import org.apache.tinkerpop.gremlin.server.op.session.SessionOpProcessor;
+import org.apache.tinkerpop.gremlin.structure.util.Host;
 import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex;
 import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph;
 import org.apache.tinkerpop.gremlin.util.Log4jRecordingAppender;
@@ -64,6 +66,7 @@ import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
+import java.lang.reflect.Field;
 import java.nio.channels.ClosedChannelException;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -71,6 +74,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.UUID;
 import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
@@ -104,7 +108,6 @@ import static org.junit.Assert.assertEquals;
 public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegrationTest {
 
     private Log4jRecordingAppender recordingAppender = null;
-
     private final Supplier<Graph> graphGetter = () -> server.getServerGremlinExecutor().getGraphManager().getGraphs().get("graph");
     private final Configuration conf = new BaseConfiguration() {{
         setProperty(Graph.GRAPH, RemoteGraph.class.getName());
@@ -833,16 +836,80 @@ public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegration
     }
 
     @Test
-    public void shouldCloseLocalSideEffects() throws Exception {
+    public void shouldGetSideEffectKeysUsingWithRemote() throws Exception {
         final Graph graph = EmptyGraph.instance();
         final GraphTraversalSource g = graph.traversal().withRemote(conf);
         g.addV("person").property("age", 20).iterate();
         g.addV("person").property("age", 10).iterate();
         final GraphTraversal traversal = g.V().aggregate("a").aggregate("b");
         traversal.iterate();
-        final List sideEffects = traversal.asAdmin().getSideEffects().get("a");
-        assertFalse(sideEffects.isEmpty());
-        traversal.asAdmin().getSideEffects().close();
-        assertNull(traversal.asAdmin().getSideEffects().get("b"));
+        final DriverRemoteTraversalSideEffects se = (DriverRemoteTraversalSideEffects) traversal.asAdmin().getSideEffects();
+
+        // Get keys
+        final Set<String> sideEffectKeys = se.keys();
+        assertEquals(2, sideEffectKeys.size());
+
+        // Get side effects
+        final List aSideEffects = se.get("a");
+        assertThat(aSideEffects.isEmpty(), is(false));
+        final List bSideEffects = se.get("b");
+        assertThat(bSideEffects.isEmpty(), is(false));
+
+        // Should get local keys/side effects after close
+        se.close();
+
+        final Set<String> localSideEffectKeys = se.keys();
+        assertEquals(2, localSideEffectKeys.size());
+
+        final List localASideEffects = se.get("a");
+        assertThat(localASideEffects.isEmpty(), is(false));
+
+        final List localBSideEffects = se.get("b");
+        assertThat(localBSideEffects.isEmpty(), is(false));
+    }
+
+    @Test
+    public void shouldCloseSideEffectsUsingWithRemote() throws Exception {
+        final Graph graph = EmptyGraph.instance();
+        final GraphTraversalSource g = graph.traversal().withRemote(conf);
+        g.addV("person").property("age", 20).iterate();
+        g.addV("person").property("age", 10).iterate();
+        final GraphTraversal traversal = g.V().aggregate("a").aggregate("b");
+        traversal.iterate();
+        final DriverRemoteTraversalSideEffects se = (DriverRemoteTraversalSideEffects) traversal.asAdmin().getSideEffects();
+        final List sideEffects = se.get("a");
+        assertThat(sideEffects.isEmpty(), is(false));
+        se.close();
+
+        // Can't get new side effects after close
+        assertNull(se.get("b"));
+
+        // Earlier keys should be cached locally
+        final Set<String> localSideEffectKeys = se.keys();
+        assertEquals(1, localSideEffectKeys.size());
+        final List localSideEffects = se.get("a");
+        assertThat(localSideEffects.isEmpty(), is(false));
+
+        // Try to get side effect from server
+        final Cluster cluster = Cluster.build("localhost").create();
+        final Client client = cluster.connect();
+        Field field = DriverRemoteTraversalSideEffects.class.getDeclaredField("serverSideEffect");
+        field.setAccessible(true);
+        UUID serverSideEffectId = (UUID) field.get(se);
+        final RequestMessage msg = RequestMessage.build(Tokens.OPS_GATHER)
+                .addArg(Tokens.ARGS_SIDE_EFFECT, serverSideEffectId)
+                .addArg(Tokens.ARGS_SIDE_EFFECT_KEY, "b")
+                .processor("traversal").create();
+        boolean error;
+        try {
+            client.submitAsync(msg).get();
+            error = false;
+        } catch (Exception ex) {
+            error = true;
+        }
+        assertThat(error, is(true));
     }
 }
+
+
+


[32/36] tinkerpop git commit: added 'safe' error parsing code to keys method

Posted by da...@apache.org.
added 'safe' error parsing code to keys method


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

Branch: refs/heads/TINKERPOP-1458
Commit: c0d35091244559d8f340a8db23ff2df01bc34142
Parents: 8270435
Author: davebshow <da...@gmail.com>
Authored: Wed Oct 5 18:46:37 2016 -0400
Committer: davebshow <da...@gmail.com>
Committed: Fri Oct 7 11:06:08 2016 -0400

----------------------------------------------------------------------
 .../gremlin/driver/remote/DriverRemoteTraversalSideEffects.java   | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c0d35091/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/remote/DriverRemoteTraversalSideEffects.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/remote/DriverRemoteTraversalSideEffects.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/remote/DriverRemoteTraversalSideEffects.java
index 2dece11..642db13 100644
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/remote/DriverRemoteTraversalSideEffects.java
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/remote/DriverRemoteTraversalSideEffects.java
@@ -100,7 +100,8 @@ public class DriverRemoteTraversalSideEffects extends AbstractRemoteTraversalSid
                 keys = client.submitAsync(msg).get().all().get().stream().map(r -> r.getString()).collect(Collectors.toSet());
             } catch (Exception ex) {
                 final Throwable root = ExceptionUtils.getRootCause(ex);
-                if (!root.getMessage().equals("Could not find side-effects for " + serverSideEffect + "."))
+                final String exMsg = null == root ? "" : root.getMessage();
+                if (!exMsg.equals("Could not find side-effects for " + serverSideEffect + "."))
                     throw new RuntimeException("Could not get keys", root);
             }
         }


[26/36] tinkerpop git commit: added close method to gremlin python sideeffects

Posted by da...@apache.org.
added close method to gremlin python sideeffects


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

Branch: refs/heads/TINKERPOP-1458
Commit: 65cc37b60bab1b391aba638526aea0824cb9179e
Parents: 6f9230b
Author: davebshow <da...@apache.org>
Authored: Mon Sep 26 13:25:17 2016 -0400
Committer: davebshow <da...@gmail.com>
Committed: Fri Oct 7 11:05:00 2016 -0400

----------------------------------------------------------------------
 .../driver/driver_remote_connection.py          | 22 +++++++++++++++++++-
 .../gremlin_python/driver/remote_connection.py  |  6 +++++-
 .../driver/test_driver_remote_connection.py     |  8 ++++++-
 3 files changed, 33 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/65cc37b6/gremlin-python/src/main/jython/gremlin_python/driver/driver_remote_connection.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/gremlin_python/driver/driver_remote_connection.py b/gremlin-python/src/main/jython/gremlin_python/driver/driver_remote_connection.py
index cac5e73..e47c8e6 100644
--- a/gremlin-python/src/main/jython/gremlin_python/driver/driver_remote_connection.py
+++ b/gremlin-python/src/main/jython/gremlin_python/driver/driver_remote_connection.py
@@ -52,7 +52,8 @@ class DriverRemoteConnection(RemoteConnection):
         traversers = self._loop.run_sync(lambda: self.submit_traversal_bytecode(request_id, bytecode))
         side_effect_keys = lambda: self._loop.run_sync(lambda: self.submit_sideEffect_keys(request_id))
         side_effect_value = lambda key: self._loop.run_sync(lambda: self.submit_sideEffect_value(request_id, key))
-        return RemoteTraversal(iter(traversers), RemoteTraversalSideEffects(side_effect_keys, side_effect_value))
+        side_effect_close = lambda: self._loop.run_sync(lambda: self.submit_sideEffect_close(request_id))
+        return RemoteTraversal(iter(traversers), RemoteTraversalSideEffects(side_effect_keys, side_effect_value, side_effect_close))
 
     @gen.coroutine
     def submit_traversal_bytecode(self, request_id, bytecode):
@@ -115,6 +116,25 @@ class DriverRemoteConnection(RemoteConnection):
         raise gen.Return(value)
 
     @gen.coroutine
+    def submit_sideEffect_close(self, request_id):
+        message = {
+            "requestId": {
+                "@type": "g:UUID",
+                "@value": str(uuid.uuid4())
+            },
+            "op": "close",
+            "processor": "traversal",
+            "args": {
+                "sideEffect": {
+                    "@type": "g:UUID",
+                    "@value": request_id
+                }
+            }
+        }
+        result = yield self._execute_message(message)
+        raise gen.Return(result)
+
+    @gen.coroutine
     def _execute_message(self, send_message):
         send_message = b"".join([b"\x21",
                                  b"application/vnd.gremlin-v2.0+json",

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/65cc37b6/gremlin-python/src/main/jython/gremlin_python/driver/remote_connection.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/gremlin_python/driver/remote_connection.py b/gremlin-python/src/main/jython/gremlin_python/driver/remote_connection.py
index 0b84a26..3e7293f 100644
--- a/gremlin-python/src/main/jython/gremlin_python/driver/remote_connection.py
+++ b/gremlin-python/src/main/jython/gremlin_python/driver/remote_connection.py
@@ -57,9 +57,10 @@ class RemoteTraversal(Traversal):
 
 
 class RemoteTraversalSideEffects(TraversalSideEffects):
-    def __init__(self, keys_lambda, value_lambda):
+    def __init__(self, keys_lambda, value_lambda, close_lambda):
         self.keys_lambda = keys_lambda
         self.value_lambda = value_lambda
+        self.close_lambda = close_lambda
 
     def keys(self):
         return self.keys_lambda()
@@ -67,6 +68,9 @@ class RemoteTraversalSideEffects(TraversalSideEffects):
     def get(self, key):
         return self.value_lambda(key)
 
+    def close(self):
+        return self.close_lambda()
+
 
 class RemoteStrategy(TraversalStrategy):
     def __init__(self, remote_connection):

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/65cc37b6/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py b/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
index 0524d74..13cf51d 100644
--- a/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
+++ b/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
@@ -22,6 +22,8 @@ __author__ = 'Marko A. Rodriguez (http://markorodriguez.com)'
 import unittest
 from unittest import TestCase
 
+import pytest
+
 from gremlin_python import statics
 from gremlin_python.statics import long
 from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection
@@ -126,7 +128,7 @@ class TestDriverRemoteConnection(TestCase):
         assert "ripple" in n.keys()
         assert 3 == n["lop"]
         assert 1 == n["ripple"]
-        #
+
         t = g.withSideEffect('m', 32).V().map(lambda: "x: x.sideEffects('m')")
         results = t.toSet()
         assert 1 == len(results)
@@ -138,6 +140,10 @@ class TestDriverRemoteConnection(TestCase):
             raise Exception("Accessing a non-existent key should throw an error")
         except KeyError:
             pass
+        result = t.side_effects.close()
+        assert not result
+        with pytest.raises(KeyError):
+            x = t.side_effects['m']
         connection.close()
 
 


[34/36] tinkerpop git commit: closed conn in tests, this should be done with pytest fixtures, but until then, manually

Posted by da...@apache.org.
closed conn in tests, this should be done with pytest fixtures, but until then, manually


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

Branch: refs/heads/TINKERPOP-1458
Commit: a50cd4d207bbd381e333957c66ac8b076e63bc9c
Parents: c0d3509
Author: davebshow <da...@gmail.com>
Authored: Thu Oct 6 09:31:18 2016 -0400
Committer: davebshow <da...@gmail.com>
Committed: Fri Oct 7 11:06:08 2016 -0400

----------------------------------------------------------------------
 .../src/main/jython/tests/driver/test_driver_remote_connection.py | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a50cd4d2/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py b/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
index 8b51c20..157f56d 100644
--- a/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
+++ b/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
@@ -140,6 +140,8 @@ class TestDriverRemoteConnection(TestCase):
             raise Exception("Accessing a non-existent key should throw an error")
         except KeyError:
             pass
+        connection.close()
+
 
     def test_side_effect_close(self):
         connection = DriverRemoteConnection('ws://localhost:8182/gremlin', 'g')
@@ -173,6 +175,7 @@ class TestDriverRemoteConnection(TestCase):
         # Try to get 'b' directly from server, should throw error
         with pytest.raises(Exception):
             t.side_effects.value_lambda('b')
+        connection.close()
 
 
 if __name__ == '__main__':


[35/36] tinkerpop git commit: updated changelog

Posted by da...@apache.org.
updated changelog


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

Branch: refs/heads/TINKERPOP-1458
Commit: 827043527d1d7cb2149163465219f91e79ef1f1f
Parents: 871f6f6
Author: davebshow <da...@gmail.com>
Authored: Wed Oct 5 18:10:15 2016 -0400
Committer: davebshow <da...@gmail.com>
Committed: Fri Oct 7 11:06:08 2016 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/82704352/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 421a1a8..718e8ad 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -78,6 +78,7 @@ TinkerPop 3.2.3 (Release Date: NOT OFFICIALLY RELEASED YET)
 * New build options for `gremlin-python` where `-DglvPython` is no longer required.
 * Added missing `InetAddress` to GraphSON extension module.
 * Gremlin Server `TraversalOpProcessor` now returns confirmation upon `Op` `close`.
+* Added `close` method Java driver and Python driver `DriverRemoteTraversalSideEffects`.
 
 [[release-3-2-2]]
 TinkerPop 3.2.2 (Release Date: September 6, 2016)


[12/36] tinkerpop git commit: changed the new methods to withSTrategies(Map...) and withoutStrategies(String...). Also, added withComputer(Map). This looks a lot cleaner in Gremlin-Python. Also, you can now register multiple strategies in one method call

Posted by da...@apache.org.
changed the new methods to withSTrategies(Map...) and withoutStrategies(String...). Also, added withComputer(Map). This looks a lot cleaner in Gremlin-Python. Also, you can now register multiple strategies in one method call so you don't over-clone() and over-sort. Finally fixed a bug in JavaTranslator around Map translation. Cleaned up Partition/SubgraphStrategies -- added public static Strings for their parameters. Found a crazy bug in Jython where var arg coecing is no-bueno. Have a 'sorta fix' ... will fix it more thoroughly in another ticket. What a crazy day.


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

Branch: refs/heads/TINKERPOP-1458
Commit: 3e4075bd0997b22e3738478c4d03ab6f24b9e15f
Parents: 523ca1a
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Wed Oct 5 19:48:32 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Wed Oct 5 19:48:32 2016 -0600

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |   6 +-
 docs/src/reference/gremlin-variants.asciidoc    |   8 +-
 .../gremlin/jsr223/JavaTranslator.java          |  42 ++++--
 .../gremlin/process/computer/Computer.java      |  29 ++--
 .../computer/util/GraphComputerHelper.java      |  25 ++++
 .../gremlin/process/traversal/Bytecode.java     |   9 +-
 .../process/traversal/TraversalSource.java      | 141 ++++++-------------
 .../process/traversal/TraversalStrategy.java    |   1 +
 .../dsl/graph/GraphTraversalSource.java         |  40 +++---
 .../decoration/HaltedTraverserStrategy.java     |   4 +-
 .../strategy/decoration/PartitionStrategy.java  |  25 ++--
 .../strategy/decoration/SubgraphStrategy.java   |  28 ++--
 .../StandardVerificationStrategy.java           |   3 +-
 .../dsl/graph/GraphTraversalSourceTest.java     |  19 ++-
 .../groovy/jsr223/GroovyTranslatorTest.java     |  37 ++++-
 .../gremlin/groovy/jsr223/GroovyTranslator.java |  18 ++-
 .../jsr223/GremlinJythonScriptEngine.java       |   9 +-
 .../gremlin/python/jsr223/PythonTranslator.java |  16 ++-
 .../gremlin_python/process/graph_traversal.py   |   8 --
 .../driver/test_driver_remote_connection.py     |  13 +-
 .../python/jsr223/JythonTranslatorTest.java     |  34 +++++
 .../PartitionStrategyProcessTest.java           |  18 +--
 .../decoration/SubgraphStrategyProcessTest.java |  12 +-
 .../process/TinkerGraphComputerProvider.java    |  13 +-
 .../decoration/HaltedTraverserStrategyTest.java |   7 +-
 25 files changed, 344 insertions(+), 221 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3e4075bd/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 35ff317..f25e095 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,9 +26,11 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 TinkerPop 3.2.3 (Release Date: NOT OFFICIALLY RELEASED YET)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-* Added `TraversalSource.withComputer(Object...)` for better language variant support.
+* Fixed a `String` bug in `GroovyTranslator` and `PythonTranslator` where if the string has double-quotes, use """ """.
+* Fixed a `List` and `Map` bug in `JavaTranslator` where such collections were not being internally translated.
+* Added `TraversalSource.withComputer(Map<String,Object>)` for better language variant support.
+* Added `TraversalSource.withStrategies(Map<String,Object>)`/`withoutStrategies(String...)` for better language variant support.
 * Added `PartitionStrategy.Builder.readPartitions()` and deprecated `PartitionStrategy.Builder.addPartition()`.
-* Added `TraversalSource.withStrategy(String,Object...)`/`withoutStrategy(String)` for better language variant support.
 * `FilterRankStrategy` now propagates labels "right" over non-`Scoping` filters.
 * Fixed a bug in `ConnectiveP` where nested equivalent connectives should be inlined.
 * Fixed a bug in `IncidentToAdjacentStrategy` where `TreeStep` traversals were allowed.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3e4075bd/docs/src/reference/gremlin-variants.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/gremlin-variants.asciidoc b/docs/src/reference/gremlin-variants.asciidoc
index 1d4099e..d74fb95 100644
--- a/docs/src/reference/gremlin-variants.asciidoc
+++ b/docs/src/reference/gremlin-variants.asciidoc
@@ -227,15 +227,15 @@ it is possible to use the `withBindings()`-model as Gremlin-Python's `Bindings.o
 Traversal Strategies
 ~~~~~~~~~~~~~~~~~~~~
 
-In order to add and remove <<traversalstrategy,traversal strategies>> from a traversal source, the `withStrategy()` and
-`withoutStrategy()` steps should be used.
+In order to add and remove <<traversalstrategy,traversal strategies>> from a traversal source, the `withStrategies(Map<String,Object>...)` and
+`withoutStrategies(String...)` steps should be used.
 
 [gremlin-python,modern]
 ----
-g = g.withStrategy('org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SubgraphStrategy','vertices',__.hasLabel('person'),'edges',__.has('weight',gt(0.5)))
+g = g.withStrategies({'strategy':'org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SubgraphStrategy','vertices': hasLabel('person'),'edges': has('weight',gt(0.5))})
 g.V().name.toList()
 g.V().outE().valueMap(True).toList()
-g = g.withoutStrategy('org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SubgraphStrategy')
+g = g.withoutStrategies('org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SubgraphStrategy')
 g.V().name.toList()
 g.V().outE().valueMap(True).toList()
 ----

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3e4075bd/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/JavaTranslator.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/JavaTranslator.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/JavaTranslator.java
index 5d3e82d..af245c5 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/JavaTranslator.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/JavaTranslator.java
@@ -89,16 +89,33 @@ public final class JavaTranslator<S extends TraversalSource, T extends Traversal
 
     ////
 
-    private Traversal.Admin<?, ?> translateFromAnonymous(final Bytecode bytecode) {
-        try {
-            final Traversal.Admin<?, ?> traversal = (Traversal.Admin) this.anonymousTraversal.getMethod("start").invoke(null);
-            for (final Bytecode.Instruction instruction : bytecode.getStepInstructions()) {
-                invokeMethod(traversal, Traversal.class, instruction.getOperator(), instruction.getArguments());
+    private Object translateObject(final Object object) {
+        if (object instanceof Bytecode.Binding)
+            return ((Bytecode.Binding) object).value();
+        else if (object instanceof Bytecode) {
+            try {
+                final Traversal.Admin<?, ?> traversal = (Traversal.Admin) this.anonymousTraversal.getMethod("start").invoke(null);
+                for (final Bytecode.Instruction instruction : ((Bytecode) object).getStepInstructions()) {
+                    invokeMethod(traversal, Traversal.class, instruction.getOperator(), instruction.getArguments());
+                }
+                return traversal;
+            } catch (final Throwable e) {
+                throw new IllegalStateException(e.getMessage());
             }
-            return traversal;
-        } catch (final Throwable e) {
-            throw new IllegalStateException(e.getMessage());
-        }
+        } else if (object instanceof Map) {
+            final Map<Object, Object> map = new HashMap<>(((Map) object).size());
+            for (final Map.Entry<?, ?> entry : ((Map<?, ?>) object).entrySet()) {
+                map.put(translateObject(entry.getKey()), translateObject(entry.getValue()));
+            }
+            return map;
+        } else if (object instanceof List) {
+            final List<Object> list = new ArrayList<>();
+            for (final Object o : (List) object) {
+                list.add(translateObject(o));
+            }
+            return list;
+        } else
+            return object;
     }
 
     private Object invokeMethod(final Object delegate, final Class returnType, final String methodName, final Object... arguments) {
@@ -109,12 +126,7 @@ public final class JavaTranslator<S extends TraversalSource, T extends Traversal
         // create a copy of the argument array so as not to mutate the original bytecode
         final Object[] argumentsCopy = new Object[arguments.length];
         for (int i = 0; i < arguments.length; i++) {
-            if (arguments[i] instanceof Bytecode.Binding)
-                argumentsCopy[i] = ((Bytecode.Binding) arguments[i]).value();
-            else if (arguments[i] instanceof Bytecode)
-                argumentsCopy[i] = this.translateFromAnonymous((Bytecode) arguments[i]);
-            else
-                argumentsCopy[i] = arguments[i];
+            argumentsCopy[i] = translateObject(arguments[i]);
         }
         try {
             for (final Method method : methodCache.get(methodName)) {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3e4075bd/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/Computer.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/Computer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/Computer.java
index fdeac0b..e06a62a 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/Computer.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/Computer.java
@@ -45,27 +45,36 @@ public final class Computer implements Function<Graph, GraphComputer>, Serializa
     private Traversal<Vertex, Vertex> vertices = null;
     private Traversal<Vertex, Edge> edges = null;
 
+    public static final String GRAPH_COMPUTER = "graphComputer";
+    public static final String WORKERS = "workers";
+    public static final String PERSIST = "persist";
+    public static final String RESULT = "result";
+    public static final String VERTICES = "vertices";
+    public static final String EDGES = "edges";
+
     private Computer(final Class<? extends GraphComputer> graphComputerClass) {
         this.graphComputerClass = graphComputerClass;
     }
 
+    private Computer() {
+
+    }
+
     public static Computer compute(final Configuration configuration) {
         try {
-            final Computer computer = new Computer(configuration.containsKey("graphComputer") ?
-                    (Class) Class.forName(configuration.getString("graphComputer")) :
-                    GraphComputer.class);
+            final Computer computer = new Computer();
             for (final String key : (List<String>) IteratorUtils.asList(configuration.getKeys())) {
-                if (key.equals("graphComputer")) {
-                    // do nothing
-                } else if (key.equals("workers"))
+                if (key.equals(GRAPH_COMPUTER))
+                    computer.graphComputerClass = (Class) Class.forName(configuration.getString("graphComputer"));
+                else if (key.equals(WORKERS))
                     computer.workers = configuration.getInt(key);
-                else if (key.equals("persist"))
+                else if (key.equals(PERSIST))
                     computer.persist = GraphComputer.Persist.valueOf(configuration.getString(key));
-                else if (key.equals("result"))
+                else if (key.equals(RESULT))
                     computer.resultGraph = GraphComputer.ResultGraph.valueOf(configuration.getString(key));
-                else if (key.equals("vertices"))
+                else if (key.equals(VERTICES))
                     computer.vertices = (Traversal) configuration.getProperty(key);
-                else if (key.equals("edges"))
+                else if (key.equals(EDGES))
                     computer.edges = (Traversal) configuration.getProperty(key);
                 else
                     computer.configuration.put(key, configuration.getProperty(key));

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3e4075bd/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/GraphComputerHelper.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/GraphComputerHelper.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/GraphComputerHelper.java
index 468791f..5787681 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/GraphComputerHelper.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/GraphComputerHelper.java
@@ -18,13 +18,19 @@
  */
 package org.apache.tinkerpop.gremlin.process.computer.util;
 
+import org.apache.tinkerpop.gremlin.process.computer.Computer;
 import org.apache.tinkerpop.gremlin.process.computer.GraphComputer;
 import org.apache.tinkerpop.gremlin.process.computer.MapReduce;
 import org.apache.tinkerpop.gremlin.process.computer.Memory;
 import org.apache.tinkerpop.gremlin.process.computer.VertexProgram;
+import org.apache.tinkerpop.gremlin.process.computer.traversal.strategy.decoration.VertexProgramStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
+import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies;
+import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
 import org.apache.tinkerpop.gremlin.structure.Graph;
 
 import java.lang.reflect.Method;
+import java.util.List;
 import java.util.Optional;
 
 /**
@@ -77,4 +83,23 @@ public final class GraphComputerHelper {
         if (!(b instanceof MapReduce)) return false;
         return a.getClass().equals(b.getClass()) && a.getMemoryKey().equals(((MapReduce) b).getMemoryKey());
     }
+
+    public static TraversalStrategy[] getTraversalStrategies(final TraversalSource traversalSource, final Computer computer) {
+        Class<? extends GraphComputer> graphComputerClass;
+        if (computer.getGraphComputerClass().equals(GraphComputer.class)) {
+            try {
+                graphComputerClass = computer.apply(traversalSource.getGraph()).getClass();
+            } catch (final Exception e) {
+                graphComputerClass = GraphComputer.class;
+            }
+        } else
+            graphComputerClass = computer.getGraphComputerClass();
+        final List<TraversalStrategy<?>> graphComputerStrategies = TraversalStrategies.GlobalCache.getStrategies(graphComputerClass).toList();
+        final TraversalStrategy[] traversalStrategies = new TraversalStrategy[graphComputerStrategies.size() + 1];
+        traversalStrategies[0] = new VertexProgramStrategy(computer);
+        for (int i = 0; i < graphComputerStrategies.size(); i++) {
+            traversalStrategies[i + 1] = graphComputerStrategies.get(i);
+        }
+        return traversalStrategies;
+    }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3e4075bd/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bytecode.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bytecode.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bytecode.java
index 3737cef..9443064 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bytecode.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bytecode.java
@@ -26,6 +26,7 @@ import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -249,7 +250,13 @@ public final class Bytecode implements Cloneable, Serializable {
     private final Object convertArgument(final Object argument) {
         if (argument instanceof Traversal)
             return ((Traversal) argument).asAdmin().getBytecode();
-
+        else if (argument instanceof Map) {
+            final Map<Object, Object> map = new LinkedHashMap<>(((Map) argument).size());
+            for (final Map.Entry<?, ?> entry : ((Map<?, ?>) argument).entrySet()) {
+                map.put(convertArgument(entry.getKey()), convertArgument(entry.getValue()));
+            }
+            return map;
+        }
         if (null != this.bindings) {
             final String variable = this.bindings.getBoundVariable(argument);
             if (null != variable)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3e4075bd/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalSource.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalSource.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalSource.java
index a31b875..5b4e663 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalSource.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalSource.java
@@ -24,22 +24,21 @@ import org.apache.commons.configuration.PropertiesConfiguration;
 import org.apache.tinkerpop.gremlin.process.computer.Computer;
 import org.apache.tinkerpop.gremlin.process.computer.GraphComputer;
 import org.apache.tinkerpop.gremlin.process.computer.traversal.strategy.decoration.VertexProgramStrategy;
+import org.apache.tinkerpop.gremlin.process.computer.util.GraphComputerHelper;
 import org.apache.tinkerpop.gremlin.process.remote.RemoteConnection;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SackStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SideEffectStrategy;
 import org.apache.tinkerpop.gremlin.structure.Graph;
-import org.apache.tinkerpop.gremlin.structure.util.ElementHelper;
 import org.apache.tinkerpop.gremlin.util.function.ConstantSupplier;
 
 import java.io.Serializable;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
-import java.util.HashMap;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 import java.util.Optional;
 import java.util.function.BinaryOperator;
-import java.util.function.Function;
 import java.util.function.Supplier;
 import java.util.function.UnaryOperator;
 
@@ -98,54 +97,56 @@ public interface TraversalSource extends Cloneable, AutoCloseable {
         public static final String withComputer = "withComputer";
         public static final String withSideEffect = "withSideEffect";
         public static final String withRemote = "withRemote";
-        public static final String withStrategy = "withStrategy";
-        public static final String withoutStrategy = "withoutStrategy";
     }
 
     /////////////////////////////
 
     /**
-     * Add a {@link TraversalStrategy} to the traversal source given the strategy name and key/value pair creation arguments.
+     * Add an arbitrary collection of {@link TraversalStrategy} instances to the traversal source.
+     * The map configurations must have a <code>strategy</code> key that is the name of the strategy class.
      *
-     * @param strategyName   the name of the strategy (the full class name)
-     * @param namedArguments key/value pair arguments where the even indices are string keys
+     * @param traversalStrategyConfigurations a collection of traversal strategies to add by configuration
      * @return a new traversal source with updated strategies
      */
-    public default TraversalSource withStrategy(final String strategyName, final Object... namedArguments) {
-        ElementHelper.legalPropertyKeyValueArray(namedArguments);
-        final Map<String, Object> configuration = new HashMap<>();
-        for (int i = 0; i < namedArguments.length; i = i + 2) {
-            configuration.put((String) namedArguments[i], namedArguments[i + 1]);
-        }
-        try {
-            final TraversalStrategy<?> traversalStrategy = (TraversalStrategy) ((0 == namedArguments.length) ?
-                    Class.forName(strategyName).getMethod("instance").invoke(null) :
-                    Class.forName(strategyName).getMethod("create", Configuration.class).invoke(null, new MapConfiguration(configuration)));
-            final TraversalSource clone = this.clone();
-            clone.getStrategies().addStrategies(traversalStrategy);
-            clone.getBytecode().addSource(Symbols.withStrategy, strategyName, namedArguments);
-            return clone;
-        } catch (final ClassNotFoundException | NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
-            throw new IllegalArgumentException(e.getMessage(), e);
+    @SuppressWarnings({"unchecked"})
+    public default TraversalSource withStrategies(final Map<String, Object>... traversalStrategyConfigurations) {
+        final TraversalSource clone = this.clone();
+        final List<TraversalStrategy<?>> strategies = new ArrayList<>();
+        for (final Map<String, Object> map : traversalStrategyConfigurations) {
+            try {
+                final TraversalStrategy<?> traversalStrategy = (TraversalStrategy) ((1 == map.size()) ?
+                        Class.forName((String) map.get("strategy")).getMethod("instance").invoke(null) :
+                        Class.forName((String) map.get("strategy")).getMethod("create", Configuration.class).invoke(null, new MapConfiguration(map)));
+                strategies.add(traversalStrategy);
+            } catch (final ClassNotFoundException | NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
+                throw new IllegalArgumentException(e.getMessage(), e);
+            }
         }
+        clone.getStrategies().addStrategies(strategies.toArray(new TraversalStrategy[strategies.size()]));
+        clone.getBytecode().addSource(TraversalSource.Symbols.withStrategies, traversalStrategyConfigurations);
+        return clone;
     }
 
     /**
-     * Remove a {@link TraversalStrategy} from the travesal source given the strategy name.
+     * Remove an arbitrary collection of {@link TraversalStrategy} classes from the traversal source.
      *
-     * @param strategyName the name of the strategy (the full class name)
+     * @param traversalStrategyNames a collection of traversal strategy class names to remove
      * @return a new traversal source with updated strategies
      */
-    @SuppressWarnings({"unchecked", "varargs"})
-    public default TraversalSource withoutStrategy(final String strategyName) {
-        try {
-            final TraversalSource clone = this.clone();
-            clone.getStrategies().removeStrategies((Class<TraversalStrategy>) Class.forName(strategyName));
-            clone.getBytecode().addSource(TraversalSource.Symbols.withoutStrategy, strategyName);
-            return clone;
-        } catch (final ClassNotFoundException e) {
-            throw new IllegalArgumentException(e.getMessage(), e);
+    @SuppressWarnings({"unchecked"})
+    public default TraversalSource withoutStrategies(final String... traversalStrategyNames) {
+        final TraversalSource clone = this.clone();
+        final List<Class<TraversalStrategy>> strategies = new ArrayList<>();
+        for (final String name : traversalStrategyNames) {
+            try {
+                strategies.add((Class) Class.forName(name));
+            } catch (final ClassNotFoundException e) {
+                throw new IllegalArgumentException(e.getMessage(), e);
+            }
         }
+        clone.getStrategies().removeStrategies(strategies.toArray(new Class[strategies.size()]));
+        clone.getBytecode().addSource(Symbols.withoutStrategies, traversalStrategyNames);
+        return clone;
     }
 
     /**
@@ -190,59 +191,28 @@ public interface TraversalSource extends Cloneable, AutoCloseable {
 
     /**
      * Configure a {@link GraphComputer} to be used for the execution of subsequently spawned traversal.
+     * This adds a {@link VertexProgramStrategy} to the strategies.
      *
-     * @param namedArguments key/value pair arguments where the even indices are string keys
+     * @param computerConfiguration key/value pair map for configuring a {@link Computer}
      * @return a new traversal source with updated strategies
      */
-    public default TraversalSource withComputer(final Object... namedArguments) {
-        if (namedArguments.length == 1) {
-            if (namedArguments[0] instanceof Class)
-                return this.withComputer((Class<? extends GraphComputer>) namedArguments[1]);
-            else if (namedArguments[0] instanceof Computer)
-                return this.withComputer((Computer) namedArguments[1]);
-        }
-        ElementHelper.legalPropertyKeyValueArray(namedArguments);
-        final Map<String, Object> configuration = new HashMap<>();
-        for (int i = 0; i < namedArguments.length; i = i + 2) {
-            configuration.put((String) namedArguments[i], namedArguments[i + 1]);
-        }
-        final Computer computer = Computer.compute(new MapConfiguration(configuration));
-        final List<TraversalStrategy<?>> graphComputerStrategies = TraversalStrategies.GlobalCache.getStrategies(computer.apply(this.getGraph()).getClass()).toList();
-        final TraversalStrategy[] traversalStrategies = new TraversalStrategy[graphComputerStrategies.size() + 1];
-        traversalStrategies[0] = new VertexProgramStrategy(computer);
-        for (int i = 0; i < graphComputerStrategies.size(); i++) {
-            traversalStrategies[i + 1] = graphComputerStrategies.get(i);
-        }
-        ///
+    public default TraversalSource withComputer(final Map<String, Object> computerConfiguration) {
         final TraversalSource clone = this.clone();
-        clone.getStrategies().addStrategies(traversalStrategies);
-        clone.getBytecode().addSource(TraversalSource.Symbols.withComputer, computer);
+        clone.getStrategies().addStrategies(GraphComputerHelper.getTraversalStrategies(this, Computer.compute(new MapConfiguration(computerConfiguration))));
+        clone.getBytecode().addSource(TraversalSource.Symbols.withComputer, computerConfiguration);
         return clone;
     }
 
     /**
-     * Add a {@link Function} that will generate a {@link GraphComputer} from the {@link Graph} that will be used to execute the traversal.
+     * Add a {@link Computer} that will generate a {@link GraphComputer} from the {@link Graph} that will be used to execute the traversal.
      * This adds a {@link VertexProgramStrategy} to the strategies.
      *
      * @param computer a builder to generate a graph computer from the graph
      * @return a new traversal source with updated strategies
      */
     public default TraversalSource withComputer(final Computer computer) {
-        Class<? extends GraphComputer> graphComputerClass;
-        try {
-            graphComputerClass = computer.apply(this.getGraph()).getClass();
-        } catch (final Exception e) {
-            graphComputerClass = computer.getGraphComputerClass();
-        }
-        final List<TraversalStrategy<?>> graphComputerStrategies = TraversalStrategies.GlobalCache.getStrategies(graphComputerClass).toList();
-        final TraversalStrategy[] traversalStrategies = new TraversalStrategy[graphComputerStrategies.size() + 1];
-        traversalStrategies[0] = new VertexProgramStrategy(computer);
-        for (int i = 0; i < graphComputerStrategies.size(); i++) {
-            traversalStrategies[i + 1] = graphComputerStrategies.get(i);
-        }
-        ///
         final TraversalSource clone = this.clone();
-        clone.getStrategies().addStrategies(traversalStrategies);
+        clone.getStrategies().addStrategies(GraphComputerHelper.getTraversalStrategies(this, computer));
         clone.getBytecode().addSource(TraversalSource.Symbols.withComputer, computer);
         return clone;
     }
@@ -255,15 +225,8 @@ public interface TraversalSource extends Cloneable, AutoCloseable {
      * @return a new traversal source with updated strategies
      */
     public default TraversalSource withComputer(final Class<? extends GraphComputer> graphComputerClass) {
-        final List<TraversalStrategy<?>> graphComputerStrategies = TraversalStrategies.GlobalCache.getStrategies(graphComputerClass).toList();
-        final TraversalStrategy[] traversalStrategies = new TraversalStrategy[graphComputerStrategies.size() + 1];
-        traversalStrategies[0] = new VertexProgramStrategy(Computer.compute(graphComputerClass));
-        for (int i = 0; i < graphComputerStrategies.size(); i++) {
-            traversalStrategies[i + 1] = graphComputerStrategies.get(i);
-        }
-        ///
         final TraversalSource clone = this.clone();
-        clone.getStrategies().addStrategies(traversalStrategies);
+        clone.getStrategies().addStrategies(GraphComputerHelper.getTraversalStrategies(this, Computer.compute(graphComputerClass)));
         clone.getBytecode().addSource(TraversalSource.Symbols.withComputer, graphComputerClass);
         return clone;
     }
@@ -275,22 +238,8 @@ public interface TraversalSource extends Cloneable, AutoCloseable {
      * @return a new traversal source with updated strategies
      */
     public default TraversalSource withComputer() {
-        final Computer computer = Computer.compute();
-        Class<? extends GraphComputer> graphComputerClass;
-        try {
-            graphComputerClass = computer.apply(this.getGraph()).getClass();
-        } catch (final Exception e) {
-            graphComputerClass = computer.getGraphComputerClass();
-        }
-        final List<TraversalStrategy<?>> graphComputerStrategies = TraversalStrategies.GlobalCache.getStrategies(graphComputerClass).toList();
-        final TraversalStrategy[] traversalStrategies = new TraversalStrategy[graphComputerStrategies.size() + 1];
-        traversalStrategies[0] = new VertexProgramStrategy(computer);
-        for (int i = 0; i < graphComputerStrategies.size(); i++) {
-            traversalStrategies[i + 1] = graphComputerStrategies.get(i);
-        }
-        ///
         final TraversalSource clone = this.clone();
-        clone.getStrategies().addStrategies(traversalStrategies);
+        clone.getStrategies().addStrategies(GraphComputerHelper.getTraversalStrategies(this, Computer.compute()));
         clone.getBytecode().addSource(TraversalSource.Symbols.withComputer);
         return clone;
     }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3e4075bd/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategy.java
index f01f418..a04f304 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategy.java
@@ -43,6 +43,7 @@ import java.util.Set;
  */
 public interface TraversalStrategy<S extends TraversalStrategy> extends Serializable, Comparable<Class<? extends TraversalStrategy>> {
 
+    public static final String STRATEGY = "strategy";
 
     public void apply(final Traversal.Admin<?, ?> traversal);
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3e4075bd/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSource.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSource.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSource.java
index 2bd4bdf..8741894 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSource.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSource.java
@@ -45,6 +45,7 @@ import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 import java.util.Optional;
 import java.util.function.BinaryOperator;
 import java.util.function.Supplier;
@@ -122,49 +123,50 @@ public class GraphTraversalSource implements TraversalSource {
     //// CONFIGURATIONS
 
     @Override
-    public GraphTraversalSource withBindings(final Bindings bindings) {
-        return (GraphTraversalSource) TraversalSource.super.withBindings(bindings);
+    @SuppressWarnings({"unchecked"})
+    public GraphTraversalSource withStrategies(final Map<String, Object>... traversalStrategyConfigurations) {
+        return (GraphTraversalSource) TraversalSource.super.withStrategies(traversalStrategyConfigurations);
     }
 
     @Override
-    public GraphTraversalSource withComputer(final Object... namedArguments) {
-        return (GraphTraversalSource) TraversalSource.super.withComputer(namedArguments);
+    public GraphTraversalSource withoutStrategies(final String... traversalStrategyNames) {
+        return (GraphTraversalSource) TraversalSource.super.withoutStrategies(traversalStrategyNames);
     }
 
     @Override
-    public GraphTraversalSource withComputer(final Computer computer) {
-        return (GraphTraversalSource) TraversalSource.super.withComputer(computer);
+    public GraphTraversalSource withStrategies(final TraversalStrategy... traversalStrategies) {
+        return (GraphTraversalSource) TraversalSource.super.withStrategies(traversalStrategies);
     }
 
     @Override
-    public GraphTraversalSource withComputer(final Class<? extends GraphComputer> graphComputerClass) {
-        return (GraphTraversalSource) TraversalSource.super.withComputer(graphComputerClass);
+    @SuppressWarnings({"unchecked"})
+    public GraphTraversalSource withoutStrategies(final Class<? extends TraversalStrategy>... traversalStrategyClasses) {
+        return (GraphTraversalSource) TraversalSource.super.withoutStrategies(traversalStrategyClasses);
     }
 
     @Override
-    public GraphTraversalSource withComputer() {
-        return (GraphTraversalSource) TraversalSource.super.withComputer();
+    public GraphTraversalSource withBindings(final Bindings bindings) {
+        return (GraphTraversalSource) TraversalSource.super.withBindings(bindings);
     }
 
     @Override
-    public GraphTraversalSource withStrategy(final String strategyName, final Object... nameArguments) {
-        return (GraphTraversalSource) TraversalSource.super.withStrategy(strategyName, nameArguments);
+    public GraphTraversalSource withComputer(final Map<String,Object> computerConfiguration) {
+        return (GraphTraversalSource) TraversalSource.super.withComputer(computerConfiguration);
     }
 
     @Override
-    public GraphTraversalSource withoutStrategy(final String strategyName) {
-        return (GraphTraversalSource) TraversalSource.super.withoutStrategy(strategyName);
+    public GraphTraversalSource withComputer(final Computer computer) {
+        return (GraphTraversalSource) TraversalSource.super.withComputer(computer);
     }
 
     @Override
-    public GraphTraversalSource withStrategies(final TraversalStrategy... traversalStrategies) {
-        return (GraphTraversalSource) TraversalSource.super.withStrategies(traversalStrategies);
+    public GraphTraversalSource withComputer(final Class<? extends GraphComputer> graphComputerClass) {
+        return (GraphTraversalSource) TraversalSource.super.withComputer(graphComputerClass);
     }
 
     @Override
-    @SuppressWarnings({"unchecked", "varargs"})
-    public GraphTraversalSource withoutStrategies(final Class<? extends TraversalStrategy>... traversalStrategyClasses) {
-        return (GraphTraversalSource) TraversalSource.super.withoutStrategies(traversalStrategyClasses);
+    public GraphTraversalSource withComputer() {
+        return (GraphTraversalSource) TraversalSource.super.withComputer();
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3e4075bd/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/HaltedTraverserStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/HaltedTraverserStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/HaltedTraverserStrategy.java
index cd5119b..ee1f017 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/HaltedTraverserStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/HaltedTraverserStrategy.java
@@ -59,9 +59,11 @@ public final class HaltedTraverserStrategy extends AbstractTraversalStrategy<Tra
         return traverser;
     }
 
+    public static final String HALTED_TRAVERSER_FACTORY = "haltedTraverserFactory";
+
     public static HaltedTraverserStrategy create(final Configuration configuration) {
         try {
-            return new HaltedTraverserStrategy(Class.forName((String) configuration.getProperty("haltedTraverserFactory")));
+            return new HaltedTraverserStrategy(Class.forName(configuration.getString(HALTED_TRAVERSER_FACTORY)));
         } catch (final ClassNotFoundException e) {
             throw new IllegalArgumentException(e.getMessage(), e);
         }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3e4075bd/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategy.java
index 1fa4105..2ee4bf3 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategy.java
@@ -324,20 +324,21 @@ public final class PartitionStrategy extends AbstractTraversalStrategy<Traversal
         }
     }
 
+    public static final String INCLUDE_META_PROPERTIES = "includeMetaProperties";
+    public static final String WRITE_PARTITION = "writePartition";
+    public static final String PARTITION_KEY = "partitionKey";
+    public static final String READ_PARTITIONS = "readPartitions";
+
     public static PartitionStrategy create(final Configuration configuration) {
         final PartitionStrategy.Builder builder = PartitionStrategy.build();
-        configuration.getKeys().forEachRemaining(key -> {
-            if (key.equals("includeMetaProperties"))
-                builder.includeMetaProperties((Boolean) configuration.getProperty(key));
-            else if (key.equals("writePartition"))
-                builder.writePartition((String) configuration.getProperty(key));
-            else if (key.equals("partitionKey"))
-                builder.partitionKey((String) configuration.getProperty(key));
-            else if (key.equals("readPartitions"))
-                builder.readPartitions((List<String>) configuration.getProperty(key));
-            else
-                throw new IllegalArgumentException("The following " + PartitionStrategy.class.getSimpleName() + " configuration is unknown: " + key + ":" + configuration.getProperty(key));
-        });
+        if (configuration.containsKey(INCLUDE_META_PROPERTIES))
+            builder.includeMetaProperties(configuration.getBoolean(INCLUDE_META_PROPERTIES));
+        if (configuration.containsKey(WRITE_PARTITION))
+            builder.writePartition(configuration.getString(WRITE_PARTITION));
+        if (configuration.containsKey(PARTITION_KEY))
+            builder.partitionKey(configuration.getString(PARTITION_KEY));
+        if (configuration.containsKey(READ_PARTITIONS))
+            builder.readPartitions((List) configuration.getList(READ_PARTITIONS));
         return builder.create();
     }
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3e4075bd/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategy.java
index bccff9b..d7269aa 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategy.java
@@ -90,8 +90,8 @@ public final class SubgraphStrategy extends AbstractTraversalStrategy<TraversalS
         } else {
             final Traversal.Admin<Edge, ?> vertexPredicate;
             vertexPredicate = __.<Edge>and(
-                    __.inV().filter(this.vertexCriterion.clone()),
-                    __.outV().filter(this.vertexCriterion.clone())).asAdmin();
+                    __.inV().filter(this.vertexCriterion),
+                    __.outV().filter(this.vertexCriterion)).asAdmin();
 
             // if there is a vertex predicate then there is an implied edge filter on vertices even if there is no
             // edge predicate provided by the user.
@@ -204,8 +204,8 @@ public final class SubgraphStrategy extends AbstractTraversalStrategy<TraversalS
         if (null != this.vertexPropertyCriterion) {
             final OrStep<Object> checkPropertyCriterion = new OrStep(traversal,
                     new DefaultTraversal<>().addStep(new ClassFilterStep<>(traversal, VertexProperty.class, false)),
-                    new DefaultTraversal<>().addStep(new TraversalFilterStep<>(traversal, this.vertexPropertyCriterion.clone())));
-            final Traversal.Admin nonCheckPropertyCriterion = new DefaultTraversal<>().addStep(new TraversalFilterStep<>(traversal, this.vertexPropertyCriterion.clone()));
+                    new DefaultTraversal<>().addStep(new TraversalFilterStep<>(traversal, this.vertexPropertyCriterion)));
+            final Traversal.Admin nonCheckPropertyCriterion = new DefaultTraversal<>().addStep(new TraversalFilterStep<>(traversal, this.vertexPropertyCriterion));
 
             // turn all ElementValueTraversals into filters
             for (final Step<?, ?> step : traversal.getSteps()) {
@@ -291,18 +291,18 @@ public final class SubgraphStrategy extends AbstractTraversalStrategy<TraversalS
         return this.vertexPropertyCriterion;
     }
 
+    public static final String VERTICES = "vertices";
+    public static final String EDGES = "edges";
+    public static final String VERTEX_PROPERTIES = "vertexProperties";
+
     public static SubgraphStrategy create(final Configuration configuration) {
         final Builder builder = SubgraphStrategy.build();
-        configuration.getKeys().forEachRemaining(key -> {
-            if (key.equals("vertices") || key.equals("vertexCriterion"))
-                builder.vertices((Traversal) configuration.getProperty(key));
-            else if (key.equals("edges") || key.equals("edgeCriterion"))
-                builder.edges((Traversal) configuration.getProperty(key));
-            else if (key.equals("vertexProperties"))
-                builder.vertexProperties((Traversal) configuration.getProperty(key));
-            else
-                throw new IllegalArgumentException("The following " + SubgraphStrategy.class.getSimpleName() + " configuration is unknown: " + key + ":" + configuration.getProperty(key));
-        });
+        if (configuration.containsKey(VERTICES))
+            builder.vertices((Traversal) configuration.getProperty(VERTICES));
+        if (configuration.containsKey(EDGES))
+            builder.edges((Traversal) configuration.getProperty(EDGES));
+        if (configuration.containsKey(VERTEX_PROPERTIES))
+            builder.vertexProperties((Traversal) configuration.getProperty(VERTEX_PROPERTIES));
         return builder.create();
     }
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3e4075bd/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/StandardVerificationStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/StandardVerificationStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/StandardVerificationStrategy.java
index 917fab9..9f7f516 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/StandardVerificationStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/StandardVerificationStrategy.java
@@ -31,6 +31,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.strategy.AbstractTraversal
 import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;
 import org.apache.tinkerpop.gremlin.structure.Graph;
 
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Set;
 
@@ -52,7 +53,7 @@ public final class StandardVerificationStrategy extends AbstractTraversalStrateg
         }
 
         for (final Step<?, ?> step : traversal.getSteps()) {
-            for (String label : step.getLabels()) {
+            for (String label : new ArrayList<>(step.getLabels())) {
                 if (Graph.Hidden.isHidden(label))
                     step.removeLabel(label);
             }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3e4075bd/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSourceTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSourceTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSourceTest.java
index 7604ab5..6efa4b5 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSourceTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSourceTest.java
@@ -24,6 +24,9 @@ import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.Read
 import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph;
 import org.junit.Test;
 
+import java.util.Collections;
+import java.util.HashMap;
+
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 import static org.mockito.Mockito.mock;
@@ -59,18 +62,20 @@ public class GraphTraversalSourceTest {
     public void shouldSupportStringBasedStrategies() throws Exception {
         GraphTraversalSource g = EmptyGraph.instance().traversal();
         assertFalse(g.getStrategies().getStrategy(SubgraphStrategy.class).isPresent());
-        g = g.withStrategy(SubgraphStrategy.class.getCanonicalName(),
-                "vertices", __.hasLabel("person"),
-                "vertexProperties", __.limit(0),
-                "edges", __.hasLabel("knows"));
+        g = g.withStrategies(new HashMap<String, Object>() {{
+            put("strategy", SubgraphStrategy.class.getCanonicalName());
+            put("vertices", __.hasLabel("person"));
+            put("vertexProperties", __.limit(0));
+            put("edges", __.hasLabel("knows"));
+        }});
         assertTrue(g.getStrategies().getStrategy(SubgraphStrategy.class).isPresent());
-        g = g.withoutStrategy(SubgraphStrategy.class.getCanonicalName());
+        g = g.withoutStrategies(SubgraphStrategy.class.getCanonicalName());
         assertFalse(g.getStrategies().getStrategy(SubgraphStrategy.class).isPresent());
         //
         assertFalse(g.getStrategies().getStrategy(ReadOnlyStrategy.class).isPresent());
-        g = g.withStrategy(ReadOnlyStrategy.class.getCanonicalName());
+        g = g.withStrategies(Collections.singletonMap("strategy", ReadOnlyStrategy.class.getCanonicalName()));
         assertTrue(g.getStrategies().getStrategy(ReadOnlyStrategy.class).isPresent());
-        g = g.withoutStrategy(ReadOnlyStrategy.class.getCanonicalName());
+        g = g.withoutStrategies(ReadOnlyStrategy.class.getCanonicalName());
         assertFalse(g.getStrategies().getStrategy(ReadOnlyStrategy.class).isPresent());
     }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3e4075bd/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslatorTest.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslatorTest.java b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslatorTest.java
index 8060d39..df960c0 100644
--- a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslatorTest.java
+++ b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslatorTest.java
@@ -21,16 +21,23 @@ package org.apache.tinkerpop.gremlin.groovy.jsr223;
 
 import org.apache.tinkerpop.gremlin.AbstractGremlinTest;
 import org.apache.tinkerpop.gremlin.LoadGraphWith;
-import org.apache.tinkerpop.gremlin.groovy.jsr223.GroovyTranslator;
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SubgraphStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.TranslationStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.apache.tinkerpop.gremlin.util.function.Lambda;
 import org.junit.Test;
 
+import javax.script.Bindings;
+import javax.script.SimpleBindings;
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
 import java.util.List;
 
 import static org.junit.Assert.assertEquals;
@@ -43,6 +50,34 @@ public class GroovyTranslatorTest extends AbstractGremlinTest {
 
     @Test
     @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
+    public void shouldHandleStrategies() throws Exception {
+        GraphTraversalSource g = graph.traversal();
+        g = g.withStrategies(new HashMap<String, Object>() {{
+            put(SubgraphStrategy.STRATEGY, SubgraphStrategy.class.getCanonicalName());
+            put(SubgraphStrategy.VERTICES, __.has("name", "marko"));
+        }});
+        final Bindings bindings = new SimpleBindings();
+        bindings.put("g", g);
+        Traversal.Admin<Vertex, Object> traversal = new GremlinGroovyScriptEngine().eval(g.V().values("name").asAdmin().getBytecode(), bindings);
+        assertEquals("marko", traversal.next());
+        assertFalse(traversal.hasNext());
+        //
+        g = g.withoutStrategies(SubgraphStrategy.class.getCanonicalName());
+        traversal = new GremlinGroovyScriptEngine().eval(g.V().count().asAdmin().getBytecode(), bindings);
+        assertEquals(new Long(6), traversal.next());
+        assertFalse(traversal.hasNext());
+        //
+        g = graph.traversal().withStrategies(new HashMap<String, Object>() {{
+            put(SubgraphStrategy.STRATEGY, SubgraphStrategy.class.getCanonicalName());
+            put(SubgraphStrategy.VERTICES, __.has("name", "marko"));
+        }}, Collections.singletonMap(ReadOnlyStrategy.STRATEGY, ReadOnlyStrategy.class.getCanonicalName()));
+        traversal = new GremlinGroovyScriptEngine().eval(g.V().values("name").asAdmin().getBytecode(), bindings);
+        assertEquals("marko", traversal.next());
+        assertFalse(traversal.hasNext());
+    }
+
+    @Test
+    @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
     public void shouldSupportStringSupplierLambdas() throws Exception {
         GraphTraversalSource g = graph.traversal();
         g = g.withStrategies(new TranslationStrategy(g, GroovyTranslator.of("g")));

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3e4075bd/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
index aba78bb..59a07b3 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
@@ -24,6 +24,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
 import org.apache.tinkerpop.gremlin.process.traversal.P;
 import org.apache.tinkerpop.gremlin.process.traversal.SackFunctions;
 import org.apache.tinkerpop.gremlin.process.traversal.Translator;
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.util.ConnectiveP;
 import org.apache.tinkerpop.gremlin.process.traversal.util.OrP;
@@ -34,6 +35,7 @@ import org.apache.tinkerpop.gremlin.util.function.Lambda;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 
 /**
  * @author Marko A. Rodriguez (http://markorodriguez.com)
@@ -80,7 +82,7 @@ public final class GroovyTranslator implements Translator.ScriptTranslator {
         final StringBuilder traversalScript = new StringBuilder(start);
         for (final Bytecode.Instruction instruction : bytecode.getInstructions()) {
             final String methodName = instruction.getOperator();
-            if(IS_TESTING && methodName.equals(TraversalSource.Symbols.withStrategies))
+            if (IS_TESTING && methodName.equals(TraversalSource.Symbols.withStrategies))
                 continue;
             if (0 == instruction.getArguments().length)
                 traversalScript.append(".").append(methodName).append("()");
@@ -100,13 +102,23 @@ public final class GroovyTranslator implements Translator.ScriptTranslator {
         if (object instanceof Bytecode.Binding)
             return ((Bytecode.Binding) object).variable();
         else if (object instanceof String)
-            return "\"" + object + "\"";
+            return ((String) object).contains("\"") ? "\"\"\"" + object + "\"\"\"" : "\"" + object + "\"";
         else if (object instanceof List) {
             final List<String> list = new ArrayList<>(((List) object).size());
             for (final Object item : (List) object) {
                 list.add(convertToString(item));
             }
             return list.toString();
+        } else if (object instanceof Map) {
+            final StringBuilder map = new StringBuilder("new LinkedHashMap(){{");
+            for (final Map.Entry<?, ?> entry : ((Map<?, ?>) object).entrySet()) {
+                map.append("put(").
+                        append(convertToString(entry.getKey())).
+                        append(",").
+                        append(convertToString(entry.getValue())).
+                        append(");");
+            }
+            return map.append("}}").toString();
         } else if (object instanceof Long)
             return object + "L";
         else if (object instanceof Double)
@@ -134,6 +146,8 @@ public final class GroovyTranslator implements Translator.ScriptTranslator {
             return lambdaString.startsWith("{") ? lambdaString : "{" + lambdaString + "}";
         } else if (object instanceof Bytecode)
             return this.internalTranslate("__", (Bytecode) object);
+        else if (object instanceof Traversal)
+            return this.internalTranslate("__", ((Traversal) object).asAdmin().getBytecode());
         else
             return null == object ? "null" : object.toString();
     }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3e4075bd/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/GremlinJythonScriptEngine.java
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/GremlinJythonScriptEngine.java b/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/GremlinJythonScriptEngine.java
index 4952803..66aecf8 100644
--- a/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/GremlinJythonScriptEngine.java
+++ b/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/GremlinJythonScriptEngine.java
@@ -25,6 +25,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
 import org.apache.tinkerpop.gremlin.util.CoreImports;
 import org.python.jsr223.PyScriptEngine;
 import org.python.jsr223.PyScriptEngineFactory;
@@ -66,8 +67,12 @@ public class GremlinJythonScriptEngine implements GremlinScriptEngine {
                     "  elif isinstance(index,slice):\n    return self.range(index.start,index.stop)\n" +
                     "  else:\n    return TypeError('Index must be int or slice')");
             this.pyScriptEngine.eval(GraphTraversal.class.getSimpleName() + ".__getitem__ = getitem_bypass");
-            this.pyScriptEngine.eval(GraphTraversal.class.getSimpleName() + ".__getattr__ = lambda self, key: self.values(key)");
-
+            this.pyScriptEngine.eval(GraphTraversal.class.getSimpleName() + ".__getattr__ = lambda self, key: self.values(key)\n");
+            // necessary cause of var args bug in Jython (http://bugs.jython.org/issue1615)
+            this.pyScriptEngine.eval("def withStrategies_bypass(self, *args):\n" +
+                    "  self.getBytecode().addSource(\"withStrategies\", *args)\n" +
+                    "  return self\n");
+            this.pyScriptEngine.eval(GraphTraversalSource.class.getSimpleName() + ".withStrategies = withStrategies_bypass\n");
             this.pyScriptEngine.eval("\n" +
                     "from java.lang import Long\n" +
                     "import org.apache.tinkerpop.gremlin.util.function.Lambda\n" + // todo: remove or remove imported subclass names? (choose)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3e4075bd/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonTranslator.java
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonTranslator.java b/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonTranslator.java
index 4744649..65042ab 100644
--- a/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonTranslator.java
+++ b/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonTranslator.java
@@ -43,6 +43,7 @@ import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
@@ -102,7 +103,7 @@ public class PythonTranslator implements Translator.ScriptTranslator {
         for (final Bytecode.Instruction instruction : bytecode.getInstructions()) {
             final String methodName = instruction.getOperator();
             final Object[] arguments = instruction.getArguments();
-            if (IS_TESTING && methodName.equals(TraversalSource.Symbols.withStrategies))
+            if (IS_TESTING && methodName.equals(TraversalSource.Symbols.withStrategies) && !(instruction.getArguments()[0] instanceof Map))
                 continue;
             else if (0 == arguments.length)
                 traversalScript.append(".").append(SymbolHelper.toPython(methodName)).append("()");
@@ -133,13 +134,22 @@ public class PythonTranslator implements Translator.ScriptTranslator {
         if (object instanceof Bytecode.Binding)
             return ((Bytecode.Binding) object).variable();
         else if (object instanceof String)
-            return "\"" + object + "\"";
+            return ((String) object).contains("\"") ? "\"\"\"" + object + "\"\"\"" : "\"" + object + "\"";
         else if (object instanceof List) {
             final List<String> list = new ArrayList<>(((List) object).size());
             for (final Object item : (List) object) {
                 list.add(convertToString(item));
             }
             return list.toString();
+        } else if (object instanceof Map) {
+            final StringBuilder map = new StringBuilder("{");
+            for (final Map.Entry<?, ?> entry : ((Map<?, ?>) object).entrySet()) {
+                map.append(convertToString(entry.getKey())).
+                        append(":").
+                        append(convertToString(entry.getValue())).
+                        append(",");
+            }
+            return map.length() > 1 ? map.substring(0, map.length() - 1) + "}" : map.append("}").toString();
         } else if (object instanceof Long)
             return object + "L";
         else if (object instanceof Boolean)
@@ -158,6 +168,8 @@ public class PythonTranslator implements Translator.ScriptTranslator {
             return convertToString(((Element) object).id()); // hack
         else if (object instanceof Bytecode)
             return this.internalTranslate("__", (Bytecode) object);
+        else if (object instanceof Traversal)
+            return this.internalTranslate("__", ((Traversal.Admin) object).asAdmin().getBytecode());
         else if (object instanceof Computer)
             return "";
         else if (object instanceof Lambda)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3e4075bd/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py b/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py
index 46b6dee..35b9b71 100644
--- a/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py
+++ b/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py
@@ -57,18 +57,10 @@ class GraphTraversalSource(object):
     source = GraphTraversalSource(self.graph, TraversalStrategies(self.traversal_strategies), Bytecode(self.bytecode))
     source.bytecode.add_source("withStrategies", *args)
     return source
-  def withStrategy(self, *args):
-    source = GraphTraversalSource(self.graph, TraversalStrategies(self.traversal_strategies), Bytecode(self.bytecode))
-    source.bytecode.add_source("withStrategy", *args)
-    return source
   def withoutStrategies(self, *args):
     source = GraphTraversalSource(self.graph, TraversalStrategies(self.traversal_strategies), Bytecode(self.bytecode))
     source.bytecode.add_source("withoutStrategies", *args)
     return source
-  def withoutStrategy(self, *args):
-    source = GraphTraversalSource(self.graph, TraversalStrategies(self.traversal_strategies), Bytecode(self.bytecode))
-    source.bytecode.add_source("withoutStrategy", *args)
-    return source
   def withRemote(self, remote_connection):
     source = GraphTraversalSource(self.graph, TraversalStrategies(self.traversal_strategies), Bytecode(self.bytecode))
     source.traversal_strategies.add_strategies([RemoteStrategy(remote_connection)])

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3e4075bd/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py b/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
index 9914197..0524d74 100644
--- a/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
+++ b/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
@@ -29,6 +29,7 @@ from gremlin_python.process.traversal import Traverser
 from gremlin_python.process.graph_traversal import __
 from gremlin_python.structure.graph import Graph
 from gremlin_python.structure.graph import Vertex
+from gremlin_python.structure.io.graphson import GraphSONWriter
 
 
 class TestDriverRemoteConnection(TestCase):
@@ -63,16 +64,18 @@ class TestDriverRemoteConnection(TestCase):
     def test_strategies(self):
         statics.load_statics(globals())
         connection = DriverRemoteConnection('ws://localhost:8182/gremlin', 'g')
-        g = Graph().traversal().withRemote(connection).withStrategy(
-            "org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SubgraphStrategy",
-            "vertices", __.hasLabel("person"),
-            "edges", __.hasLabel("created"))
+        g = Graph().traversal().withRemote(connection).withStrategies(
+            {"strategy": "org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SubgraphStrategy",
+             "vertices": __.hasLabel("person"),
+             "edges": __.hasLabel("created")})
+        print GraphSONWriter.writeObject(g.bytecode)
         assert 4 == g.V().count().next()
         assert 0 == g.E().count().next()
         assert 1 == g.V().label().dedup().count().next()
         assert "person" == g.V().label().dedup().next()
         #
-        g = g.withoutStrategy("org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SubgraphStrategy").withComputer("workers", 4, "vertices", __.has("name", "marko"), "edges", __.limit(0))
+        g = g.withoutStrategies("org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SubgraphStrategy"). \
+            withComputer({"workers": 4, "vertices": __.has("name", "marko"), "edges": __.limit(0)})
         assert 1 == g.V().count().next()
         assert 0 == g.E().count().next()
         assert "person" == g.V().label().next()

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3e4075bd/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/jsr223/JythonTranslatorTest.java
----------------------------------------------------------------------
diff --git a/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/jsr223/JythonTranslatorTest.java b/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/jsr223/JythonTranslatorTest.java
index 9f6dd42..40aac5c 100644
--- a/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/jsr223/JythonTranslatorTest.java
+++ b/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/jsr223/JythonTranslatorTest.java
@@ -19,16 +19,26 @@
 
 package org.apache.tinkerpop.gremlin.python.jsr223;
 
+import org.apache.tinkerpop.gremlin.jsr223.GremlinScriptEngine;
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SubgraphStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.TranslationStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerFactory;
+import org.apache.tinkerpop.gremlin.util.ScriptEngineCache;
 import org.apache.tinkerpop.gremlin.util.function.Lambda;
 import org.junit.Test;
 
+import javax.script.Bindings;
+import javax.script.SimpleBindings;
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
 import java.util.List;
 
 import static org.junit.Assert.assertEquals;
@@ -40,6 +50,30 @@ import static org.junit.Assert.assertFalse;
 public class JythonTranslatorTest {
 
     @Test
+    public void shouldHandleStrategies() throws Exception {
+        GraphTraversalSource g = TinkerFactory.createModern().traversal();
+        g = g.withStrategies(new HashMap<String, Object>() {{
+            put(SubgraphStrategy.STRATEGY, SubgraphStrategy.class.getCanonicalName());
+            put(SubgraphStrategy.VERTICES, __.has("name", "marko"));
+        }});
+        final Bindings bindings = new SimpleBindings();
+        bindings.put("g", g);
+        //System.out.println(JythonTranslator.of("g").translate(g.V().values("name").asAdmin().getBytecode()));
+        Traversal.Admin<Vertex, String> traversal = ((GremlinScriptEngine) ScriptEngineCache.get("gremlin-jython")).eval(g.V().values("name").asAdmin().getBytecode(), bindings);
+        assertEquals("marko", traversal.next());
+        assertFalse(traversal.hasNext());
+        //
+        g = g.withStrategies(new HashMap<String, Object>() {{
+            put(SubgraphStrategy.STRATEGY, SubgraphStrategy.class.getCanonicalName());
+            put(SubgraphStrategy.VERTICES, __.has("name", "marko"));
+        }}, Collections.singletonMap(ReadOnlyStrategy.STRATEGY, ReadOnlyStrategy.class.getCanonicalName()));
+        //System.out.println(JythonTranslator.of("g").translate(g.V().values("name").asAdmin().getBytecode()));
+        traversal = ((GremlinScriptEngine) ScriptEngineCache.get("gremlin-jython")).eval(g.V().values("name").asAdmin().getBytecode(), bindings);
+        assertEquals("marko", traversal.next());
+        assertFalse(traversal.hasNext());
+    }
+
+    @Test
     public void shouldSupportStringSupplierLambdas() throws Exception {
         GraphTraversalSource g = TinkerFactory.createModern().traversal();
         g = g.withStrategies(new TranslationStrategy(g, JythonTranslator.of("g")));

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3e4075bd/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategyProcessTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategyProcessTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategyProcessTest.java
index 168e4fe..5d82e0e 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategyProcessTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategyProcessTest.java
@@ -31,6 +31,7 @@ import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
 import org.junit.Test;
 
 import java.util.Arrays;
+import java.util.HashMap;
 import java.util.List;
 import java.util.NoSuchElementException;
 import java.util.stream.Collectors;
@@ -419,17 +420,12 @@ public class PartitionStrategyProcessTest extends AbstractGremlinProcessTest {
                 .partitionKey(partition).writePartition("C").readPartitions("A").create();
         final GraphTraversalSource sourceCA = g.withStrategies(partitionStrategyCA);
 
-        final PartitionStrategy partitionStrategyCABC = PartitionStrategy.build()
-                .partitionKey(partition)
-                .writePartition("C")
-                .addReadPartition("A")
-                .addReadPartition("B")
-                .addReadPartition("C").create();
-        final GraphTraversalSource sourceCABC = g.withStrategy(PartitionStrategy.class.getCanonicalName(),
-                "writePartition", "C",
-                "partitionKey", partition,
-                "readPartitions", Arrays.asList("A", "B", "C"));
-
+        final GraphTraversalSource sourceCABC = g.withStrategies(new HashMap<String, Object>() {{
+            put(PartitionStrategy.STRATEGY, PartitionStrategy.class.getCanonicalName());
+            put(PartitionStrategy.WRITE_PARTITION, "C");
+            put(PartitionStrategy.PARTITION_KEY, partition);
+            put(PartitionStrategy.READ_PARTITIONS, Arrays.asList("A", "B", "C"));
+        }});
         final PartitionStrategy partitionStrategyCC = PartitionStrategy.build()
                 .partitionKey(partition).writePartition("C").addReadPartition("C").create();
         final GraphTraversalSource sourceCC = g.withStrategies(partitionStrategyCC);

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3e4075bd/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategyProcessTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategyProcessTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategyProcessTest.java
index 2a79c3c..4d95c96 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategyProcessTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategyProcessTest.java
@@ -36,6 +36,7 @@ import org.junit.Test;
 import org.junit.runner.RunWith;
 
 import java.util.Arrays;
+import java.util.HashMap;
 import java.util.List;
 import java.util.NoSuchElementException;
 
@@ -371,7 +372,10 @@ public class SubgraphStrategyProcessTest extends AbstractGremlinProcessTest {
     @Test
     @LoadGraphWith(CREW)
     public void shouldFilterVertexProperties() throws Exception {
-        GraphTraversalSource sg = g.withStrategy(SubgraphStrategy.class.getCanonicalName(), "vertexProperties", __.has("startTime", P.gt(2005)));
+        GraphTraversalSource sg = g.withStrategies(new HashMap<String, Object>() {{
+            put(SubgraphStrategy.STRATEGY, SubgraphStrategy.class.getCanonicalName());
+            put(SubgraphStrategy.VERTEX_PROPERTIES, __.has("startTime", P.gt(2005)));
+        }});
         checkResults(Arrays.asList("purcellville", "baltimore", "oakland", "seattle", "aachen"), sg.V().properties("location").value());
         checkResults(Arrays.asList("purcellville", "baltimore", "oakland", "seattle", "aachen"), sg.V().values("location"));
         if (sg.getStrategies().getStrategy(InlineFilterStrategy.class).isPresent())
@@ -397,7 +401,11 @@ public class SubgraphStrategyProcessTest extends AbstractGremlinProcessTest {
         sg = g.withStrategies(SubgraphStrategy.build().vertices(has("location")).vertexProperties(hasNot("endTime")).create());
         checkOrderedResults(Arrays.asList("aachen", "purcellville", "santa fe", "seattle"), sg.V().order().by("location", Order.incr).values("location"));
         //
-        sg = g.withStrategy(SubgraphStrategy.class.getCanonicalName(), "vertices", __.has("location"), "vertexProperties", __.hasNot("endTime"));
+        sg = g.withStrategies(new HashMap<String, Object>() {{
+            put(SubgraphStrategy.STRATEGY, SubgraphStrategy.class.getCanonicalName());
+            put(SubgraphStrategy.VERTICES, __.has("location"));
+            put(SubgraphStrategy.VERTEX_PROPERTIES, __.hasNot("endTime"));
+        }});
         checkResults(Arrays.asList("aachen", "purcellville", "santa fe", "seattle"), sg.V().valueMap("location").select(Column.values).unfold().unfold());
         checkResults(Arrays.asList("aachen", "purcellville", "santa fe", "seattle"), sg.V().propertyMap("location").select(Column.values).unfold().unfold().value());
         //

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3e4075bd/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/TinkerGraphComputerProvider.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/TinkerGraphComputerProvider.java b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/TinkerGraphComputerProvider.java
index 139384f..131a9c3 100644
--- a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/TinkerGraphComputerProvider.java
+++ b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/TinkerGraphComputerProvider.java
@@ -19,12 +19,14 @@
 package org.apache.tinkerpop.gremlin.tinkergraph.process;
 
 import org.apache.tinkerpop.gremlin.GraphProvider;
+import org.apache.tinkerpop.gremlin.process.computer.Computer;
 import org.apache.tinkerpop.gremlin.process.computer.GraphComputer;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.tinkergraph.TinkerGraphProvider;
 import org.apache.tinkerpop.gremlin.tinkergraph.process.computer.TinkerGraphComputer;
 
+import java.util.HashMap;
 import java.util.Random;
 
 /**
@@ -38,11 +40,12 @@ public class TinkerGraphComputerProvider extends TinkerGraphProvider {
     @Override
     public GraphTraversalSource traversal(final Graph graph) {
         return RANDOM.nextBoolean() ?
-                graph.traversal().withComputer(
-                        "workers", RANDOM.nextInt(Runtime.getRuntime().availableProcessors()) + 1,
-                        "graphComputer", RANDOM.nextBoolean() ?
-                                GraphComputer.class.getCanonicalName() :
-                                TinkerGraphComputer.class.getCanonicalName()) :
+                graph.traversal().withComputer(new HashMap<String, Object>() {{
+                    put(Computer.WORKERS, RANDOM.nextInt(Runtime.getRuntime().availableProcessors()) + 1);
+                    put(Computer.GRAPH_COMPUTER, RANDOM.nextBoolean() ?
+                            GraphComputer.class.getCanonicalName() :
+                            TinkerGraphComputer.class.getCanonicalName());
+                }}) :
                 graph.traversal(GraphTraversalSource.computer());
     }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3e4075bd/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/traversal/strategy/decoration/HaltedTraverserStrategyTest.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/traversal/strategy/decoration/HaltedTraverserStrategyTest.java b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/traversal/strategy/decoration/HaltedTraverserStrategyTest.java
index fd3dfaa..c70a31e 100644
--- a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/traversal/strategy/decoration/HaltedTraverserStrategyTest.java
+++ b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/traversal/strategy/decoration/HaltedTraverserStrategyTest.java
@@ -38,6 +38,8 @@ import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
+import java.util.HashMap;
+
 import static org.junit.Assert.assertEquals;
 
 /**
@@ -59,7 +61,10 @@ public class HaltedTraverserStrategyTest {
     @Test
     public void shouldReturnDetachedElements() {
         final Graph graph = TinkerFactory.createModern();
-        final GraphTraversalSource g = graph.traversal().withComputer().withStrategy(HaltedTraverserStrategy.class.getCanonicalName(), "haltedTraverserFactory", DetachedFactory.class.getCanonicalName());
+        final GraphTraversalSource g = graph.traversal().withComputer().withStrategies(new HashMap<String, Object>() {{
+            put(HaltedTraverserStrategy.STRATEGY, HaltedTraverserStrategy.class.getCanonicalName());
+            put(HaltedTraverserStrategy.HALTED_TRAVERSER_FACTORY, DetachedFactory.class.getCanonicalName());
+        }});
         g.V().out().forEachRemaining(vertex -> assertEquals(DetachedVertex.class, vertex.getClass()));
         g.V().out().properties("name").forEachRemaining(vertexProperty -> assertEquals(DetachedVertexProperty.class, vertexProperty.getClass()));
         g.V().out().values("name").forEachRemaining(value -> assertEquals(String.class, value.getClass()));


[19/36] tinkerpop git commit: Merge branch 'tp31'

Posted by da...@apache.org.
Merge branch 'tp31'


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

Branch: refs/heads/TINKERPOP-1458
Commit: a829e9d627d7e0707912f026fb373abd5ce4271a
Parents: 3caa2a9 e97b56d
Author: Daniel Kuppitz <da...@hotmail.com>
Authored: Thu Oct 6 23:59:04 2016 +0200
Committer: Daniel Kuppitz <da...@hotmail.com>
Committed: Thu Oct 6 23:59:04 2016 +0200

----------------------------------------------------------------------
 bin/gremlin.sh                          | 23 +----------------------
 docs/src/dev/developer/release.asciidoc |  4 ++++
 gremlin-console/bin/gremlin.sh          | 25 +------------------------
 gremlin-console/src/main/bin/gremlin.sh | 28 +++++++++++++++-------------
 4 files changed, 21 insertions(+), 59 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a829e9d6/docs/src/dev/developer/release.asciidoc
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a829e9d6/gremlin-console/src/main/bin/gremlin.sh
----------------------------------------------------------------------


[29/36] tinkerpop git commit: Add some tests for DriverRemoteTraversalSideEffects.

Posted by da...@apache.org.
Add some tests for DriverRemoteTraversalSideEffects.


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

Branch: refs/heads/TINKERPOP-1458
Commit: 504a99de2074e1df86cd462cc48e4d99b56f8e29
Parents: 651d91e
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Sep 30 09:23:29 2016 -0400
Committer: davebshow <da...@gmail.com>
Committed: Fri Oct 7 11:05:00 2016 -0400

----------------------------------------------------------------------
 gremlin-driver/pom.xml                          |  5 +
 .../DriverRemoteTraversalSideEffectsTest.java   | 96 ++++++++++++++++++++
 2 files changed, 101 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/504a99de/gremlin-driver/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-driver/pom.xml b/gremlin-driver/pom.xml
index 41e775c..65beb52 100644
--- a/gremlin-driver/pom.xml
+++ b/gremlin-driver/pom.xml
@@ -79,6 +79,11 @@ limitations under the License.
             <scope>test</scope>
         </dependency>
         <dependency>
+            <groupId>org.mockito</groupId>
+            <artifactId>mockito-core</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>org.hamcrest</groupId>
             <artifactId>hamcrest-all</artifactId>
             <scope>test</scope>

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/504a99de/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/remote/DriverRemoteTraversalSideEffectsTest.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/remote/DriverRemoteTraversalSideEffectsTest.java b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/remote/DriverRemoteTraversalSideEffectsTest.java
new file mode 100644
index 0000000..d4c5618
--- /dev/null
+++ b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/remote/DriverRemoteTraversalSideEffectsTest.java
@@ -0,0 +1,96 @@
+/*
+ * 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.driver.remote;
+
+import org.apache.tinkerpop.gremlin.driver.AbstractResultQueueTest;
+import org.apache.tinkerpop.gremlin.driver.Client;
+import org.apache.tinkerpop.gremlin.driver.ResultSet;
+import org.apache.tinkerpop.gremlin.driver.message.RequestMessage;
+import org.apache.tinkerpop.gremlin.process.traversal.TraversalSideEffects;
+import org.junit.Test;
+
+import java.util.UUID;
+import java.util.concurrent.CompletableFuture;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class DriverRemoteTraversalSideEffectsTest extends AbstractResultQueueTest {
+
+    @Test
+    public void shouldNotContactRemoteForKeysAfterCloseIsCalled() throws Exception {
+        final Client client = mock(Client.class);
+        mockClientForCall(client);
+        mockClientForCall(client);
+
+        final UUID sideEffectKey = UUID.fromString("31dec2c6-b214-4a6f-a68b-996608dce0d9");
+        final TraversalSideEffects sideEffects = new DriverRemoteTraversalSideEffects(client, sideEffectKey, null);
+
+        assertEquals(1, sideEffects.keys().size());
+        sideEffects.close();
+
+        // call this again and again and it will only hit the cached keys - no more server calls
+        assertEquals(1, sideEffects.keys().size());
+        assertEquals(1, sideEffects.keys().size());
+        assertEquals(1, sideEffects.keys().size());
+        assertEquals(1, sideEffects.keys().size());
+
+        // once for the keys and once for the close message
+        verify(client, times(2)).submitAsync(any(RequestMessage.class));
+    }
+
+    @Test
+    public void shouldNotContactRemoteMoreThanOnceForClose() throws Exception {
+        final Client client = mock(Client.class);
+        mockClientForCall(client);
+        mockClientForCall(client);
+
+        final UUID sideEffectKey = UUID.fromString("31dec2c6-b214-4a6f-a68b-996608dce0d9");
+        final TraversalSideEffects sideEffects = new DriverRemoteTraversalSideEffects(client, sideEffectKey, null);
+
+        sideEffects.close();
+        sideEffects.close();
+        sideEffects.close();
+        sideEffects.close();
+        sideEffects.close();
+
+        assertEquals(0, sideEffects.keys().size());
+
+        // once for the keys and once for the close message
+        verify(client, times(1)).submitAsync(any(RequestMessage.class));
+    }
+
+    private void mockClientForCall(final Client client) throws Exception {
+        final ResultSet returnedResultSet = new ResultSet(resultQueue, pool, readCompleted, RequestMessage.build("traversal").create(), null);
+        addToQueue(1, 0, true, true, 1);
+        final CompletableFuture<ResultSet> returnedFuture = new CompletableFuture<>();
+        returnedFuture.complete(returnedResultSet);
+
+        // the return is just generic garbage from addToQueue for any call to submitAsync() - but given the logic
+        // of DriverRemoteTraversalSideEffects, that's ok
+        when(client.submitAsync(any(RequestMessage.class))).thenReturn(returnedFuture);
+    }
+}


[28/36] tinkerpop git commit: fixed logic in DriverRemoteSideEffects, don't clear local side effect cache

Posted by da...@apache.org.
fixed logic in DriverRemoteSideEffects, don't clear local side effect cache


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

Branch: refs/heads/TINKERPOP-1458
Commit: 651d91e8e616db10bcc9f0fd8d6501a72c55d6dd
Parents: c919032
Author: davebshow <da...@gmail.com>
Authored: Thu Sep 29 13:04:57 2016 -0400
Committer: davebshow <da...@gmail.com>
Committed: Fri Oct 7 11:05:00 2016 -0400

----------------------------------------------------------------------
 .../DriverRemoteTraversalSideEffects.java       | 48 ++++++++++----------
 .../server/GremlinServerIntegrateTest.java      | 13 +++---
 2 files changed, 31 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/651d91e8/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/remote/DriverRemoteTraversalSideEffects.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/remote/DriverRemoteTraversalSideEffects.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/remote/DriverRemoteTraversalSideEffects.java
index c565dfa..d2fced5 100644
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/remote/DriverRemoteTraversalSideEffects.java
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/remote/DriverRemoteTraversalSideEffects.java
@@ -39,7 +39,7 @@ import java.util.stream.Collectors;
 public class DriverRemoteTraversalSideEffects extends AbstractRemoteTraversalSideEffects {
 
     private final Client client;
-    private Set<String> keys = null;
+    private Set<String> keys = Collections.emptySet();
     private final UUID serverSideEffect;
     private final Host host;
 
@@ -56,22 +56,27 @@ public class DriverRemoteTraversalSideEffects extends AbstractRemoteTraversalSid
     @Override
     public <V> V get(final String key) throws IllegalArgumentException {
         if (!sideEffects.containsKey(key)) {
-            // specify the ARGS_HOST so that the LoadBalancingStrategy is subverted and the connection is forced
-            // from the specified host (i.e. the host from the previous request as that host will hold the side-effects)
-            final RequestMessage msg = RequestMessage.build(Tokens.OPS_GATHER)
-                    .addArg(Tokens.ARGS_SIDE_EFFECT, serverSideEffect)
-                    .addArg(Tokens.ARGS_SIDE_EFFECT_KEY, key)
-                    .addArg(Tokens.ARGS_HOST, host)
-                    .processor("traversal").create();
-            try {
-                final Result result = client.submitAsync(msg).get().one();
-                sideEffects.put(key, null == result ? null : result.getObject());
-            } catch (Exception ex) {
-                final Throwable root = ExceptionUtils.getRootCause(ex);
-                if (root.getMessage().equals("Could not find side-effects for " + serverSideEffect + "."))
-                    sideEffects.put(key, null);
-                else
-                    throw new RuntimeException("Could not get keys", root);
+            if (!closed) {
+                // specify the ARGS_HOST so that the LoadBalancingStrategy is subverted and the connection is forced
+                // from the specified host (i.e. the host from the previous request as that host will hold the side-effects)
+                final RequestMessage msg = RequestMessage.build(Tokens.OPS_GATHER)
+                        .addArg(Tokens.ARGS_SIDE_EFFECT, serverSideEffect)
+                        .addArg(Tokens.ARGS_SIDE_EFFECT_KEY, key)
+                        .addArg(Tokens.ARGS_HOST, host)
+                        .processor("traversal").create();
+                try {
+                    final Result result = client.submitAsync(msg).get().one();
+                    sideEffects.put(key, null == result ? null : result.getObject());
+                    keys.add(key);
+                } catch (Exception ex) {
+                    final Throwable root = ExceptionUtils.getRootCause(ex);
+                    if (root.getMessage().equals("Could not find side-effects for " + serverSideEffect + "."))
+                        sideEffects.put(key, null);
+                    else
+                        throw new RuntimeException("Could not get keys", root);
+                }
+            } else {
+                sideEffects.put(key, null);
             }
         }
 
@@ -80,7 +85,7 @@ public class DriverRemoteTraversalSideEffects extends AbstractRemoteTraversalSid
 
     @Override
     public Set<String> keys() {
-        if (null == keys) {
+        if (!closed) {
             // specify the ARGS_HOST so that the LoadBalancingStrategy is subverted and the connection is forced
             // from the specified host (i.e. the host from the previous request as that host will hold the side-effects)
             final RequestMessage msg = RequestMessage.build(Tokens.OPS_KEYS)
@@ -91,9 +96,7 @@ public class DriverRemoteTraversalSideEffects extends AbstractRemoteTraversalSid
                 keys = client.submitAsync(msg).get().all().get().stream().map(r -> r.getString()).collect(Collectors.toSet());
             } catch (Exception ex) {
                 final Throwable root = ExceptionUtils.getRootCause(ex);
-                if (root.getMessage().equals("Could not find side-effects for " + serverSideEffect + "."))
-                    keys = Collections.emptySet();
-                else
+                if (!root.getMessage().equals("Could not find side-effects for " + serverSideEffect + "."))
                     throw new RuntimeException("Could not get keys", root);
             }
         }
@@ -101,7 +104,6 @@ public class DriverRemoteTraversalSideEffects extends AbstractRemoteTraversalSid
         return keys;
     }
 
-
     @Override
     public void close() throws Exception {
         if (!closed) {
@@ -111,8 +113,6 @@ public class DriverRemoteTraversalSideEffects extends AbstractRemoteTraversalSid
                     .processor("traversal").create();
             try {
                 client.submitAsync(msg).get();
-                sideEffects.clear();
-                keys = null;
                 closed = true;
             } catch (Exception ex) {
                 final Throwable root = ExceptionUtils.getRootCause(ex);

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/651d91e8/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
index a1d019b..e6e0021 100644
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
@@ -70,6 +70,7 @@ import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
@@ -90,6 +91,7 @@ import static org.hamcrest.core.StringEndsWith.endsWith;
 import static org.hamcrest.core.StringStartsWith.startsWith;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.fail;
 import static org.junit.Assume.assumeThat;
 import static org.junit.Assert.assertEquals;
@@ -831,17 +833,16 @@ public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegration
     }
 
     @Test
-    public void shouldCloseSideEffects() throws Exception {
+    public void shouldCloseLocalSideEffects() throws Exception {
         final Graph graph = EmptyGraph.instance();
         final GraphTraversalSource g = graph.traversal().withRemote(conf);
         g.addV("person").property("age", 20).iterate();
         g.addV("person").property("age", 10).iterate();
-        final GraphTraversal traversal = g.V().aggregate("a");
+        final GraphTraversal traversal = g.V().aggregate("a").aggregate("b");
         traversal.iterate();
-        final Set sideEffects = traversal.asAdmin().getSideEffects().keys();
-        assertTrue(sideEffects.contains("a"));
+        final List sideEffects = traversal.asAdmin().getSideEffects().get("a");
+        assertFalse(sideEffects.isEmpty());
         traversal.asAdmin().getSideEffects().close();
-        final Set emptySideEffects = traversal.asAdmin().getSideEffects().keys();
-        assertTrue(emptySideEffects.isEmpty());
+        assertNull(traversal.asAdmin().getSideEffects().get("b"));
     }
 }


[16/36] tinkerpop git commit: added back a Deprecated version of LazyBarrierStrategy that is a finalization. Updated CHANGELOG.

Posted by da...@apache.org.
added back a Deprecated version of LazyBarrierStrategy that is a finalization. Updated CHANGELOG.


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

Branch: refs/heads/TINKERPOP-1458
Commit: aa3cd937bd8100e3dc9fce131b131ac2c9d9d35b
Parents: 658630a
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Thu Oct 6 12:37:48 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Thu Oct 6 12:37:48 2016 -0600

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |   1 +
 .../finalization/LazyBarrierStrategy.java       | 111 +++++++++++++++++++
 2 files changed, 112 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/aa3cd937/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index dc2b03b..6a21b7d 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,6 +26,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 TinkerPop 3.2.3 (Release Date: NOT OFFICIALLY RELEASED YET)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+* A new version of `LazyBarrierStrategy` has been created and added to the default strategies.
 * `FilterRankStrategy` now propagates labels "right" over non-`Scoping` filters.
 * Fixed a bug in `ConnectiveP` where nested equivalent connectives should be inlined.
 * Fixed a bug in `IncidentToAdjacentStrategy` where `TreeStep` traversals were allowed.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/aa3cd937/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/finalization/LazyBarrierStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/finalization/LazyBarrierStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/finalization/LazyBarrierStrategy.java
new file mode 100644
index 0000000..4a89b1b
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/finalization/LazyBarrierStrategy.java
@@ -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.
+ */
+
+package org.apache.tinkerpop.gremlin.process.traversal.strategy.finalization;
+
+import org.apache.tinkerpop.gremlin.process.traversal.Step;
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.step.Barrier;
+import org.apache.tinkerpop.gremlin.process.traversal.step.HasContainerHolder;
+import org.apache.tinkerpop.gremlin.process.traversal.step.filter.FilterStep;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.EdgeVertexStep;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.NoOpBarrierStep;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.VertexStep;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.AbstractTraversalStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.traverser.TraverserRequirement;
+import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ * @deprecated As of release 3.2.3. Please use {@link org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.LazyBarrierStrategy}.
+ */
+@Deprecated
+public final class LazyBarrierStrategy extends AbstractTraversalStrategy<TraversalStrategy.FinalizationStrategy> implements TraversalStrategy.FinalizationStrategy {
+
+    private static final LazyBarrierStrategy INSTANCE = new LazyBarrierStrategy();
+    private static final Set<Class<? extends FinalizationStrategy>> PRIORS = new HashSet<>();
+    private static final Set<Class<? extends FinalizationStrategy>> POSTS = new HashSet<>();
+
+    private static final int REQUIRED_DEPTH = 2;
+    private static final int BIG_START_SIZE = 5;
+    protected static final int MAX_BARRIER_SIZE = 10000;
+
+    static {
+        POSTS.add(ProfileStrategy.class);
+    }
+
+
+    private LazyBarrierStrategy() {
+    }
+
+    @Override
+    public void apply(final Traversal.Admin<?, ?> traversal) {
+        if (TraversalHelper.onGraphComputer(traversal))
+            return;
+
+        if (traversal.getTraverserRequirements().contains(TraverserRequirement.PATH))
+            return;
+
+        int depth = 0;
+        for (final Step<?, ?> step : traversal.getSteps()) {
+            if (step instanceof VertexStep)
+                depth++;
+        }
+
+        if (depth > REQUIRED_DEPTH) {
+            boolean bigStart = false;
+            char foundVertexStep = 'x';
+            for (int i = 0; i < traversal.getSteps().size() - 1; i++) {
+                final Step<?, ?> step = traversal.getSteps().get(i);
+                if (i == 0)
+                    bigStart = step instanceof GraphStep && (((GraphStep) step).getIds().length >= BIG_START_SIZE || (((GraphStep) step).getIds().length == 0 && step instanceof HasContainerHolder && ((HasContainerHolder) step).getHasContainers().isEmpty()));
+                else if ('v' == foundVertexStep || bigStart) {
+                    if (!(step instanceof FilterStep) && !(step instanceof Barrier) && !(step instanceof VertexStep && ((VertexStep) step).returnsEdge())) {
+                        TraversalHelper.insertAfterStep(new NoOpBarrierStep<>(traversal, MAX_BARRIER_SIZE), step, traversal);
+                    }
+                }
+
+                if ('x' == foundVertexStep && step instanceof VertexStep)
+                    foundVertexStep = ((VertexStep) step).returnsVertex() ? 'v' : 'e';
+                else if ('e' == foundVertexStep && step instanceof EdgeVertexStep)
+                    foundVertexStep = 'v';
+            }
+        }
+    }
+
+
+    @Override
+    public Set<Class<? extends FinalizationStrategy>> applyPrior() {
+        return PRIORS;
+    }
+
+    @Override
+    public Set<Class<? extends FinalizationStrategy>> applyPost() {
+        return POSTS;
+    }
+
+    public static LazyBarrierStrategy instance() {
+        return INSTANCE;
+    }
+}


[23/36] tinkerpop git commit: TraversalOpProcessor returns a success message upon receiveing a close command

Posted by da...@apache.org.
TraversalOpProcessor returns a success message upon receiveing a close command


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

Branch: refs/heads/TINKERPOP-1458
Commit: 6f9230bbc28aa7bbd5fc92e0b129f10199f53f00
Parents: c6b49f2
Author: davebshow <da...@apache.org>
Authored: Thu Sep 22 14:51:21 2016 -0400
Committer: davebshow <da...@gmail.com>
Committed: Fri Oct 7 11:04:07 2016 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                                                | 1 +
 .../gremlin/server/op/traversal/TraversalOpProcessor.java         | 3 +++
 2 files changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6f9230bb/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index cda6d8c..421a1a8 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -77,6 +77,7 @@ TinkerPop 3.2.3 (Release Date: NOT OFFICIALLY RELEASED YET)
 * VertexPrograms can now declare traverser requirements, e.g. to have access to the path when used with `.program()`.
 * New build options for `gremlin-python` where `-DglvPython` is no longer required.
 * Added missing `InetAddress` to GraphSON extension module.
+* Gremlin Server `TraversalOpProcessor` now returns confirmation upon `Op` `close`.
 
 [[release-3-2-2]]
 TinkerPop 3.2.2 (Release Date: September 6, 2016)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6f9230bb/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/traversal/TraversalOpProcessor.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/traversal/TraversalOpProcessor.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/traversal/TraversalOpProcessor.java
index 80cacd2..88d8d90 100644
--- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/traversal/TraversalOpProcessor.java
+++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/traversal/TraversalOpProcessor.java
@@ -198,6 +198,9 @@ public class TraversalOpProcessor extends AbstractOpProcessor {
 
                     final Optional<UUID> sideEffect = msg.optionalArgs(Tokens.ARGS_SIDE_EFFECT);
                     cache.invalidate(sideEffect.get());
+
+                    final String successMessage = String.format("Successfully cleared side effect cache for [%s].", Tokens.ARGS_SIDE_EFFECT);
+                    ctx.getChannelHandlerContext().writeAndFlush(ResponseMessage.build(message).code(ResponseStatusCode.NO_CONTENT).statusMessage(successMessage).create());
                 };
 
                 break;


[13/36] tinkerpop git commit: so many bug fixes in the GLV/Translator world. So many more tests added. We are now testing translators against all the strategies (save Evenstrategy cause it requires Java objects). This is really becoming clean.

Posted by da...@apache.org.
so many bug fixes in the GLV/Translator world. So many more tests added. We are now testing translators against all the strategies (save Evenstrategy cause it requires Java objects). This is really becoming clean.


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

Branch: refs/heads/TINKERPOP-1458
Commit: 894ff3dc0ccae16dae2fa314684aff7bbbcc139a
Parents: 3e4075b
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Thu Oct 6 10:07:15 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Thu Oct 6 10:07:15 2016 -0600

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              | 11 +++-
 .../upgrade/release-3.2.x-incubating.asciidoc   | 63 +++++++++++++-----
 .../gremlin/jsr223/JavaTranslator.java          | 22 ++++++-
 .../gremlin/process/computer/Computer.java      | 22 ++++++-
 .../gremlin/process/traversal/Bindings.java     |  5 ++
 .../gremlin/process/traversal/Bytecode.java     | 69 +++++++++++++-------
 .../process/traversal/TraversalStrategy.java    | 12 ++++
 .../strategy/decoration/ElementIdStrategy.java  | 27 +++++---
 .../decoration/HaltedTraverserStrategy.java     | 12 ++++
 .../strategy/decoration/PartitionStrategy.java  | 18 ++++-
 .../strategy/decoration/SubgraphStrategy.java   | 27 ++++++--
 .../finalization/MatchAlgorithmStrategy.java    | 24 +++++++
 .../StandardVerificationStrategy.java           |  2 +-
 .../gremlin/jsr223/JavaTranslatorTest.java      | 68 +++++++++++++++++++
 .../gremlin/process/traversal/BytecodeTest.java | 42 ++++++++++++
 .../dsl/graph/GraphTraversalSourceTest.java     |  2 +-
 .../gremlin/groovy/jsr223/GroovyTranslator.java | 20 ++++--
 .../python/TraversalSourceGenerator.groovy      | 17 ++++-
 .../gremlin/python/jsr223/PythonTranslator.java | 19 ++++--
 .../jython/gremlin_python/process/traversal.py  | 17 ++++-
 .../gremlin_python/structure/io/graphson.py     |  5 +-
 .../TinkerGraphGroovyTranslatorProvider.java    |  3 +
 .../TinkerGraphJavaTranslatorProvider.java      |  3 +
 23 files changed, 429 insertions(+), 81 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/894ff3dc/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index f25e095..7ec7d15 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,10 +26,15 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 TinkerPop 3.2.3 (Release Date: NOT OFFICIALLY RELEASED YET)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-* Fixed a `String` bug in `GroovyTranslator` and `PythonTranslator` where if the string has double-quotes, use """ """.
-* Fixed a `List` and `Map` bug in `JavaTranslator` where such collections were not being internally translated.
+* Fixed a `Set`, `List`, `Map` bug in the various `Translators` where such collections were not being internally translated.
+* Fixed a `Bytecode` bug where nested structures (map, list, set) were not being analyzed for bindings and bytecode conversions.
+* Fixed a `String` bug in `GroovyTranslator` and `PythonTranslator` where if the string has double-quotes it now uses """ """.
+* Added a default `TraversalStrategy.getConfiguration()` which returns the configuration needed to construct the strategy.
+* Gremlin-Java `TraversalStrategy` and `Computer` instances are now converted to `Map`-representations in `Bytecode`.
+* `Computer` instances can be created with `Computer.create(Configuration)` and accessed via `Computer.getConf()`.
+* Every `TraversalStrategy` can be created via a `Configuration` and a static `MyStrategy.create(Configuration)`.
 * Added `TraversalSource.withComputer(Map<String,Object>)` for better language variant support.
-* Added `TraversalSource.withStrategies(Map<String,Object>)`/`withoutStrategies(String...)` for better language variant support.
+* Added `TraversalSource.withStrategies(Map<String,Object>...)`/`withoutStrategies(String...)` for better language variant support.
 * Added `PartitionStrategy.Builder.readPartitions()` and deprecated `PartitionStrategy.Builder.addPartition()`.
 * `FilterRankStrategy` now propagates labels "right" over non-`Scoping` filters.
 * Fixed a bug in `ConnectiveP` where nested equivalent connectives should be inlined.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/894ff3dc/docs/src/upgrade/release-3.2.x-incubating.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/upgrade/release-3.2.x-incubating.asciidoc b/docs/src/upgrade/release-3.2.x-incubating.asciidoc
index 983c63e..5fbf4fe 100644
--- a/docs/src/upgrade/release-3.2.x-incubating.asciidoc
+++ b/docs/src/upgrade/release-3.2.x-incubating.asciidoc
@@ -163,7 +163,7 @@ Configurable Strategies
 
 `TraversalSource.withStrategies()` and `TraversalSource.withoutStrategies()` use Java objects. In order to make strategy
 manipulation possible from Gremlin language variants like Gremlin-Python, it is important to support non-JVM-based versions
-of these methods. As such, `TraversalSource.withStrategy(String,Object...)` and `TraversalSource.withoutStrategy(String)`
+of these methods. As such, `TraversalSource.withStrategies(Map<String,Object>...)` and `TraversalSource.withoutStrategies(String...)`
 were added.
 
 If the provider has non-configurable `TraversalStrategy` classes, those classes should expose a static `instance()`-method.
@@ -175,31 +175,60 @@ a `SubgraphStrategy`, it does the following:
 [source,python]
 ----
 g = Graph().traversal().withRemote(connection).
-        withStrategy('org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SubgraphStrategy',
-            'vertices', __.hasLabel('person'),
-            'edges', __.has('weight',gt(0.5))
+        withStrategy({'strategy':'org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SubgraphStrategy',
+            'vertices': __.hasLabel('person'),
+            'edges': __.has('weight',gt(0.5))})
 ---
 
-`SubgraphStrategy.create(Configuration)`-method is defined as:
+The `SubgraphStrategy.create(Configuration)`-method is defined as:
 
 [source,java]
 ----
 public static SubgraphStrategy create(final Configuration configuration) {
     final Builder builder = SubgraphStrategy.build();
-    configuration.getKeys().forEachRemaining(key -> {
-        if (key.equals("vertices") || key.equals("vertexCriterion"))
-            builder.vertices((Traversal) configuration.getProperty(key));
-        else if (key.equals("edges") || key.equals("edgeCriterion"))
-            builder.edges((Traversal) configuration.getProperty(key));
-        else if (key.equals("vertexProperties"))
-            builder.vertexProperties((Traversal) configuration.getProperty(key));
-        else
-            throw new IllegalArgumentException("The following " + SubgraphStrategy.class.getSimpleName() + " configuration is unknown: " + key + ":" + configuration.getProperty(key));
-        });
-        return builder.create();
-    }
+    if (configuration.containsKey(VERTICES))
+        builder.vertices((Traversal) configuration.getProperty(VERTICES));
+    if (configuration.containsKey(EDGES))
+        builder.edges((Traversal) configuration.getProperty(EDGES));
+    if (configuration.containsKey(VERTEX_PROPERTIES))
+        builder.vertexProperties((Traversal) configuration.getProperty(VERTEX_PROPERTIES));
+    return builder.create();
+}
+----
+
+Finally, in order to make serialization possible from JVM-based Gremlin language variants, all strategies have a
+`TraverserStrategy.getConfiguration()` method which returns a `Configuration` that can be used to `create()` the
+`TraversalStrategy`.
+
+The `SubgraphStrategy.getConfiguration()`-method is defined as:
+
+[source,java]
+----
+@Override
+public Configuration getConfiguration() {
+    final Map<String, Object> map = new HashMap<>();
+    map.put(STRATEGY, SubgraphStrategy.class.getCanonicalName());
+    if (null != this.vertexCriterion)
+        map.put(VERTICES, this.vertexCriterion);
+    if (null != this.edgeCriterion)
+            map.put(EDGES, this.edgeCriterion);
+    if (null != this.vertexPropertyCriterion)
+        map.put(VERTEX_PROPERTIES, this.vertexPropertyCriterion);
+    return new MapConfiguration(map);
+}
 ----
 
+The default implementation of `TraversalStrategy.getConfiguration()` is defined as:
+
+[source,java]
+----
+public default Configuration getConfiguration() {
+    return new MapConfiguration(Collections.singletonMap(STRATEGY, this.getClass().getCanonicalName()));
+}
+----
+
+Thus, if the provider does not have any "builder"-based strategies, then no updates to their strategies are required.
+
 See: link:https://issues.apache.org/jira/browse/TINKERPOP-1455[TINKERPOP-1455]
 
 Deprecated elementNotFound

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/894ff3dc/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/JavaTranslator.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/JavaTranslator.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/JavaTranslator.java
index af245c5..d1e974d 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/JavaTranslator.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/JavaTranslator.java
@@ -23,6 +23,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
 import org.apache.tinkerpop.gremlin.process.traversal.Translator;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
+import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
 import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
 
 import java.lang.reflect.Array;
@@ -31,8 +32,11 @@ import java.lang.reflect.Parameter;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 
 /**
@@ -40,6 +44,8 @@ import java.util.concurrent.ConcurrentHashMap;
  */
 public final class JavaTranslator<S extends TraversalSource, T extends Traversal.Admin<?, ?>> implements Translator.StepTranslator<S, T> {
 
+    private static final boolean IS_TESTING = Boolean.valueOf(System.getProperty("is.testing", "false"));
+
     private final S traversalSource;
     private final Class anonymousTraversal;
     private static final Map<Class<?>, Map<String, List<Method>>> GLOBAL_METHOD_CACHE = new ConcurrentHashMap<>();
@@ -64,6 +70,10 @@ public final class JavaTranslator<S extends TraversalSource, T extends Traversal
         TraversalSource dynamicSource = this.traversalSource;
         Traversal.Admin<?, ?> traversal = null;
         for (final Bytecode.Instruction instruction : bytecode.getSourceInstructions()) {
+            if (IS_TESTING &&
+                    instruction.getOperator().equals(TraversalSource.Symbols.withStrategies) &&
+                    ((Map) instruction.getArguments()[0]).get(TraversalStrategy.STRATEGY).toString().contains("TranslationStrategy"))
+                continue;
             dynamicSource = (TraversalSource) invokeMethod(dynamicSource, TraversalSource.class, instruction.getOperator(), instruction.getArguments());
         }
         boolean spawned = false;
@@ -91,7 +101,7 @@ public final class JavaTranslator<S extends TraversalSource, T extends Traversal
 
     private Object translateObject(final Object object) {
         if (object instanceof Bytecode.Binding)
-            return ((Bytecode.Binding) object).value();
+            return translateObject(((Bytecode.Binding) object).value());
         else if (object instanceof Bytecode) {
             try {
                 final Traversal.Admin<?, ?> traversal = (Traversal.Admin) this.anonymousTraversal.getMethod("start").invoke(null);
@@ -103,17 +113,23 @@ public final class JavaTranslator<S extends TraversalSource, T extends Traversal
                 throw new IllegalStateException(e.getMessage());
             }
         } else if (object instanceof Map) {
-            final Map<Object, Object> map = new HashMap<>(((Map) object).size());
+            final Map<Object, Object> map = new LinkedHashMap<>(((Map) object).size());
             for (final Map.Entry<?, ?> entry : ((Map<?, ?>) object).entrySet()) {
                 map.put(translateObject(entry.getKey()), translateObject(entry.getValue()));
             }
             return map;
         } else if (object instanceof List) {
-            final List<Object> list = new ArrayList<>();
+            final List<Object> list = new ArrayList<>(((List) object).size());
             for (final Object o : (List) object) {
                 list.add(translateObject(o));
             }
             return list;
+        } else if (object instanceof Set) {
+            final Set<Object> set = new HashSet<>(((Set) object).size());
+            for (final Object o : (Set) object) {
+                set.add(translateObject(o));
+            }
+            return set;
         } else
             return object;
     }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/894ff3dc/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/Computer.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/Computer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/Computer.java
index e06a62a..86e1a12 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/Computer.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/Computer.java
@@ -20,6 +20,7 @@
 package org.apache.tinkerpop.gremlin.process.computer;
 
 import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.MapConfiguration;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.structure.Edge;
 import org.apache.tinkerpop.gremlin.structure.Graph;
@@ -65,7 +66,7 @@ public final class Computer implements Function<Graph, GraphComputer>, Serializa
             final Computer computer = new Computer();
             for (final String key : (List<String>) IteratorUtils.asList(configuration.getKeys())) {
                 if (key.equals(GRAPH_COMPUTER))
-                    computer.graphComputerClass = (Class) Class.forName(configuration.getString("graphComputer"));
+                    computer.graphComputerClass = (Class) Class.forName(configuration.getString(key));
                 else if (key.equals(WORKERS))
                     computer.workers = configuration.getInt(key);
                 else if (key.equals(PERSIST))
@@ -198,4 +199,23 @@ public final class Computer implements Function<Graph, GraphComputer>, Serializa
     public int getWorkers() {
         return this.workers;
     }
+
+    public Configuration getConf() {
+        final Map<String, Object> map = new HashMap<>();
+        if (-1 != this.workers)
+            map.put(WORKERS, this.workers);
+        if (null != this.persist)
+            map.put(PERSIST, this.persist.name());
+        if (null != this.resultGraph)
+            map.put(RESULT, this.resultGraph.name());
+        if (null != this.vertices)
+            map.put(RESULT, this.vertices);
+        if (null != this.edges)
+            map.put(EDGES, this.edges);
+        map.put(GRAPH_COMPUTER, this.graphComputerClass.getCanonicalName());
+        for (final Map.Entry<String, Object> entry : this.configuration.entrySet()) {
+            map.put(entry.getKey(), entry.getValue());
+        }
+        return new MapConfiguration(map);
+    }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/894ff3dc/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bindings.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bindings.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bindings.java
index ca830f1..ba31e21 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bindings.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bindings.java
@@ -55,4 +55,9 @@ public final class Bindings {
     protected void clear() {
         this.map.clear();
     }
+
+    @Override
+    public String toString() {
+        return this.map.toString();
+    }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/894ff3dc/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bytecode.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bytecode.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bytecode.java
index 9443064..f331d50 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bytecode.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bytecode.java
@@ -19,6 +19,8 @@
 
 package org.apache.tinkerpop.gremlin.process.traversal;
 
+import org.apache.commons.configuration.ConfigurationConverter;
+import org.apache.tinkerpop.gremlin.process.computer.Computer;
 import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
 import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
 
@@ -44,6 +46,8 @@ import java.util.Map;
  */
 public final class Bytecode implements Cloneable, Serializable {
 
+    private static final Object[] EMPTY_ARRAY = new Object[]{};
+
     private List<Instruction> sourceInstructions = new ArrayList<>();
     private List<Instruction> stepInstructions = new ArrayList<>();
     private transient Bindings bindings = null;
@@ -111,21 +115,32 @@ public final class Bytecode implements Cloneable, Serializable {
     public Map<String, Object> getBindings() {
         final Map<String, Object> bindingsMap = new HashMap<>();
         for (final Instruction instruction : this.sourceInstructions) {
-            addInstructionBindings(bindingsMap, instruction);
+            for (final Object argument : instruction.getArguments()) {
+                addArgumentBinding(bindingsMap, argument);
+            }
         }
         for (final Instruction instruction : this.stepInstructions) {
-            addInstructionBindings(bindingsMap, instruction);
+            for (final Object argument : instruction.getArguments()) {
+                addArgumentBinding(bindingsMap, argument);
+            }
         }
         return bindingsMap;
     }
 
-    private static final void addInstructionBindings(final Map<String, Object> bindingsMap, final Instruction instruction) {
-        for (final Object argument : instruction.getArguments()) {
-            if (argument instanceof Binding)
-                bindingsMap.put(((Binding) argument).key, ((Binding) argument).value);
-            else if (argument instanceof Bytecode)
-                bindingsMap.putAll(((Bytecode) argument).getBindings());
-        }
+    private static final void addArgumentBinding(final Map<String, Object> bindingsMap, final Object argument) {
+        if (argument instanceof Binding)
+            bindingsMap.put(((Binding) argument).key, ((Binding) argument).value);
+        else if (argument instanceof Map) {
+            for (final Map.Entry<?, ?> entry : ((Map<?, ?>) argument).entrySet()) {
+                addArgumentBinding(bindingsMap, entry.getKey());
+                addArgumentBinding(bindingsMap, entry.getValue());
+            }
+        } else if (argument instanceof List) {
+            for (final Object item : (List) argument) {
+                addArgumentBinding(bindingsMap, item);
+            }
+        } else if (argument instanceof Bytecode)
+            bindingsMap.putAll(((Bytecode) argument).getBindings());
     }
 
     @Override
@@ -234,35 +249,45 @@ public final class Bytecode implements Cloneable, Serializable {
 
     private final Object[] flattenArguments(final Object... arguments) {
         if (arguments.length == 0)
-            return new Object[]{};
+            return EMPTY_ARRAY;
         final List<Object> flatArguments = new ArrayList<>();
         for (final Object object : arguments) {
             if (object instanceof Object[]) {
                 for (final Object nestObject : (Object[]) object) {
-                    flatArguments.add(convertArgument(nestObject));
+                    flatArguments.add(convertArgument(nestObject, true));
                 }
             } else
-                flatArguments.add(convertArgument(object));
+                flatArguments.add(convertArgument(object, true));
         }
         return flatArguments.toArray();
     }
 
-    private final Object convertArgument(final Object argument) {
+    private final Object convertArgument(final Object argument, final boolean searchBindings) {
+        if (searchBindings && null != this.bindings) {
+            final String variable = this.bindings.getBoundVariable(argument);
+            if (null != variable)
+                return new Binding<>(variable, convertArgument(argument, false));
+        }
+        //
         if (argument instanceof Traversal)
             return ((Traversal) argument).asAdmin().getBytecode();
+        else if (argument instanceof TraversalStrategy)
+            return convertArgument(ConfigurationConverter.getMap(((TraversalStrategy) argument).getConfiguration()), true);
+        else if (argument instanceof Computer)
+            return convertArgument(ConfigurationConverter.getMap(((Computer) argument).getConf()), true);
         else if (argument instanceof Map) {
             final Map<Object, Object> map = new LinkedHashMap<>(((Map) argument).size());
             for (final Map.Entry<?, ?> entry : ((Map<?, ?>) argument).entrySet()) {
-                map.put(convertArgument(entry.getKey()), convertArgument(entry.getValue()));
+                map.put(convertArgument(entry.getKey(), true), convertArgument(entry.getValue(), true));
             }
             return map;
-        }
-        if (null != this.bindings) {
-            final String variable = this.bindings.getBoundVariable(argument);
-            if (null != variable)
-                return new Binding<>(variable, argument);
-        }
-
-        return argument;
+        } else if (argument instanceof List) {
+            final List<Object> list = new ArrayList<>(((List) argument).size());
+            for (final Object item : (List) argument) {
+                list.add(convertArgument(item, true));
+            }
+            return list;
+        } else
+            return argument;
     }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/894ff3dc/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategy.java
index a04f304..7943624 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategy.java
@@ -18,6 +18,8 @@
  */
 package org.apache.tinkerpop.gremlin.process.traversal;
 
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.MapConfiguration;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.PartitionStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.finalization.ProfileStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.RangeByIsCountStrategy;
@@ -76,6 +78,16 @@ public interface TraversalStrategy<S extends TraversalStrategy> extends Serializ
         return (Class) TraversalStrategy.class;
     }
 
+    /**
+     * Get the configuration representation of this strategy.
+     * This is useful for converting a strategy into a serialized form.
+     *
+     * @return the configuration used to create this strategy
+     */
+    public default Configuration getConfiguration() {
+        return new MapConfiguration(Collections.singletonMap(STRATEGY, this.getClass().getCanonicalName()));
+    }
+
     @Override
     public default int compareTo(final Class<? extends TraversalStrategy> otherTraversalCategory) {
         return 0;

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/894ff3dc/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/ElementIdStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/ElementIdStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/ElementIdStrategy.java
index 396de49..32437e1 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/ElementIdStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/ElementIdStrategy.java
@@ -19,6 +19,7 @@
 package org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration;
 
 import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.MapConfiguration;
 import org.apache.tinkerpop.gremlin.process.traversal.P;
 import org.apache.tinkerpop.gremlin.process.traversal.Parameterizing;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
@@ -40,6 +41,8 @@ import org.apache.tinkerpop.gremlin.structure.T;
 import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
 
 import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
 import java.util.UUID;
 import java.util.function.Supplier;
 
@@ -152,16 +155,24 @@ public final class ElementIdStrategy extends AbstractTraversalStrategy<Traversal
         }
     }
 
+    public static final String ID_PROPERTY_KEY = "idPropertyKey";
+    public static final String ID_MAKER = "idMaker";
+
     public static ElementIdStrategy create(final Configuration configuration) {
         final ElementIdStrategy.Builder builder = ElementIdStrategy.build();
-        configuration.getKeys().forEachRemaining(key -> {
-            if (key.equals("idPropertyKey"))
-                builder.idPropertyKey((String) configuration.getProperty(key));
-            else if (key.equals("idMaker"))
-                builder.idMaker((Supplier) configuration.getProperty(key));
-            else
-                throw new IllegalArgumentException("The following " + ElementIdStrategy.class.getSimpleName() + " configuration is unknown: " + key + ":" + configuration.getProperty(key));
-        });
+        if (configuration.containsKey(ID_MAKER))
+            builder.idMaker((Supplier) configuration.getProperty(ID_MAKER));
+        if (configuration.containsKey(ID_PROPERTY_KEY))
+            builder.idPropertyKey(configuration.getString(ID_PROPERTY_KEY));
         return builder.create();
     }
+
+    @Override
+    public Configuration getConfiguration() {
+        final Map<String, Object> map = new HashMap<>();
+        map.put(STRATEGY, ElementIdStrategy.class.getCanonicalName());
+        map.put(ID_PROPERTY_KEY, this.idPropertyKey);
+        map.put(ID_MAKER, this.idMaker);
+        return new MapConfiguration(map);
+    }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/894ff3dc/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/HaltedTraverserStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/HaltedTraverserStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/HaltedTraverserStrategy.java
index ee1f017..3f02c40 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/HaltedTraverserStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/HaltedTraverserStrategy.java
@@ -20,6 +20,7 @@
 package org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration;
 
 import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.MapConfiguration;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
@@ -27,6 +28,9 @@ import org.apache.tinkerpop.gremlin.process.traversal.strategy.AbstractTraversal
 import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedFactory;
 import org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceFactory;
 
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  * @author Marko A. Rodriguez (http://markorodriguez.com)
  */
@@ -69,6 +73,14 @@ public final class HaltedTraverserStrategy extends AbstractTraversalStrategy<Tra
         }
     }
 
+    @Override
+    public Configuration getConfiguration() {
+        final Map<String, Object> map = new HashMap<>();
+        map.put(STRATEGY, HaltedTraverserStrategy.class.getCanonicalName());
+        map.put(HALTED_TRAVERSER_FACTORY, this.haltedTraverserFactory.getCanonicalName());
+        return new MapConfiguration(map);
+    }
+
     ////////////
 
     public static HaltedTraverserStrategy detached() {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/894ff3dc/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategy.java
index 2ee4bf3..438d8b2 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategy.java
@@ -19,6 +19,7 @@
 package org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration;
 
 import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.MapConfiguration;
 import org.apache.tinkerpop.gremlin.process.traversal.P;
 import org.apache.tinkerpop.gremlin.process.traversal.Parameterizing;
 import org.apache.tinkerpop.gremlin.process.traversal.Step;
@@ -55,6 +56,7 @@ import org.apache.tinkerpop.gremlin.structure.util.ElementHelper;
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -324,6 +326,20 @@ public final class PartitionStrategy extends AbstractTraversalStrategy<Traversal
         }
     }
 
+    @Override
+    public Configuration getConfiguration() {
+        final Map<String, Object> map = new HashMap<>();
+        map.put(STRATEGY, PartitionStrategy.class.getCanonicalName());
+        map.put(INCLUDE_META_PROPERTIES, this.includeMetaProperties);
+        if (null != this.writePartition)
+            map.put(WRITE_PARTITION, this.writePartition);
+        if (null != this.readPartitions)
+            map.put(READ_PARTITIONS, this.readPartitions);
+        if (null != this.partitionKey)
+            map.put(PARTITION_KEY, this.partitionKey);
+        return new MapConfiguration(map);
+    }
+
     public static final String INCLUDE_META_PROPERTIES = "includeMetaProperties";
     public static final String WRITE_PARTITION = "writePartition";
     public static final String PARTITION_KEY = "partitionKey";
@@ -338,7 +354,7 @@ public final class PartitionStrategy extends AbstractTraversalStrategy<Traversal
         if (configuration.containsKey(PARTITION_KEY))
             builder.partitionKey(configuration.getString(PARTITION_KEY));
         if (configuration.containsKey(READ_PARTITIONS))
-            builder.readPartitions((List) configuration.getList(READ_PARTITIONS));
+            builder.readPartitions(new ArrayList((Collection)configuration.getProperty(READ_PARTITIONS)));
         return builder.create();
     }
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/894ff3dc/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategy.java
index d7269aa..e612bee 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategy.java
@@ -19,6 +19,7 @@
 package org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration;
 
 import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.MapConfiguration;
 import org.apache.tinkerpop.gremlin.process.traversal.Step;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
@@ -54,9 +55,10 @@ import org.apache.tinkerpop.gremlin.structure.VertexProperty;
 
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
-import java.util.UUID;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
@@ -78,15 +80,15 @@ public final class SubgraphStrategy extends AbstractTraversalStrategy<TraversalS
 
     private static final Set<Class<? extends DecorationStrategy>> POSTS = Collections.singleton(ConnectiveStrategy.class);
 
-    private final String MARKER = Graph.Hidden.hide(UUID.randomUUID().toString());
+    private final String MARKER = Graph.Hidden.hide("gremlin.subgraphStrategy");
 
     private SubgraphStrategy(final Traversal<Vertex, ?> vertexCriterion, final Traversal<Edge, ?> edgeCriterion, final Traversal<VertexProperty, ?> vertexPropertyCriterion) {
 
-        this.vertexCriterion = null == vertexCriterion ? null : vertexCriterion.asAdmin();
+        this.vertexCriterion = null == vertexCriterion ? null : vertexCriterion.asAdmin().clone();
 
         // if there is no vertex predicate there is no need to test either side of the edge
         if (null == this.vertexCriterion) {
-            this.edgeCriterion = null == edgeCriterion ? null : edgeCriterion.asAdmin();
+            this.edgeCriterion = null == edgeCriterion ? null : edgeCriterion.asAdmin().clone();
         } else {
             final Traversal.Admin<Edge, ?> vertexPredicate;
             vertexPredicate = __.<Edge>and(
@@ -97,10 +99,10 @@ public final class SubgraphStrategy extends AbstractTraversalStrategy<TraversalS
             // edge predicate provided by the user.
             this.edgeCriterion = null == edgeCriterion ?
                     vertexPredicate :
-                    edgeCriterion.asAdmin().addStep(new TraversalFilterStep<>(edgeCriterion.asAdmin(), vertexPredicate));
+                    edgeCriterion.asAdmin().clone().addStep(new TraversalFilterStep<>(edgeCriterion.asAdmin(), vertexPredicate));
         }
 
-        this.vertexPropertyCriterion = null == vertexPropertyCriterion ? null : vertexPropertyCriterion.asAdmin();
+        this.vertexPropertyCriterion = null == vertexPropertyCriterion ? null : vertexPropertyCriterion.asAdmin().clone();
 
         if (null != this.vertexCriterion)
             this.addLabelMarker(this.vertexCriterion);
@@ -275,6 +277,19 @@ public final class SubgraphStrategy extends AbstractTraversalStrategy<TraversalS
     }
 
     @Override
+    public Configuration getConfiguration() {
+        final Map<String, Object> map = new HashMap<>();
+        map.put(STRATEGY, SubgraphStrategy.class.getCanonicalName());
+        if (null != this.vertexCriterion)
+            map.put(VERTICES, this.vertexCriterion);
+        if (null != this.edgeCriterion)
+            map.put(EDGES, this.edgeCriterion);
+        if (null != this.vertexPropertyCriterion)
+            map.put(VERTEX_PROPERTIES, this.vertexPropertyCriterion);
+        return new MapConfiguration(map);
+    }
+
+    @Override
     public Set<Class<? extends DecorationStrategy>> applyPost() {
         return POSTS;
     }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/894ff3dc/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/finalization/MatchAlgorithmStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/finalization/MatchAlgorithmStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/finalization/MatchAlgorithmStrategy.java
index be31575..7b78295 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/finalization/MatchAlgorithmStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/finalization/MatchAlgorithmStrategy.java
@@ -18,6 +18,8 @@
  */
 package org.apache.tinkerpop.gremlin.process.traversal.strategy.finalization;
 
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.MapConfiguration;
 import org.apache.tinkerpop.gremlin.process.traversal.Step;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
@@ -25,11 +27,15 @@ import org.apache.tinkerpop.gremlin.process.traversal.step.map.MatchStep;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.AbstractTraversalStrategy;
 import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
 
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  * @author Marko A. Rodriguez (http://markorodriguez.com)
  */
 public final class MatchAlgorithmStrategy extends AbstractTraversalStrategy<TraversalStrategy.FinalizationStrategy> implements TraversalStrategy.FinalizationStrategy {
 
+    private static final String MATCH_ALGORITHM = "matchAlgorithm";
     private final Class<? extends MatchStep.MatchAlgorithm> matchAlgorithmClass;
 
     private MatchAlgorithmStrategy(final Class<? extends MatchStep.MatchAlgorithm> matchAlgorithmClass) {
@@ -45,6 +51,24 @@ public final class MatchAlgorithmStrategy extends AbstractTraversalStrategy<Trav
         }
     }
 
+    public static MatchAlgorithmStrategy create(final Configuration configuration) {
+        try {
+            return new MatchAlgorithmStrategy((Class) Class.forName(configuration.getString(MATCH_ALGORITHM)));
+        } catch (final ClassNotFoundException e) {
+            throw new IllegalArgumentException(e.getMessage(), e);
+        }
+    }
+
+    @Override
+    public Configuration getConfiguration() {
+        final Map<String, Object> map = new HashMap<>();
+        map.put(STRATEGY, MatchAlgorithmStrategy.class.getCanonicalName());
+        map.put(MATCH_ALGORITHM, null != this.matchAlgorithmClass.getDeclaringClass() ?
+                this.matchAlgorithmClass.getCanonicalName().replace("." + this.matchAlgorithmClass.getSimpleName(), "$" + this.matchAlgorithmClass.getSimpleName()) :
+                this.matchAlgorithmClass.getCanonicalName());
+        return new MapConfiguration(map);
+    }
+
     public static Builder build() {
         return new Builder();
     }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/894ff3dc/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/StandardVerificationStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/StandardVerificationStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/StandardVerificationStrategy.java
index 9f7f516..f72de50 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/StandardVerificationStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/StandardVerificationStrategy.java
@@ -53,7 +53,7 @@ public final class StandardVerificationStrategy extends AbstractTraversalStrateg
         }
 
         for (final Step<?, ?> step : traversal.getSteps()) {
-            for (String label : new ArrayList<>(step.getLabels())) {
+            for (String label : step.getLabels()) {
                 if (Graph.Hidden.isHidden(label))
                     step.removeLabel(label);
             }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/894ff3dc/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/JavaTranslatorTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/JavaTranslatorTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/JavaTranslatorTest.java
new file mode 100644
index 0000000..ac8a645
--- /dev/null
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/JavaTranslatorTest.java
@@ -0,0 +1,68 @@
+/*
+ *  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.jsr223;
+
+import org.apache.tinkerpop.gremlin.process.traversal.Bindings;
+import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
+import org.apache.tinkerpop.gremlin.process.traversal.step.filter.TraversalFilterStep;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SubgraphStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;
+import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph;
+import org.junit.Test;
+
+import java.util.HashMap;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public class JavaTranslatorTest {
+
+    @Test
+    public void shouldTranslateNestedBindings() {
+        final Bindings b = new Bindings();
+        final GraphTraversalSource g = EmptyGraph.instance().traversal().withBindings(b);
+
+        final Bytecode bytecode = g.withStrategies(new HashMap<String, Object>() {{
+            put(SubgraphStrategy.STRATEGY, SubgraphStrategy.class.getCanonicalName());
+            put(SubgraphStrategy.VERTICES, b.of("a", __.has("name", "marko")));
+        }}).V().out(b.of("b", "created")).asAdmin().getBytecode();
+
+        Traversal.Admin<?, ?> traversal = JavaTranslator.of(EmptyGraph.instance().traversal()).translate(bytecode);
+        assertFalse(traversal.isLocked());
+        assertEquals(2, traversal.getSteps().size());
+        // assertEquals(traversal.getBytecode(),bytecode); TODO: bindings are removed -- should translated bytecode be the same bytecode?!
+        traversal.applyStrategies();
+        assertEquals(5, TraversalHelper.getStepsOfAssignableClassRecursively(TraversalFilterStep.class, traversal).size());
+
+        // JavaTranslator should not mutate original bytecode
+        assertTrue(bytecode.getBindings().containsKey("a"));
+        assertTrue(bytecode.getBindings().containsKey("b"));
+        assertEquals(2, bytecode.getBindings().size());
+        assertEquals(__.has("name", "marko").asAdmin().getBytecode(), bytecode.getBindings().get("a"));
+        assertEquals("created", bytecode.getBindings().get("b"));
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/894ff3dc/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/BytecodeTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/BytecodeTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/BytecodeTest.java
index 0b9c65a..6093dae 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/BytecodeTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/BytecodeTest.java
@@ -19,15 +19,24 @@
 
 package org.apache.tinkerpop.gremlin.process.traversal;
 
+import org.apache.commons.configuration.ConfigurationConverter;
+import org.apache.tinkerpop.gremlin.process.computer.Computer;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SubgraphStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy;
 import org.apache.tinkerpop.gremlin.structure.Column;
 import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph;
 import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
 import org.junit.Test;
 
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertTrue;
 
 /**
  * @author Marko A. Rodriguez (http://markorodriguez.com)
@@ -92,6 +101,39 @@ public class BytecodeTest {
 
         assertEquals(1, bytecode1.getBindings().size());
         assertEquals("created", bytecode1.getBindings().get("a"));
+    }
+
+    @Test
+    public void shouldSupportNestedBindings() {
+        final Bindings b = new Bindings();
+        final GraphTraversalSource g = EmptyGraph.instance().traversal().withBindings(b);
 
+        final Bytecode bytecode = g.withStrategies(new HashMap<String, Object>() {{
+            put(SubgraphStrategy.STRATEGY, SubgraphStrategy.class.getCanonicalName());
+            put(SubgraphStrategy.VERTICES, b.of("a", __.has("name", "marko")));
+        }}).V().out(b.of("b", "created")).asAdmin().getBytecode();
+
+        assertTrue(bytecode.getBindings().containsKey("a"));
+        assertTrue(bytecode.getBindings().containsKey("b"));
+        assertEquals(2, bytecode.getBindings().size());
+        assertEquals(__.has("name", "marko").asAdmin().getBytecode(), bytecode.getBindings().get("a"));
+        assertEquals("created", bytecode.getBindings().get("b"));
+    }
+
+    @Test
+    public void shouldConvertStrategies() {
+        final GraphTraversalSource g = EmptyGraph.instance().traversal();
+        Bytecode bytecode = g.withStrategies(ReadOnlyStrategy.instance()).getBytecode();
+        assertEquals(Collections.singletonMap(ReadOnlyStrategy.STRATEGY, ReadOnlyStrategy.class.getCanonicalName()), bytecode.getSourceInstructions().iterator().next().getArguments()[0]);
+        bytecode = g.withStrategies(SubgraphStrategy.build().edges(__.hasLabel("knows")).create()).getBytecode();
+        assertEquals(SubgraphStrategy.build().edges(__.hasLabel("knows")).create().getEdgeCriterion().asAdmin().getBytecode(),
+                ((Map) bytecode.getSourceInstructions().iterator().next().getArguments()[0]).get(SubgraphStrategy.EDGES));
+    }
+
+    @Test
+    public void shouldConvertComputer() {
+        final GraphTraversalSource g = EmptyGraph.instance().traversal();
+        Bytecode bytecode = g.withComputer(Computer.compute().workers(10)).getBytecode();
+        assertEquals(ConfigurationConverter.getMap(Computer.compute().workers(10).getConf()), bytecode.getSourceInstructions().iterator().next().getArguments()[0]);
     }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/894ff3dc/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSourceTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSourceTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSourceTest.java
index 6efa4b5..457747d 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSourceTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSourceTest.java
@@ -59,7 +59,7 @@ public class GraphTraversalSourceTest {
     }
 
     @Test
-    public void shouldSupportStringBasedStrategies() throws Exception {
+    public void shouldSupportMapBasedStrategies() throws Exception {
         GraphTraversalSource g = EmptyGraph.instance().traversal();
         assertFalse(g.getStrategies().getStrategy(SubgraphStrategy.class).isPresent());
         g = g.withStrategies(new HashMap<String, Object>() {{

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/894ff3dc/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
index 59a07b3..154c4a1 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
@@ -24,8 +24,8 @@ import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
 import org.apache.tinkerpop.gremlin.process.traversal.P;
 import org.apache.tinkerpop.gremlin.process.traversal.SackFunctions;
 import org.apache.tinkerpop.gremlin.process.traversal.Translator;
-import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
+import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.util.ConnectiveP;
 import org.apache.tinkerpop.gremlin.process.traversal.util.OrP;
 import org.apache.tinkerpop.gremlin.structure.Element;
@@ -34,8 +34,10 @@ import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
 import org.apache.tinkerpop.gremlin.util.function.Lambda;
 
 import java.util.ArrayList;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 /**
  * @author Marko A. Rodriguez (http://markorodriguez.com)
@@ -82,7 +84,9 @@ public final class GroovyTranslator implements Translator.ScriptTranslator {
         final StringBuilder traversalScript = new StringBuilder(start);
         for (final Bytecode.Instruction instruction : bytecode.getInstructions()) {
             final String methodName = instruction.getOperator();
-            if (IS_TESTING && methodName.equals(TraversalSource.Symbols.withStrategies))
+            if (IS_TESTING &&
+                    instruction.getOperator().equals(TraversalSource.Symbols.withStrategies) &&
+                    ((Map) instruction.getArguments()[0]).get(TraversalStrategy.STRATEGY).toString().contains("TranslationStrategy"))
                 continue;
             if (0 == instruction.getArguments().length)
                 traversalScript.append(".").append(methodName).append("()");
@@ -103,7 +107,13 @@ public final class GroovyTranslator implements Translator.ScriptTranslator {
             return ((Bytecode.Binding) object).variable();
         else if (object instanceof String)
             return ((String) object).contains("\"") ? "\"\"\"" + object + "\"\"\"" : "\"" + object + "\"";
-        else if (object instanceof List) {
+        else if (object instanceof Set) {
+            final Set<String> set = new HashSet<>(((Set) object).size());
+            for (final Object item : (Set) object) {
+                set.add(convertToString(item));
+            }
+            return set.toString() + " as Set";
+        } else if (object instanceof List) {
             final List<String> list = new ArrayList<>(((List) object).size());
             for (final Object item : (List) object) {
                 list.add(convertToString(item));
@@ -139,15 +149,11 @@ public final class GroovyTranslator implements Translator.ScriptTranslator {
             return ((Enum) object).getDeclaringClass().getSimpleName() + "." + object.toString();
         else if (object instanceof Element)
             return convertToString(((Element) object).id()); // hack
-        else if (object instanceof Computer)
-            return "";
         else if (object instanceof Lambda) {
             final String lambdaString = ((Lambda) object).getLambdaScript().trim();
             return lambdaString.startsWith("{") ? lambdaString : "{" + lambdaString + "}";
         } else if (object instanceof Bytecode)
             return this.internalTranslate("__", (Bytecode) object);
-        else if (object instanceof Traversal)
-            return this.internalTranslate("__", ((Traversal) object).asAdmin().getBytecode());
         else
             return null == object ? "null" : object.toString();
     }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/894ff3dc/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/TraversalSourceGenerator.groovy
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/TraversalSourceGenerator.groovy b/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/TraversalSourceGenerator.groovy
index e12c2cd..fe62685 100644
--- a/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/TraversalSourceGenerator.groovy
+++ b/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/TraversalSourceGenerator.groovy
@@ -254,9 +254,24 @@ class Bytecode(object):
         if isinstance(arg, Traversal):
             self.bindings.update(arg.bytecode.bindings)
             return arg.bytecode
+        elif isinstance(arg, dict):
+            newDict = {}
+            for key in arg:
+                newDict[self.__convertArgument(key)] = self.__convertArgument(arg[key])
+            return newDict
+        elif isinstance(arg, list):
+            newList = []
+            for item in arg:
+                newList.append(self.__convertArgument(item))
+            return newList
+        elif isinstance(arg, set):
+            newSet = set()
+            for item in arg:
+                newSet.add(self.__convertArgument(item))
+            return newSet
         elif isinstance(arg, tuple) and 2 == len(arg) and isinstance(arg[0], str):
             self.bindings[arg[0]] = arg[1]
-            return Binding(arg[0],arg[1])
+            return Binding(arg[0],self.__convertArgument(arg[1]))
         else:
             return arg
     def __repr__(self):

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/894ff3dc/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonTranslator.java
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonTranslator.java b/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonTranslator.java
index 65042ab..4bfdc45 100644
--- a/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonTranslator.java
+++ b/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonTranslator.java
@@ -19,7 +19,6 @@
 
 package org.apache.tinkerpop.gremlin.python.jsr223;
 
-import org.apache.tinkerpop.gremlin.process.computer.Computer;
 import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
 import org.apache.tinkerpop.gremlin.process.traversal.Operator;
 import org.apache.tinkerpop.gremlin.process.traversal.P;
@@ -27,6 +26,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.SackFunctions;
 import org.apache.tinkerpop.gremlin.process.traversal.Translator;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
+import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
 import org.apache.tinkerpop.gremlin.process.traversal.util.ConnectiveP;
 import org.apache.tinkerpop.gremlin.process.traversal.util.OrP;
@@ -42,6 +42,7 @@ import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashSet;
+import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -103,7 +104,9 @@ public class PythonTranslator implements Translator.ScriptTranslator {
         for (final Bytecode.Instruction instruction : bytecode.getInstructions()) {
             final String methodName = instruction.getOperator();
             final Object[] arguments = instruction.getArguments();
-            if (IS_TESTING && methodName.equals(TraversalSource.Symbols.withStrategies) && !(instruction.getArguments()[0] instanceof Map))
+            if (IS_TESTING &&
+                    instruction.getOperator().equals(TraversalSource.Symbols.withStrategies) &&
+                    ((Map) instruction.getArguments()[0]).get(TraversalStrategy.STRATEGY).toString().contains("TranslationStrategy"))
                 continue;
             else if (0 == arguments.length)
                 traversalScript.append(".").append(SymbolHelper.toPython(methodName)).append("()");
@@ -135,7 +138,13 @@ public class PythonTranslator implements Translator.ScriptTranslator {
             return ((Bytecode.Binding) object).variable();
         else if (object instanceof String)
             return ((String) object).contains("\"") ? "\"\"\"" + object + "\"\"\"" : "\"" + object + "\"";
-        else if (object instanceof List) {
+        else if (object instanceof Set) {
+            final Set<String> set = new LinkedHashSet<>(((Set) object).size());
+            for (final Object item : (Set) object) {
+                set.add(convertToString(item));
+            }
+            return "set(" + set.toString() + ")";
+        } else if (object instanceof List) {
             final List<String> list = new ArrayList<>(((List) object).size());
             for (final Object item : (List) object) {
                 list.add(convertToString(item));
@@ -168,10 +177,6 @@ public class PythonTranslator implements Translator.ScriptTranslator {
             return convertToString(((Element) object).id()); // hack
         else if (object instanceof Bytecode)
             return this.internalTranslate("__", (Bytecode) object);
-        else if (object instanceof Traversal)
-            return this.internalTranslate("__", ((Traversal.Admin) object).asAdmin().getBytecode());
-        else if (object instanceof Computer)
-            return "";
         else if (object instanceof Lambda)
             return convertLambdaToString((Lambda) object);
         else

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/894ff3dc/gremlin-python/src/main/jython/gremlin_python/process/traversal.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/gremlin_python/process/traversal.py b/gremlin-python/src/main/jython/gremlin_python/process/traversal.py
index 4c2f3b9..aa36869 100644
--- a/gremlin-python/src/main/jython/gremlin_python/process/traversal.py
+++ b/gremlin-python/src/main/jython/gremlin_python/process/traversal.py
@@ -313,9 +313,24 @@ class Bytecode(object):
         if isinstance(arg, Traversal):
             self.bindings.update(arg.bytecode.bindings)
             return arg.bytecode
+        elif isinstance(arg, dict):
+            newDict = {}
+            for key in arg:
+                newDict[self.__convertArgument(key)] = self.__convertArgument(arg[key])
+            return newDict
+        elif isinstance(arg, list):
+            newList = []
+            for item in arg:
+                newList.append(self.__convertArgument(item))
+            return newList
+        elif isinstance(arg, set):
+            newSet = set()
+            for item in arg:
+                newSet.add(self.__convertArgument(item))
+            return newSet
         elif isinstance(arg, tuple) and 2 == len(arg) and isinstance(arg[0], str):
             self.bindings[arg[0]] = arg[1]
-            return Binding(arg[0],arg[1])
+            return Binding(arg[0],self.__convertArgument(arg[1]))
         else:
             return arg
     def __repr__(self):

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/894ff3dc/gremlin-python/src/main/jython/gremlin_python/structure/io/graphson.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/gremlin_python/structure/io/graphson.py b/gremlin-python/src/main/jython/gremlin_python/structure/io/graphson.py
index a032032..7899925 100644
--- a/gremlin-python/src/main/jython/gremlin_python/structure/io/graphson.py
+++ b/gremlin-python/src/main/jython/gremlin_python/structure/io/graphson.py
@@ -47,7 +47,7 @@ class GraphSONWriter(object):
             if isinstance(object, key):
                 return serializers[key]._dictify(object)
         # list and map are treated as normal json objects (could be isolated serializers)
-        if isinstance(object, list):
+        if isinstance(object, list) or isinstance(object, set):
             newList = []
             for item in object:
                 newList.append(GraphSONWriter._dictify(item))
@@ -181,7 +181,8 @@ class NumberSerializer(GraphSONSerializer):
     def _dictify(self, number):
         if isinstance(number, bool):  # python thinks that 0/1 integers are booleans
             return number
-        elif isinstance(number, long) or (abs(number) > 2147483647): # in python all numbers are int unless specified otherwise
+        elif isinstance(number, long) or (
+                    abs(number) > 2147483647):  # in python all numbers are int unless specified otherwise
             return _SymbolHelper.objectify("Int64", number)
         elif isinstance(number, int):
             return _SymbolHelper.objectify("Int32", number)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/894ff3dc/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/groovy/jsr223/TinkerGraphGroovyTranslatorProvider.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/groovy/jsr223/TinkerGraphGroovyTranslatorProvider.java b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/groovy/jsr223/TinkerGraphGroovyTranslatorProvider.java
index 7591bf0..c086c3a 100644
--- a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/groovy/jsr223/TinkerGraphGroovyTranslatorProvider.java
+++ b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/groovy/jsr223/TinkerGraphGroovyTranslatorProvider.java
@@ -27,6 +27,8 @@ import org.apache.tinkerpop.gremlin.process.traversal.TraversalInterruptionTest;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.ProgramTest;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.ElementIdStrategyProcessTest;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.EventStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.EventStrategyProcessTest;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.TranslationStrategy;
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.tinkergraph.TinkerGraphProvider;
@@ -52,6 +54,7 @@ public class TinkerGraphGroovyTranslatorProvider extends TinkerGraphProvider {
             ProgramTest.Traversals.class.getCanonicalName(),
             TraversalInterruptionTest.class.getCanonicalName(),
             TraversalInterruptionComputerTest.class.getCanonicalName(),
+            EventStrategyProcessTest.class.getCanonicalName(),
             ElementIdStrategyProcessTest.class.getCanonicalName()));
 
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/894ff3dc/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/jsr223/TinkerGraphJavaTranslatorProvider.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/jsr223/TinkerGraphJavaTranslatorProvider.java b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/jsr223/TinkerGraphJavaTranslatorProvider.java
index 1e6645b..f40a8c7 100644
--- a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/jsr223/TinkerGraphJavaTranslatorProvider.java
+++ b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/jsr223/TinkerGraphJavaTranslatorProvider.java
@@ -27,6 +27,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSo
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.ProgramTest;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.ElementIdStrategyProcessTest;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.EventStrategyProcessTest;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.TranslationStrategy;
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.tinkergraph.TinkerGraphProvider;
@@ -48,6 +49,8 @@ public class TinkerGraphJavaTranslatorProvider extends TinkerGraphProvider {
             TraversalInterruptionComputerTest.class.getCanonicalName(),
             "shouldNeverPropagateANoBulkTraverser",
             "shouldNeverPropagateANullValuedTraverser",
+            ElementIdStrategyProcessTest.class.getCanonicalName(),
+            EventStrategyProcessTest.class.getCanonicalName(),
             ProgramTest.Traversals.class.getCanonicalName()));
 
 


[24/36] tinkerpop git commit: added close method to DriverRemoteTraversalSideEffects, implement AutoCloseable on TraversalSideEffects, add test for close method

Posted by da...@apache.org.
added close method to DriverRemoteTraversalSideEffects, implement AutoCloseable on TraversalSideEffects, add test for close method


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

Branch: refs/heads/TINKERPOP-1458
Commit: d4823e3ac1373b66a06dd8eddd9d95c793a948b2
Parents: 65cc37b
Author: davebshow <da...@gmail.com>
Authored: Thu Sep 29 11:55:09 2016 -0400
Committer: davebshow <da...@gmail.com>
Committed: Fri Oct 7 11:05:00 2016 -0400

----------------------------------------------------------------------
 .../process/traversal/TraversalSideEffects.java |  9 ++++-
 .../DriverRemoteTraversalSideEffects.java       | 21 +++++++++--
 .../server/GremlinServerIntegrateTest.java      | 38 +++++++++++++-------
 3 files changed, 51 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d4823e3a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalSideEffects.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalSideEffects.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalSideEffects.java
index 95b9fb1..ae6ef54 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalSideEffects.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalSideEffects.java
@@ -32,7 +32,7 @@ import java.util.function.UnaryOperator;
  *
  * @author Marko A. Rodriguez (http://markorodriguez.com)
  */
-public interface TraversalSideEffects extends Cloneable, Serializable {
+public interface TraversalSideEffects extends Cloneable, Serializable, AutoCloseable {
 
     /**
      * Return true if the key is a registered side-effect.
@@ -83,6 +83,13 @@ public interface TraversalSideEffects extends Cloneable, Serializable {
     public Set<String> keys();
 
     /**
+     * Invalidate the side effect cache for traversal.
+     */
+    public default void close() throws Exception {
+        // do nothing
+    }
+
+    /**
      * Determines if there are any side-effects to be retrieved.
      */
     public default boolean isEmpty() {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d4823e3a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/remote/DriverRemoteTraversalSideEffects.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/remote/DriverRemoteTraversalSideEffects.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/remote/DriverRemoteTraversalSideEffects.java
index 85d7abc..c565dfa 100644
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/remote/DriverRemoteTraversalSideEffects.java
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/remote/DriverRemoteTraversalSideEffects.java
@@ -45,6 +45,8 @@ public class DriverRemoteTraversalSideEffects extends AbstractRemoteTraversalSid
 
     private final Map<String, Object> sideEffects = new HashMap<>();
 
+    private boolean closed = false;
+
     public DriverRemoteTraversalSideEffects(final Client client, final UUID serverSideEffect, final Host host) {
         this.client = client;
         this.serverSideEffect = serverSideEffect;
@@ -99,10 +101,23 @@ public class DriverRemoteTraversalSideEffects extends AbstractRemoteTraversalSid
         return keys;
     }
 
+
     @Override
     public void close() throws Exception {
-        // todo: need to add a call to "close" the side effects on the server - probably should ensure request only sends once
-
-        // leave the client open as it is owned by the DriverRemoteConnection not the traversal or side-effects
+        if (!closed) {
+            final RequestMessage msg = RequestMessage.build(Tokens.OPS_CLOSE)
+                    .addArg(Tokens.ARGS_SIDE_EFFECT, serverSideEffect)
+                    .addArg(Tokens.ARGS_HOST, host)
+                    .processor("traversal").create();
+            try {
+                client.submitAsync(msg).get();
+                sideEffects.clear();
+                keys = null;
+                closed = true;
+            } catch (Exception ex) {
+                final Throwable root = ExceptionUtils.getRootCause(ex);
+                throw new RuntimeException("Error on closing side effects", root);
+            }
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d4823e3a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
index 5a36acf..7d6c0c9 100644
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
@@ -49,6 +49,7 @@ import org.apache.tinkerpop.gremlin.groovy.jsr223.customizer.InterpreterModeCust
 import org.apache.tinkerpop.gremlin.groovy.jsr223.customizer.SimpleSandboxExtension;
 import org.apache.tinkerpop.gremlin.groovy.jsr223.customizer.TimedInterruptCustomizerProvider;
 import org.apache.tinkerpop.gremlin.process.remote.RemoteGraph;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.T;
@@ -64,11 +65,7 @@ import org.junit.Before;
 import org.junit.Test;
 
 import java.nio.channels.ClosedChannelException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
@@ -102,6 +99,14 @@ public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegration
 
     private Log4jRecordingAppender recordingAppender = null;
 
+    private final Supplier<Graph> graphGetter = () -> server.getServerGremlinExecutor().getGraphManager().getGraphs().get("graph");
+    private final Configuration conf = new BaseConfiguration() {{
+        setProperty(Graph.GRAPH, RemoteGraph.class.getName());
+        setProperty(GREMLIN_REMOTE_CONNECTION_CLASS, DriverRemoteConnection.class.getName());
+        setProperty(DriverRemoteConnection.GREMLIN_REMOTE_DRIVER_SOURCENAME, "g");
+        setProperty("hidden.for.testing.only", graphGetter);
+    }};
+
     @Before
     public void setupForEachTest() {
         recordingAppender = new Log4jRecordingAppender();
@@ -814,18 +819,25 @@ public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegration
 
     @Test
     public void shouldSupportLambdasUsingWithRemote() throws Exception {
-        final Supplier<Graph> graphGetter = () -> server.getServerGremlinExecutor().getGraphManager().getGraphs().get("graph");
-        final Configuration conf = new BaseConfiguration() {{
-            setProperty(Graph.GRAPH, RemoteGraph.class.getName());
-            setProperty(GREMLIN_REMOTE_CONNECTION_CLASS, DriverRemoteConnection.class.getName());
-            setProperty(DriverRemoteConnection.GREMLIN_REMOTE_DRIVER_SOURCENAME, "g");
-            setProperty("hidden.for.testing.only", graphGetter);
-        }};
-
         final Graph graph = EmptyGraph.instance();
         final GraphTraversalSource g = graph.traversal().withRemote(conf);
         g.addV("person").property("age", 20).iterate();
         g.addV("person").property("age", 10).iterate();
         assertEquals(50L, g.V().hasLabel("person").map(Lambda.function("it.get().value('age') + 10")).sum().next());
     }
+
+    @Test
+    public void shouldCloseSideEffects() throws Exception {
+        final Graph graph = EmptyGraph.instance();
+        final GraphTraversalSource g = graph.traversal().withRemote(conf);
+        g.addV("person").property("age", 20).iterate();
+        g.addV("person").property("age", 10).iterate();
+        final GraphTraversal traversal = g.V().aggregate("a");
+        traversal.iterate();
+        final Set sideEffects = traversal.asAdmin().getSideEffects().keys();
+        assertTrue(sideEffects.contains("a"));
+        traversal.asAdmin().getSideEffects().close();
+        final Set emptySideEffects = traversal.asAdmin().getSideEffects().keys();
+        assertTrue(emptySideEffects.isEmpty());
+    }
 }


[15/36] tinkerpop git commit: Added a final declaration on a variable. CTR

Posted by da...@apache.org.
Added a final declaration on a variable. CTR


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

Branch: refs/heads/TINKERPOP-1458
Commit: c1206f04db0cbcfe489de5ac08303995f8ab2a01
Parents: 8e4f3e0
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Oct 6 14:02:34 2016 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Oct 6 14:04:49 2016 -0400

----------------------------------------------------------------------
 .../gremlin/structure/io/graphson/GraphSONSerializerProvider.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c1206f04/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONSerializerProvider.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONSerializerProvider.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONSerializerProvider.java
index 60c3200..458a2d9 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONSerializerProvider.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONSerializerProvider.java
@@ -35,7 +35,7 @@ final class GraphSONSerializerProvider extends DefaultSerializerProvider {
     private static final long serialVersionUID = 1L;
     private final JsonSerializer<Object> unknownTypeSerializer;
 
-    public GraphSONSerializerProvider(GraphSONVersion version) {
+    public GraphSONSerializerProvider(final GraphSONVersion version) {
         super();
         if (version == GraphSONVersion.V1_0) {
             setDefaultKeySerializer(new GraphSONSerializersV1d0.GraphSONKeySerializer());


[04/36] tinkerpop git commit: Removed `popd` from the end of `gremlin.sh`.

Posted by da...@apache.org.
Removed `popd` from the end of `gremlin.sh`.


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

Branch: refs/heads/TINKERPOP-1458
Commit: d1f4c5760df870b93d5939ceff26ba14b6fbc525
Parents: bac5b0d
Author: Daniel Kuppitz <da...@hotmail.com>
Authored: Thu Sep 29 19:09:03 2016 +0200
Committer: Daniel Kuppitz <da...@hotmail.com>
Committed: Thu Sep 29 19:09:03 2016 +0200

----------------------------------------------------------------------
 gremlin-console/src/main/bin/gremlin.sh | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d1f4c576/gremlin-console/src/main/bin/gremlin.sh
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/bin/gremlin.sh b/gremlin-console/src/main/bin/gremlin.sh
index e47d94e..bb154aa 100755
--- a/gremlin-console/src/main/bin/gremlin.sh
+++ b/gremlin-console/src/main/bin/gremlin.sh
@@ -32,10 +32,8 @@ while [ -h "${SCRIPT_NAME}" ]; do
   cd ${DIR}
 done
 
-WORKING_DIR="$( cd -P "${DIR}/.." && pwd )"
-SYSTEM_EXT_DIR="${WORKING_DIR}/ext"
-
-pushd ${WORKING_DIR} > /dev/null
+cd ..
+SYSTEM_EXT_DIR="`pwd`/ext"
 
 JAVA_OPTIONS=${JAVA_OPTIONS:-}
 
@@ -115,5 +113,3 @@ fi
 
 # Start the JVM, execute the application, and return its exit code
 exec $JAVA $JAVA_OPTIONS $MAIN_CLASS "$@"
-
-popd > /dev/null


[27/36] tinkerpop git commit: got rid of wildcard set by intellij

Posted by da...@apache.org.
got rid of wildcard set by intellij


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

Branch: refs/heads/TINKERPOP-1458
Commit: c9190328ea934042cc58bafc93110c515d4c4f83
Parents: d4823e3
Author: davebshow <da...@gmail.com>
Authored: Thu Sep 29 12:04:03 2016 -0400
Committer: davebshow <da...@gmail.com>
Committed: Fri Oct 7 11:05:00 2016 -0400

----------------------------------------------------------------------
 .../tinkerpop/gremlin/server/GremlinServerIntegrateTest.java   | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c9190328/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
index 7d6c0c9..a1d019b 100644
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
@@ -65,7 +65,11 @@ import org.junit.Before;
 import org.junit.Test;
 
 import java.nio.channels.ClosedChannelException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;