From 301e3a0b880323b3498dbd20dbc5ecaa198c679d Mon Sep 17 00:00:00 2001 From: Stephen Mallette Date: Mon, 9 Apr 2018 17:36:53 -0400 Subject: [PATCH] TINKERPOP-1705 Removed rebindings API from java driver The "rebindings" API methods were long ago deprecated in 3.1.0-incubating but were not removed in 3.2.x or 3.3.x for extended support of that feature - especially for third-party drivers. By now, most users should have moved on to use the "aliases" API instead and most of the drivers should be supporting that as well, especially since most of the drivers are now officially TinkerPop maintained. --- CHANGELOG.asciidoc | 3 +- .../tinkerpop/gremlin/driver/Client.java | 71 +------------------ .../tinkerpop/gremlin/driver/Tokens.java | 6 -- .../handler/HttpGremlinEndpointHandler.java | 30 +------- .../server/op/AbstractOpProcessor.java | 18 ++--- .../server/op/session/SessionOpProcessor.java | 17 +---- .../op/standard/StandardOpProcessor.java | 18 +---- .../server/GremlinDriverIntegrateTest.java | 29 +------- .../GremlinServerHttpIntegrateTest.java | 54 -------------- .../server/GremlinServerIntegrateTest.java | 18 ----- 10 files changed, 17 insertions(+), 247 deletions(-) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index fcc96b21309..534030e006d 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -23,11 +23,12 @@ NEED AND IMAGE [[release-3-4-0]] === TinkerPop 3.4.0 (Release Date: NOT OFFICIALLY RELEASED YET) -This release also includes changes from <>. +This release also includes changes from <>. * Change the `toString()` of `Path` to be standardized as other graph elements are. * Fixed a bug in `ReducingBarrierStep`, that returned the provided seed value despite no elements being available. * Changed the order of `select()` scopes. The order is now: maps, side-effects, paths. +* Removed previously deprecated `rebindings` options from the Java driver API. * Removed support for Giraph. == TinkerPop 3.3.0 (Gremlin Symphony #40 in G Minor) diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Client.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Client.java index 3da86637714..7ef92ac14a6 100644 --- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Client.java +++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Client.java @@ -89,18 +89,6 @@ public RequestMessage.Builder buildMessage(final RequestMessage.Builder builder) */ public abstract CompletableFuture closeAsync(); - /** - * Create a new {@code Client} that aliases the specified {@link Graph} or {@link TraversalSource} name on the - * server to a variable called "g" for the context of the requests made through that {@code Client}. - * - * @param graphOrTraversalSource rebinds the specified global Gremlin Server variable to "g" - * @deprecated As of release 3.1.0, replaced by {@link #alias(String)} - */ - @Deprecated - public Client rebind(final String graphOrTraversalSource) { - return alias(graphOrTraversalSource); - } - /** * Create a new {@code Client} that aliases the specified {@link Graph} or {@link TraversalSource} name on the * server to a variable called "g" for the context of the requests made through that {@code Client}. @@ -111,16 +99,6 @@ public Client alias(final String graphOrTraversalSource) { return alias(makeDefaultAliasMap(graphOrTraversalSource)); } - /** - * Creates a {@code Client} that supplies the specified set of aliases, thus allowing the user to re-name - * one or more globally defined {@link Graph} or {@link TraversalSource} server bindings for the context of - * the created {@code Client}. - */ - @Deprecated - public Client rebind(final Map rebindings) { - return alias(rebindings); - } - /** * Creates a {@code Client} that supplies the specified set of aliases, thus allowing the user to re-name * one or more globally defined {@link Graph} or {@link TraversalSource} server bindings for the context of @@ -440,15 +418,6 @@ public CompletableFuture submitAsync(final String gremlin, final Map< return submitAsync(buildMessage(request).create()); } - /** - * {@inheritDoc} - */ - @Override - @Deprecated - public Client rebind(final String graphOrTraversalSource) { - return alias(graphOrTraversalSource); - } - /** * {@inheritDoc} */ @@ -459,16 +428,6 @@ public Client alias(final String graphOrTraversalSource) { return alias(aliases); } - /** - * Creates a {@code Client} that supplies the specified set of aliases, thus allowing the user to re-name - * one or more globally defined {@link Graph} or {@link TraversalSource} server bindings for the context of - * the created {@code Client}. - */ - @Deprecated - public Client rebind(final Map rebindings) { - return alias(rebindings); - } - /** * {@inheritDoc} */ @@ -541,30 +500,15 @@ public synchronized CompletableFuture closeAsync() { * Uses a {@link org.apache.tinkerpop.gremlin.driver.Client.ClusteredClient} that rebinds requests to a * specified {@link Graph} or {@link TraversalSource} instances on the server-side. */ - public final static class AliasClusteredClient extends ReboundClusteredClient { - public AliasClusteredClient(final Client client, final Map rebindings, - final Client.Settings settings) { - super(client, rebindings, settings); - } - } - - /** - * Uses a {@link org.apache.tinkerpop.gremlin.driver.Client.ClusteredClient} that rebinds requests to a - * specified {@link Graph} or {@link TraversalSource} instances on the server-side. - * - * @deprecated As of release 3.1.1-incubating, replaced by {@link AliasClusteredClient}. - */ - @Deprecated - public static class ReboundClusteredClient extends Client { + public static class AliasClusteredClient extends Client { private final Client client; private final Map aliases = new HashMap<>(); final CompletableFuture close = new CompletableFuture<>(); - ReboundClusteredClient(final Client client, final Map rebindings, - final Client.Settings settings) { + AliasClusteredClient(final Client client, final Map aliases, final Client.Settings settings) { super(client.cluster, settings); this.client = client; - this.aliases.putAll(rebindings); + this.aliases.putAll(aliases); } @Override @@ -640,15 +584,6 @@ public boolean isClosing() { return close.isDone(); } - /** - * {@inheritDoc} - */ - @Override - @Deprecated - public Client rebind(final String graphOrTraversalSource) { - return alias(graphOrTraversalSource); - } - /** * {@inheritDoc} */ diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Tokens.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Tokens.java index 9dfc4bd9b8f..0a8b4d01630 100644 --- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Tokens.java +++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Tokens.java @@ -50,12 +50,6 @@ private Tokens() {} public static final String ARGS_AGGREGATE_TO = "aggregateTo"; public static final String ARGS_SIDE_EFFECT_KEY = "sideEffectKey"; - /** - * @deprecated As of release 3.1.0-incubating, replaced by {@link #ARGS_ALIASES}. - */ - @Deprecated - public static final String ARGS_REBINDINGS = "rebindings"; - public static final String VAL_AGGREGATE_TO_BULKSET = "bulkset"; public static final String VAL_AGGREGATE_TO_LIST = "list"; public static final String VAL_AGGREGATE_TO_MAP = "map"; diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java index e2b15d66f64..6292ddd806e 100644 --- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java +++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java @@ -35,7 +35,6 @@ import org.apache.tinkerpop.gremlin.server.util.MetricManager; import org.apache.tinkerpop.gremlin.structure.Graph; import org.apache.tinkerpop.gremlin.util.function.FunctionUtils; -import org.apache.tinkerpop.gremlin.util.function.ThrowingBiConsumer; import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; @@ -108,11 +107,6 @@ public class HttpGremlinEndpointHandler extends ChannelInboundHandlerAdapter { private static final String ARGS_BINDINGS_DOT = Tokens.ARGS_BINDINGS + "."; - /** - * @deprecated As of release 3.1.0, replaced by {@link #ARGS_ALIASES_DOT}. - */ - @Deprecated - private static final String ARGS_REBINDINGS_DOT = Tokens.ARGS_REBINDINGS + "."; private static final String ARGS_ALIASES_DOT = Tokens.ARGS_ALIASES + "."; private static final Timer evalOpTimer = MetricManager.INSTANCE.getTimer(name(GremlinServer.class, "op", "eval")); @@ -365,18 +359,9 @@ private static Quartet, String, Map> decoder.parameters().entrySet().stream().filter(kv -> kv.getKey().startsWith(ARGS_BINDINGS_DOT)) .forEach(kv -> bindings.put(kv.getKey().substring(ARGS_BINDINGS_DOT.length()), kv.getValue().get(0))); - // don't allow both rebindings and aliases parameters as they are the same thing. aliases were introduced - // as of 3.1.0 as a replacement for rebindings. this check can be removed when rebindings are completely - // removed from the protocol - final boolean hasRebindings = decoder.parameters().entrySet().stream().anyMatch(kv -> kv.getKey().startsWith(ARGS_REBINDINGS_DOT)); - final boolean hasAliases = decoder.parameters().entrySet().stream().anyMatch(kv -> kv.getKey().startsWith(ARGS_ALIASES_DOT)); - if (hasRebindings && hasAliases) - throw new IllegalArgumentException("prefer use of the 'aliases' parameter over 'rebindings' and do not use both"); - final Map aliases = new HashMap<>(); - final String rebindingOrAliasParameter = hasRebindings ? ARGS_REBINDINGS_DOT : ARGS_ALIASES_DOT; - decoder.parameters().entrySet().stream().filter(kv -> kv.getKey().startsWith(rebindingOrAliasParameter)) - .forEach(kv -> aliases.put(kv.getKey().substring(rebindingOrAliasParameter.length()), kv.getValue().get(0))); + decoder.parameters().entrySet().stream().filter(kv -> kv.getKey().startsWith(ARGS_ALIASES_DOT)) + .forEach(kv -> aliases.put(kv.getKey().substring(ARGS_ALIASES_DOT.length()), kv.getValue().get(0))); final List languageParms = decoder.parameters().get(Tokens.ARGS_LANGUAGE); final String language = (null == languageParms || languageParms.size() == 0) ? null : languageParms.get(0); @@ -401,16 +386,7 @@ private static Quartet, String, Map> if (bindingsNode != null) bindingsNode.fields().forEachRemaining(kv -> bindings.put(kv.getKey(), fromJsonNode(kv.getValue()))); - // don't allow both rebindings and aliases parameters as they are the same thing. aliases were introduced - // as of 3.1.0 as a replacement for rebindings. this check can be removed when rebindings are completely - // removed from the protocol - final boolean hasRebindings = body.has(Tokens.ARGS_REBINDINGS); - final boolean hasAliases = body.has(Tokens.ARGS_ALIASES); - if (hasRebindings && hasAliases) - throw new IllegalArgumentException("prefer use of the 'aliases' parameter over 'rebindings' and do not use both"); - - final String rebindingOrAliasParameter = hasRebindings ? Tokens.ARGS_REBINDINGS : Tokens.ARGS_ALIASES; - final JsonNode aliasesNode = body.get(rebindingOrAliasParameter); + final JsonNode aliasesNode = body.get(Tokens.ARGS_ALIASES); if (aliasesNode != null && !aliasesNode.isObject()) throw new IllegalArgumentException("aliases must be a Map"); diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/AbstractOpProcessor.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/AbstractOpProcessor.java index 8899bb509e6..fd2d27f053f 100644 --- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/AbstractOpProcessor.java +++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/AbstractOpProcessor.java @@ -290,13 +290,8 @@ protected static Frame makeFrame(final ChannelHandlerContext ctx, final RequestM protected static void attemptCommit(final RequestMessage msg, final GraphManager graphManager, final boolean strict) { if (strict) { - // validations should have already been performed in StandardOpProcessor, but a failure in bindings maker - // at the time of the eval might raise through here at which point the validation didn't yet happen. better - // to just check again - final boolean hasRebindings = msg.getArgs().containsKey(Tokens.ARGS_REBINDINGS); - final String rebindingOrAliasParameter = hasRebindings ? Tokens.ARGS_REBINDINGS : Tokens.ARGS_ALIASES; - if (msg.getArgs().containsKey(rebindingOrAliasParameter)) { - final Map aliases = (Map) msg.getArgs().get(rebindingOrAliasParameter); + if (msg.getArgs().containsKey(Tokens.ARGS_ALIASES)) { + final Map aliases = (Map) msg.getArgs().get(Tokens.ARGS_ALIASES); graphManager.commit(new HashSet<>(aliases.values())); } else { graphManager.commitAll(); @@ -308,13 +303,8 @@ protected static void attemptCommit(final RequestMessage msg, final GraphManager protected static void attemptRollback(final RequestMessage msg, final GraphManager graphManager, final boolean strict) { if (strict) { - // validations should have already been performed in StandardOpProcessor, but a failure in bindings maker - // at the time of the eval might raise through here at which point the validation didn't yet happen. better - // to just check again - final boolean hasRebindings = msg.getArgs().containsKey(Tokens.ARGS_REBINDINGS); - final String rebindingOrAliasParameter = hasRebindings ? Tokens.ARGS_REBINDINGS : Tokens.ARGS_ALIASES; - if (msg.getArgs().containsKey(rebindingOrAliasParameter)) { - final Map aliases = (Map) msg.getArgs().get(rebindingOrAliasParameter); + if (msg.getArgs().containsKey(Tokens.ARGS_ALIASES)) { + final Map aliases = (Map) msg.getArgs().get(Tokens.ARGS_ALIASES); graphManager.rollback(new HashSet<>(aliases.values())); } else { graphManager.rollbackAll(); diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/session/SessionOpProcessor.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/session/SessionOpProcessor.java index 3dd04398db0..8154be626ca 100644 --- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/session/SessionOpProcessor.java +++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/session/SessionOpProcessor.java @@ -218,22 +218,9 @@ protected Function getBindingMaker(final Session sessi final RequestMessage msg = context.getRequestMessage(); final Bindings bindings = session.getBindings(); - // don't allow both rebindings and aliases parameters as they are the same thing. aliases were introduced - // as of 3.1.0 as a replacement for rebindings. this check can be removed when rebindings are completely - // removed from the protocol - final boolean hasRebindings = msg.getArgs().containsKey(Tokens.ARGS_REBINDINGS); - final boolean hasAliases = msg.getArgs().containsKey(Tokens.ARGS_ALIASES); - if (hasRebindings && hasAliases) { - final String error = "Prefer use of the 'aliases' parameter over 'rebindings' and do not use both"; - throw new OpProcessorException(error, ResponseMessage.build(msg) - .code(ResponseStatusCode.REQUEST_ERROR_INVALID_REQUEST_ARGUMENTS).statusMessage(error).create()); - } - - final String rebindingOrAliasParameter = hasRebindings ? Tokens.ARGS_REBINDINGS : Tokens.ARGS_ALIASES; - // alias any global bindings to a different variable - if (msg.getArgs().containsKey(rebindingOrAliasParameter)) { - final Map aliases = (Map) msg.getArgs().get(rebindingOrAliasParameter); + if (msg.getArgs().containsKey(Tokens.ARGS_ALIASES)) { + final Map aliases = (Map) msg.getArgs().get(Tokens.ARGS_ALIASES); for (Map.Entry aliasKv : aliases.entrySet()) { boolean found = false; diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/standard/StandardOpProcessor.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/standard/StandardOpProcessor.java index 105ca88ee8b..da1831b16ef 100644 --- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/standard/StandardOpProcessor.java +++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/standard/StandardOpProcessor.java @@ -28,7 +28,6 @@ import org.apache.tinkerpop.gremlin.server.Settings; import org.apache.tinkerpop.gremlin.server.op.AbstractEvalOpProcessor; import org.apache.tinkerpop.gremlin.server.op.OpProcessorException; -import org.apache.tinkerpop.gremlin.server.op.session.SessionOpProcessor; import org.apache.tinkerpop.gremlin.structure.Graph; import org.apache.tinkerpop.gremlin.util.function.ThrowingConsumer; import org.slf4j.Logger; @@ -115,22 +114,9 @@ protected Function getBindingMaker() { final RequestMessage msg = context.getRequestMessage(); final Bindings bindings = new SimpleBindings(); - // don't allow both rebindings and aliases parameters as they are the same thing. aliases were introduced - // as of 3.1.0 as a replacement for rebindings. this check can be removed when rebindings are completely - // removed from the protocol - final boolean hasRebindings = msg.getArgs().containsKey(Tokens.ARGS_REBINDINGS); - final boolean hasAliases = msg.getArgs().containsKey(Tokens.ARGS_ALIASES); - if (hasRebindings && hasAliases) { - final String error = "Prefer use of the 'aliases' parameter over 'rebindings' and do not use both"; - throw new OpProcessorException(error, ResponseMessage.build(msg) - .code(ResponseStatusCode.REQUEST_ERROR_INVALID_REQUEST_ARGUMENTS).statusMessage(error).create()); - } - - final String rebindingOrAliasParameter = hasRebindings ? Tokens.ARGS_REBINDINGS : Tokens.ARGS_ALIASES; - // alias any global bindings to a different variable. - if (msg.getArgs().containsKey(rebindingOrAliasParameter)) { - final Map aliases = (Map) msg.getArgs().get(rebindingOrAliasParameter); + if (msg.getArgs().containsKey(Tokens.ARGS_ALIASES)) { + final Map aliases = (Map) msg.getArgs().get(Tokens.ARGS_ALIASES); for (Map.Entry aliasKv : aliases.entrySet()) { boolean found = false; 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 6affde4334c..c7e7bb2736a 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 @@ -1244,11 +1244,6 @@ public void shouldAliasGraphVariablesInStrictTransactionMode() throws Exception assertEquals(ResponseStatusCode.REQUEST_ERROR_INVALID_REQUEST_ARGUMENTS, re.getResponseStatusCode()); } - // keep the testing here until "rebind" is completely removed - final Client reboundLegacy = cluster.connect().rebind("graph"); - final Vertex vLegacy = reboundLegacy.submit("g.addVertex('name','stephen')").all().get().get(0).getVertex(); - assertEquals("stephen", vLegacy.value("name")); - final Client rebound = cluster.connect().alias("graph"); final Vertex v = rebound.submit("g.addVertex('name','jason')").all().get().get(0).getVertex(); assertEquals("jason", v.value("name")); @@ -1271,11 +1266,6 @@ public void shouldAliasGraphVariables() throws Exception { assertEquals(ResponseStatusCode.SERVER_ERROR_SCRIPT_EVALUATION, re.getResponseStatusCode()); } - // keep the testing here until "rebind" is completely removed - final Client reboundLegacy = cluster.connect().rebind("graph"); - final Vertex vLegacy = reboundLegacy.submit("g.addVertex('name','stephen')").all().get().get(0).getVertex(); - assertEquals("stephen", vLegacy.value("name")); - final Client rebound = cluster.connect().alias("graph"); final Vertex v = rebound.submit("g.addVertex('name','jason')").all().get().get(0).getVertex(); assertEquals("jason", v.value("name")); @@ -1298,11 +1288,6 @@ public void shouldAliasTraversalSourceVariables() throws Exception { assertEquals(ResponseStatusCode.SERVER_ERROR_SCRIPT_EVALUATION, re.getResponseStatusCode()); } - // keep the testing here until "rebind" is completely removed - final Client clientLegacy = client.rebind("g1"); - final Vertex vLegacy = clientLegacy.submit("g.addV().property('name','stephen')").all().get().get(0).getVertex(); - assertEquals("stephen", vLegacy.value("name")); - final Client clientAliased = client.alias("g1"); final Vertex v = clientAliased.submit("g.addV().property('name','jason')").all().get().get(0).getVertex(); assertEquals("jason", v.value("name")); @@ -1325,14 +1310,8 @@ public void shouldAliasGraphVariablesInSession() throws Exception { assertEquals(ResponseStatusCode.SERVER_ERROR_SCRIPT_EVALUATION, re.getResponseStatusCode()); } - // keep the testing here until "rebind" is completely removed - final Client reboundLegacy = client.rebind("graph"); - assertEquals("stephen", reboundLegacy.submit("n='stephen'").all().get().get(0).getString()); - final Vertex vLegacy = reboundLegacy.submit("g.addVertex('name',n)").all().get().get(0).getVertex(); - assertEquals("stephen", vLegacy.value("name")); - final Client aliased = client.alias("graph"); - assertEquals("jason", reboundLegacy.submit("n='jason'").all().get().get(0).getString()); + assertEquals("jason", aliased.submit("n='jason'").all().get().get(0).getString()); final Vertex v = aliased.submit("g.addVertex('name',n)").all().get().get(0).getVertex(); assertEquals("jason", v.value("name")); @@ -1354,12 +1333,6 @@ public void shouldAliasTraversalSourceVariablesInSession() throws Exception { assertEquals(ResponseStatusCode.SERVER_ERROR_SCRIPT_EVALUATION, re.getResponseStatusCode()); } - // keep the testing here until "rebind" is completely removed - final Client clientLegacy = client.rebind("g1"); - assertEquals("stephen", clientLegacy.submit("n='stephen'").all().get().get(0).getString()); - final Vertex vLegacy = clientLegacy.submit("g.addV().property('name',n)").all().get().get(0).getVertex(); - assertEquals("stephen", vLegacy.value("name")); - final Client clientAliased = client.alias("g1"); assertEquals("jason", clientAliased.submit("n='jason'").all().get().get(0).getString()); final Vertex v = clientAliased.submit("g.addV().property('name',n)").all().get().get(0).getVertex(); diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerHttpIntegrateTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerHttpIntegrateTest.java index 1a844cf7659..a7fe0d4be9d 100644 --- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerHttpIntegrateTest.java +++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerHttpIntegrateTest.java @@ -337,32 +337,6 @@ public void should200OnGETWithGremlinQueryStringArgumentWithIteratorResult() thr } } - @Test - public void should200OnGETWithGremlinQueryStringArgumentWithIteratorResultAndAliases() throws Exception { - // we can remove this first test when rebindings are completely removed - final CloseableHttpClient httpclientLegacy = HttpClients.createDefault(); - final HttpGet httpgetLegacy = new HttpGet(TestClientFactory.createURLString("?gremlin=g1.V()&rebindings.g1=g")); - - try (final CloseableHttpResponse response = httpclientLegacy.execute(httpgetLegacy)) { - assertEquals(200, response.getStatusLine().getStatusCode()); - assertEquals("application/json", response.getEntity().getContentType().getValue()); - final String json = EntityUtils.toString(response.getEntity()); - final JsonNode node = mapper.readTree(json); - assertEquals(6, node.get("result").get("data").get(GraphSONTokens.VALUEPROP).size()); - } - - final CloseableHttpClient httpclient = HttpClients.createDefault(); - final HttpGet httpget = new HttpGet(TestClientFactory.createURLString("?gremlin=g1.V()&aliases.g1=g")); - - try (final CloseableHttpResponse response = httpclient.execute(httpget)) { - assertEquals(200, response.getStatusLine().getStatusCode()); - assertEquals("application/json", response.getEntity().getContentType().getValue()); - final String json = EntityUtils.toString(response.getEntity()); - final JsonNode node = mapper.readTree(json); - assertEquals(6, node.get("result").get("data").get(GraphSONTokens.VALUEPROP).size()); - } - } - @Test public void should200OnGETWithGremlinQueryStringArgument() throws Exception { final CloseableHttpClient httpclient = HttpClients.createDefault(); @@ -512,20 +486,6 @@ public void should200OnPOSTTransactionalGraph() throws Exception { public void should200OnPOSTTransactionalGraphInStrictMode() throws Exception { assumeNeo4jIsPresent(); - // we can remove this first test when rebindings are completely removed - final CloseableHttpClient httpclientLegacy = HttpClients.createDefault(); - final HttpPost httppostLegacy = new HttpPost(TestClientFactory.createURLString()); - httppostLegacy.addHeader("Content-Type", "application/json"); - httppostLegacy.setEntity(new StringEntity("{\"gremlin\":\"g1.addV()\",\"rebindings\":{\"g1\":\"g\"}}", Consts.UTF_8)); - - try (final CloseableHttpResponse response = httpclientLegacy.execute(httppostLegacy)) { - assertEquals(200, response.getStatusLine().getStatusCode()); - assertEquals("application/json", response.getEntity().getContentType().getValue()); - final String json = EntityUtils.toString(response.getEntity()); - final JsonNode node = mapper.readTree(json); - assertEquals(1, node.get("result").get("data").get(GraphSONTokens.VALUEPROP).size()); - } - final CloseableHttpClient httpclient = HttpClients.createDefault(); final HttpPost httppost = new HttpPost(TestClientFactory.createURLString()); httppost.addHeader("Content-Type", "application/json"); @@ -578,20 +538,6 @@ public void should200OnPOSTWithGremlinJsonEndcodedBodyWithTinkerGraphResult() th @Test public void should200OnPOSTWithGremlinJsonEndcodedBodyWithIteratorResultAndAliases() throws Exception { - // we can remove this first test when rebindings are completely removed - final CloseableHttpClient httpclientLegacy = HttpClients.createDefault(); - final HttpPost httppostLegacy = new HttpPost(TestClientFactory.createURLString()); - httppostLegacy.addHeader("Content-Type", "application/json"); - httppostLegacy.setEntity(new StringEntity("{\"gremlin\":\"g1.V()\",\"rebindings\":{\"g1\":\"g\"}}", Consts.UTF_8)); - - try (final CloseableHttpResponse response = httpclientLegacy.execute(httppostLegacy)) { - assertEquals(200, response.getStatusLine().getStatusCode()); - assertEquals("application/json", response.getEntity().getContentType().getValue()); - final String json = EntityUtils.toString(response.getEntity()); - final JsonNode node = mapper.readTree(json); - assertEquals(6, node.get("result").get("data").get(GraphSONTokens.VALUEPROP).size()); - } - final CloseableHttpClient httpclient = HttpClients.createDefault(); final HttpPost httppost = new HttpPost(TestClientFactory.createURLString()); httppost.addHeader("Content-Type", "application/json"); 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 6454ad5668e..cdf36d5f8b4 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 @@ -981,24 +981,6 @@ public void shouldFailWithBadScriptEval() throws Exception { } } - @Test - @SuppressWarnings("unchecked") - public void shouldStillSupportDeprecatedRebindingsParameterOnServer() throws Exception { - // this test can be removed when the rebindings arg is removed - try (SimpleClient client = TestClientFactory.createWebSocketClient()) { - final Map rebindings = new HashMap<>(); - rebindings.put("xyz", "graph"); - final RequestMessage request = RequestMessage.build(Tokens.OPS_EVAL) - .addArg(Tokens.ARGS_GREMLIN, "xyz.addVertex('name','jason')") - .addArg(Tokens.ARGS_REBINDINGS, rebindings).create(); - final List responses = client.submit(request); - assertEquals(1, responses.size()); - - final DetachedVertex v = ((ArrayList) responses.get(0).getResult().getData()).get(0); - assertEquals("jason", v.value("name")); - } - } - @Test public void shouldSupportLambdasUsingWithRemote() throws Exception { final Graph graph = EmptyGraph.instance();