This is an automated email from the ASF dual-hosted git repository. spmallette pushed a commit to branch TINKERPOP-2079 in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
commit e46610eaf45a1efc3f7acabb7122175e8e74e43d Author: Stephen Mallette <sp...@genoprime.com> AuthorDate: Fri Nov 9 12:13:15 2018 -0500 TINKERPOP-2079 Moved RemoteGraph to gremlin-test This is a breaking change as it removes the long deprecated RemoteGraph from gremlin-core. Users should not have been using this at this point, so the impact should be fairly limited. RemoteGraph is still needed as a test component because we need a Graph instance for the JVM test suite to run properly. This change required some refactoring as well in the RemoteGraphProvider so that configurations were being passed around properly to allow for the test suite to re-attach elements. Tha [...] --- CHANGELOG.asciidoc | 4 +- docs/src/upgrade/release-3.4.x.asciidoc | 14 ++++++- .../tinkerpop/gremlin/jsr223/CoreImports.java | 2 - .../strategy/decoration/RemoteStrategy.java | 38 ++--------------- .../driver/remote/DriverRemoteConnection.java | 5 +-- .../driver/remote/RemoteGraphComputerProvider.java | 2 +- .../gremlin/driver/remote/RemoteGraphProvider.java | 7 ++-- ...emoteGraphGroovyTranslatorComputerProvider.java | 2 +- ...teGraphGroovyTranslatorProcessComputerTest.java | 2 +- ...teGraphGroovyTranslatorProcessStandardTest.java | 2 +- .../remote/RemoteGraphProcessComputerTest.java | 2 +- .../remote/RemoteGraphProcessStandardTest.java | 2 +- .../gremlin/server/GremlinServerIntegrateTest.java | 4 +- .../tinkerpop/gremlin/AbstractGremlinTest.java | 6 +-- .../process/traversal/step/map/ReadTest.java | 5 +-- .../decoration/SubgraphStrategyProcessTest.java | 2 +- .../verification/ReadOnlyStrategyProcessTest.java | 2 +- .../tinkerpop/gremlin/structure}/RemoteGraph.java | 48 +++++++++------------- 18 files changed, 57 insertions(+), 92 deletions(-) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index a2778fb..603cce0 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -28,7 +28,7 @@ This release also includes changes from <<release-3-3-3, 3.3.3>>. * Use `Compare.eq` in `Contains` predicates to ensure the same filter behavior for numeric values. * Added `OptionsStrategy` to allow traversals to take arbitrary traversal-wide configurations. * Added text predicates. -* Removed groovy-sql +* Removed groovy-sql dependency. * Modified `Mutating` steps so that they are no longer marked as `final`. * Rewrote `ConnectiveStrategy` to support an arbitrary number of infix notations in a single traversal. * GraphSON `MessageSerializer`s will automatically register the GremlinServerModule to a provided GraphSONMapper. @@ -71,6 +71,8 @@ This release also includes changes from <<release-3-3-3, 3.3.3>>. * Nested loop support added allowing `repeat()` steps to be nested. * Events from `EventStrategy` raised from "new" mutations will now return a `KeyedVertexProperty` or `KeyedProperty` as is appropriate. * `MutationListener#vertexPropertyChanged(Vertex, VertexProperty, Object, Object...)` no longer has a default implementation. +* Moved previously deprecated `RemoteGraph` to `gremlin-test` as it is now just a testing component. +* Removed previously deprecated `RemoteStrategy.instance()` and the strategy no longer has any connection to `RemoteGraph`. * Removed previously deprecated methods in `SubgraphStrategy` and `PartitionStrategy` builders. * Removed previously deprecated Credentials DSL infrastructure. * Removed previously deprecated `MutationListener#vertexPropertyChanged(Vertex, Property, Object, Object...)`. diff --git a/docs/src/upgrade/release-3.4.x.asciidoc b/docs/src/upgrade/release-3.4.x.asciidoc index bc4b921..02c03e2 100644 --- a/docs/src/upgrade/release-3.4.x.asciidoc +++ b/docs/src/upgrade/release-3.4.x.asciidoc @@ -252,6 +252,15 @@ List<Result> result = client.submit("g.V()", options).all().get(); See: link:https://issues.apache.org/jira/browse/TINKERPOP-1342[TINKERPOP-1342] +==== Moving of RemoteGraph + +`RemoteGraph` was long ago deprecated in favor of `withRemote()`. It became even less useful with the introduction of +the `AnonymousTraversalSource` concept in 3.3.5. It's only real use was for testing remote bytecode based traversals +in the test suite as the test suite requires an actual `Graph` object to function properly. As such, `RemoteGraph` has +been moved to `gremlin-test`. It should no longer be used in any capacity besides that. + +See: link:https://issues.apache.org/jira/browse/TINKERPOP-2079[TINKERPOP-2079] + ==== Removal of Giraph Support Support for Giraph has been removed as of this version. There were a number of reasons for this decision which were @@ -350,6 +359,8 @@ The following deprecated classes, methods or fields have been removed in this ve * `gremlin-core` ** `org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer#GREMLIN_CORE` +** `org.apache.tinkerpop.gremlin.process.remote.RemoteGraph` - moved to `gremlin-test`. +** `org.apache.tinkerpop.gremlin.process.remote.traversal.strategy.decoration.RemoteStrategy#identity()` ** `org.apache.tinkerpop.gremlin.process.traversal.TraversalEngine` ** `org.apache.tinkerpop.gremlin.process.traversal.engine.*` ** `org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.PartitionStrategy.Builder#addReadPartition(String)` @@ -386,7 +397,8 @@ link:https://issues.apache.org/jira/browse/TINKERPOP-1296[TINKERPOP-1296], link:https://issues.apache.org/jira/browse/TINKERPOP-1705[TINKERPOP-1705], link:https://issues.apache.org/jira/browse/TINKERPOP-1707[TINKERPOP-1707], link:https://issues.apache.org/jira/browse/TINKERPOP-1954[TINKERPOP-1954], -link:https://issues.apache.org/jira/browse/TINKERPOP-1986[TINKERPOP-1986] +link:https://issues.apache.org/jira/browse/TINKERPOP-1986[TINKERPOP-1986], +link:https://issues.apache.org/jira/browse/TINKERPOP-2079[TINKERPOP-2079] ==== Modifications to reducing barrier steps diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreImports.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreImports.java index 08d4936..bff3b63 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreImports.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreImports.java @@ -58,7 +58,6 @@ import org.apache.tinkerpop.gremlin.process.computer.traversal.step.map.Shortest import org.apache.tinkerpop.gremlin.process.computer.traversal.strategy.decoration.VertexProgramStrategy; import org.apache.tinkerpop.gremlin.process.computer.traversal.strategy.optimization.GraphFilterStrategy; import org.apache.tinkerpop.gremlin.process.remote.RemoteConnection; -import org.apache.tinkerpop.gremlin.process.remote.RemoteGraph; import org.apache.tinkerpop.gremlin.process.traversal.Bindings; import org.apache.tinkerpop.gremlin.process.traversal.IO; import org.apache.tinkerpop.gremlin.process.traversal.Operator; @@ -187,7 +186,6 @@ public final class CoreImports { CLASS_IMPORTS.add(TextP.class); // remote CLASS_IMPORTS.add(RemoteConnection.class); - CLASS_IMPORTS.add(RemoteGraph.class); CLASS_IMPORTS.add(EmptyGraph.class); // io CLASS_IMPORTS.add(GraphReader.class); diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/remote/traversal/strategy/decoration/RemoteStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/remote/traversal/strategy/decoration/RemoteStrategy.java index f6e3ed6..3d98e95 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/remote/traversal/strategy/decoration/RemoteStrategy.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/remote/traversal/strategy/decoration/RemoteStrategy.java @@ -20,7 +20,6 @@ package org.apache.tinkerpop.gremlin.process.remote.traversal.strategy.decoratio import org.apache.tinkerpop.gremlin.process.computer.traversal.strategy.decoration.VertexProgramStrategy; import org.apache.tinkerpop.gremlin.process.remote.RemoteConnection; -import org.apache.tinkerpop.gremlin.process.remote.RemoteGraph; import org.apache.tinkerpop.gremlin.process.remote.traversal.step.map.RemoteStep; import org.apache.tinkerpop.gremlin.process.traversal.Traversal; import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy; @@ -38,12 +37,8 @@ import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SideEf import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SubgraphStrategy; import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.VerificationException; import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper; -import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph; -import java.util.Arrays; -import java.util.Collections; import java.util.HashSet; -import java.util.Optional; import java.util.Set; /** @@ -57,8 +52,7 @@ import java.util.Set; public final class RemoteStrategy extends AbstractTraversalStrategy<TraversalStrategy.DecorationStrategy> implements TraversalStrategy.DecorationStrategy { - private static final RemoteStrategy INSTANCE = new RemoteStrategy(); - private final Optional<RemoteConnection> remoteConnection; + private final RemoteConnection remoteConnection; /** * Should be applied before all {@link DecorationStrategy} instances. @@ -76,21 +70,9 @@ public final class RemoteStrategy extends AbstractTraversalStrategy<TraversalStr add(SubgraphStrategy.class); }}; - private RemoteStrategy() { - remoteConnection = Optional.empty(); - } - public RemoteStrategy(final RemoteConnection remoteConnection) { - this.remoteConnection = Optional.ofNullable(remoteConnection); - } - - /** - * @deprecated As of release 3.2.2, replaced by {@link #RemoteStrategy(RemoteConnection)} where this method should - * only be used by {@link RemoteGraph} for backward compatibility. - */ - @Deprecated - public static RemoteStrategy instance() { - return INSTANCE; + if (null == remoteConnection) throw new IllegalArgumentException("remoteConnection cannot be null"); + this.remoteConnection = remoteConnection; } @Override @@ -100,17 +82,6 @@ public final class RemoteStrategy extends AbstractTraversalStrategy<TraversalStr @Override public void apply(final Traversal.Admin<?, ?> traversal) { - // this check for a remoteConnection is really only relevant for backward compatibility for RemoteGraph prior - // to the now preferred method of withRemote(). - if (!remoteConnection.isPresent()) { - if (!(traversal.getGraph().orElse(EmptyGraph.instance()) instanceof RemoteGraph)) - throw new IllegalStateException("RemoteStrategy expects a RemoteGraph instance attached to the Traversal"); - - final RemoteGraph remoteGraph = (RemoteGraph) traversal.getGraph().get(); - if (null == remoteGraph.getConnection()) - throw new IllegalStateException("RemoteStrategy expects the RemoteGraph instance to have a RemoteConnection"); - } - if (!(traversal.getParent() instanceof EmptyStep)) return; @@ -122,8 +93,7 @@ public final class RemoteStrategy extends AbstractTraversalStrategy<TraversalStr } // remote step wraps the traversal and emits the results from the remote connection. - final RemoteStep<?, ?> remoteStep = new RemoteStep<>(traversal, - remoteConnection.orElseGet(() -> ((RemoteGraph) traversal.getGraph().get()).getConnection())); + final RemoteStep<?, ?> remoteStep = new RemoteStep<>(traversal, remoteConnection); TraversalHelper.removeAllSteps(traversal); traversal.addStep(remoteStep); diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/remote/DriverRemoteConnection.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/remote/DriverRemoteConnection.java index e6fa945..8fc7d21 100644 --- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/remote/DriverRemoteConnection.java +++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/remote/DriverRemoteConnection.java @@ -25,7 +25,6 @@ import org.apache.tinkerpop.gremlin.driver.ResultSet; import org.apache.tinkerpop.gremlin.process.computer.traversal.strategy.decoration.VertexProgramStrategy; import org.apache.tinkerpop.gremlin.process.remote.RemoteConnection; import org.apache.tinkerpop.gremlin.process.remote.RemoteConnectionException; -import org.apache.tinkerpop.gremlin.process.remote.RemoteGraph; import org.apache.tinkerpop.gremlin.process.remote.traversal.RemoteTraversal; import org.apache.tinkerpop.gremlin.process.traversal.Bytecode; import org.apache.tinkerpop.gremlin.process.traversal.Traversal; @@ -33,7 +32,6 @@ import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource; import org.apache.tinkerpop.gremlin.process.traversal.Traverser; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.structure.Graph; -import org.apache.tinkerpop.gremlin.structure.util.GraphFactory; import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils; import java.util.Iterator; @@ -161,8 +159,7 @@ public class DriverRemoteConnection implements RemoteConnection { } /** - * Creates a {@link DriverRemoteConnection} using an Apache {@code Configuration} object. This method of creation - * is typically used by {@link RemoteGraph} when being constructed via {@link GraphFactory}. The + * Creates a {@link DriverRemoteConnection} using an Apache {@code Configuration} object. The * {@code Configuration} object should contain one of two required keys, either: {@code clusterConfigurationFile} * or {@code clusterConfiguration}. The {@code clusterConfigurationFile} key is a pointer to a file location * containing a configuration for a {@link Cluster}. The {@code clusterConfiguration} should contain the actual diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/driver/remote/RemoteGraphComputerProvider.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/driver/remote/RemoteGraphComputerProvider.java index 0fc1086..d310a55 100644 --- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/driver/remote/RemoteGraphComputerProvider.java +++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/driver/remote/RemoteGraphComputerProvider.java @@ -21,7 +21,7 @@ package org.apache.tinkerpop.gremlin.driver.remote; import org.apache.tinkerpop.gremlin.GraphProvider; import org.apache.tinkerpop.gremlin.process.computer.Computer; -import org.apache.tinkerpop.gremlin.process.remote.RemoteGraph; +import org.apache.tinkerpop.gremlin.structure.RemoteGraph; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.structure.Graph; import org.apache.tinkerpop.gremlin.tinkergraph.process.computer.TinkerGraphComputer; diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/driver/remote/RemoteGraphProvider.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/driver/remote/RemoteGraphProvider.java index a7ef58a..204d21a 100644 --- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/driver/remote/RemoteGraphProvider.java +++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/driver/remote/RemoteGraphProvider.java @@ -23,7 +23,8 @@ import org.apache.tinkerpop.gremlin.AbstractGraphProvider; import org.apache.tinkerpop.gremlin.LoadGraphWith; import org.apache.tinkerpop.gremlin.driver.Client; import org.apache.tinkerpop.gremlin.driver.Cluster; -import org.apache.tinkerpop.gremlin.process.remote.RemoteGraph; +import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource; +import org.apache.tinkerpop.gremlin.structure.RemoteGraph; import org.apache.tinkerpop.gremlin.process.traversal.AnonymousTraversalSource; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.server.GremlinServer; @@ -74,7 +75,7 @@ public class RemoteGraphProvider extends AbstractGraphProvider implements AutoCl public Graph openTestGraph(final Configuration config) { final String serverGraphName = config.getString(DriverRemoteConnection.GREMLIN_REMOTE_DRIVER_SOURCENAME); return remoteCache.computeIfAbsent(serverGraphName, - k -> RemoteGraph.open(new DriverRemoteConnection(cluster, config))); + k -> RemoteGraph.open(new DriverRemoteConnection(cluster, config), config)); } @Override @@ -85,7 +86,7 @@ public class RemoteGraphProvider extends AbstractGraphProvider implements AutoCl final Supplier<Graph> graphGetter = () -> server.getServerGremlinExecutor().getGraphManager().getGraph(serverGraphName); return new HashMap<String, Object>() {{ put(Graph.GRAPH, RemoteGraph.class.getName()); - put(RemoteGraph.GREMLIN_REMOTE_GRAPH_REMOTE_CONNECTION_CLASS, DriverRemoteConnection.class.getName()); + put(TraversalSource.GREMLIN_REMOTE_CONNECTION_CLASS, DriverRemoteConnection.class.getName()); put(DriverRemoteConnection.GREMLIN_REMOTE_DRIVER_SOURCENAME, "g" + serverGraphName); put("clusterConfiguration.port", TestClientFactory.PORT); put("clusterConfiguration.hosts", "localhost"); diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/RemoteGraphGroovyTranslatorComputerProvider.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/RemoteGraphGroovyTranslatorComputerProvider.java index 1b6cf70..456ba89 100644 --- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/RemoteGraphGroovyTranslatorComputerProvider.java +++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/RemoteGraphGroovyTranslatorComputerProvider.java @@ -21,7 +21,7 @@ package org.apache.tinkerpop.gremlin.groovy.jsr223; import org.apache.tinkerpop.gremlin.GraphProvider; import org.apache.tinkerpop.gremlin.process.computer.Computer; -import org.apache.tinkerpop.gremlin.process.remote.RemoteGraph; +import org.apache.tinkerpop.gremlin.structure.RemoteGraph; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.structure.Graph; import org.apache.tinkerpop.gremlin.tinkergraph.process.computer.TinkerGraphComputer; diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/RemoteGraphGroovyTranslatorProcessComputerTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/RemoteGraphGroovyTranslatorProcessComputerTest.java index ba95fde..401990d 100644 --- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/RemoteGraphGroovyTranslatorProcessComputerTest.java +++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/RemoteGraphGroovyTranslatorProcessComputerTest.java @@ -21,7 +21,7 @@ package org.apache.tinkerpop.gremlin.groovy.jsr223; import org.apache.tinkerpop.gremlin.GraphProviderClass; import org.apache.tinkerpop.gremlin.process.ProcessComputerSuite; -import org.apache.tinkerpop.gremlin.process.remote.RemoteGraph; +import org.apache.tinkerpop.gremlin.structure.RemoteGraph; import org.junit.runner.RunWith; /** diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/RemoteGraphGroovyTranslatorProcessStandardTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/RemoteGraphGroovyTranslatorProcessStandardTest.java index db71d2c..e7fc9ba 100644 --- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/RemoteGraphGroovyTranslatorProcessStandardTest.java +++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/RemoteGraphGroovyTranslatorProcessStandardTest.java @@ -21,7 +21,7 @@ package org.apache.tinkerpop.gremlin.groovy.jsr223; import org.apache.tinkerpop.gremlin.GraphProviderClass; import org.apache.tinkerpop.gremlin.process.ProcessStandardSuite; -import org.apache.tinkerpop.gremlin.process.remote.RemoteGraph; +import org.apache.tinkerpop.gremlin.structure.RemoteGraph; import org.junit.runner.RunWith; /** diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/process/remote/RemoteGraphProcessComputerTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/process/remote/RemoteGraphProcessComputerTest.java index bd5bc3a..a4c053e 100644 --- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/process/remote/RemoteGraphProcessComputerTest.java +++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/process/remote/RemoteGraphProcessComputerTest.java @@ -22,7 +22,7 @@ package org.apache.tinkerpop.gremlin.process.remote; import org.apache.tinkerpop.gremlin.GraphProviderClass; import org.apache.tinkerpop.gremlin.driver.remote.RemoteGraphComputerProvider; import org.apache.tinkerpop.gremlin.process.ProcessComputerSuite; -import org.apache.tinkerpop.gremlin.process.remote.RemoteGraph; +import org.apache.tinkerpop.gremlin.structure.RemoteGraph; import org.junit.runner.RunWith; /** diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/process/remote/RemoteGraphProcessStandardTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/process/remote/RemoteGraphProcessStandardTest.java index 0eec63a..abb1ad2 100644 --- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/process/remote/RemoteGraphProcessStandardTest.java +++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/process/remote/RemoteGraphProcessStandardTest.java @@ -20,7 +20,7 @@ package org.apache.tinkerpop.gremlin.process.remote; import org.apache.tinkerpop.gremlin.GraphProviderClass; import org.apache.tinkerpop.gremlin.process.ProcessStandardSuite; -import org.apache.tinkerpop.gremlin.process.remote.RemoteGraph; +import org.apache.tinkerpop.gremlin.structure.RemoteGraph; import org.apache.tinkerpop.gremlin.driver.remote.RemoteGraphProvider; import org.junit.runner.RunWith; diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java index 74bf876..a556cc3 100644 --- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java +++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java @@ -47,7 +47,7 @@ import org.apache.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine; import org.apache.tinkerpop.gremlin.groovy.jsr223.GroovyCompilerGremlinPlugin; import org.apache.tinkerpop.gremlin.groovy.jsr223.customizer.SimpleSandboxExtension; import org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin; -import org.apache.tinkerpop.gremlin.process.remote.RemoteGraph; +import org.apache.tinkerpop.gremlin.structure.RemoteGraph; import org.apache.tinkerpop.gremlin.process.traversal.Traversal; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; @@ -59,7 +59,6 @@ import org.apache.tinkerpop.gremlin.server.op.standard.StandardOpProcessor; import org.apache.tinkerpop.gremlin.structure.Graph; import org.apache.tinkerpop.gremlin.structure.T; import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex; import org.apache.tinkerpop.gremlin.util.Log4jRecordingAppender; import org.apache.tinkerpop.gremlin.util.function.Lambda; import org.hamcrest.CoreMatchers; @@ -70,7 +69,6 @@ import org.junit.Test; import java.lang.reflect.Field; import java.nio.channels.ClosedChannelException; -import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.Iterator; 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 a58ea0d..c6741df 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 @@ -187,7 +187,7 @@ public abstract class AbstractGremlinTest { public Vertex convertToVertex(final Graph graph, final String vertexName) { // all test graphs have "name" as a unique id which makes it easy to hardcode this...works for now - return graph.traversal().V().has("name", vertexName).next(); + return graphProvider.traversal(graph).V().has("name", vertexName).next(); } public GraphTraversal<Vertex, Object> convertToVertexPropertyId(final String vertexName, final String vertexPropertyKey) { @@ -200,7 +200,7 @@ public abstract class AbstractGremlinTest { public GraphTraversal<Vertex, VertexProperty<Object>> convertToVertexProperty(final Graph graph, final String vertexName, final String vertexPropertyKey) { // all test graphs have "name" as a unique id which makes it easy to hardcode this...works for now - return (GraphTraversal<Vertex, VertexProperty<Object>>) graph.traversal().V().has("name", vertexName).properties(vertexPropertyKey); + return (GraphTraversal<Vertex, VertexProperty<Object>>) graphProvider.traversal(graph).V().has("name", vertexName).properties(vertexPropertyKey); } public Object convertToEdgeId(final String outVertexName, String edgeLabel, final String inVertexName) { @@ -208,7 +208,7 @@ public abstract class AbstractGremlinTest { } public Object convertToEdgeId(final Graph graph, final String outVertexName, String edgeLabel, final String inVertexName) { - return graph.traversal().V().has("name", outVertexName).outE(edgeLabel).as("e").inV().has("name", inVertexName).<Edge>select("e").next().id(); + return graphProvider.traversal(graph).V().has("name", outVertexName).outE(edgeLabel).as("e").inV().has("name", inVertexName).<Edge>select("e").next().id(); } /** diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ReadTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ReadTest.java index 24bacbb..c3b53c4 100644 --- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ReadTest.java +++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ReadTest.java @@ -19,11 +19,10 @@ package org.apache.tinkerpop.gremlin.process.traversal.step.map; import org.apache.tinkerpop.gremlin.FeatureRequirement; -import org.apache.tinkerpop.gremlin.FeatureRequirementSet; import org.apache.tinkerpop.gremlin.TestHelper; import org.apache.tinkerpop.gremlin.process.AbstractGremlinProcessTest; import org.apache.tinkerpop.gremlin.process.GremlinProcessRunner; -import org.apache.tinkerpop.gremlin.process.remote.RemoteGraph; +import org.apache.tinkerpop.gremlin.structure.RemoteGraph; import org.apache.tinkerpop.gremlin.process.traversal.IO; import org.apache.tinkerpop.gremlin.process.traversal.Traversal; import org.apache.tinkerpop.gremlin.structure.Graph; @@ -35,9 +34,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import java.io.IOException; -import java.util.function.Supplier; -import static org.apache.tinkerpop.gremlin.structure.Graph.Features.GraphFeatures.FEATURE_IO_READ; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategyProcessTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategyProcessTest.java index 9968842..f333905 100644 --- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategyProcessTest.java +++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategyProcessTest.java @@ -22,7 +22,7 @@ import org.apache.commons.configuration.MapConfiguration; import org.apache.tinkerpop.gremlin.LoadGraphWith; import org.apache.tinkerpop.gremlin.process.AbstractGremlinProcessTest; import org.apache.tinkerpop.gremlin.process.GremlinProcessRunner; -import org.apache.tinkerpop.gremlin.process.remote.RemoteGraph; +import org.apache.tinkerpop.gremlin.structure.RemoteGraph; import org.apache.tinkerpop.gremlin.process.traversal.Order; import org.apache.tinkerpop.gremlin.process.traversal.P; import org.apache.tinkerpop.gremlin.process.traversal.Traversal; diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/ReadOnlyStrategyProcessTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/ReadOnlyStrategyProcessTest.java index 5d97b6c..0fa4b0c 100644 --- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/ReadOnlyStrategyProcessTest.java +++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/ReadOnlyStrategyProcessTest.java @@ -20,7 +20,7 @@ package org.apache.tinkerpop.gremlin.process.traversal.strategy.verification; import org.apache.tinkerpop.gremlin.FeatureRequirement; import org.apache.tinkerpop.gremlin.process.AbstractGremlinProcessTest; -import org.apache.tinkerpop.gremlin.process.remote.RemoteGraph; +import org.apache.tinkerpop.gremlin.structure.RemoteGraph; import org.apache.tinkerpop.gremlin.process.traversal.Traversal; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.structure.Graph; diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/remote/RemoteGraph.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/RemoteGraph.java similarity index 82% rename from gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/remote/RemoteGraph.java rename to gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/RemoteGraph.java index 680ce4a..5523900 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/remote/RemoteGraph.java +++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/RemoteGraph.java @@ -16,34 +16,29 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.tinkerpop.gremlin.process.remote; +package org.apache.tinkerpop.gremlin.structure; import org.apache.commons.configuration.Configuration; import org.apache.commons.configuration.PropertiesConfiguration; +import org.apache.tinkerpop.gremlin.GraphProvider; import org.apache.tinkerpop.gremlin.process.computer.GraphComputer; -import org.apache.tinkerpop.gremlin.process.remote.traversal.strategy.decoration.RemoteStrategy; +import org.apache.tinkerpop.gremlin.process.remote.RemoteConnection; +import org.apache.tinkerpop.gremlin.process.traversal.AnonymousTraversalSource; import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource; -import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies; -import org.apache.tinkerpop.gremlin.structure.Edge; -import org.apache.tinkerpop.gremlin.structure.Graph; -import org.apache.tinkerpop.gremlin.structure.Transaction; -import org.apache.tinkerpop.gremlin.structure.Vertex; import org.apache.tinkerpop.gremlin.structure.util.GraphFactory; import org.apache.tinkerpop.gremlin.structure.util.StringFactory; -import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph; import java.lang.reflect.Constructor; import java.util.Collections; import java.util.Iterator; /** - * A {@code ServerGraph} represents a proxy by which traversals spawned from this graph are expected over a - * {@link RemoteConnection}. This is not a full {@link Graph} implementation in the sense that the most of the methods - * will throw an {@link UnsupportedOperationException}. This implementation can only be used for spawning remote - * traversal instances. + * {@code RemoteGraph} is only required for integrating with the test suite as there must be a {@link Graph} instance + * for the test suite to bind to. Test suites that use this must ensure that the {@link TraversalSource} be + * generated from their {@link GraphProvider} in via {@link AnonymousTraversalSource#withRemote(RemoteConnection)} or + * similar overload. See {@code RemoteGraphProvider} in the gremlin-server module for an example. * * @author Stephen Mallette (http://stephen.genoprime.com) - * @deprecated As for release 3.2.2, replaced by {@link TraversalSource#withRemote(RemoteConnection)} or its overloads. */ @Graph.OptIn(Graph.OptIn.SUITE_PROCESS_STANDARD) @Graph.OptIn(Graph.OptIn.SUITE_PROCESS_COMPUTER) @@ -107,42 +102,37 @@ import java.util.Iterator; test = "org.apache.tinkerpop.gremlin.process.traversal.TraversalInterruptionComputerTest", method = "*", reason = "The interruption model in the test can't guarantee interruption at the right time with RemoteGraph.") -@Deprecated public class RemoteGraph implements Graph { private final RemoteConnection connection; + private final Configuration conf; - public static final String GREMLIN_REMOTE_GRAPH_REMOTE_CONNECTION_CLASS = "gremlin.remoteGraph.remoteConnectionClass"; - - static { - TraversalStrategies.GlobalCache.registerStrategies(RemoteGraph.class, TraversalStrategies.GlobalCache.getStrategies(EmptyGraph.class).clone().addStrategies(RemoteStrategy.instance())); - } - - private RemoteGraph(final RemoteConnection connection) { + private RemoteGraph(final RemoteConnection connection, final Configuration conf) { this.connection = connection; + this.conf = conf; } /** * Creates a new {@link RemoteGraph} instance using the specified configuration, which allows {@link RemoteGraph} - * to be compliant with {@link GraphFactory}. Expects key for {@link #GREMLIN_REMOTE_GRAPH_REMOTE_CONNECTION_CLASS} + * to be compliant with {@link GraphFactory}. Expects key for {@link TraversalSource#GREMLIN_REMOTE_CONNECTION_CLASS} * as well as any configuration required by the underlying {@link RemoteConnection} which will be instantiated. * Note that the {@code Configuration} object is passed down without change to the creation of the * {@link RemoteConnection} instance. */ public static RemoteGraph open(final Configuration conf) { - if (!conf.containsKey(GREMLIN_REMOTE_GRAPH_REMOTE_CONNECTION_CLASS)) - throw new IllegalArgumentException("Configuration must contain the '" + GREMLIN_REMOTE_GRAPH_REMOTE_CONNECTION_CLASS + "' key"); + if (!conf.containsKey(TraversalSource.GREMLIN_REMOTE_CONNECTION_CLASS)) + throw new IllegalArgumentException("Configuration must contain the '" + TraversalSource.GREMLIN_REMOTE_CONNECTION_CLASS + "' key"); final RemoteConnection remoteConnection; try { - final Class<? extends RemoteConnection> clazz = Class.forName(conf.getString(GREMLIN_REMOTE_GRAPH_REMOTE_CONNECTION_CLASS)).asSubclass(RemoteConnection.class); + final Class<? extends RemoteConnection> clazz = Class.forName(conf.getString(TraversalSource.GREMLIN_REMOTE_CONNECTION_CLASS)).asSubclass(RemoteConnection.class); final Constructor<? extends RemoteConnection> ctor = clazz.getConstructor(Configuration.class); remoteConnection = ctor.newInstance(conf); } catch (Exception ex) { throw new IllegalStateException(ex); } - return new RemoteGraph(remoteConnection); + return new RemoteGraph(remoteConnection, conf); } public static RemoteGraph open(final String configFile) throws Exception { @@ -156,8 +146,8 @@ public class RemoteGraph implements Graph { * @param connection the {@link RemoteConnection} instance to use * {@link RemoteConnection} */ - public static RemoteGraph open(final RemoteConnection connection) { - return new RemoteGraph(connection); + public static RemoteGraph open(final RemoteConnection connection, final Configuration conf) { + return new RemoteGraph(connection, conf); } public RemoteConnection getConnection() { @@ -215,7 +205,7 @@ public class RemoteGraph implements Graph { @Override public Configuration configuration() { - throw new UnsupportedOperationException(String.format("RemoteGraph is a proxy to %s - this method is not supported", connection)); + return conf; } @Override