Merge Combined WS and Http Channelizer to master
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/cee56f52 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/cee56f52 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/cee56f52 Branch: refs/heads/master Commit: cee56f527ad4975878a9ac866bc00a24b7fd3a88 Parents: 188fe4b c264390 Author: Keith Lohnes <krloh...@us.ibm.com> Authored: Wed Jul 12 11:35:17 2017 -0400 Committer: Keith Lohnes <krloh...@us.ibm.com> Committed: Wed Jul 12 11:35:17 2017 -0400 ---------------------------------------------------------------------- CHANGELOG.asciidoc | 1 + .../src/reference/gremlin-applications.asciidoc | 7 +- .../upgrade/release-3.2.x-incubating.asciidoc | 9 + .../gremlin/server/AbstractChannelizer.java | 11 +- .../server/channel/WebSocketChannelizer.java | 7 +- .../server/channel/WsAndHttpChannelizer.java | 61 ++++ .../SaslAndHttpBasicAuthenticationHandler.java | 57 +++ .../server/handler/WebSocketHandlerUtil.java | 38 ++ .../handler/WsAndHttpChannelizerHandler.java | 87 +++++ .../AbstractGremlinServerIntegrationTest.java | 23 +- .../server/GremlinServerIntegrateTest.java | 37 -- ...tGremlminServerChannelizerIntegrateTest.java | 346 +++++++++++++++++++ .../channel/HttpChannelizerIntegrateTest.java | 56 +++ .../channel/NioChannelizerIntegrateTest.java | 56 +++ .../WebSocketChannelizerIntegrateTest.java | 56 +++ .../WsAndHttpChannelizerIntegrateTest.java | 58 ++++ 16 files changed, 864 insertions(+), 46 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/cee56f52/CHANGELOG.asciidoc ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/cee56f52/docs/src/reference/gremlin-applications.asciidoc ---------------------------------------------------------------------- diff --cc docs/src/reference/gremlin-applications.asciidoc index 38e6be6,4e367e9..6263796 --- a/docs/src/reference/gremlin-applications.asciidoc +++ b/docs/src/reference/gremlin-applications.asciidoc @@@ -882,9 -859,9 +882,9 @@@ programming languages, tools and librar with Gremlin Server. It also may represent an easier upgrade path from link:http://rexster.tinkerpop.com/[Rexster] as the API for the endpoint is very similar to Rexster's link:https://github.com/tinkerpop/rexster/wiki/Gremlin-Extension[Gremlin Extension]. -Gremlin Server provides for a single REST endpoint - a Gremlin evaluator - which allows the submission of a Gremlin +Gremlin Server provides for a single HTTP endpoint - a Gremlin evaluator - which allows the submission of a Gremlin script as a request. For each request, it returns a response containing the serialized results of that script. - To enable this endpoint, Gremlin Server needs to be configured with the `HttpChannelizer`, which replaces the default + To enable this endpoint, Gremlin Server needs to be configured with the `HttpChannelizer`, which replaces the default. The `WsAndHttpChannelizer` may also be configured to enable both WebSockets and the REST endpoint. `WebSocketChannelizer`, in the configuration file: [source,yaml] http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/cee56f52/docs/src/upgrade/release-3.2.x-incubating.asciidoc ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/cee56f52/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/AbstractChannelizer.java ---------------------------------------------------------------------- diff --cc gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/AbstractChannelizer.java index cb088be,22bb1eb..d53cdfe --- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/AbstractChannelizer.java +++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/AbstractChannelizer.java @@@ -81,10 -85,18 +81,17 @@@ public abstract class AbstractChanneliz protected ExecutorService gremlinExecutorService; protected ScheduledExecutorService scheduledExecutorService; + + public static final String PIPELINE_AUTHENTICATOR = "authenticator"; + public static final String PIPELINE_REQUEST_HANDLER = "request-handler"; + public static final String PIPELINE_HTTP_RESPONSE_ENCODER = "http-response-encoder"; + protected static final String PIPELINE_SSL = "ssl"; protected static final String PIPELINE_OP_SELECTOR = "op-selector"; - protected static final String PIPELINE_RESULT_ITERATOR_HANDLER = "result-iterator-handler"; protected static final String PIPELINE_OP_EXECUTOR = "op-executor"; - protected static final String PIPELINE_AUTHENTICATOR = "authenticator"; + protected static final String PIPELINE_HTTP_REQUEST_DECODER = "http-request-decoder"; + + protected static final String GREMLIN_ENDPOINT = "/gremlin"; protected final Map<String, MessageSerializer> serializers = new HashMap<>(); http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/cee56f52/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/channel/WebSocketChannelizer.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/cee56f52/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java ---------------------------------------------------------------------- diff --cc gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java index 90076d5,aad8131..ef0d4f0 --- 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 @@@ -210,24 -208,16 +206,19 @@@ public class GremlinServerIntegrateTes // Trust ONLY the server cert settings.ssl.trustCertChainFile = SERVER_CRT; break; - case "shouldStartWithDefaultSettings": - // test with defaults exception for port because we want to keep testing off of 8182 - final Settings defaultSettings = new Settings(); - defaultSettings.port = TestClientFactory.PORT; - return settings; case "shouldUseSimpleSandbox": - settings.scriptEngines.get("gremlin-groovy").config = getScriptEngineConfForSimpleSandbox(); + settings.scriptEngines.get("gremlin-groovy").plugins.put(GroovyCompilerGremlinPlugin.class.getName(), getScriptEngineConfForSimpleSandbox()); + // remove the script because it isn't used in the test but also because it's not CompileStatic ready + settings.scriptEngines.get("gremlin-groovy").plugins.remove(ScriptFileGremlinPlugin.class.getName()); break; case "shouldUseInterpreterMode": - settings.scriptEngines.get("gremlin-groovy").config = getScriptEngineConfForInterpreterMode(); + settings.scriptEngines.get("gremlin-groovy").plugins.put(GroovyCompilerGremlinPlugin.class.getName(), getScriptEngineConfForInterpreterMode()); break; case "shouldReceiveFailureTimeOutOnScriptEvalOfOutOfControlLoop": - settings.scriptEngines.get("gremlin-groovy").config = getScriptEngineConfForTimedInterrupt(); + settings.scriptEngines.get("gremlin-groovy").plugins.put(GroovyCompilerGremlinPlugin.class.getName(), getScriptEngineConfForTimedInterrupt()); break; case "shouldUseBaseScript": + settings.scriptEngines.get("gremlin-groovy").plugins.put(GroovyCompilerGremlinPlugin.class.getName(), getScriptEngineConfForBaseScript()); settings.scriptEngines.get("gremlin-groovy").config = getScriptEngineConfForBaseScript(); break; case "shouldReturnInvalidRequestArgsWhenBindingCountExceedsAllowable":