You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2015/08/25 14:53:58 UTC
[2/6] incubator-tinkerpop git commit: Revert "Merge remote-tracking
branch 'origin' into tp30"
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6902e68a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/AbstractTransaction.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/AbstractTransaction.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/AbstractTransaction.java
index 56c6f36..4d15a45 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/AbstractTransaction.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/AbstractTransaction.java
@@ -28,11 +28,13 @@ import java.util.function.Consumer;
import java.util.function.Function;
/**
- * A simple base class for {@link Transaction} that provides some common functionality and default behavior.
- * While vendors can choose to use this class, it is generally better to extend from
- * {@link AbstractThreadedTransaction} or {@link AbstractThreadLocalTransaction} which include default "listener"
- * functionality. Implementers should note that this class assumes that threaded transactions are not enabled
- * and should explicitly override {@link #createThreadedTx} to implement that functionality if required.
+ * A simple base class for {@link Transaction} that provides some common functionality and default behavior. Vendors
+ * can use this class as a starting point for their own implementations. Implementers should note that this
+ * class assumes that threaded transactions are not enabled. Vendors should explicitly override
+ * {@link #createThreadedTx} to implement that functionality if required.
+ * <p/>
+ * Note that transaction listeners are registered in a {@link ThreadLocal} fashion which matches the pattern
+ * expected of vendor implementations of a {@link Transaction}.
*
* @author Stephen Mallette (http://stephen.genoprime.com)
*/
@@ -42,12 +44,19 @@ public abstract class AbstractTransaction implements Transaction {
private Graph g;
+ private ThreadLocal<List<Consumer<Status>>> transactionListeners = new ThreadLocal<List<Consumer<Status>>>() {
+ @Override
+ protected List<Consumer<Status>> initialValue() {
+ return new ArrayList<>();
+ }
+ };
+
public AbstractTransaction(final Graph g) {
// auto transaction behavior
readWriteConsumer = READ_WRITE_BEHAVIOR.AUTO;
- // default is to rollback transactions on close
- closeConsumer = CLOSE_BEHAVIOR.ROLLBACK;
+ // commit on close
+ closeConsumer = CLOSE_BEHAVIOR.COMMIT;
this.g = g;
}
@@ -70,23 +79,6 @@ public abstract class AbstractTransaction implements Transaction {
*/
protected abstract void doRollback() throws TransactionException;
- /**
- * Called within {@link #commit()} just after the internal call to {@link #doCommit()}. Implementations of this
- * method should raise {@link Status#COMMIT} events to any listeners added via
- * {@link #addTransactionListener(Consumer)}.
- */
- protected abstract void fireOnCommit();
-
- /**
- * Called within {@link #rollback()} just after the internal call to {@link #doRollback()} ()}. Implementations
- * of this method should raise {@link Status#ROLLBACK} events to any listeners added via
- * {@link #addTransactionListener(Consumer)}.
- */
- protected abstract void fireOnRollback();
-
- /**
- * {@inheritDoc}
- */
@Override
public void open() {
if (isOpen())
@@ -95,52 +87,40 @@ public abstract class AbstractTransaction implements Transaction {
doOpen();
}
- /**
- * {@inheritDoc}
- */
@Override
public void commit() {
readWriteConsumer.accept(this);
try {
doCommit();
- fireOnCommit();
} catch (TransactionException te) {
throw new RuntimeException(te);
}
+
+ transactionListeners.get().forEach(c -> c.accept(Status.COMMIT));
}
- /**
- * {@inheritDoc}
- */
@Override
public void rollback() {
readWriteConsumer.accept(this);
try {
doRollback();
- fireOnRollback();
} catch (TransactionException te) {
throw new RuntimeException(te);
}
+
+ transactionListeners.get().forEach(c -> c.accept(Status.ROLLBACK));
}
- /**
- * {@inheritDoc}
- */
@Override
public <R> Workload<R> submit(final Function<Graph, R> work) {
return new Workload<>(g, work);
}
- /**
- * {@inheritDoc}
- */
+
@Override
public <G extends Graph> G createThreadedTx() {
throw Transaction.Exceptions.threadedTransactionsNotSupported();
}
- /**
- * {@inheritDoc}
- */
@Override
public void readWrite() {
readWriteConsumer.accept(this);
@@ -154,24 +134,33 @@ public abstract class AbstractTransaction implements Transaction {
closeConsumer.accept(this);
}
- /**
- * {@inheritDoc}
- */
@Override
public synchronized Transaction onReadWrite(final Consumer<Transaction> consumer) {
readWriteConsumer = Optional.ofNullable(consumer).orElseThrow(Transaction.Exceptions::onReadWriteBehaviorCannotBeNull);
return this;
}
- /**
- * {@inheritDoc}
- */
@Override
public synchronized Transaction onClose(final Consumer<Transaction> consumer) {
closeConsumer = Optional.ofNullable(consumer).orElseThrow(Transaction.Exceptions::onCloseBehaviorCannotBeNull);
return this;
}
+ @Override
+ public void addTransactionListener(final Consumer<Status> listener) {
+ transactionListeners.get().add(listener);
+ }
+
+ @Override
+ public void removeTransactionListener(final Consumer<Status> listener) {
+ transactionListeners.get().remove(listener);
+ }
+
+ @Override
+ public void clearTransactionListeners() {
+ transactionListeners.get().clear();
+ }
+
/**
* An "internal" exception thrown by vendors when calls to {@link AbstractTransaction#doCommit} or
* {@link AbstractTransaction#doRollback} fail.
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6902e68a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/PathTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/PathTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/PathTest.java
index 18d160e..e24e024 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/PathTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/PathTest.java
@@ -31,10 +31,8 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
-import java.util.LinkedHashSet;
import java.util.List;
import java.util.function.Supplier;
-import java.util.stream.Collectors;
import static org.junit.Assert.*;
@@ -59,7 +57,7 @@ public class PathTest {
assertEquals(Integer.valueOf(1), path.get("a"));
assertEquals(Integer.valueOf(2), path.get("b"));
assertEquals(Integer.valueOf(3), path.get("c"));
- path = path.extend(Collections.singleton("d"));
+ path.addLabel("d");
assertEquals(3, path.size());
assertEquals(Integer.valueOf(1), path.get("a"));
assertEquals(Integer.valueOf(2), path.get("b"));
@@ -105,9 +103,9 @@ public class PathTest {
public void shouldExcludeUnlabeledLabelsFromPath() {
PATH_SUPPLIERS.forEach(supplier -> {
Path path = supplier.get();
- path = path.extend("marko", Collections.singleton("a"));
- path = path.extend("stephen", Collections.singleton("b"));
- path = path.extend("matthias", new LinkedHashSet<>(Arrays.asList("c", "d")));
+ path = path.extend("marko", "a");
+ path = path.extend("stephen", "b");
+ path = path.extend("matthias", "c", "d");
assertEquals(3, path.size());
assertEquals(3, path.objects().size());
assertEquals(3, path.labels().size());
@@ -124,9 +122,9 @@ public class PathTest {
public void shouldHaveOrderedPathLabels() {
PATH_SUPPLIERS.forEach(supplier -> {
Path path = supplier.get();
- path = path.extend("marko", new LinkedHashSet<>(Arrays.asList("a", "b")));
- path = path.extend("stephen", new LinkedHashSet<>(Arrays.asList("c", "a")));
- path = path.extend("matthias", new LinkedHashSet<>(Arrays.asList("a", "b")));
+ path = path.extend("marko", "a", "b");
+ path = path.extend("stephen", "c", "a");
+ path = path.extend("matthias", "a", "b");
assertEquals(3, path.size());
assertEquals(3, path.objects().size());
assertEquals(3, path.labels().size());
@@ -162,9 +160,9 @@ public class PathTest {
public void shouldSelectSingleCorrectly() {
PATH_SUPPLIERS.forEach(supplier -> {
Path path = supplier.get();
- path = path.extend("marko", new LinkedHashSet<String>(Arrays.asList("a", "b")));
- path = path.extend("stephen", new LinkedHashSet<>(Arrays.asList("a", "c")));
- path = path.extend("matthias", new LinkedHashSet<>(Arrays.asList("c", "d")));
+ path = path.extend("marko", "a", "b");
+ path = path.extend("stephen", "a", "c");
+ path = path.extend("matthias", "c", "d");
assertEquals(3, path.size());
assertEquals("marko", path.get(Pop.first, "a"));
assertEquals("marko", path.get(Pop.first, "b"));
@@ -182,9 +180,9 @@ public class PathTest {
public void shouldSelectListCorrectly() {
PATH_SUPPLIERS.forEach(supplier -> {
Path path = supplier.get();
- path = path.extend("marko", new LinkedHashSet<>(Arrays.asList("a", "b")));
- path = path.extend("stephen", new LinkedHashSet<>(Arrays.asList("a", "c")));
- path = path.extend("matthias", new LinkedHashSet<>(Arrays.asList("c", "d")));
+ path = path.extend("marko", "a", "b");
+ path = path.extend("stephen", "a", "c");
+ path = path.extend("matthias", "c", "d");
assertEquals(3, path.size());
assertEquals(2, path.<List>get(Pop.all, "a").size());
assertEquals("marko", path.<List>get(Pop.all, "a").get(0));
@@ -201,61 +199,4 @@ public class PathTest {
});
}
- @Test
- public void shouldHaveEquality() {
- PATH_SUPPLIERS.forEach(supplier -> {
- Path pathA1 = supplier.get();
- Path pathA2 = supplier.get();
- Path pathB1 = supplier.get();
- Path pathB2 = supplier.get();
- assertEquals(pathA1, pathA2);
- assertEquals(pathA1.hashCode(), pathA2.hashCode());
- assertEquals(pathA2, pathB1);
- assertEquals(pathA2.hashCode(), pathB1.hashCode());
- assertEquals(pathB1, pathB2);
- assertEquals(pathB1.hashCode(), pathB2.hashCode());
- ///
- pathA1 = pathA1.extend("marko", Collections.singleton("a"));
- pathA2 = pathA2.extend("marko", Collections.singleton("a"));
- pathB1 = pathB1.extend("marko", Collections.singleton("b"));
- pathB2 = pathB2.extend("marko", Collections.singleton("b"));
- assertEquals(pathA1, pathA2);
- assertEquals(pathA1.hashCode(), pathA2.hashCode());
- assertNotEquals(pathA2, pathB1);
- assertEquals(pathB1, pathB2);
- assertEquals(pathB1.hashCode(), pathB2.hashCode());
- ///
- pathA1 = pathA1.extend("daniel", new LinkedHashSet<>(Arrays.asList("aa", "aaa")));
- pathA2 = pathA2.extend("daniel", new LinkedHashSet<>(Arrays.asList("aa", "aaa")));
- pathB1 = pathB1.extend("stephen", new LinkedHashSet<>(Arrays.asList("bb", "bbb")));
- pathB2 = pathB2.extend("stephen", Collections.singleton("bb"));
- assertEquals(pathA1, pathA2);
- assertEquals(pathA1.hashCode(), pathA2.hashCode());
- assertNotEquals(pathA2, pathB1);
- assertNotEquals(pathB1, pathB2);
- ///
- pathA1 = pathA1.extend("matthias", new LinkedHashSet<>(Arrays.asList("aaaa", "aaaaa")));
- pathA2 = pathA2.extend("bob", new LinkedHashSet<>(Arrays.asList("aaaa", "aaaaa")));
- pathB1 = pathB1.extend("byn", Collections.singleton("bbbb"));
- pathB2 = pathB2.extend("bryn", Collections.singleton("bbbb"));
- assertNotEquals(pathA1, pathA2);
- assertNotEquals(pathA2, pathB1);
- assertNotEquals(pathB1, pathB2);
- });
- }
-
- @Test
- public void shouldHaveCrossTypeEquality() {
- List<Path> paths = PATH_SUPPLIERS.stream()
- .map(Supplier::get)
- .map(path -> path.extend("marko", new LinkedHashSet<>(Arrays.asList("a", "aa"))))
- .map(path -> path.extend("daniel", Collections.singleton("b")))
- .collect(Collectors.toList());
- for (final Path pathA : paths) {
- for (final Path pathB : paths) {
- assertEquals(pathA, pathB);
- assertEquals(pathA.hashCode(), pathB.hashCode());
- }
- }
- }
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6902e68a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WhereStepTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WhereStepTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WhereStepTest.java
index ca7da87..8f8c26e 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WhereStepTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WhereStepTest.java
@@ -61,7 +61,7 @@ public class WhereStepTest extends StepTest {
{false, __.as("a").local(__.where(P.not(P.within("x")))).asAdmin()},
};
for (final Object[] traversalPath : traversalPaths) {
- assertEquals(traversalPath[0], ((Traversal.Admin<?, ?>) traversalPath[1]).getTraverserRequirements().contains(TraverserRequirement.LABELED_PATH));
+ assertEquals(traversalPath[0], ((Traversal.Admin<?, ?>) traversalPath[1]).getTraverserRequirements().contains(TraverserRequirement.PATH));
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6902e68a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/LoopsStepTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/LoopsStepTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/LoopsStepTest.java
deleted file mode 100644
index ea11673..0000000
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/LoopsStepTest.java
+++ /dev/null
@@ -1,40 +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.step.map;
-
-import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
-import org.apache.tinkerpop.gremlin.process.traversal.step.StepTest;
-
-import java.util.Collections;
-import java.util.List;
-
-/**
- * @author Daniel Kuppitz (http://gremlin.guru)
- */
-public class LoopsStepTest extends StepTest {
-
- @Override
- protected List<Traversal> getTraversals() {
- return Collections.singletonList(__.loops());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6902e68a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectOneStepTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectOneStepTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectOneStepTest.java
index 9bdb307..42f8309 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectOneStepTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectOneStepTest.java
@@ -61,7 +61,7 @@ public class SelectOneStepTest extends StepTest {
{true, __.as("x").local(__.select("x")).asAdmin()},
};
for (final Object[] traversalPath : traversalPaths) {
- assertEquals(traversalPath[0], ((Traversal.Admin<?, ?>) traversalPath[1]).getTraverserRequirements().contains(TraverserRequirement.LABELED_PATH));
+ assertEquals(traversalPath[0], ((Traversal.Admin<?, ?>) traversalPath[1]).getTraverserRequirements().contains(TraverserRequirement.PATH));
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6902e68a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectStepTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectStepTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectStepTest.java
index e9604af..59c3233 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectStepTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectStepTest.java
@@ -63,7 +63,7 @@ public class SelectStepTest extends StepTest {
{true, __.as("x").out().as("y").local(__.select("x", "y")).asAdmin()},
};
for (final Object[] traversalPath : traversalPaths) {
- assertEquals(traversalPath[0], ((Traversal.Admin<?, ?>) traversalPath[1]).getTraverserRequirements().contains(TraverserRequirement.LABELED_PATH));
+ assertEquals(traversalPath[0], ((Traversal.Admin<?, ?>) traversalPath[1]).getTraverserRequirements().contains(TraverserRequirement.PATH));
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6902e68a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/DedupBijectionStrategyTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/DedupBijectionStrategyTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/DedupBijectionStrategyTest.java
new file mode 100644
index 0000000..99998f7
--- /dev/null
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/DedupBijectionStrategyTest.java
@@ -0,0 +1,128 @@
+/*
+ *
+ * * 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.Traversal;
+import org.apache.tinkerpop.gremlin.process.traversal.TraversalEngine;
+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.Before;
+import org.junit.Test;
+import org.junit.experimental.runners.Enclosed;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import java.util.Arrays;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+@RunWith(Enclosed.class)
+public class DedupBijectionStrategyTest {
+
+ @RunWith(Parameterized.class)
+ public static class StandardTest extends AbstractDedupBijectionStrategyTest {
+
+ @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;
+
+ @Before
+ public void setup() {
+ this.traversalEngine = mock(TraversalEngine.class);
+ when(this.traversalEngine.getType()).thenReturn(TraversalEngine.Type.STANDARD);
+ }
+
+ @Test
+ public void shouldApplyStrategy() {
+ doTest(original, optimized);
+ }
+ }
+
+ @RunWith(Parameterized.class)
+ public static class ComputerTest extends AbstractDedupBijectionStrategyTest {
+
+ @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;
+
+ @Before
+ public void setup() {
+ this.traversalEngine = mock(TraversalEngine.class);
+ when(this.traversalEngine.getType()).thenReturn(TraversalEngine.Type.COMPUTER);
+ }
+
+ @Test
+ public void shouldApplyStrategy() {
+ doTest(original, optimized);
+ }
+ }
+
+ private static abstract class AbstractDedupBijectionStrategyTest {
+
+ protected TraversalEngine traversalEngine;
+
+ void applyDedupBijectionStrategy(final Traversal traversal) {
+ final TraversalStrategies strategies = new DefaultTraversalStrategies();
+ strategies.addStrategies(DedupBijectionStrategy.instance(), IdentityRemovalStrategy.instance());
+
+ traversal.asAdmin().setStrategies(strategies);
+ traversal.asAdmin().setEngine(this.traversalEngine);
+ traversal.asAdmin().applyStrategies();
+ }
+
+ public void doTest(final Traversal traversal, final Traversal optimized) {
+ applyDedupBijectionStrategy(traversal);
+ assertEquals(optimized, traversal);
+ }
+
+ static Iterable<Object[]> generateTestParameters() {
+
+ return Arrays.asList(new Traversal[][]{
+ {__.dedup().order(), __.dedup().order()},
+ {__.order().dedup(), __.dedup().order()},
+ {__.identity().order().dedup(), __.dedup().order()},
+ {__.order().identity().dedup(), __.dedup().order()},
+ {__.order().out().dedup(), __.order().out().dedup()}});
+ }
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6902e68a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/FilterRankingStrategyTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/FilterRankingStrategyTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/FilterRankingStrategyTest.java
deleted file mode 100644
index ca8037d..0000000
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/FilterRankingStrategyTest.java
+++ /dev/null
@@ -1,133 +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.optimization;
-
-import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
-import org.apache.tinkerpop.gremlin.process.traversal.TraversalEngine;
-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.Before;
-import org.junit.Test;
-import org.junit.experimental.runners.Enclosed;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-
-import java.util.Arrays;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-@RunWith(Enclosed.class)
-public class FilterRankingStrategyTest {
-
- @RunWith(Parameterized.class)
- public static class StandardTest extends AbstractDedupBijectionStrategyTest {
-
- @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;
-
- @Before
- public void setup() {
- this.traversalEngine = mock(TraversalEngine.class);
- when(this.traversalEngine.getType()).thenReturn(TraversalEngine.Type.STANDARD);
- }
-
- @Test
- public void shouldApplyStrategy() {
- doTest(original, optimized);
- }
- }
-
- @RunWith(Parameterized.class)
- public static class ComputerTest extends AbstractDedupBijectionStrategyTest {
-
- @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;
-
- @Before
- public void setup() {
- this.traversalEngine = mock(TraversalEngine.class);
- when(this.traversalEngine.getType()).thenReturn(TraversalEngine.Type.COMPUTER);
- }
-
- @Test
- public void shouldApplyStrategy() {
- doTest(original, optimized);
- }
- }
-
- private static abstract class AbstractDedupBijectionStrategyTest {
-
- protected TraversalEngine traversalEngine;
-
- void applyDedupBijectionStrategy(final Traversal traversal) {
- final TraversalStrategies strategies = new DefaultTraversalStrategies();
- strategies.addStrategies(FilterRankingStrategy.instance(), IdentityRemovalStrategy.instance());
-
- traversal.asAdmin().setStrategies(strategies);
- traversal.asAdmin().setEngine(this.traversalEngine);
- traversal.asAdmin().applyStrategies();
- }
-
- public void doTest(final Traversal traversal, final Traversal optimized) {
- applyDedupBijectionStrategy(traversal);
- assertEquals(optimized, traversal);
- }
-
- static Iterable<Object[]> generateTestParameters() {
-
- return Arrays.asList(new Traversal[][]{
- {__.dedup().order(), __.dedup().order()},
- {__.order().dedup(), __.dedup().order()},
- {__.identity().order().dedup(), __.dedup().order()},
- {__.order().identity().dedup(), __.dedup().order()},
- {__.order().out().dedup(), __.order().out().dedup()},
- {__.has("value", 0).filter(__.out()).dedup(), __.has("value", 0).filter(__.out()).dedup()},
- {__.dedup().filter(__.out()).has("value", 0), __.has("value", 0).filter(__.out()).dedup()},
- {__.filter(__.out()).dedup().has("value", 0), __.has("value", 0).filter(__.out()).dedup()},
- {__.has("value", 0).filter(__.out()).dedup(), __.has("value", 0).filter(__.out()).dedup()},
- });
- }
- }
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6902e68a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/LambdaRestrictionStrategyTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/LambdaRestrictionStrategyTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/LambdaRestrictionStrategyTest.java
index 6665cfa..09325e0 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/LambdaRestrictionStrategyTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/LambdaRestrictionStrategyTest.java
@@ -24,6 +24,9 @@ import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies;
import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
import org.apache.tinkerpop.gremlin.process.traversal.engine.StandardTraversalEngine;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.DedupBijectionStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.IdentityRemovalStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.LambdaRestrictionStrategy;
import org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversalStrategies;
import org.junit.Test;
import org.junit.runner.RunWith;
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6902e68a/gremlin-driver/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-driver/pom.xml b/gremlin-driver/pom.xml
index bdf2af6..c158ce5 100644
--- a/gremlin-driver/pom.xml
+++ b/gremlin-driver/pom.xml
@@ -21,7 +21,7 @@ limitations under the License.
<parent>
<groupId>org.apache.tinkerpop</groupId>
<artifactId>tinkerpop</artifactId>
- <version>3.1.0-SNAPSHOT</version>
+ <version>3.0.1-SNAPSHOT</version>
</parent>
<artifactId>gremlin-driver</artifactId>
<name>Apache TinkerPop :: Gremlin Driver</name>
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6902e68a/gremlin-groovy-test/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/pom.xml b/gremlin-groovy-test/pom.xml
index ab3d253..7230e10 100644
--- a/gremlin-groovy-test/pom.xml
+++ b/gremlin-groovy-test/pom.xml
@@ -21,7 +21,7 @@ limitations under the License.
<parent>
<groupId>org.apache.tinkerpop</groupId>
<artifactId>tinkerpop</artifactId>
- <version>3.1.0-SNAPSHOT</version>
+ <version>3.0.1-SNAPSHOT</version>
</parent>
<artifactId>gremlin-groovy-test</artifactId>
<name>Apache TinkerPop :: Gremlin Groovy Test</name>
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6902e68a/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 ced0753..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,9 +18,9 @@
*/
package org.apache.tinkerpop.gremlin.process.traversal.step.branch
+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.process.traversal.util.TraversalScriptHelper
import org.apache.tinkerpop.gremlin.structure.Vertex
/**
@@ -74,10 +74,5 @@ public abstract class GroovyRepeatTest {
public Traversal<Vertex, Map<String, Long>> get_g_V_repeatXgroupCountXmX_byXnameX_outX_timesX2X_capXmX() {
TraversalScriptHelper.compute("g.V.repeat(groupCount('m').by('name').out).times(2).cap('m')", g)
}
-
- @Override
- public Traversal<Vertex, Map<String, Vertex>> get_g_V_repeatXbothX_timesX10X_asXaX_out_asXbX_selectXa_bX() {
- TraversalScriptHelper.compute("g.V.repeat(both()).times(10).as('a').out().as('b').select('a', 'b')", g);
- }
}
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6902e68a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyCountTest.groovy
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyCountTest.groovy b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyCountTest.groovy
index 016749f..3c4e48f 100644
--- a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyCountTest.groovy
+++ b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyCountTest.groovy
@@ -18,8 +18,8 @@
*/
package org.apache.tinkerpop.gremlin.process.traversal.step.map
-import org.apache.tinkerpop.gremlin.process.traversal.Traversal
import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalScriptHelper
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal
import org.apache.tinkerpop.gremlin.structure.Vertex
/**
@@ -45,17 +45,12 @@ public abstract class GroovyCountTest {
@Override
public Traversal<Vertex, Long> get_g_V_repeatXoutX_timesX3X_count() {
- TraversalScriptHelper.compute("g.V().repeat(__.out).times(3).count()", g)
+ TraversalScriptHelper.compute("g.V().repeat(__.out).times(3).count()", g);
}
@Override
public Traversal<Vertex, Long> get_g_V_repeatXoutX_timesX8X_count() {
- TraversalScriptHelper.compute("g.V.repeat(__.out).times(8).count()", g)
- }
-
- @Override
- public Traversal<Vertex, Long> get_g_V_repeatXoutX_timesX5X_asXaX_outXwrittenByX_asXbX_selectXa_bX_count() {
- TraversalScriptHelper.compute("g.V.repeat(out()).times(5).as('a').out('writtenBy').as('b').select('a', 'b').count()", g)
+ TraversalScriptHelper.compute("g.V.repeat(__.out).times(8).count()", g);
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6902e68a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyLoopsTest.groovy
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyLoopsTest.groovy b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyLoopsTest.groovy
deleted file mode 100644
index 6704a51..0000000
--- a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyLoopsTest.groovy
+++ /dev/null
@@ -1,56 +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.step.map
-
-import org.apache.tinkerpop.gremlin.process.traversal.Path
-import org.apache.tinkerpop.gremlin.process.traversal.Traversal
-import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalScriptHelper
-import org.apache.tinkerpop.gremlin.structure.Vertex
-
-/**
- * @author Daniel Kuppitz (http://gremlin.guru)
- */
-public abstract class GroovyLoopsTest {
-
- public static class Traversals extends LoopsTest {
-
- @Override
- Traversal<Vertex, Path> get_g_VX1X_repeatXboth_simplePathX_untilXhasXname_peterX_or_loops_isX3XX_hasXname_peterX_path_byXnameX(
- final Object v1Id) {
- TraversalScriptHelper.compute("g.V(v1Id).repeat(__.both.simplePath).until(has('name', 'peter').or.loops.is(3)).has('name', 'peter').path.by('name')", g, "v1Id", v1Id)
- }
-
- @Override
- Traversal<Vertex, Path> get_g_VX1X_repeatXboth_simplePathX_untilXhasXname_peterX_or_loops_isX2XX_hasXname_peterX_path_byXnameX(
- final Object v1Id) {
- TraversalScriptHelper.compute("g.V(v1Id).repeat(__.both.simplePath).until(has('name', 'peter').or.loops.is(2)).has('name', 'peter').path.by('name')", g, "v1Id", v1Id)
- }
-
- @Override
- Traversal<Vertex, Path> get_g_VX1X_repeatXboth_simplePathX_untilXhasXname_peterX_and_loops_isX3XX_hasXname_peterX_path_byXnameX(
- final Object v1Id) {
- TraversalScriptHelper.compute("g.V(v1Id).repeat(__.both.simplePath).until(has('name', 'peter').and.loops.is(3)).has('name', 'peter').path.by('name')", g, "v1Id", v1Id)
- }
-
- @Override
- Traversal<Vertex, String> get_g_V_emitXhasXname_markoX_or_loops_isX2XX_repeatXoutX_valuesXnameX() {
- TraversalScriptHelper.compute("g.V.emit(has('name', 'marko').or.loops.is(2)).repeat(__.out).name", g)
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6902e68a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyMapKeysTest.groovy
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyMapKeysTest.groovy b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyMapKeysTest.groovy
index 648ffab..de16a1d 100644
--- a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyMapKeysTest.groovy
+++ b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyMapKeysTest.groovy
@@ -34,10 +34,5 @@ public abstract class GroovyMapKeysTest {
public Traversal<Vertex, Double> get_g_V_outE_valuesXweightX_groupCount_mapKeys() {
TraversalScriptHelper.compute("g.V.outE().weight.groupCount().mapKeys()", g)
}
-
- @Override
- public Traversal<Vertex, Double> get_g_V_outE_valuesXweightX_groupCount_unfold_mapKeys() {
- TraversalScriptHelper.compute("g.V.outE().weight.groupCount().unfold().mapKeys()", g)
- }
}
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6902e68a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyMapValuesTest.groovy
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyMapValuesTest.groovy b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyMapValuesTest.groovy
index 4572b73..67998f4 100644
--- a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyMapValuesTest.groovy
+++ b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyMapValuesTest.groovy
@@ -36,11 +36,6 @@ public abstract class GroovyMapValuesTest {
}
@Override
- public Traversal<Vertex, Long> get_g_V_outE_valuesXweightX_groupCount_unfold_mapValues() {
- TraversalScriptHelper.compute("g.V.outE().weight.groupCount().unfold().mapValues()", g)
- }
-
- @Override
public Traversal<Vertex, Long> get_g_V_outE_valuesXweightX_groupCount_mapValues_groupCount_mapValues() {
TraversalScriptHelper.compute("g.V.outE().weight.groupCount().mapValues().groupCount().mapValues()", g)
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6902e68a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyMatchTest.groovy
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyMatchTest.groovy b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyMatchTest.groovy
index c2f9d43..d68a88e 100644
--- a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyMatchTest.groovy
+++ b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyMatchTest.groovy
@@ -48,11 +48,6 @@ public abstract class GroovyMatchTest {
public abstract static class Traversals extends MatchTest {
@Override
- public Traversal<Vertex, Map<String, Object>> get_g_V_valueMap_matchXa_selectXnameX_bX() {
- TraversalScriptHelper.compute("g.V.valueMap.match(__.as('a').select('name').as('b'))", g)
- }
-
- @Override
public Traversal<Vertex, Map<String, Vertex>> get_g_V_matchXa_out_bX() {
TraversalScriptHelper.compute("g.V.match(__.as('a').out.as('b'))", g)
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6902e68a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyUnfoldTest.groovy
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyUnfoldTest.groovy b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyUnfoldTest.groovy
index 220951c..409172f 100644
--- a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyUnfoldTest.groovy
+++ b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyUnfoldTest.groovy
@@ -18,8 +18,8 @@
*/
package org.apache.tinkerpop.gremlin.process.traversal.step.map
-import org.apache.tinkerpop.gremlin.process.traversal.Traversal
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
@@ -39,10 +39,7 @@ public abstract class GroovyUnfoldTest {
public Traversal<Vertex, String> get_g_V_valueMap_unfold_mapXkeyX() {
TraversalScriptHelper.compute("g.V.valueMap.unfold.map { it.key }", g)
}
-
- @Override
- Traversal<Vertex, String> get_g_VX1X_repeatXboth_simplePathX_untilXhasIdX6XX_path_byXnameX_unfold(Object v1Id, Object v6Id) {
- TraversalScriptHelper.compute("g.V(v1Id).repeat(__.both.simplePath).until(hasId(v6Id)).path.by('name').unfold", g, "v1Id", v1Id, "v6Id", v6Id)
- }
}
+
+
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6902e68a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyVertexTest.groovy
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyVertexTest.groovy b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyVertexTest.groovy
index 34a567e..71041e4 100644
--- a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyVertexTest.groovy
+++ b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyVertexTest.groovy
@@ -18,8 +18,8 @@
*/
package org.apache.tinkerpop.gremlin.process.traversal.step.map
-import org.apache.tinkerpop.gremlin.process.traversal.Traversal
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,16 +31,6 @@ public abstract class GroovyVertexTest {
public static class Traversals extends VertexTest {
@Override
- public Traversal<Vertex, String> get_g_VXlistXv1_v2_v3XX_name() {
- TraversalScriptHelper.compute("g.V(ids).name", g, "ids", [convertToVertex(graph, "marko"), convertToVertex(graph, "vadas"), convertToVertex(graph, "lop")])
- }
-
- @Override
- public Traversal<Vertex, String> get_g_VXlistX1_2_3XX_name() {
- TraversalScriptHelper.compute("g.V(ids).name", g, "ids", [convertToVertexId(graph, "marko"), convertToVertexId(graph, "vadas"), convertToVertexId(graph, "lop")])
- }
-
- @Override
public Traversal<Vertex, Vertex> get_g_V() {
TraversalScriptHelper.compute("g.V", g);
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6902e68a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/GroovyProfileTest.groovy
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/GroovyProfileTest.groovy b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/GroovyProfileTest.groovy
index 1edbc54..4efbbcf 100644
--- a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/GroovyProfileTest.groovy
+++ b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/GroovyProfileTest.groovy
@@ -35,7 +35,7 @@ public abstract class GroovyProfileTest {
}
@Override
- public Traversal<Vertex, Vertex> get_g_V_repeatXbothX_timesX3X_profile() {
+ public Traversal<Vertex, Vertex> get_g_V_repeat_both_profile() {
TraversalScriptHelper.compute("g.V.repeat(__.both()).times(3).profile()", g);
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6902e68a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/process/GroovyProcessComputerSuite.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/process/GroovyProcessComputerSuite.java b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/process/GroovyProcessComputerSuite.java
index dfde060..6a24469 100644
--- a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/process/GroovyProcessComputerSuite.java
+++ b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/process/GroovyProcessComputerSuite.java
@@ -105,7 +105,6 @@ public class GroovyProcessComputerSuite extends ProcessComputerSuite {
GroovyConstantTest.Traversals.class,
GroovyCountTest.Traversals.class,
GroovyFoldTest.Traversals.class,
- GroovyLoopsTest.Traversals.class,
GroovyMapTest.Traversals.class,
GroovyMapKeysTest.Traversals.class,
GroovyMapValuesTest.Traversals.class,
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6902e68a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/process/GroovyProcessStandardSuite.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/process/GroovyProcessStandardSuite.java b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/process/GroovyProcessStandardSuite.java
index 729b5df..ef97c97 100644
--- a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/process/GroovyProcessStandardSuite.java
+++ b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/process/GroovyProcessStandardSuite.java
@@ -77,7 +77,6 @@ public class GroovyProcessStandardSuite extends ProcessStandardSuite {
GroovyConstantTest.Traversals.class,
GroovyCountTest.Traversals.class,
GroovyFoldTest.Traversals.class,
- GroovyLoopsTest.Traversals.class,
GroovyMapTest.Traversals.class,
GroovyMapKeysTest.Traversals.class,
GroovyMapValuesTest.Traversals.class,
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6902e68a/gremlin-groovy/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-groovy/pom.xml b/gremlin-groovy/pom.xml
index eefc871..69b5e0c 100644
--- a/gremlin-groovy/pom.xml
+++ b/gremlin-groovy/pom.xml
@@ -21,7 +21,7 @@ limitations under the License.
<parent>
<groupId>org.apache.tinkerpop</groupId>
<artifactId>tinkerpop</artifactId>
- <version>3.1.0-SNAPSHOT</version>
+ <version>3.0.1-SNAPSHOT</version>
</parent>
<artifactId>gremlin-groovy</artifactId>
<name>Apache TinkerPop :: Gremlin Groovy</name>
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6902e68a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
index 99bf36f..3d2048b 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
@@ -82,6 +82,7 @@ public class GremlinExecutor implements AutoCloseable {
private final Map<String, EngineSettings> settings;
private final long scriptEvaluationTimeout;
private final Bindings globalBindings;
+ private final Predicate<Map.Entry<String,Object>> promoteBinding;
private final List<List<String>> use;
private final ExecutorService executorService;
private final ScheduledExecutorService scheduledExecutorService;
@@ -106,6 +107,7 @@ public class GremlinExecutor implements AutoCloseable {
this.settings = builder.settings;
this.scriptEvaluationTimeout = builder.scriptEvaluationTimeout;
this.globalBindings = builder.globalBindings;
+ this.promoteBinding = builder.promoteBinding;
this.enabledPlugins = builder.enabledPlugins;
this.scriptEngines = createScriptEngines();
this.suppliedExecutor = suppliedExecutor;
@@ -420,12 +422,23 @@ public class GremlinExecutor implements AutoCloseable {
// evaluate init scripts with hard reference so as to ensure it doesn't get garbage collected
bindings.put(GremlinGroovyScriptEngine.KEY_REFERENCE_TYPE, GremlinGroovyScriptEngine.REFERENCE_TYPE_HARD);
- // the returned object should be a Map of initialized global bindings
+ // todo: drop the "old method" in 3.1.0
+ // the returned object should be a Map of initialized global bindings - this is in contrast
+ // to the older method of scanning bindings for certain types/keys to promote. the reason
+ // for this change has to do with CompileStatic/TypeChecked "secure" configurations that
+ // require the defined variables to be typed. Under that scenario they are not "unresolved"
+ // and thus don't get set to bindings automatically by the InvokerHelper.
final Object initializedBindings = se.eval(p.getValue1(), bindings, language);
- if (initializedBindings != null && initializedBindings instanceof Map)
+ if (initializedBindings != null && initializedBindings instanceof Map) {
globalBindings.putAll((Map) initializedBindings);
- else
- logger.warn("Initialization script {} did not return a Map - no global bindings specified", p.getValue0());
+ } else {
+ // re-assign graph bindings back to global bindings and grab TraversalSource creations.
+ // prevent assignment of non-graph implementations just in case someone tries to overwrite
+ // them in the init
+ bindings.entrySet().stream()
+ .filter(promoteBinding)
+ .forEach(kv -> globalBindings.put(kv.getKey(), kv.getValue()));
+ }
logger.info("Initialized {} ScriptEngine with {}", language, p.getValue0());
} catch (ScriptException sx) {
@@ -469,6 +482,7 @@ public class GremlinExecutor implements AutoCloseable {
};
private List<List<String>> use = new ArrayList<>();
private Bindings globalBindings = new SimpleBindings();
+ private Predicate<Map.Entry<String,Object>> promoteBinding = kv -> false;
private Builder() {
}
@@ -495,6 +509,16 @@ public class GremlinExecutor implements AutoCloseable {
}
/**
+ * A predicate applied to the binding list to determine if it should be promoted to a "global" binding
+ * that should be tied to every script.
+ */
+ @Deprecated
+ public Builder promoteBindings(final Predicate<Map.Entry<String,Object>> promoteBinding) {
+ this.promoteBinding = promoteBinding;
+ return this;
+ }
+
+ /**
* Bindings to apply to every script evaluated.
*/
public Builder globalBindings(final Bindings bindings) {
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6902e68a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutorTest.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutorTest.java b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutorTest.java
index 1c164da..1268a3e 100644
--- a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutorTest.java
+++ b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutorTest.java
@@ -412,20 +412,23 @@ public class GremlinExecutorTest {
}
@Test
- public void shouldInitializeWithScriptAndMakeGlobalBinding() throws Exception {
+ public void shouldInitializeWithScriptAndPromoteBinding() throws Exception {
final GremlinExecutor gremlinExecutor = GremlinExecutor.build()
.addEngineSettings("gremlin-groovy",
Collections.emptyList(),
Collections.emptyList(),
Arrays.asList(PATHS.get("GremlinExecutorInit.groovy")),
Collections.emptyMap())
+ .promoteBindings(kv -> kv.getValue() instanceof Set)
.create();
assertEquals(2, gremlinExecutor.eval("add(1,1)").get());
- assertThat(gremlinExecutor.getGlobalBindings().keySet(), not(contains("someSet")));
- assertThat(gremlinExecutor.getGlobalBindings().keySet(), contains("name"));
+ assertThat(gremlinExecutor.getGlobalBindings().keySet(), contains("someSet"));
+ assertThat(gremlinExecutor.getGlobalBindings().keySet(), not(contains("someMap")));
- assertEquals("stephen", gremlinExecutor.getGlobalBindings().get("name"));
+ final Set<String> s = (Set<String>) gremlinExecutor.getGlobalBindings().get("someSet");
+ assertThat(s, contains("test"));
+ assertEquals(1, s.size());
gremlinExecutor.close();
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6902e68a/gremlin-groovy/src/test/resources/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutorInit.groovy
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/test/resources/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutorInit.groovy b/gremlin-groovy/src/test/resources/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutorInit.groovy
index 6f92355..db046b0 100644
--- a/gremlin-groovy/src/test/resources/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutorInit.groovy
+++ b/gremlin-groovy/src/test/resources/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutorInit.groovy
@@ -19,4 +19,5 @@
def add(x, y) { x + y }
someSet = ["test"] as Set
-[name:"stephen"]
+someMap = [name:"stephen"]
+""
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6902e68a/gremlin-server/conf/gremlin-server-classic.yaml
----------------------------------------------------------------------
diff --git a/gremlin-server/conf/gremlin-server-classic.yaml b/gremlin-server/conf/gremlin-server-classic.yaml
index a054346..0023de4 100644
--- a/gremlin-server/conf/gremlin-server-classic.yaml
+++ b/gremlin-server/conf/gremlin-server-classic.yaml
@@ -31,7 +31,7 @@ scriptEngines: {
staticImports: [java.lang.Math.PI],
scripts: [scripts/complex-lifecycle.groovy]}}
serializers:
- - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { useMapperFromGraph: graph }} # application/vnd.gremlin-v1.0+gryo
+ - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0 } # application/vnd.gremlin-v1.0+gryo
- { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { serializeResultToString: true }} # application/vnd.gremlin-v1.0+gryo-stringd
metrics: {
slf4jReporter: {enabled: true, interval: 180000}}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6902e68a/gremlin-server/conf/gremlin-server-modern-readonly.yaml
----------------------------------------------------------------------
diff --git a/gremlin-server/conf/gremlin-server-modern-readonly.yaml b/gremlin-server/conf/gremlin-server-modern-readonly.yaml
index 1f44153..ba2d108 100644
--- a/gremlin-server/conf/gremlin-server-modern-readonly.yaml
+++ b/gremlin-server/conf/gremlin-server-modern-readonly.yaml
@@ -31,7 +31,7 @@ scriptEngines: {
staticImports: [java.lang.Math.PI],
scripts: [scripts/generate-modern-readonly.groovy]}}
serializers:
- - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { useMapperFromGraph: graph }} # application/vnd.gremlin-v1.0+gryo
+ - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0 } # application/vnd.gremlin-v1.0+gryo
- { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { serializeResultToString: true }} # application/vnd.gremlin-v1.0+gryo-stringd
metrics: {
slf4jReporter: {enabled: true, interval: 180000}}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6902e68a/gremlin-server/conf/gremlin-server-modern.yaml
----------------------------------------------------------------------
diff --git a/gremlin-server/conf/gremlin-server-modern.yaml b/gremlin-server/conf/gremlin-server-modern.yaml
index 35b1f54..8b009e5 100644
--- a/gremlin-server/conf/gremlin-server-modern.yaml
+++ b/gremlin-server/conf/gremlin-server-modern.yaml
@@ -31,7 +31,7 @@ scriptEngines: {
staticImports: [java.lang.Math.PI],
scripts: [scripts/generate-modern.groovy]}}
serializers:
- - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { useMapperFromGraph: graph }} # application/vnd.gremlin-v1.0+gryo
+ - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0 } # application/vnd.gremlin-v1.0+gryo
- { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { serializeResultToString: true }} # application/vnd.gremlin-v1.0+gryo-stringd
metrics: {
slf4jReporter: {enabled: true, interval: 180000}}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6902e68a/gremlin-server/conf/gremlin-server-secure.yaml
----------------------------------------------------------------------
diff --git a/gremlin-server/conf/gremlin-server-secure.yaml b/gremlin-server/conf/gremlin-server-secure.yaml
index 20ae461..7fce9f7 100644
--- a/gremlin-server/conf/gremlin-server-secure.yaml
+++ b/gremlin-server/conf/gremlin-server-secure.yaml
@@ -45,7 +45,7 @@ scriptEngines: {
"org.apache.tinkerpop.gremlin.groovy.jsr223.customizer.TimedInterruptCustomizerProvider":[10000],
"org.apache.tinkerpop.gremlin.groovy.jsr223.customizer.CompileStaticCustomizerProvider":["org.apache.tinkerpop.gremlin.groovy.jsr223.customizer.SimpleSandboxExtension"]}}}}
serializers:
- - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { useMapperFromGraph: graph }} # application/vnd.gremlin-v1.0+gryo
+ - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0 } # application/vnd.gremlin-v1.0+gryo
- { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { serializeResultToString: true }} # application/vnd.gremlin-v1.0+gryo-stringd
- { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV1d0 } # application/vnd.gremlin-v1.0+json
- { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0 } # application/json
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6902e68a/gremlin-server/conf/gremlin-server.yaml
----------------------------------------------------------------------
diff --git a/gremlin-server/conf/gremlin-server.yaml b/gremlin-server/conf/gremlin-server.yaml
index 7899b56..e6c0d1b 100644
--- a/gremlin-server/conf/gremlin-server.yaml
+++ b/gremlin-server/conf/gremlin-server.yaml
@@ -35,7 +35,7 @@ scriptEngines: {
imports: [java.lang.Math],
staticImports: [java.lang.Math.PI]}}
serializers:
- - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { useMapperFromGraph: graph }} # application/vnd.gremlin-v1.0+gryo
+ - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0 } # application/vnd.gremlin-v1.0+gryo
- { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { serializeResultToString: true }} # application/vnd.gremlin-v1.0+gryo-stringd
- { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV1d0 } # application/vnd.gremlin-v1.0+json
- { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0 } # application/json
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6902e68a/gremlin-server/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-server/pom.xml b/gremlin-server/pom.xml
index 57bbaff..9a9a110 100644
--- a/gremlin-server/pom.xml
+++ b/gremlin-server/pom.xml
@@ -21,7 +21,7 @@ limitations under the License.
<parent>
<groupId>org.apache.tinkerpop</groupId>
<artifactId>tinkerpop</artifactId>
- <version>3.1.0-SNAPSHOT</version>
+ <version>3.0.1-SNAPSHOT</version>
</parent>
<artifactId>gremlin-server</artifactId>
<name>Apache TinkerPop :: Gremlin Server</name>
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6902e68a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/session/Session.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/session/Session.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/session/Session.java
index 4c2364e..e998c3a 100644
--- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/session/Session.java
+++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/session/Session.java
@@ -135,6 +135,8 @@ public class Session {
})
.enabledPlugins(new HashSet<>(settings.plugins))
.globalBindings(graphManager.getAsBindings())
+ .promoteBindings(kv -> kv.getValue() instanceof Graph
+ || kv.getValue() instanceof TraversalSource)
.executorService(executor)
.scheduledExecutorService(scheduledExecutorService);
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6902e68a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/ServerGremlinExecutor.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/ServerGremlinExecutor.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/ServerGremlinExecutor.java
index a3a2175..02a763a 100644
--- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/ServerGremlinExecutor.java
+++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/ServerGremlinExecutor.java
@@ -95,6 +95,7 @@ public class ServerGremlinExecutor<T extends ScheduledExecutorService> {
logger.info("Initialized Gremlin thread pool. Threads in pool named with pattern gremlin-*");
+ // todo: deprecate promoteBindings in 3.1.0
final GremlinExecutor.Builder gremlinExecutorBuilder = GremlinExecutor.build()
.scriptEvaluationTimeout(settings.scriptEvaluationTimeout)
.afterFailure((b, e) -> graphManager.rollbackAll())
@@ -102,6 +103,9 @@ public class ServerGremlinExecutor<T extends ScheduledExecutorService> {
.afterTimeout(b -> graphManager.rollbackAll())
.enabledPlugins(new HashSet<>(settings.plugins))
.globalBindings(graphManager.getAsBindings())
+ .promoteBindings(kv -> kv.getValue() instanceof Graph
+ || kv.getValue() instanceof TraversalSource
+ || kv.getValue() instanceof LifeCycleHook)
.executorService(this.gremlinExecutorService)
.scheduledExecutorService(this.scheduledExecutorService);
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6902e68a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java
index 2437e16..407436c 100644
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java
@@ -370,7 +370,7 @@ public class GremlinDriverIntegrateTest extends AbstractGremlinServerIntegration
final Cluster cluster = Cluster.open();
final Client client = cluster.connect();
- final ResultSet results = client.submit("TinkerGraph.open().variables()");
+ final ResultSet results = client.submit("TinkerFactory.createClassic()");
try {
results.all().join();
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6902e68a/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 7315e71..53bb631 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
@@ -115,7 +115,7 @@ public class GremlinResultSetIntegrateTest extends AbstractGremlinServerIntegrat
@Test
public void shouldHandlePathResult() throws Exception {
- final ResultSet results = client.submit("g.V().out().path()");
+ final ResultSet results = client.submit("g.V().out().path().next()");
final Path p = results.all().get().get(0).getPath();
assertThat(p, instanceOf(DetachedPath.class));
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6902e68a/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/server/gremlin-server-integration.yaml
----------------------------------------------------------------------
diff --git a/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/server/gremlin-server-integration.yaml b/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/server/gremlin-server-integration.yaml
index 7b6e5c2..f57225d 100644
--- a/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/server/gremlin-server-integration.yaml
+++ b/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/server/gremlin-server-integration.yaml
@@ -34,7 +34,7 @@ scriptEngines: {
imports: [java.lang.Math],
staticImports: [java.lang.Math.PI]}}
serializers:
- - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { useMapperFromGraph: graph, custom: [groovy.json.JsonBuilder;org.apache.tinkerpop.gremlin.driver.ser.JsonBuilderGryoSerializer]}}
+ - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { custom: [groovy.json.JsonBuilder;org.apache.tinkerpop.gremlin.driver.ser.JsonBuilderGryoSerializer]}}
- { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { serializeResultToString: true}}
- { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV1d0 }
- { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0 }
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6902e68a/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/server/gremlin-server-performance.yaml
----------------------------------------------------------------------
diff --git a/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/server/gremlin-server-performance.yaml b/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/server/gremlin-server-performance.yaml
index e907343..8abc6ac 100644
--- a/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/server/gremlin-server-performance.yaml
+++ b/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/server/gremlin-server-performance.yaml
@@ -34,7 +34,7 @@ scriptEngines: {
imports: [java.lang.Math],
staticImports: [java.lang.Math.PI]}}
serializers:
- - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { useMapperFromGraph: graph }}
+ - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0 }
- { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV1d0 }
- { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0 }
processors:
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6902e68a/gremlin-shaded/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-shaded/pom.xml b/gremlin-shaded/pom.xml
index 6861b52..056f694 100644
--- a/gremlin-shaded/pom.xml
+++ b/gremlin-shaded/pom.xml
@@ -20,7 +20,7 @@ limitations under the License.
<parent>
<groupId>org.apache.tinkerpop</groupId>
<artifactId>tinkerpop</artifactId>
- <version>3.1.0-SNAPSHOT</version>
+ <version>3.0.1-SNAPSHOT</version>
</parent>
<artifactId>gremlin-shaded</artifactId>
<name>Apache TinkerPop :: Gremlin Shaded</name>
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6902e68a/gremlin-test/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-test/pom.xml b/gremlin-test/pom.xml
index 4433c14..1a412a1 100644
--- a/gremlin-test/pom.xml
+++ b/gremlin-test/pom.xml
@@ -21,7 +21,7 @@ limitations under the License.
<parent>
<groupId>org.apache.tinkerpop</groupId>
<artifactId>tinkerpop</artifactId>
- <version>3.1.0-SNAPSHOT</version>
+ <version>3.0.1-SNAPSHOT</version>
</parent>
<artifactId>gremlin-test</artifactId>
<name>Apache TinkerPop :: Gremlin Test</name>
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6902e68a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinTest.java
index 97dfea2..d05e162 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinTest.java
@@ -149,12 +149,12 @@ public abstract class AbstractGremlinTest {
/**
* Looks up the identifier as generated by the current source graph being tested.
*
- * @param graph the graph to get the element id from
+ * @param g the graph to get the element id from
* @param vertexName a unique string that will identify a graph element within a graph
* @return the id as generated by the graph
*/
- public Object convertToVertexId(final Graph graph, final String vertexName) {
- return convertToVertex(graph, vertexName).id();
+ public Object convertToVertexId(final Graph g, final String vertexName) {
+ return convertToVertex(g, vertexName).id();
}
public Vertex convertToVertex(final Graph graph, final String vertexName) {
@@ -166,8 +166,8 @@ public abstract class AbstractGremlinTest {
return convertToVertexPropertyId(graph, vertexName, vertexPropertyKey);
}
- public GraphTraversal<Vertex, Object> convertToVertexPropertyId(final Graph graph, final String vertexName, final String vertexPropertyKey) {
- return convertToVertexProperty(graph, vertexName, vertexPropertyKey).id();
+ public GraphTraversal<Vertex, Object> convertToVertexPropertyId(final Graph g, final String vertexName, final String vertexPropertyKey) {
+ return convertToVertexProperty(g, vertexName, vertexPropertyKey).id();
}
public GraphTraversal<Vertex, VertexProperty<Object>> convertToVertexProperty(final Graph graph, final String vertexName, final String vertexPropertyKey) {
@@ -186,34 +186,34 @@ public abstract class AbstractGremlinTest {
/**
* Utility method that commits if the graph supports transactions.
*/
- public void tryCommit(final Graph graph) {
- if (graph.features().graph().supportsTransactions())
- graph.tx().commit();
+ public void tryCommit(final Graph g) {
+ if (g.features().graph().supportsTransactions())
+ g.tx().commit();
}
- public void tryRandomCommit(final Graph graph) {
- if (graph.features().graph().supportsTransactions() && new Random().nextBoolean())
- graph.tx().commit();
+ public void tryRandomCommit(final Graph g) {
+ if (g.features().graph().supportsTransactions() && new Random().nextBoolean())
+ g.tx().commit();
}
/**
* Utility method that commits if the graph supports transactions and executes an assertion function before and
* after the commit. It assumes that the assertion should be true before and after the commit.
*/
- public void tryCommit(final Graph graph, final Consumer<Graph> assertFunction) {
- assertFunction.accept(graph);
- if (graph.features().graph().supportsTransactions()) {
- graph.tx().commit();
- assertFunction.accept(graph);
+ public void tryCommit(final Graph g, final Consumer<Graph> assertFunction) {
+ assertFunction.accept(g);
+ if (g.features().graph().supportsTransactions()) {
+ g.tx().commit();
+ assertFunction.accept(g);
}
}
/**
* Utility method that rollsback if the graph supports transactions.
*/
- public void tryRollback(final Graph graph) {
- if (graph.features().graph().supportsTransactions())
- graph.tx().rollback();
+ public void tryRollback(final Graph g) {
+ if (g.features().graph().supportsTransactions())
+ g.tx().rollback();
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6902e68a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphProvider.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphProvider.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphProvider.java
index 1941ac4..766e70d 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphProvider.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphProvider.java
@@ -29,9 +29,8 @@ 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.engine.StandardTraversalEngine;
-import org.apache.tinkerpop.gremlin.process.traversal.traverser.B_LP_O_P_S_SE_SL_Traverser;
-import org.apache.tinkerpop.gremlin.process.traversal.traverser.B_LP_O_S_SE_SL_Traverser;
import org.apache.tinkerpop.gremlin.process.traversal.traverser.B_O_S_SE_SL_Traverser;
+import org.apache.tinkerpop.gremlin.process.traversal.traverser.B_O_P_S_SE_SL_Traverser;
import org.apache.tinkerpop.gremlin.process.traversal.traverser.B_O_Traverser;
import org.apache.tinkerpop.gremlin.process.traversal.traverser.O_Traverser;
import org.apache.tinkerpop.gremlin.structure.Edge;
@@ -79,8 +78,7 @@ public interface GraphProvider {
add(DefaultGraphTraversal.class);
add(GraphTraversalSource.class);
add(B_O_S_SE_SL_Traverser.class);
- add(B_LP_O_P_S_SE_SL_Traverser.class);
- add(B_LP_O_S_SE_SL_Traverser.class);
+ add(B_O_P_S_SE_SL_Traverser.class);
add(B_O_Traverser.class);
add(O_Traverser.class);
}};
@@ -188,7 +186,7 @@ public interface GraphProvider {
* @param test the test class
* @param testMethodName the name of the test
* @param configurationOverrides settings to override defaults with.
- * @param loadGraphWith the data set to load and will be null if no data is to be loaded
+ * @param loadGraphWith the data set to load and will be null if no data is to be loaded
*/
public Configuration newGraphConfiguration(final String graphName,
final Class<?> test,
@@ -238,7 +236,7 @@ public interface GraphProvider {
* <li>{@link Graph}</li>
* <li>{@link org.apache.tinkerpop.gremlin.structure.Graph.Variables}</li>
* <li>{@link GraphTraversal}</li>
- * <li>{@link B_LP_O_P_S_SE_SL_Traverser}</li>
+ * <li>{@link B_O_P_S_SE_SL_Traverser}</li>
* <li>{@link Property}</li>
* <li>{@link B_O_S_SE_SL_Traverser}</li>
* <li>{@link Traversal}</li>
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6902e68a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/ProcessComputerSuite.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/ProcessComputerSuite.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/ProcessComputerSuite.java
index f859267..a14fc25 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/ProcessComputerSuite.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/ProcessComputerSuite.java
@@ -41,7 +41,27 @@ import org.apache.tinkerpop.gremlin.process.traversal.step.filter.SampleTest;
import org.apache.tinkerpop.gremlin.process.traversal.step.filter.SimplePathTest;
import org.apache.tinkerpop.gremlin.process.traversal.step.filter.TailTest;
import org.apache.tinkerpop.gremlin.process.traversal.step.filter.WhereTest;
-import org.apache.tinkerpop.gremlin.process.traversal.step.map.*;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.AddEdgeTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.CoalesceTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.ConstantTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.CountTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.FlatMapTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.FoldTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.MapKeysTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.MapTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.MapValuesTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.MatchTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.MaxTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.MeanTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.MinTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.OrderTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.PathTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.PropertiesTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.SelectTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.SumTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.UnfoldTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.ValueMapTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.VertexTest;
import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.AggregateTest;
import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.GroupCountTest;
import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.GroupTest;
@@ -110,7 +130,6 @@ public class ProcessComputerSuite extends AbstractGremlinSuite {
CountTest.Traversals.class,
FlatMapTest.Traversals.class,
FoldTest.Traversals.class,
- LoopsTest.Traversals.class,
MapTest.Traversals.class,
MapKeysTest.Traversals.class,
MapValuesTest.Traversals.class,
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6902e68a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/ProcessStandardSuite.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/ProcessStandardSuite.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/ProcessStandardSuite.java
index c380391..4c9d8e6 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/ProcessStandardSuite.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/ProcessStandardSuite.java
@@ -83,7 +83,6 @@ public class ProcessStandardSuite extends AbstractGremlinSuite {
CountTest.Traversals.class,
FlatMapTest.Traversals.class,
FoldTest.Traversals.class,
- LoopsTest.Traversals.class,
MapTest.Traversals.class,
MapKeysTest.Traversals.class,
MapValuesTest.Traversals.class,
@@ -169,7 +168,6 @@ public class ProcessStandardSuite extends AbstractGremlinSuite {
CountTest.class,
FlatMapTest.class,
FoldTest.class,
- LoopsTest.class,
MapTest.class,
MapKeysTest.class,
MapValuesTest.class,