You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by ok...@apache.org on 2015/05/09 22:41:53 UTC
[7/7] incubator-tinkerpop git commit: GroovyComputerTestHelper is now
general to gremlin-core/process/util. Renamed to TraversalScriptHelper and it
will determine from the Source and Script whether its a STANDARD or COMPUTER
traversal. Neat. Moved Script
GroovyComputerTestHelper is now general to gremlin-core/process/util. Renamed to TraversalScriptHelper and it will determine from the Source and Script whether its a STANDARD or COMPUTER traversal. Neat. Moved ScriptEngineLambda to gremlin-core/function.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/97e46779
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/97e46779
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/97e46779
Branch: refs/heads/master
Commit: 97e46779a45d019ce450725c5a787af78a69cf06
Parents: abd23f4
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Sat May 9 14:41:32 2015 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Sat May 9 14:41:32 2015 -0600
----------------------------------------------------------------------
.../peerpressure/PeerPressureVertexProgram.java | 4 +-
.../ranking/pagerank/PageRankVertexProgram.java | 4 +-
.../traversal/TraversalObjectFunction.java | 47 --------
.../traversal/TraversalScriptFunction.java | 69 ------------
.../traversal/TraversalVertexProgram.java | 3 +-
.../computer/util/ScriptEngineLambda.java | 111 -------------------
.../process/traversal/step/util/BulkSet.java | 2 +-
.../traversal/util/TraversalObjectFunction.java | 47 ++++++++
.../traversal/util/TraversalScriptFunction.java | 69 ++++++++++++
.../traversal/util/TraversalScriptHelper.java | 59 ++++++++++
.../util/function/ScriptEngineLambda.java | 111 +++++++++++++++++++
.../process/computer/GroovyTestHelper.groovy | 53 ---------
.../step/branch/GroovyBranchTest.groovy | 6 +-
.../step/branch/GroovyChooseTest.groovy | 4 +-
.../step/branch/GroovyLocalTest.groovy | 22 ++--
.../step/branch/GroovyRepeatTest.groovy | 20 ++--
.../step/branch/GroovyUnionTest.groovy | 16 ++-
.../traversal/step/filter/GroovyAndTest.groovy | 6 +-
.../traversal/step/filter/GroovyCoinTest.groovy | 6 +-
.../step/filter/GroovyCyclicPathTest.groovy | 6 +-
.../step/filter/GroovyDedupTest.groovy | 10 +-
.../traversal/step/filter/GroovyDropTest.groovy | 8 +-
.../step/filter/GroovyExceptTest.groovy | 18 +--
.../step/filter/GroovyFilterTest.groovy | 22 ++--
.../step/filter/GroovyHasNotTest.groovy | 8 +-
.../traversal/step/filter/GroovyHasTest.groovy | 36 +++---
.../traversal/step/filter/GroovyIsTest.groovy | 12 +-
.../traversal/step/filter/GroovyOrTest.groovy | 6 +-
.../step/filter/GroovyRangeTest.groovy | 16 +--
.../step/filter/GroovyRetainTest.groovy | 8 +-
.../step/filter/GroovySampleTest.groovy | 21 +---
.../step/filter/GroovySimplePathTest.groovy | 6 +-
.../step/filter/GroovyWhereTest.groovy | 14 +--
.../traversal/step/map/GroovyAddEdgeTest.groovy | 8 +-
.../step/map/GroovyAddVertexTest.groovy | 6 +-
.../step/map/GroovyCoalesceTest.groovy | 12 +-
.../traversal/step/map/GroovyCountTest.groovy | 16 +--
.../traversal/step/map/GroovyFoldTest.groovy | 8 +-
.../traversal/step/map/GroovyMapTest.groovy | 12 +-
.../traversal/step/map/GroovyMaxTest.groovy | 9 +-
.../traversal/step/map/GroovyMeanTest.groovy | 6 +-
.../traversal/step/map/GroovyMinTest.groovy | 8 +-
.../traversal/step/map/GroovyOrderTest.groovy | 20 ++--
.../traversal/step/map/GroovyPathTest.groovy | 12 +-
.../step/map/GroovyPropertiesTest.groovy | 8 +-
.../traversal/step/map/GroovySelectTest.groovy | 50 ++++-----
.../traversal/step/map/GroovySumTest.groovy | 6 +-
.../traversal/step/map/GroovyUnfoldTest.groovy | 6 +-
.../step/map/GroovyValueMapTest.groovy | 8 +-
.../traversal/step/map/GroovyVertexTest.groovy | 54 ++++-----
.../step/sideEffect/GroovyAggregateTest.groovy | 8 +-
.../step/sideEffect/GroovyGroupCountTest.groovy | 18 +--
.../step/sideEffect/GroovyGroupTest.groovy | 14 +--
.../step/sideEffect/GroovyProfileTest.groovy | 8 +-
.../step/sideEffect/GroovySackTest.groovy | 8 +-
.../sideEffect/GroovySideEffectCapTest.groovy | 11 +-
.../step/sideEffect/GroovySideEffectTest.groovy | 8 +-
.../step/sideEffect/GroovyStoreTest.groovy | 10 +-
.../step/sideEffect/GroovySubgraphTest.groovy | 6 +-
.../step/sideEffect/GroovyTreeTest.groovy | 14 +--
.../computer/util/ScriptEngineLambdaTest.java | 1 +
61 files changed, 597 insertions(+), 608 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/97e46779/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/clustering/peerpressure/PeerPressureVertexProgram.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/clustering/peerpressure/PeerPressureVertexProgram.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/clustering/peerpressure/PeerPressureVertexProgram.java
index 907179a..7e697a2 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/clustering/peerpressure/PeerPressureVertexProgram.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/clustering/peerpressure/PeerPressureVertexProgram.java
@@ -23,8 +23,8 @@ import org.apache.tinkerpop.gremlin.process.computer.GraphComputer;
import org.apache.tinkerpop.gremlin.process.computer.Memory;
import org.apache.tinkerpop.gremlin.process.computer.MessageScope;
import org.apache.tinkerpop.gremlin.process.computer.Messenger;
-import org.apache.tinkerpop.gremlin.process.computer.traversal.TraversalObjectFunction;
-import org.apache.tinkerpop.gremlin.process.computer.traversal.TraversalScriptFunction;
+import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalObjectFunction;
+import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalScriptFunction;
import org.apache.tinkerpop.gremlin.process.computer.util.AbstractVertexProgramBuilder;
import org.apache.tinkerpop.gremlin.process.computer.util.ConfigurationTraversal;
import org.apache.tinkerpop.gremlin.process.computer.util.StaticVertexProgram;
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/97e46779/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/ranking/pagerank/PageRankVertexProgram.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/ranking/pagerank/PageRankVertexProgram.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/ranking/pagerank/PageRankVertexProgram.java
index bc07e99..b91efa4 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/ranking/pagerank/PageRankVertexProgram.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/ranking/pagerank/PageRankVertexProgram.java
@@ -24,8 +24,8 @@ import org.apache.tinkerpop.gremlin.process.computer.Memory;
import org.apache.tinkerpop.gremlin.process.computer.MessageCombiner;
import org.apache.tinkerpop.gremlin.process.computer.MessageScope;
import org.apache.tinkerpop.gremlin.process.computer.Messenger;
-import org.apache.tinkerpop.gremlin.process.computer.traversal.TraversalObjectFunction;
-import org.apache.tinkerpop.gremlin.process.computer.traversal.TraversalScriptFunction;
+import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalObjectFunction;
+import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalScriptFunction;
import org.apache.tinkerpop.gremlin.process.computer.util.AbstractVertexProgramBuilder;
import org.apache.tinkerpop.gremlin.process.computer.util.ConfigurationTraversal;
import org.apache.tinkerpop.gremlin.process.computer.util.StaticVertexProgram;
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/97e46779/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalObjectFunction.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalObjectFunction.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalObjectFunction.java
deleted file mode 100644
index 662d8fa..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalObjectFunction.java
+++ /dev/null
@@ -1,47 +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.computer.traversal;
-
-import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
-import org.apache.tinkerpop.gremlin.structure.Graph;
-
-import java.io.Serializable;
-import java.util.function.Function;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public final class TraversalObjectFunction<S, E> implements Function<Graph, Traversal.Admin<S, E>>, Serializable {
-
- private final Traversal.Admin<S, E> traversal;
-
- public TraversalObjectFunction(final Traversal.Admin<S, E> traversal) {
- this.traversal = traversal;
- }
-
- @Override
- public Traversal.Admin<S, E> apply(final Graph graph) {
- final Traversal.Admin<S, E> clone = this.traversal.clone();
- if (!clone.isLocked()) {
- clone.setGraph(graph);
- clone.applyStrategies();
- }
- return clone;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/97e46779/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalScriptFunction.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalScriptFunction.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalScriptFunction.java
deleted file mode 100644
index abce73a..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalScriptFunction.java
+++ /dev/null
@@ -1,69 +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.computer.traversal;
-
-import org.apache.tinkerpop.gremlin.process.computer.util.ScriptEngineCache;
-import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
-import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
-import org.apache.tinkerpop.gremlin.structure.Graph;
-
-import javax.script.Bindings;
-import javax.script.ScriptEngine;
-import javax.script.ScriptException;
-import java.io.Serializable;
-import java.util.function.Function;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public final class TraversalScriptFunction<S, E> implements Function<Graph, Traversal.Admin<S, E>>, Serializable {
-
- private final TraversalSource.Builder traversalContextBuilder;
- private final String scriptEngineName;
- private final String traversalScript;
- private final Object[] bindings;
-
- public TraversalScriptFunction(final TraversalSource.Builder traversalContextBuilder, final String scriptEngineName, final String traversalScript, final Object... bindings) {
- this.traversalContextBuilder = traversalContextBuilder;
- this.scriptEngineName = scriptEngineName;
- this.traversalScript = traversalScript;
- this.bindings = bindings;
- }
-
- public Traversal.Admin<S, E> apply(final Graph graph) {
- try {
- final ScriptEngine engine = ScriptEngineCache.get(this.scriptEngineName);
- final Bindings engineBindings = engine.createBindings();
- engineBindings.put("g", this.traversalContextBuilder.create(graph));
- if (this.bindings.length % 2 != 0)
- throw new IllegalArgumentException("The provided key/value bindings array length must be a multiple of two");
- for (int i = 0; i < this.bindings.length; i = i + 2) {
- engineBindings.put((String) this.bindings[i], this.bindings[i + 1]);
- }
- final Traversal.Admin<S, E> traversal = (Traversal.Admin<S, E>) engine.eval(this.traversalScript, engineBindings);
- if (!traversal.isLocked()) {
- traversal.setGraph(graph);
- traversal.applyStrategies();
- }
- return traversal;
- } catch (final ScriptException e) {
- throw new IllegalStateException(e.getMessage(), e);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/97e46779/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalVertexProgram.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalVertexProgram.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalVertexProgram.java
index 5e74393..e7dff8e 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalVertexProgram.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalVertexProgram.java
@@ -43,6 +43,8 @@ import org.apache.tinkerpop.gremlin.process.traversal.step.util.ReducingBarrierS
import org.apache.tinkerpop.gremlin.process.traversal.traverser.util.TraverserSet;
import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;
import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalMatrix;
+import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalObjectFunction;
+import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalScriptFunction;
import org.apache.tinkerpop.gremlin.structure.Direction;
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.apache.tinkerpop.gremlin.structure.Element;
@@ -59,7 +61,6 @@ import java.util.Iterator;
import java.util.Optional;
import java.util.Set;
import java.util.function.Function;
-import java.util.function.Supplier;
/**
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/97e46779/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/ScriptEngineLambda.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/ScriptEngineLambda.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/ScriptEngineLambda.java
deleted file mode 100644
index a3f70dc..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/ScriptEngineLambda.java
+++ /dev/null
@@ -1,111 +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.computer.util;
-
-import org.apache.tinkerpop.gremlin.util.function.TriConsumer;
-
-import javax.script.Bindings;
-import javax.script.ScriptEngine;
-import javax.script.ScriptException;
-import javax.script.SimpleBindings;
-import java.util.function.BiConsumer;
-import java.util.function.Consumer;
-import java.util.function.Function;
-import java.util.function.Predicate;
-import java.util.function.Supplier;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public class ScriptEngineLambda implements Function, Supplier, Consumer, Predicate, BiConsumer, TriConsumer {
-
- private static final String A = "a";
- private static final String B = "b";
- private static final String C = "c";
-
- protected final ScriptEngine engine;
- protected final String script;
-
- public ScriptEngineLambda(final String engineName, final String script) {
- this.engine = ScriptEngineCache.get(engineName);
- this.script = script;
- }
-
- public Object apply(final Object a) {
- try {
- final Bindings bindings = new SimpleBindings();
- bindings.put(A, a);
- return this.engine.eval(this.script, bindings);
- } catch (final ScriptException e) {
- throw new IllegalArgumentException(e.getMessage());
- }
- }
-
- public Object get() {
- try {
- return this.engine.eval(this.script);
- } catch (final ScriptException e) {
- throw new IllegalArgumentException(e.getMessage());
- }
- }
-
- public void accept(final Object a) {
- try {
- final Bindings bindings = new SimpleBindings();
- bindings.put(A, a);
- this.engine.eval(this.script, bindings);
- } catch (final ScriptException e) {
- throw new IllegalArgumentException(e.getMessage());
- }
- }
-
- public void accept(final Object a, final Object b) {
- try {
- final Bindings bindings = new SimpleBindings();
- bindings.put(A, a);
- bindings.put(B, b);
- this.engine.eval(this.script, bindings);
- } catch (final ScriptException e) {
- throw new IllegalArgumentException(e.getMessage());
- }
- }
-
- public void accept(final Object a, final Object b, final Object c) {
- try {
- final Bindings bindings = new SimpleBindings();
- bindings.put(A, a);
- bindings.put(B, b);
- bindings.put(C, c);
- this.engine.eval(this.script, bindings);
- } catch (final ScriptException e) {
- throw new IllegalArgumentException(e.getMessage());
- }
- }
-
- public boolean test(final Object a) {
- try {
- final Bindings bindings = new SimpleBindings();
- bindings.put(A, a);
- return (boolean) this.engine.eval(this.script, bindings);
- } catch (final ScriptException e) {
- throw new IllegalArgumentException(e.getMessage());
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/97e46779/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/BulkSet.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/BulkSet.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/BulkSet.java
index a90b009..ce29b5a 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/BulkSet.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/BulkSet.java
@@ -38,7 +38,7 @@ import java.util.stream.Collectors;
*
* @author Marko A. Rodriguez (http://markorodriguez.com)
*/
-public class BulkSet<S> extends AbstractSet<S> implements Set<S>, Serializable {
+public final class BulkSet<S> extends AbstractSet<S> implements Set<S>, Serializable {
private final Map<S, Long> map = new LinkedHashMap<>();
@Override
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/97e46779/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalObjectFunction.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalObjectFunction.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalObjectFunction.java
new file mode 100644
index 0000000..729dfdb
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalObjectFunction.java
@@ -0,0 +1,47 @@
+/*
+ * 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.util;
+
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+
+import java.io.Serializable;
+import java.util.function.Function;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public final class TraversalObjectFunction<S, E> implements Function<Graph, Traversal.Admin<S, E>>, Serializable {
+
+ private final Traversal.Admin<S, E> traversal;
+
+ public TraversalObjectFunction(final Traversal.Admin<S, E> traversal) {
+ this.traversal = traversal;
+ }
+
+ @Override
+ public Traversal.Admin<S, E> apply(final Graph graph) {
+ final Traversal.Admin<S, E> clone = this.traversal.clone();
+ if (!clone.isLocked()) {
+ clone.setGraph(graph);
+ clone.applyStrategies();
+ }
+ return clone;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/97e46779/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalScriptFunction.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalScriptFunction.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalScriptFunction.java
new file mode 100644
index 0000000..73337ef
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalScriptFunction.java
@@ -0,0 +1,69 @@
+/*
+ * 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.util;
+
+import org.apache.tinkerpop.gremlin.process.computer.util.ScriptEngineCache;
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+
+import javax.script.Bindings;
+import javax.script.ScriptEngine;
+import javax.script.ScriptException;
+import java.io.Serializable;
+import java.util.function.Function;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public final class TraversalScriptFunction<S, E> implements Function<Graph, Traversal.Admin<S, E>>, Serializable {
+
+ private final TraversalSource.Builder traversalContextBuilder;
+ private final String scriptEngineName;
+ private final String traversalScript;
+ private final Object[] bindings;
+
+ public TraversalScriptFunction(final TraversalSource.Builder traversalContextBuilder, final String scriptEngineName, final String traversalScript, final Object... bindings) {
+ this.traversalContextBuilder = traversalContextBuilder;
+ this.scriptEngineName = scriptEngineName;
+ this.traversalScript = traversalScript;
+ this.bindings = bindings;
+ }
+
+ public Traversal.Admin<S, E> apply(final Graph graph) {
+ try {
+ final ScriptEngine engine = ScriptEngineCache.get(this.scriptEngineName);
+ final Bindings engineBindings = engine.createBindings();
+ engineBindings.put("g", this.traversalContextBuilder.create(graph));
+ if (this.bindings.length % 2 != 0)
+ throw new IllegalArgumentException("The provided key/value bindings array length must be a multiple of two");
+ for (int i = 0; i < this.bindings.length; i = i + 2) {
+ engineBindings.put((String) this.bindings[i], this.bindings[i + 1]);
+ }
+ final Traversal.Admin<S, E> traversal = (Traversal.Admin<S, E>) engine.eval(this.traversalScript, engineBindings);
+ if (!traversal.isLocked()) {
+ traversal.setGraph(graph);
+ traversal.applyStrategies();
+ }
+ return traversal;
+ } catch (final ScriptException e) {
+ throw new IllegalStateException(e.getMessage(), e);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/97e46779/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalScriptHelper.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalScriptHelper.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalScriptHelper.java
new file mode 100644
index 0000000..235392e
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalScriptHelper.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.process.traversal.util;
+
+import org.apache.tinkerpop.gremlin.process.computer.ComputerResult;
+import org.apache.tinkerpop.gremlin.process.computer.traversal.TraversalVertexProgram;
+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.GraphTraversalSource;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public final class TraversalScriptHelper {
+
+ private TraversalScriptHelper() {
+ }
+
+ public static <S, E> Traversal.Admin<S, E> compute(
+ final Graph graph,
+ final TraversalSource.Builder builder,
+ final String scriptEngineName,
+ final String traversalScript,
+ final Object... bindings) {
+
+ try {
+ if (builder.create(graph).getGraphComputer().isPresent()) {
+ final TraversalVertexProgram program = TraversalVertexProgram.build().traversal(builder, scriptEngineName, traversalScript, bindings).create(graph);
+ final ComputerResult result = builder.create(graph).getGraphComputer().get().program(program).submit().get();
+ return program.computerResultTraversal(result);
+ } else {
+ return new TraversalScriptFunction<S, E>(builder, scriptEngineName, traversalScript, bindings).apply(graph);
+ }
+ } catch (final Exception e) {
+ throw new IllegalArgumentException(e.getMessage());
+ }
+ }
+
+ public static <S, E> Traversal.Admin<S, E> compute(final String script, final GraphTraversalSource g, final Object... bindings) {
+ return TraversalScriptHelper.compute(g.getGraph().get(), g.asBuilder(), "gremlin-groovy", script, bindings);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/97e46779/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/function/ScriptEngineLambda.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/function/ScriptEngineLambda.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/function/ScriptEngineLambda.java
new file mode 100644
index 0000000..cafba62
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/function/ScriptEngineLambda.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.util.function;
+
+import org.apache.tinkerpop.gremlin.process.computer.util.ScriptEngineCache;
+
+import javax.script.Bindings;
+import javax.script.ScriptEngine;
+import javax.script.ScriptException;
+import javax.script.SimpleBindings;
+import java.util.function.BiConsumer;
+import java.util.function.Consumer;
+import java.util.function.Function;
+import java.util.function.Predicate;
+import java.util.function.Supplier;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public final class ScriptEngineLambda implements Function, Supplier, Consumer, Predicate, BiConsumer, TriConsumer {
+
+ private static final String A = "a";
+ private static final String B = "b";
+ private static final String C = "c";
+
+ protected final ScriptEngine engine;
+ protected final String script;
+
+ public ScriptEngineLambda(final String engineName, final String script) {
+ this.engine = ScriptEngineCache.get(engineName);
+ this.script = script;
+ }
+
+ public Object apply(final Object a) {
+ try {
+ final Bindings bindings = new SimpleBindings();
+ bindings.put(A, a);
+ return this.engine.eval(this.script, bindings);
+ } catch (final ScriptException e) {
+ throw new IllegalArgumentException(e.getMessage());
+ }
+ }
+
+ public Object get() {
+ try {
+ return this.engine.eval(this.script);
+ } catch (final ScriptException e) {
+ throw new IllegalArgumentException(e.getMessage());
+ }
+ }
+
+ public void accept(final Object a) {
+ try {
+ final Bindings bindings = new SimpleBindings();
+ bindings.put(A, a);
+ this.engine.eval(this.script, bindings);
+ } catch (final ScriptException e) {
+ throw new IllegalArgumentException(e.getMessage());
+ }
+ }
+
+ public void accept(final Object a, final Object b) {
+ try {
+ final Bindings bindings = new SimpleBindings();
+ bindings.put(A, a);
+ bindings.put(B, b);
+ this.engine.eval(this.script, bindings);
+ } catch (final ScriptException e) {
+ throw new IllegalArgumentException(e.getMessage());
+ }
+ }
+
+ public void accept(final Object a, final Object b, final Object c) {
+ try {
+ final Bindings bindings = new SimpleBindings();
+ bindings.put(A, a);
+ bindings.put(B, b);
+ bindings.put(C, c);
+ this.engine.eval(this.script, bindings);
+ } catch (final ScriptException e) {
+ throw new IllegalArgumentException(e.getMessage());
+ }
+ }
+
+ public boolean test(final Object a) {
+ try {
+ final Bindings bindings = new SimpleBindings();
+ bindings.put(A, a);
+ return (boolean) this.engine.eval(this.script, bindings);
+ } catch (final ScriptException e) {
+ throw new IllegalArgumentException(e.getMessage());
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/97e46779/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/computer/GroovyTestHelper.groovy
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/computer/GroovyTestHelper.groovy b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/computer/GroovyTestHelper.groovy
deleted file mode 100644
index d648720..0000000
--- a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/computer/GroovyTestHelper.groovy
+++ /dev/null
@@ -1,53 +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.computer
-
-import org.apache.tinkerpop.gremlin.process.computer.traversal.TraversalScriptFunction
-import org.apache.tinkerpop.gremlin.process.computer.traversal.TraversalVertexProgram
-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.GraphTraversalSource
-import org.apache.tinkerpop.gremlin.structure.Graph
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public class GroovyTestHelper {
-
- public static final Traversal.Admin<?, ?> compute(
- final Graph graph,
- final TraversalSource.Builder builder,
- final String scriptEngineName,
- final String traversalScript,
- final Object... bindings) {
-
- if (builder.create(graph).getGraphComputer().isPresent()) {
- final TraversalVertexProgram program = TraversalVertexProgram.build().traversal(builder, scriptEngineName, traversalScript, bindings).create(graph);
- final ComputerResult result = builder.create(graph).getGraphComputer().get().program(program).submit().get();
- return program.computerResultTraversal(result);
- } else {
- return new TraversalScriptFunction<>(builder, scriptEngineName, traversalScript, bindings).apply(graph);
- }
- }
-
- public static final <S, E> Traversal.Admin<S, E> compute(
- final String script, final GraphTraversalSource g, final Object... bindings) {
- return GroovyTestHelper.compute(g.getGraph().get(), g.asBuilder(), "gremlin-groovy", script, bindings);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/97e46779/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/branch/GroovyBranchTest.groovy
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/branch/GroovyBranchTest.groovy b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/branch/GroovyBranchTest.groovy
index 8e0c6eb..e31418d 100644
--- a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/branch/GroovyBranchTest.groovy
+++ b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/branch/GroovyBranchTest.groovy
@@ -18,7 +18,7 @@
*/
package org.apache.tinkerpop.gremlin.process.traversal.step.branch
-import org.apache.tinkerpop.gremlin.process.computer.GroovyTestHelper
+import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalScriptHelper
import org.apache.tinkerpop.gremlin.process.traversal.Traversal
import org.apache.tinkerpop.gremlin.structure.Vertex
@@ -31,12 +31,12 @@ public abstract class GroovyBranchTest {
@Override
public Traversal<Vertex, Object> get_g_V_branchXlabel_eq_person__a_bX_optionXa__ageX_optionXb__langX_optionXb__nameX() {
- GroovyTestHelper.compute("g.V.branch(__.label.is('person').count).option(1L, __.age).option(0L, __.lang).option(0L,__.name)", g);
+ TraversalScriptHelper.compute("g.V.branch(__.label.is('person').count).option(1L, __.age).option(0L, __.lang).option(0L,__.name)", g);
}
@Override
public Traversal<Vertex, Object> get_g_V_branchXlabelX_optionXperson__ageX_optionXsoftware__langX_optionXsoftware__nameX() {
- GroovyTestHelper.compute("""
+ TraversalScriptHelper.compute("""
g.V.branch(__.label)
.option('person', __.age)
.option('software', __.lang)
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/97e46779/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/branch/GroovyChooseTest.groovy
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/branch/GroovyChooseTest.groovy b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/branch/GroovyChooseTest.groovy
index f0c66b9..6fea6b0 100644
--- a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/branch/GroovyChooseTest.groovy
+++ b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/branch/GroovyChooseTest.groovy
@@ -18,7 +18,7 @@
*/
package org.apache.tinkerpop.gremlin.process.traversal.step.branch
-import org.apache.tinkerpop.gremlin.process.computer.GroovyTestHelper
+import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalScriptHelper
import org.apache.tinkerpop.gremlin.process.traversal.Traversal
import org.apache.tinkerpop.gremlin.structure.Vertex
@@ -31,7 +31,7 @@ public abstract class GroovyChooseTest {
public static class Traversals extends ChooseTest {
@Override
public Traversal<Vertex, Object> get_g_V_chooseXout_countX_optionX2L__nameX_optionX3L__valueMapX() {
- GroovyTestHelper.compute("g.V.choose(__.out.count).option(2L, __.values('name')).option(3L, __.valueMap())", g);
+ TraversalScriptHelper.compute("g.V.choose(__.out.count).option(2L, __.values('name')).option(3L, __.valueMap())", g);
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/97e46779/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/branch/GroovyLocalTest.groovy
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/branch/GroovyLocalTest.groovy b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/branch/GroovyLocalTest.groovy
index fcf7a8c..7ed2673 100644
--- a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/branch/GroovyLocalTest.groovy
+++ b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/branch/GroovyLocalTest.groovy
@@ -18,7 +18,7 @@
*/
package org.apache.tinkerpop.gremlin.process.traversal.step.branch
-import org.apache.tinkerpop.gremlin.process.computer.GroovyTestHelper
+import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalScriptHelper
import org.apache.tinkerpop.gremlin.process.traversal.Traversal
import org.apache.tinkerpop.gremlin.structure.Edge
import org.apache.tinkerpop.gremlin.structure.Vertex
@@ -32,52 +32,52 @@ public abstract class GroovyLocalTest {
@Override
public Traversal<Vertex, String> get_g_V_localXpropertiesXlocationX_order_byXvalueX_limitX2XX_value() {
- GroovyTestHelper.compute("g.V.local(__.properties('location').order.by(T.value,Order.incr).limit(2)).value", g);
+ TraversalScriptHelper.compute("g.V.local(__.properties('location').order.by(T.value,Order.incr).limit(2)).value", g);
}
@Override
public Traversal<Vertex, Map<String, Object>> get_g_V_hasXlabel_personX_asXaX_localXoutXcreatedX_asXbXX_selectXa_bX_byXnameX_byXidX() {
- GroovyTestHelper.compute("g.V.has(T.label, 'person').as('a').local(__.out('created').as('b')).select('a', 'b').by('name').by(T.id)", g);
+ TraversalScriptHelper.compute("g.V.has(T.label, 'person').as('a').local(__.out('created').as('b')).select('a', 'b').by('name').by(T.id)", g);
}
@Override
public Traversal<Vertex, Long> get_g_V_localXoutE_countX() {
- GroovyTestHelper.compute("g.V.local(__.outE.count())", g);
+ TraversalScriptHelper.compute("g.V.local(__.outE.count())", g);
}
@Override
public Traversal<Vertex, String> get_g_VX1X_localXoutEXknowsX_limitX1XX_inV_name(final Object v1Id) {
- GroovyTestHelper.compute("g.V(v1Id).local(__.outE('knows').limit(1)).inV.name", g, "v1Id", v1Id);
+ TraversalScriptHelper.compute("g.V(v1Id).local(__.outE('knows').limit(1)).inV.name", g, "v1Id", v1Id);
}
@Override
public Traversal<Vertex, String> get_g_V_localXbothEXcreatedX_limitX1XX_otherV_name() {
- GroovyTestHelper.compute("g.V().local(__.bothE('created').limit(1)).otherV.name", g);
+ TraversalScriptHelper.compute("g.V().local(__.bothE('created').limit(1)).otherV.name", g);
}
@Override
public Traversal<Vertex, Edge> get_g_VX4X_localXbothEX1_createdX_limitX1XX(final Object v4Id) {
- GroovyTestHelper.compute("g.V(v4Id).local(__.bothE('created').limit(1))", g, "v4Id", v4Id);
+ TraversalScriptHelper.compute("g.V(v4Id).local(__.bothE('created').limit(1))", g, "v4Id", v4Id);
}
@Override
public Traversal<Vertex, Edge> get_g_VX4X_localXbothEXknows_createdX_limitX1XX(final Object v4Id) {
- GroovyTestHelper.compute("g.V(v4Id).local(__.bothE('knows', 'created').limit(1))", g, "v4Id", v4Id);
+ TraversalScriptHelper.compute("g.V(v4Id).local(__.bothE('knows', 'created').limit(1))", g, "v4Id", v4Id);
}
@Override
public Traversal<Vertex, String> get_g_VX4X_localXbothE_limitX1XX_otherV_name(final Object v4Id) {
- GroovyTestHelper.compute("g.V(v4Id).local(__.bothE.limit(1)).otherV.name", g, "v4Id", v4Id);
+ TraversalScriptHelper.compute("g.V(v4Id).local(__.bothE.limit(1)).otherV.name", g, "v4Id", v4Id);
}
@Override
public Traversal<Vertex, String> get_g_VX4X_localXbothE_limitX2XX_otherV_name(final Object v4Id) {
- GroovyTestHelper.compute("g.V(v4Id).local(__.bothE.limit(2)).otherV.name", g, "v4Id", v4Id);
+ TraversalScriptHelper.compute("g.V(v4Id).local(__.bothE.limit(2)).otherV.name", g, "v4Id", v4Id);
}
@Override
public Traversal<Vertex, String> get_g_V_localXinEXknowsX_limitX2XX_outV_name() {
- GroovyTestHelper.compute("g.V().local(__.inE('knows').limit(2).outV).name", g);
+ TraversalScriptHelper.compute("g.V().local(__.inE('knows').limit(2).outV).name", g);
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/97e46779/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/branch/GroovyRepeatTest.groovy
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/branch/GroovyRepeatTest.groovy b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/branch/GroovyRepeatTest.groovy
index c3c872e..024ed6c 100644
--- a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/branch/GroovyRepeatTest.groovy
+++ b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/branch/GroovyRepeatTest.groovy
@@ -18,7 +18,7 @@
*/
package org.apache.tinkerpop.gremlin.process.traversal.step.branch
-import org.apache.tinkerpop.gremlin.process.computer.GroovyTestHelper
+import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalScriptHelper
import org.apache.tinkerpop.gremlin.process.traversal.Path
import org.apache.tinkerpop.gremlin.process.traversal.Traversal
import org.apache.tinkerpop.gremlin.structure.Vertex
@@ -32,47 +32,47 @@ public abstract class GroovyRepeatTest {
@Override
public Traversal<Vertex, Path> get_g_V_repeatXoutX_timesX2X_emit_path() {
- GroovyTestHelper.compute("g.V.repeat(__.out).times(2).emit.path", g)
+ TraversalScriptHelper.compute("g.V.repeat(__.out).times(2).emit.path", g)
}
@Override
public Traversal<Vertex, String> get_g_V_repeatXoutX_timesX2X_repeatXinX_timesX2X_name() {
- GroovyTestHelper.compute("g.V.repeat(__.out).times(2).repeat(__.in).times(2).name", g)
+ TraversalScriptHelper.compute("g.V.repeat(__.out).times(2).repeat(__.in).times(2).name", g)
}
@Override
public Traversal<Vertex, Vertex> get_g_V_repeatXoutX_timesX2X() {
- GroovyTestHelper.compute("g.V.repeat(__.out).times(2)", g)
+ TraversalScriptHelper.compute("g.V.repeat(__.out).times(2)", g)
}
@Override
public Traversal<Vertex, Vertex> get_g_V_repeatXoutX_timesX2X_emit() {
- GroovyTestHelper.compute("g.V.repeat(__.out).times(2).emit", g)
+ TraversalScriptHelper.compute("g.V.repeat(__.out).times(2).emit", g)
}
@Override
public Traversal<Vertex, String> get_g_VX1X_timesX2X_repeatXoutX_name(Object v1Id) {
- GroovyTestHelper.compute("g.V(v1Id).times(2).repeat(__.out).name", g, "v1Id", v1Id)
+ TraversalScriptHelper.compute("g.V(v1Id).times(2).repeat(__.out).name", g, "v1Id", v1Id)
}
@Override
public Traversal<Vertex, Path> get_g_V_emit_repeatXoutX_timesX2X_path() {
- GroovyTestHelper.compute("g.V.emit.repeat(__.out).times(2).path", g)
+ TraversalScriptHelper.compute("g.V.emit.repeat(__.out).times(2).path", g)
}
@Override
public Traversal<Vertex, Path> get_g_V_emit_timesX2X_repeatXoutX_path() {
- GroovyTestHelper.compute("g.V.emit.times(2).repeat(__.out).path", g)
+ TraversalScriptHelper.compute("g.V.emit.times(2).repeat(__.out).path", g)
}
@Override
public Traversal<Vertex, String> get_g_V_emitXhasXlabel_personXX_repeatXoutX_name(final Object v1Id) {
- GroovyTestHelper.compute("g.V(v1Id).emit(has(T.label, 'person')).repeat(__.out).name", g, "v1Id", v1Id)
+ TraversalScriptHelper.compute("g.V(v1Id).emit(has(T.label, 'person')).repeat(__.out).name", g, "v1Id", v1Id)
}
@Override
public Traversal<Vertex, Map<String, Long>> get_g_V_repeatXgroupCountXmX_byXnameX_outX_timesX2X_capXmX() {
- GroovyTestHelper.compute("g.V.repeat(groupCount('m').by('name').out).times(2).cap('m')", g)
+ TraversalScriptHelper.compute("g.V.repeat(groupCount('m').by('name').out).times(2).cap('m')", g)
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/97e46779/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/branch/GroovyUnionTest.groovy
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/branch/GroovyUnionTest.groovy b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/branch/GroovyUnionTest.groovy
index c20daee..a31b437 100644
--- a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/branch/GroovyUnionTest.groovy
+++ b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/branch/GroovyUnionTest.groovy
@@ -18,10 +18,8 @@
*/
package org.apache.tinkerpop.gremlin.process.traversal.step.branch
-import org.apache.tinkerpop.gremlin.process.UseEngine
-import org.apache.tinkerpop.gremlin.process.computer.GroovyTestHelper
+import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalScriptHelper
import org.apache.tinkerpop.gremlin.process.traversal.Traversal
-import org.apache.tinkerpop.gremlin.process.traversal.TraversalEngine
import org.apache.tinkerpop.gremlin.structure.Vertex
/**
@@ -32,23 +30,23 @@ public abstract class GroovyUnionTest {
public static class Traversals extends UnionTest {
public Traversal<Vertex, String> get_g_V_unionXout__inX_name() {
- GroovyTestHelper.compute("g.V.union(__.out, __.in).name", g)
+ TraversalScriptHelper.compute("g.V.union(__.out, __.in).name", g)
}
public Traversal<Vertex, String> get_g_VX1X_unionXrepeatXoutX_timesX2X__outX_name(final Object v1Id) {
- GroovyTestHelper.compute("g.V(v1Id).union(repeat(__.out).times(2), __.out).name", g, "v1Id", v1Id)
+ TraversalScriptHelper.compute("g.V(v1Id).union(repeat(__.out).times(2), __.out).name", g, "v1Id", v1Id)
}
public Traversal<Vertex, String> get_g_V_chooseXlabel_is_person__unionX__out_lang__out_nameX__in_labelX() {
- GroovyTestHelper.compute("g.V.choose(__.label.is('person'), union(__.out.lang, __.out.name), __.in.label)", g)
+ TraversalScriptHelper.compute("g.V.choose(__.label.is('person'), union(__.out.lang, __.out.name), __.in.label)", g)
}
public Traversal<Vertex, Map<String, Long>> get_g_V_chooseXlabel_is_person__unionX__out_lang__out_nameX__in_labelX_groupCount() {
- GroovyTestHelper.compute("g.V.choose(__.label.is('person'), union(__.out.lang, __.out.name), __.in.label).groupCount", g)
+ TraversalScriptHelper.compute("g.V.choose(__.label.is('person'), union(__.out.lang, __.out.name), __.in.label).groupCount", g)
}
public Traversal<Vertex, Map<String, Long>> get_g_V_unionXrepeatXunionXoutXcreatedX__inXcreatedXX_timesX2X__repeatXunionXinXcreatedX__outXcreatedXX_timesX2XX_label_groupCount() {
- GroovyTestHelper.compute("""
+ TraversalScriptHelper.compute("""
g.V.union(
repeat(union(
out('created'),
@@ -62,7 +60,7 @@ public abstract class GroovyUnionTest {
@Override
public Traversal<Vertex, Number> get_g_VX1_2X_unionXoutE_count__inE_count__outE_weight_sumX(
final Object v1Id, final Object v2Id) {
- GroovyTestHelper.compute("g.V(v1Id, v2Id).union(outE().count, inE().count, outE().weight.sum)", g, "v1Id", v1Id, "v2Id", v2Id);
+ TraversalScriptHelper.compute("g.V(v1Id, v2Id).union(outE().count, inE().count, outE().weight.sum)", g, "v1Id", v1Id, "v2Id", v2Id);
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/97e46779/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyAndTest.groovy
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyAndTest.groovy b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyAndTest.groovy
index fdd8f90..abce9ab 100644
--- a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyAndTest.groovy
+++ b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyAndTest.groovy
@@ -18,7 +18,7 @@
*/
package org.apache.tinkerpop.gremlin.process.traversal.step.filter
-import org.apache.tinkerpop.gremlin.process.computer.GroovyTestHelper
+import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalScriptHelper
import org.apache.tinkerpop.gremlin.process.traversal.Traversal
import org.apache.tinkerpop.gremlin.structure.Vertex
@@ -31,12 +31,12 @@ public abstract class GroovyAndTest {
@Override
public Traversal<Vertex, String> get_g_V_andXhasXage_gt_27X__outE_count_gt_2X_name() {
- GroovyTestHelper.compute("g.V.and(has('age',gt(27)), outE().count.is(gte(2l))).name", g)
+ TraversalScriptHelper.compute("g.V.and(has('age',gt(27)), outE().count.is(gte(2l))).name", g)
}
@Override
public Traversal<Vertex, String> get_g_V_andXoutE__hasXlabel_personX_and_hasXage_gte_32XX_name() {
- GroovyTestHelper.compute("g.V.and(outE(), has(T.label, 'person') & has('age', gte(32))).name", g)
+ TraversalScriptHelper.compute("g.V.and(outE(), has(T.label, 'person') & has('age', gte(32))).name", g)
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/97e46779/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyCoinTest.groovy
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyCoinTest.groovy b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyCoinTest.groovy
index 8127595..a8207c4 100644
--- a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyCoinTest.groovy
+++ b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyCoinTest.groovy
@@ -18,7 +18,7 @@
*/
package org.apache.tinkerpop.gremlin.process.traversal.step.filter
-import org.apache.tinkerpop.gremlin.process.computer.GroovyTestHelper
+import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalScriptHelper
import org.apache.tinkerpop.gremlin.process.traversal.Traversal
import org.apache.tinkerpop.gremlin.structure.Vertex
@@ -30,12 +30,12 @@ public abstract class GroovyCoinTest {
public static class Traversals extends CoinTest {
@Override
public Traversal<Vertex, Vertex> get_g_V_coinX1X() {
- GroovyTestHelper.compute("g.V.coin(1.0f)", g);
+ TraversalScriptHelper.compute("g.V.coin(1.0f)", g);
}
@Override
public Traversal<Vertex, Vertex> get_g_V_coinX0X() {
- GroovyTestHelper.compute("g.V.coin(0.0f)", g);
+ TraversalScriptHelper.compute("g.V.coin(0.0f)", g);
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/97e46779/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyCyclicPathTest.groovy
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyCyclicPathTest.groovy b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyCyclicPathTest.groovy
index fceaec9..5359db4 100644
--- a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyCyclicPathTest.groovy
+++ b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyCyclicPathTest.groovy
@@ -18,7 +18,7 @@
*/
package org.apache.tinkerpop.gremlin.process.traversal.step.filter
-import org.apache.tinkerpop.gremlin.process.computer.GroovyTestHelper
+import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalScriptHelper
import org.apache.tinkerpop.gremlin.process.traversal.Path
import org.apache.tinkerpop.gremlin.process.traversal.Traversal
import org.apache.tinkerpop.gremlin.structure.Vertex
@@ -32,12 +32,12 @@ public abstract class GroovyCyclicPathTest {
@Override
Traversal<Vertex, Vertex> get_g_VX1X_outXcreatedX_inXcreatedX_cyclicPath(final Object v1Id) {
- GroovyTestHelper.compute("g.V(v1Id).out('created').in('created').cyclicPath", g, "v1Id", v1Id);
+ TraversalScriptHelper.compute("g.V(v1Id).out('created').in('created').cyclicPath", g, "v1Id", v1Id);
}
@Override
Traversal<Vertex, Path> get_g_VX1X_outXcreatedX_inXcreatedX_cyclicPath_path(final Object v1Id) {
- GroovyTestHelper.compute("g.V(v1Id).out('created').in('created').cyclicPath().path()", g, "v1Id", v1Id);
+ TraversalScriptHelper.compute("g.V(v1Id).out('created').in('created').cyclicPath().path()", g, "v1Id", v1Id);
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/97e46779/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyDedupTest.groovy
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyDedupTest.groovy b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyDedupTest.groovy
index 5e22987..f0ca09c 100644
--- a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyDedupTest.groovy
+++ b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyDedupTest.groovy
@@ -18,7 +18,7 @@
*/
package org.apache.tinkerpop.gremlin.process.traversal.step.filter
-import org.apache.tinkerpop.gremlin.process.computer.GroovyTestHelper
+import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalScriptHelper
import org.apache.tinkerpop.gremlin.process.traversal.Traversal
import org.apache.tinkerpop.gremlin.structure.Vertex
@@ -49,23 +49,23 @@ public abstract class GroovyDedupTest {
@Override
public Traversal<Vertex, String> get_g_V_both_dedup_name() {
- GroovyTestHelper.compute("g.V.both.dedup.name", g);
+ TraversalScriptHelper.compute("g.V.both.dedup.name", g);
}
@Override
public Traversal<Vertex, Map<String, Set<Double>>> get_g_V_group_byXlabelX_byXbothE_valuesXweightX_foldX_byXdedupXlocalXX() {
- GroovyTestHelper.compute("g.V().group().by(T.label).by(bothE().values('weight').fold()).by(dedup(Scope.local))", g);
+ TraversalScriptHelper.compute("g.V().group().by(T.label).by(bothE().values('weight').fold()).by(dedup(Scope.local))", g);
}
@Override
public Traversal<Vertex, String> get_g_V_both_hasXlabel_softwareX_dedup_byXlangX_name() {
- GroovyTestHelper.compute("g.V.both.has(T.label, 'software').dedup.by('lang').name", g);
+ TraversalScriptHelper.compute("g.V.both.has(T.label, 'software').dedup.by('lang').name", g);
}
@Override
public Traversal<Vertex, String> get_g_V_both_name_orderXa_bX_dedup() {
- return GroovyTestHelper.compute("g.V().both().properties('name').order.by { a, b -> a.value() <=> b.value() }.dedup.value", g);
+ return TraversalScriptHelper.compute("g.V().both().properties('name').order.by { a, b -> a.value() <=> b.value() }.dedup.value", g);
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/97e46779/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyDropTest.groovy
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyDropTest.groovy b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyDropTest.groovy
index 1f5a8d7..1ff4a95 100644
--- a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyDropTest.groovy
+++ b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyDropTest.groovy
@@ -19,7 +19,7 @@
package org.apache.tinkerpop.gremlin.process.traversal.step.filter
-import org.apache.tinkerpop.gremlin.process.computer.GroovyTestHelper
+import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalScriptHelper
import org.apache.tinkerpop.gremlin.process.traversal.Traversal
import org.apache.tinkerpop.gremlin.structure.Edge
import org.apache.tinkerpop.gremlin.structure.Vertex
@@ -34,17 +34,17 @@ public abstract class GroovyDropTest {
@Override
public Traversal<Vertex, Vertex> get_g_V_drop() {
- GroovyTestHelper.compute("g.V.drop", g)
+ TraversalScriptHelper.compute("g.V.drop", g)
}
@Override
public Traversal<Vertex, Edge> get_g_V_outE_drop() {
- GroovyTestHelper.compute("g.V.outE.drop", g)
+ TraversalScriptHelper.compute("g.V.outE.drop", g)
}
@Override
public Traversal<Vertex, VertexProperty> get_g_V_properties_drop() {
- GroovyTestHelper.compute("g.V.properties().drop", g)
+ TraversalScriptHelper.compute("g.V.properties().drop", g)
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/97e46779/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyExceptTest.groovy
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyExceptTest.groovy b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyExceptTest.groovy
index 0b03f2d..96b68b9 100644
--- a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyExceptTest.groovy
+++ b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyExceptTest.groovy
@@ -18,7 +18,7 @@
*/
package org.apache.tinkerpop.gremlin.process.traversal.step.filter
-import org.apache.tinkerpop.gremlin.process.computer.GroovyTestHelper
+import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalScriptHelper
import org.apache.tinkerpop.gremlin.process.traversal.Path
import org.apache.tinkerpop.gremlin.process.traversal.Traversal
import org.apache.tinkerpop.gremlin.structure.Vertex
@@ -33,44 +33,44 @@ public abstract class GroovyExceptTest {
@Override
public Traversal<Vertex, Vertex> get_g_VX1X_out_exceptXg_v2X(final Object v1Id, final Object v2Id) {
- GroovyTestHelper.compute("g.V(v1Id).out.except(g.V(v2Id).next())", g, "v1Id", v1Id, "v2Id", v2Id);
+ TraversalScriptHelper.compute("g.V(v1Id).out.except(g.V(v2Id).next())", g, "v1Id", v1Id, "v2Id", v2Id);
}
@Override
public Traversal<Vertex, Vertex> get_g_VX1X_out_aggregateXxX_out_exceptXxX(final Object v1Id) {
- GroovyTestHelper.compute("g.V(v1Id).out.aggregate('x').out.except('x')", g, "v1Id", v1Id);
+ TraversalScriptHelper.compute("g.V(v1Id).out.aggregate('x').out.except('x')", g, "v1Id", v1Id);
}
@Override
public Traversal<Vertex, String> get_g_VX1X_outXcreatedX_inXcreatedX_exceptXg_v1X_name(final Object v1Id) {
- GroovyTestHelper.compute("g.V(v1Id).out('created').in('created').except(g.V(v1Id).next()).values('name')", g, "v1Id", v1Id);
+ TraversalScriptHelper.compute("g.V(v1Id).out('created').in('created').except(g.V(v1Id).next()).values('name')", g, "v1Id", v1Id);
}
@Override
public Traversal<Vertex, Vertex> get_g_V_exceptXg_V_toListX() {
- GroovyTestHelper.compute("g.V.out.except(g.V.toList())", g);
+ TraversalScriptHelper.compute("g.V.out.except(g.V.toList())", g);
}
@Override
public Traversal<Vertex, Vertex> get_g_V_exceptXX() {
- GroovyTestHelper.compute("g.V.out.except([])", g);
+ TraversalScriptHelper.compute("g.V.out.except([])", g);
}
@Override
public Traversal<Vertex, Path> get_g_VX1X_repeatXbothEXcreatedX_exceptXeX_aggregateXeX_otherVX_emit_path(
final Object v1Id) {
- GroovyTestHelper.compute("g.V(v1Id).repeat(__.bothE('created').except('e').aggregate('e').otherV).emit.path", g, "v1Id", v1Id);
+ TraversalScriptHelper.compute("g.V(v1Id).repeat(__.bothE('created').except('e').aggregate('e').otherV).emit.path", g, "v1Id", v1Id);
}
@Override
public Traversal<Vertex, Path> get_g_VX1X_repeatXbothEXcreatedX_dedup_otherVX_emit_path(
final Object v1Id) {
- GroovyTestHelper.compute("g.V(v1Id).repeat(__.bothE('created').dedup.otherV).emit.path", g, "v1Id", v1Id);
+ TraversalScriptHelper.compute("g.V(v1Id).repeat(__.bothE('created').dedup.otherV).emit.path", g, "v1Id", v1Id);
}
@Override
public Traversal<Vertex, String> get_g_VX1X_asXaX_outXcreatedX_inXcreatedX_exceptXaX_name(final Object v1Id) {
- GroovyTestHelper.compute("g.V(v1Id).as('a').out('created').in('created').except('a').name", g, "v1Id", v1Id);
+ TraversalScriptHelper.compute("g.V(v1Id).as('a').out('created').in('created').except('a').name", g, "v1Id", v1Id);
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/97e46779/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyFilterTest.groovy
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyFilterTest.groovy b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyFilterTest.groovy
index ffc7140..11476bd 100644
--- a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyFilterTest.groovy
+++ b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyFilterTest.groovy
@@ -18,14 +18,10 @@
*/
package org.apache.tinkerpop.gremlin.process.traversal.step.filter
-import org.apache.tinkerpop.gremlin.LoadGraphWith
-import org.apache.tinkerpop.gremlin.process.UseEngine
-import org.apache.tinkerpop.gremlin.process.computer.GroovyTestHelper
+import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalScriptHelper
import org.apache.tinkerpop.gremlin.process.traversal.Traversal
-import org.apache.tinkerpop.gremlin.process.traversal.TraversalEngine
import org.apache.tinkerpop.gremlin.structure.Edge
import org.apache.tinkerpop.gremlin.structure.Vertex
-import org.junit.Test
/**
* @author Marko A. Rodriguez (http://markorodriguez.com)
@@ -36,42 +32,42 @@ public abstract class GroovyFilterTest {
@Override
public Traversal<Vertex, Vertex> get_g_V_filterXfalseX() {
- GroovyTestHelper.compute("g.V.filter { false }", g);
+ TraversalScriptHelper.compute("g.V.filter { false }", g);
}
@Override
public Traversal<Vertex, Vertex> get_g_V_filterXtrueX() {
- GroovyTestHelper.compute("g.V.filter { true }", g);
+ TraversalScriptHelper.compute("g.V.filter { true }", g);
}
@Override
public Traversal<Vertex, Vertex> get_g_V_filterXlang_eq_javaX() {
- GroovyTestHelper.compute("g.V.filter { it.property('lang').orElse('none') == 'java' }", g);
+ TraversalScriptHelper.compute("g.V.filter { it.property('lang').orElse('none') == 'java' }", g);
}
@Override
public Traversal<Vertex, Vertex> get_g_VX1X_filterXage_gt_30X(final Object v1Id) {
- GroovyTestHelper.compute("g.V(v1Id).filter { it.age > 30 }", g, "v1Id", v1Id);
+ TraversalScriptHelper.compute("g.V(v1Id).filter { it.age > 30 }", g, "v1Id", v1Id);
}
@Override
public Traversal<Vertex, Vertex> get_g_VX1X_out_filterXage_gt_30X(final Object v1Id) {
- GroovyTestHelper.compute("g.V(v1Id).out.filter { it.property('age').orElse(0) > 30 }", g, "v1Id", v1Id);
+ TraversalScriptHelper.compute("g.V(v1Id).out.filter { it.property('age').orElse(0) > 30 }", g, "v1Id", v1Id);
}
@Override
public Traversal<Vertex, Vertex> get_g_V_filterXname_startsWith_m_OR_name_startsWith_pX() {
- GroovyTestHelper.compute("g.V.filter { it.name.startsWith('m') || it.name.startsWith('p') }", g);
+ TraversalScriptHelper.compute("g.V.filter { it.name.startsWith('m') || it.name.startsWith('p') }", g);
}
@Override
public Traversal<Edge, Edge> get_g_E_filterXfalseX() {
- GroovyTestHelper.compute("g.E.filter { false }", g);
+ TraversalScriptHelper.compute("g.E.filter { false }", g);
}
@Override
public Traversal<Edge, Edge> get_g_E_filterXtrueX() {
- GroovyTestHelper.compute("g.E.filter { true }", g);
+ TraversalScriptHelper.compute("g.E.filter { true }", g);
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/97e46779/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyHasNotTest.groovy
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyHasNotTest.groovy b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyHasNotTest.groovy
index 839215f..430d9b8 100644
--- a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyHasNotTest.groovy
+++ b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyHasNotTest.groovy
@@ -18,7 +18,7 @@
*/
package org.apache.tinkerpop.gremlin.process.traversal.step.filter
-import org.apache.tinkerpop.gremlin.process.computer.GroovyTestHelper
+import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalScriptHelper
import org.apache.tinkerpop.gremlin.process.traversal.Traversal
import org.apache.tinkerpop.gremlin.structure.Vertex
@@ -30,17 +30,17 @@ public abstract class GroovyHasNotTest {
public static class Traversals extends HasNotTest {
@Override
public Traversal<Vertex, Vertex> get_g_VX1X_hasNotXprop(final Object v1Id, final String propertyKey) {
- GroovyTestHelper.compute("g.V(v1Id).hasNot('${propertyKey}')", g, "v1Id", v1Id);
+ TraversalScriptHelper.compute("g.V(v1Id).hasNot('${propertyKey}')", g, "v1Id", v1Id);
}
@Override
public Traversal<Vertex, Vertex> get_g_V_hasNotXprop(final String propertyKey) {
- GroovyTestHelper.compute("g.V.hasNot('${propertyKey}')", g);
+ TraversalScriptHelper.compute("g.V.hasNot('${propertyKey}')", g);
}
@Override
public Traversal<Vertex, String> get_g_V_hasNotXoutXcreatedXX() {
- GroovyTestHelper.compute("return g.V().hasNot(__.out('created')).values('name')", g);
+ TraversalScriptHelper.compute("return g.V().hasNot(__.out('created')).values('name')", g);
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/97e46779/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyHasTest.groovy
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyHasTest.groovy b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyHasTest.groovy
index 2f5a86c..cbedf72 100644
--- a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyHasTest.groovy
+++ b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyHasTest.groovy
@@ -18,7 +18,7 @@
*/
package org.apache.tinkerpop.gremlin.process.traversal.step.filter
-import org.apache.tinkerpop.gremlin.process.computer.GroovyTestHelper
+import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalScriptHelper
import org.apache.tinkerpop.gremlin.process.traversal.Traversal
import org.apache.tinkerpop.gremlin.structure.Edge
import org.apache.tinkerpop.gremlin.structure.Vertex
@@ -31,88 +31,88 @@ public abstract class GroovyHasTest {
public static class Traversals extends HasTest {
@Override
public Traversal<Edge, Edge> get_g_EX11X_outV_outE_hasXid_10X(final Object e11Id, final Object e8Id) {
- GroovyTestHelper.compute("g.E(e11Id).outV.outE.has(T.id, e8Id)", g, "e11Id", e11Id, "e8Id", e8Id);
+ TraversalScriptHelper.compute("g.E(e11Id).outV.outE.has(T.id, e8Id)", g, "e11Id", e11Id, "e8Id", e8Id);
}
@Override
public Traversal<Vertex, String> get_g_V_outXknowsX_hasXoutXcreatedXX_name() {
- GroovyTestHelper.compute("g.V.out('knows').has(__.out('created')).name", g);
+ TraversalScriptHelper.compute("g.V.out('knows').has(__.out('created')).name", g);
}
@Override
public Traversal<Vertex, Vertex> get_g_VX1X_hasXkeyX(final Object v1Id, final String key) {
- GroovyTestHelper.compute("g.V(v1Id).has('${key}')", g, "v1Id", v1Id);
+ TraversalScriptHelper.compute("g.V(v1Id).has('${key}')", g, "v1Id", v1Id);
}
@Override
public Traversal<Vertex, Vertex> get_g_VX1X_hasXname_markoX(final Object v1Id) {
- GroovyTestHelper.compute("g.V(v1Id).has('name', 'marko')", g, "v1Id", v1Id);
+ TraversalScriptHelper.compute("g.V(v1Id).has('name', 'marko')", g, "v1Id", v1Id);
}
@Override
public Traversal<Vertex, Vertex> get_g_V_hasXname_markoX() {
- GroovyTestHelper.compute("g.V.has('name', 'marko')", g);
+ TraversalScriptHelper.compute("g.V.has('name', 'marko')", g);
}
@Override
public Traversal<Vertex, Vertex> get_g_V_hasXname_blahX() {
- GroovyTestHelper.compute(" g.V.has('name', 'blah')", g);
+ TraversalScriptHelper.compute(" g.V.has('name', 'blah')", g);
}
@Override
public Traversal<Vertex, Vertex> get_g_V_hasXblahX() {
- GroovyTestHelper.compute("g.V.has('blah')", g);
+ TraversalScriptHelper.compute("g.V.has('blah')", g);
}
@Override
public Traversal<Vertex, Vertex> get_g_VX1X_hasXage_gt_30X(final Object v1Id) {
- GroovyTestHelper.compute("g.V(v1Id).has('age', gt(30))", g, "v1Id", v1Id);
+ TraversalScriptHelper.compute("g.V(v1Id).has('age', gt(30))", g, "v1Id", v1Id);
}
@Override
public Traversal<Vertex, Vertex> get_g_VX1X_out_hasIdX2X(final Object v1Id, final Object v2Id) {
- GroovyTestHelper.compute(" g.V(v1Id).out.hasId(v2Id)", g, "v1Id", v1Id, "v2Id", v2Id);
+ TraversalScriptHelper.compute(" g.V(v1Id).out.hasId(v2Id)", g, "v1Id", v1Id, "v2Id", v2Id);
}
@Override
public Traversal<Vertex, Vertex> get_g_VX1X_out_hasIdX2_3X(
final Object v1Id, final Object v2Id, final Object v3Id) {
- GroovyTestHelper.compute(" g.V(v1Id).out.hasId(v2Id, v3Id)", g, "v1Id", v1Id, "v2Id", v2Id, "v3Id", v3Id);
+ TraversalScriptHelper.compute(" g.V(v1Id).out.hasId(v2Id, v3Id)", g, "v1Id", v1Id, "v2Id", v2Id, "v3Id", v3Id);
}
@Override
public Traversal<Vertex, Vertex> get_g_V_hasXage_gt_30X() {
- GroovyTestHelper.compute("g.V.has('age', gt(30))", g);
+ TraversalScriptHelper.compute("g.V.has('age', gt(30))", g);
}
@Override
public Traversal<Edge, Edge> get_g_EX7X_hasLabelXknowsX(final Object e7Id) {
- GroovyTestHelper.compute("g.E(e7Id).hasLabel('knows')", g, "e7Id", e7Id);
+ TraversalScriptHelper.compute("g.E(e7Id).hasLabel('knows')", g, "e7Id", e7Id);
}
@Override
public Traversal<Edge, Edge> get_g_E_hasLabelXknowsX() {
- GroovyTestHelper.compute("g.E.hasLabel('knows')", g);
+ TraversalScriptHelper.compute("g.E.hasLabel('knows')", g);
}
@Override
public Traversal<Edge, Edge> get_g_E_hasLabelXuses_traversesX() {
- GroovyTestHelper.compute("g.E.hasLabel('uses', 'traverses')", g);
+ TraversalScriptHelper.compute("g.E.hasLabel('uses', 'traverses')", g);
}
@Override
Traversal<Vertex, Vertex> get_g_V_hasLabelXperson_software_blahX() {
- GroovyTestHelper.compute("g.V.hasLabel('person', 'software', 'blah')", g);
+ TraversalScriptHelper.compute("g.V.hasLabel('person', 'software', 'blah')", g);
}
@Override
public Traversal<Vertex, Integer> get_g_V_hasXperson_name_markoX_age() {
- GroovyTestHelper.compute("g.V.has('person', 'name', 'marko').age", g);
+ TraversalScriptHelper.compute("g.V.has('person', 'name', 'marko').age", g);
}
@Override
public Traversal<Vertex, Vertex> get_g_VX1X_outE_hasXweight_inside_0_06X_inV(final Object v1Id) {
- GroovyTestHelper.compute("g.V(v1Id).outE.has('weight', inside(0.0d, 0.6d)).inV", g, "v1Id", v1Id);
+ TraversalScriptHelper.compute("g.V(v1Id).outE.has('weight', inside(0.0d, 0.6d)).inV", g, "v1Id", v1Id);
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/97e46779/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyIsTest.groovy
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyIsTest.groovy b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyIsTest.groovy
index 05559e9..e44c48d 100644
--- a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyIsTest.groovy
+++ b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyIsTest.groovy
@@ -18,7 +18,7 @@
*/
package org.apache.tinkerpop.gremlin.process.traversal.step.filter
-import org.apache.tinkerpop.gremlin.process.computer.GroovyTestHelper
+import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalScriptHelper
import org.apache.tinkerpop.gremlin.process.traversal.Traversal
import org.apache.tinkerpop.gremlin.structure.Vertex
@@ -31,27 +31,27 @@ public abstract class GroovyIsTest {
@Override
public Traversal<Vertex, Integer> get_g_V_valuesXageX_isX32X() {
- GroovyTestHelper.compute("g.V.age.is(32)", g)
+ TraversalScriptHelper.compute("g.V.age.is(32)", g)
}
@Override
public Traversal<Vertex, Integer> get_g_V_valuesXageX_isXlte_30X() {
- GroovyTestHelper.compute("g.V.age.is(lte(30))", g)
+ TraversalScriptHelper.compute("g.V.age.is(lte(30))", g)
}
@Override
public Traversal<Vertex, Integer> get_g_V_valuesXageX_isXgte_29X_isXlt_34X() {
- GroovyTestHelper.compute("g.V.age.is(gte(29)).is(lt(34))", g)
+ TraversalScriptHelper.compute("g.V.age.is(gte(29)).is(lt(34))", g)
}
@Override
public Traversal<Vertex, String> get_g_V_hasXinXcreatedX_count_isX1XX_valuesXnameX() {
- GroovyTestHelper.compute("g.V.has(__.in('created').count.is(1)).name", g)
+ TraversalScriptHelper.compute("g.V.has(__.in('created').count.is(1)).name", g)
}
@Override
public Traversal<Vertex, String> get_g_V_hasXinXcreatedX_count_isXgte_2XX_valuesXnameX() {
- GroovyTestHelper.compute("g.V.has(__.in('created').count.is(gte(2l))).name", g)
+ TraversalScriptHelper.compute("g.V.has(__.in('created').count.is(gte(2l))).name", g)
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/97e46779/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyOrTest.groovy
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyOrTest.groovy b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyOrTest.groovy
index 7b0a014..a647f36 100644
--- a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyOrTest.groovy
+++ b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyOrTest.groovy
@@ -18,7 +18,7 @@
*/
package org.apache.tinkerpop.gremlin.process.traversal.step.filter
-import org.apache.tinkerpop.gremlin.process.computer.GroovyTestHelper
+import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalScriptHelper
import org.apache.tinkerpop.gremlin.process.traversal.Traversal
import org.apache.tinkerpop.gremlin.structure.Vertex
@@ -31,12 +31,12 @@ public abstract class GroovyOrTest {
@Override
public Traversal<Vertex, String> get_g_V_orXhasXage_gt_27X__outE_count_gte_2X_name() {
- GroovyTestHelper.compute("g.V.or(has('age', gt(27)), outE().count.is(gte(2l))).name", g)
+ TraversalScriptHelper.compute("g.V.or(has('age', gt(27)), outE().count.is(gte(2l))).name", g)
}
@Override
public Traversal<Vertex, String> get_g_V_orXoutEXknowsX__hasXlabel_softwareX_or_hasXage_gte_35XX_name() {
- GroovyTestHelper.compute("g.V.or(outE('knows'), has(T.label, 'software') | has('age', gte(35))).name", g)
+ TraversalScriptHelper.compute("g.V.or(outE('knows'), has(T.label, 'software') | has('age', gte(35))).name", g)
}
}
}