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 2017/02/27 22:05:08 UTC
[29/38] tinkerpop git commit: TINKERPOP-1612 Removed a number of
deprecated classes from the old plugin infrastructure
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1cc19e9a/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/SpyPluginAcceptor.java
----------------------------------------------------------------------
diff --git a/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/SpyPluginAcceptor.java b/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/SpyPluginAcceptor.java
deleted file mode 100644
index dae34ca..0000000
--- a/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/SpyPluginAcceptor.java
+++ /dev/null
@@ -1,87 +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.console.groovy.plugin;
-
-import org.apache.tinkerpop.gremlin.groovy.plugin.PluginAcceptor;
-
-import javax.script.ScriptException;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.function.Function;
-import java.util.function.Supplier;
-
-/**
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-public class SpyPluginAcceptor implements PluginAcceptor {
-
- private final Set<String> imports = new HashSet<>();
- private final Map<String, Object> bindings = new HashMap<>();
-
- private final Function<String, Object> evalSpy;
- private final Supplier<Map<String, Object>> environment;
-
- public SpyPluginAcceptor() {
- this(script -> script);
- }
-
- public SpyPluginAcceptor(final Function<String, Object> evalSpy) {
- this(evalSpy, HashMap::new);
- }
-
- public SpyPluginAcceptor(final Supplier<Map<String, Object>> environmentMaker) {
- this(script -> script, environmentMaker);
- }
-
- public SpyPluginAcceptor(final Function<String, Object> evalSpy, final Supplier<Map<String, Object>> environmentMaker) {
- this.evalSpy = evalSpy;
- this.environment = environmentMaker;
- }
-
- @Override
- public void addImports(final Set<String> importStatements) {
- imports.addAll(importStatements);
- }
-
- @Override
- public void addBinding(final String key, final Object val) {
- bindings.put(key, val);
- }
-
- @Override
- public Map<String, Object> getBindings() {
- return bindings;
- }
-
- @Override
- public Object eval(final String script) throws ScriptException {
- return evalSpy.apply(script);
- }
-
- @Override
- public Map<String, Object> environment() {
- return environment.get();
- }
-
- public Set<String> getImports() {
- return imports;
- }
-}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1cc19e9a/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/SugarGremlinPluginTest.java
----------------------------------------------------------------------
diff --git a/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/SugarGremlinPluginTest.java b/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/SugarGremlinPluginTest.java
deleted file mode 100644
index 4b18cea..0000000
--- a/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/SugarGremlinPluginTest.java
+++ /dev/null
@@ -1,63 +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.console.groovy.plugin;
-
-import org.apache.tinkerpop.gremlin.groovy.plugin.SugarGremlinPlugin;
-import org.apache.tinkerpop.gremlin.groovy.util.MetaRegistryUtil;
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
-import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerFactory;
-import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
-import org.codehaus.groovy.tools.shell.Groovysh;
-import org.codehaus.groovy.tools.shell.IO;
-import org.junit.Test;
-
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * This test lives here (even though the SugarPlugin is over in gremlin-groovy, because it really tests the
- * plugin with respect to the Console.
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-public class SugarGremlinPluginTest {
- @Test
- public void shouldPluginSugar() throws Exception {
- MetaRegistryUtil.clearRegistry(new HashSet<>(Arrays.asList(TinkerGraph.class)));
-
- final SugarGremlinPlugin plugin = new SugarGremlinPlugin();
-
- final Groovysh groovysh = new Groovysh();
-
- final Map<String, Object> env = new HashMap<>();
- env.put("ConsolePluginAcceptor.io", new IO());
- env.put("ConsolePluginAcceptor.shell", groovysh);
-
- final SpyPluginAcceptor spy = new SpyPluginAcceptor(groovysh::execute, () -> env);
- plugin.pluginTo(spy);
-
- groovysh.getInterp().getContext().setProperty("g", TinkerFactory.createClassic());
- assertEquals(6l, ((GraphTraversal) groovysh.execute("g.traversal().V()")).count().next());
- assertEquals(6l, ((GraphTraversal) groovysh.execute("g.traversal().V")).count().next());
- }
-}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1cc19e9a/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/UtilitiesGremlinPluginTest.java
----------------------------------------------------------------------
diff --git a/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/UtilitiesGremlinPluginTest.java b/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/UtilitiesGremlinPluginTest.java
deleted file mode 100644
index 37a0eef..0000000
--- a/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/UtilitiesGremlinPluginTest.java
+++ /dev/null
@@ -1,72 +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.console.groovy.plugin;
-
-import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerFactory;
-import org.codehaus.groovy.tools.shell.Groovysh;
-import org.codehaus.groovy.tools.shell.IO;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import static org.hamcrest.CoreMatchers.*;
-import static org.junit.Assert.*;
-
-/**
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-public class UtilitiesGremlinPluginTest {
- @Test
- public void shouldPluginToAndDoImports() throws Exception {
- final UtilitiesGremlinPlugin plugin = new UtilitiesGremlinPlugin();
- final SpyPluginAcceptor spy = new SpyPluginAcceptor();
- plugin.pluginTo(spy);
-
- assertEquals(4, spy.getImports().size());
- }
-
- @Test
- public void shouldFailWithoutUtilitiesPlugin() throws Exception {
- final Groovysh groovysh = new Groovysh();
- try {
- groovysh.execute("describeGraph(g.class)");
- fail("Utilities were not loaded - this should fail.");
- } catch (Exception ignored) {
- }
- }
-
- @Test
- public void shouldPluginUtilities() throws Exception {
- final UtilitiesGremlinPlugin plugin = new UtilitiesGremlinPlugin();
-
- final Groovysh groovysh = new Groovysh();
- groovysh.getInterp().getContext().setProperty("g", TinkerFactory.createClassic());
-
- final Map<String, Object> env = new HashMap<>();
- env.put("ConsolePluginAcceptor.io", new IO());
- env.put("ConsolePluginAcceptor.shell", groovysh);
-
- final SpyPluginAcceptor spy = new SpyPluginAcceptor(groovysh::execute, () -> env);
- plugin.pluginTo(spy);
-
- assertThat(groovysh.execute("describeGraph(org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph)").toString(), containsString("IMPLEMENTATION - org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph"));
- }
-}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1cc19e9a/gremlin-console/src/test/resources/org/apache/tinkerpop/gremlin/console/groovy/plugin/gremlin-server-integration.yaml
----------------------------------------------------------------------
diff --git a/gremlin-console/src/test/resources/org/apache/tinkerpop/gremlin/console/groovy/plugin/gremlin-server-integration.yaml b/gremlin-console/src/test/resources/org/apache/tinkerpop/gremlin/console/groovy/plugin/gremlin-server-integration.yaml
deleted file mode 100644
index a7ef1a9..0000000
--- a/gremlin-console/src/test/resources/org/apache/tinkerpop/gremlin/console/groovy/plugin/gremlin-server-integration.yaml
+++ /dev/null
@@ -1,54 +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.
-
-host: localhost
-port: 45940
-threadPoolWorker: 1
-gremlinPool: 8
-scriptEvaluationTimeout: 30000
-serializedResponseTimeout: 30000
-graphs: {
- g: conf/tinkergraph-empty.properties}
-plugins:
- - tinkerpop.tinkergraph
-scriptEngines: {
- gremlin-groovy: {
- imports: [java.lang.Math],
- staticImports: [java.lang.Math.PI]}}
-serializers:
- - { 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 }
-processors:
- - { className: org.apache.tinkerpop.gremlin.server.op.session.SessionOpProcessor, config: { sessionTimeout: 28800000 }}
-metrics: {
- consoleReporter: {enabled: true, interval: 180000},
- csvReporter: {enabled: true, interval: 180000, fileName: /tmp/gremlin-server-metrics.csv},
- jmxReporter: {enabled: true},
- slf4jReporter: {enabled: true, interval: 180000},
- gangliaReporter: {enabled: false, interval: 180000, addressingMode: MULTICAST},
- graphiteReporter: {enabled: false, interval: 180000}}
-threadPoolBoss: 1
-maxInitialLineLength: 4096
-maxHeaderSize: 8192
-maxChunkSize: 8192
-maxContentLength: 65536
-maxAccumulationBufferComponents: 1024
-resultIterationBatchSize: 64
-writeBufferHighWaterMark: 32768
-writeBufferHighWaterMark: 65536
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1cc19e9a/gremlin-console/src/test/resources/org/apache/tinkerpop/gremlin/console/groovy/plugin/remote.yaml
----------------------------------------------------------------------
diff --git a/gremlin-console/src/test/resources/org/apache/tinkerpop/gremlin/console/groovy/plugin/remote.yaml b/gremlin-console/src/test/resources/org/apache/tinkerpop/gremlin/console/groovy/plugin/remote.yaml
deleted file mode 100644
index 373934b..0000000
--- a/gremlin-console/src/test/resources/org/apache/tinkerpop/gremlin/console/groovy/plugin/remote.yaml
+++ /dev/null
@@ -1,20 +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.
-
-hosts: [localhost]
-port: 45940
-serializer: { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { serializeResultToString: true }}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1cc19e9a/gremlin-console/src/test/resources/org/apache/tinkerpop/gremlin/console/groovy/plugin/script-customizer-1.groovy
----------------------------------------------------------------------
diff --git a/gremlin-console/src/test/resources/org/apache/tinkerpop/gremlin/console/groovy/plugin/script-customizer-1.groovy b/gremlin-console/src/test/resources/org/apache/tinkerpop/gremlin/console/groovy/plugin/script-customizer-1.groovy
deleted file mode 100644
index c2cc784..0000000
--- a/gremlin-console/src/test/resources/org/apache/tinkerpop/gremlin/console/groovy/plugin/script-customizer-1.groovy
+++ /dev/null
@@ -1,3 +0,0 @@
-x = 1 + 1
-y = 10 * x
-z = 1 + x + y
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1cc19e9a/gremlin-console/src/test/resources/org/apache/tinkerpop/gremlin/console/groovy/plugin/script-customizer-2.groovy
----------------------------------------------------------------------
diff --git a/gremlin-console/src/test/resources/org/apache/tinkerpop/gremlin/console/groovy/plugin/script-customizer-2.groovy b/gremlin-console/src/test/resources/org/apache/tinkerpop/gremlin/console/groovy/plugin/script-customizer-2.groovy
deleted file mode 100644
index 1a4f9a9..0000000
--- a/gremlin-console/src/test/resources/org/apache/tinkerpop/gremlin/console/groovy/plugin/script-customizer-2.groovy
+++ /dev/null
@@ -1,2 +0,0 @@
-l = g.V(z).out()
- .group().by('name')
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1cc19e9a/gremlin-console/src/test/resources/org/apache/tinkerpop/gremlin/console/groovy/plugin/tinkergraph-empty.properties
----------------------------------------------------------------------
diff --git a/gremlin-console/src/test/resources/org/apache/tinkerpop/gremlin/console/groovy/plugin/tinkergraph-empty.properties b/gremlin-console/src/test/resources/org/apache/tinkerpop/gremlin/console/groovy/plugin/tinkergraph-empty.properties
deleted file mode 100644
index 6590d39..0000000
--- a/gremlin-console/src/test/resources/org/apache/tinkerpop/gremlin/console/groovy/plugin/tinkergraph-empty.properties
+++ /dev/null
@@ -1,18 +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.
-
-gremlin.graph=org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1cc19e9a/gremlin-console/src/test/resources/org/apache/tinkerpop/gremlin/console/jsr223/gremlin-server-integration.yaml
----------------------------------------------------------------------
diff --git a/gremlin-console/src/test/resources/org/apache/tinkerpop/gremlin/console/jsr223/gremlin-server-integration.yaml b/gremlin-console/src/test/resources/org/apache/tinkerpop/gremlin/console/jsr223/gremlin-server-integration.yaml
index a7ef1a9..0f6a331 100644
--- a/gremlin-console/src/test/resources/org/apache/tinkerpop/gremlin/console/jsr223/gremlin-server-integration.yaml
+++ b/gremlin-console/src/test/resources/org/apache/tinkerpop/gremlin/console/jsr223/gremlin-server-integration.yaml
@@ -17,25 +17,23 @@
host: localhost
port: 45940
-threadPoolWorker: 1
-gremlinPool: 8
scriptEvaluationTimeout: 30000
-serializedResponseTimeout: 30000
-graphs: {
- g: conf/tinkergraph-empty.properties}
-plugins:
- - tinkerpop.tinkergraph
+channelizer: org.apache.tinkerpop.gremlin.server.channel.WebSocketChannelizer
scriptEngines: {
gremlin-groovy: {
- imports: [java.lang.Math],
- staticImports: [java.lang.Math.PI]}}
+ plugins: { org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {},
+ org.apache.tinkerpop.gremlin.tinkergraph.jsr223.TinkerGraphGremlinPlugin: {},
+ org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin: {classImports: [java.lang.Math], methodImports: [java.lang.Math#*]}}}}
serializers:
- - { 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 }
+ - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { }} # application/vnd.gremlin-v1.0+gryo
+ - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoLiteMessageSerializerV1d0, config: { }} # application/vnd.gremlin-v1.0+gryo-lite
+ - { 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, config: { ioRegistries: [org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerIoRegistryV1d0] }} # application/vnd.gremlin-v1.0+json
+ - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV2d0, config: { ioRegistries: [org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerIoRegistryV2d0] }} # application/vnd.gremlin-v2.0+json
+ - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0, config: { }} # application/json,application/vnd.gremlin-v3.0+json
processors:
- { className: org.apache.tinkerpop.gremlin.server.op.session.SessionOpProcessor, config: { sessionTimeout: 28800000 }}
+ - { className: org.apache.tinkerpop.gremlin.server.op.traversal.TraversalOpProcessor, config: { cacheExpirationTime: 600000, cacheMaxSize: 1000 }}
metrics: {
consoleReporter: {enabled: true, interval: 180000},
csvReporter: {enabled: true, interval: 180000, fileName: /tmp/gremlin-server-metrics.csv},
@@ -43,12 +41,14 @@ metrics: {
slf4jReporter: {enabled: true, interval: 180000},
gangliaReporter: {enabled: false, interval: 180000, addressingMode: MULTICAST},
graphiteReporter: {enabled: false, interval: 180000}}
-threadPoolBoss: 1
+strictTransactionManagement: false
maxInitialLineLength: 4096
maxHeaderSize: 8192
maxChunkSize: 8192
maxContentLength: 65536
maxAccumulationBufferComponents: 1024
resultIterationBatchSize: 64
-writeBufferHighWaterMark: 32768
+writeBufferLowWaterMark: 32768
writeBufferHighWaterMark: 65536
+ssl: {
+ enabled: false}
\ No newline at end of file