You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2015/02/12 14:02:13 UTC
[47/77] [partial] incubator-tinkerpop git commit: moved com/tinkerpop
directories to org/apache/tinkerpop
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/1545201f/gremlin-console/src/main/resources/com/tinkerpop/gremlin/console/groovy/plugin/UtilitiesGremlinPluginScript.groovy
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/resources/com/tinkerpop/gremlin/console/groovy/plugin/UtilitiesGremlinPluginScript.groovy b/gremlin-console/src/main/resources/com/tinkerpop/gremlin/console/groovy/plugin/UtilitiesGremlinPluginScript.groovy
deleted file mode 100644
index d4a2bbb..0000000
--- a/gremlin-console/src/main/resources/com/tinkerpop/gremlin/console/groovy/plugin/UtilitiesGremlinPluginScript.groovy
+++ /dev/null
@@ -1,52 +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.
- */
-
-/**
- * @author Daniel Kuppitz (http://thinkaurelius.com)
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-
-describeGraph = { Class<? extends com.tinkerpop.gremlin.structure.Graph> c ->
- def lf = System.getProperty("line.separator")
- def optIns = c.getAnnotationsByType(com.tinkerpop.gremlin.structure.Graph.OptIn)
- def optOuts = c.getAnnotationsByType(com.tinkerpop.gremlin.structure.Graph.OptOut)
-
- def optInCount = optIns != null ? optIns.size() : 0
- def optOutCount = optOuts != null ? optOuts.size() : 0
- def suitesSupported = optIns != null && optIns.size() > 0 ? optIns.collect { "> " + it.value() }.join(lf) : "> none"
- def testsOptedOut = optOuts != null && optOuts.size() > 0 ? optOuts.collect { "> " + it.test() + "#" + it.method() + "${lf}\t\"" + it.reason() + "\"" }.join(lf) : "> none";
-
- // not the use of {lf} here rather than triple quoted string is that groovy 2.4.0 seems to have trouble
- // parsing that into groovysh - note the bug report here: https://jira.codehaus.org/browse/GROOVY-7290
- return "${lf}" +
-"IMPLEMENTATION - ${c.getCanonicalName()} ${lf}" +
-"TINKERPOP TEST SUITE ${lf}" +
-"- Compliant with ($optInCount of 10 suites) + ${lf}" +
-"$suitesSupported ${lf}" +
-"- Opts out of $optOutCount individual tests ${lf}" +
-"$testsOptedOut ${lf}" +
-"- NOTE - ${lf}" +
-"The describeGraph() function shows information about a Graph implementation. ${lf}" +
-"It uses information found in Java Annotations on the implementation itself to ${lf}" +
-"determine this output and does not assess the actual code of the test cases of ${lf}" +
-"the implementation itself. Compliant implementations will faithfully and ${lf}" +
-"honestly supply these Annotations to provide the most accurate depiction of ${lf}" +
-"their support."
-}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/1545201f/gremlin-console/src/main/resources/org/apache/tinkerpop/gremlin/console/commands/InstallCommand.properties
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/resources/org/apache/tinkerpop/gremlin/console/commands/InstallCommand.properties b/gremlin-console/src/main/resources/org/apache/tinkerpop/gremlin/console/commands/InstallCommand.properties
new file mode 100644
index 0000000..a51db82
--- /dev/null
+++ b/gremlin-console/src/main/resources/org/apache/tinkerpop/gremlin/console/commands/InstallCommand.properties
@@ -0,0 +1,20 @@
+# 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.
+
+command.description=Install a Maven library and its dependencies into the Gremlin Console
+command.usage=<group> <module> <version>
+command.help=Import a Maven library into Gremlin. In some cases, a dependency can only be included properly after restart of the Console (a message will appear with such a notification if such action is necessary).
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/1545201f/gremlin-console/src/main/resources/org/apache/tinkerpop/gremlin/console/commands/PluginCommand.properties
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/resources/org/apache/tinkerpop/gremlin/console/commands/PluginCommand.properties b/gremlin-console/src/main/resources/org/apache/tinkerpop/gremlin/console/commands/PluginCommand.properties
new file mode 100644
index 0000000..bc7f2dd
--- /dev/null
+++ b/gremlin-console/src/main/resources/org/apache/tinkerpop/gremlin/console/commands/PluginCommand.properties
@@ -0,0 +1,19 @@
+# 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.
+command.description=Manage plugins for the Console
+command.usage=[use <plugin-name>|list|deactivate <plugin-name>]
+command.help=Manage plugins for the Console.
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/1545201f/gremlin-console/src/main/resources/org/apache/tinkerpop/gremlin/console/commands/RemoteCommand.properties
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/resources/org/apache/tinkerpop/gremlin/console/commands/RemoteCommand.properties b/gremlin-console/src/main/resources/org/apache/tinkerpop/gremlin/console/commands/RemoteCommand.properties
new file mode 100644
index 0000000..3591848
--- /dev/null
+++ b/gremlin-console/src/main/resources/org/apache/tinkerpop/gremlin/console/commands/RemoteCommand.properties
@@ -0,0 +1,19 @@
+# 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.
+command.description=Define a remote connection
+command.usage=[current|connect <type-of-remote> [<args>]|config <args>|list|next|prev|choose <index>|close]
+command.help=Define and manage remote connections to use in conjunction with the :submit command, which will send Gremlin scripts to the specified remote agent for processing.
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/1545201f/gremlin-console/src/main/resources/org/apache/tinkerpop/gremlin/console/commands/SubmitCommand.properties
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/resources/org/apache/tinkerpop/gremlin/console/commands/SubmitCommand.properties b/gremlin-console/src/main/resources/org/apache/tinkerpop/gremlin/console/commands/SubmitCommand.properties
new file mode 100644
index 0000000..448173f
--- /dev/null
+++ b/gremlin-console/src/main/resources/org/apache/tinkerpop/gremlin/console/commands/SubmitCommand.properties
@@ -0,0 +1,19 @@
+# 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.
+command.description=Send a Gremlin script to Gremlin Server
+command.usage=<script>
+command.help=Send a Gremlin script to Gremlin Server given the connection established by the :remote command. Results will be stored in a "reserved" variable defined as "_l".
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/1545201f/gremlin-console/src/main/resources/org/apache/tinkerpop/gremlin/console/commands/UninstallCommand.properties
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/resources/org/apache/tinkerpop/gremlin/console/commands/UninstallCommand.properties b/gremlin-console/src/main/resources/org/apache/tinkerpop/gremlin/console/commands/UninstallCommand.properties
new file mode 100644
index 0000000..f84cb45
--- /dev/null
+++ b/gremlin-console/src/main/resources/org/apache/tinkerpop/gremlin/console/commands/UninstallCommand.properties
@@ -0,0 +1,19 @@
+# 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.
+command.description=Uninstall a Maven library and its dependencies from the Gremlin Console
+command.usage=<module>
+command.help=Uninstall a Maven library and its dependencies from the Gremlin Console, by removing it from the path. A restart of the Console is required to complete the un-installation.
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/1545201f/gremlin-console/src/main/resources/org/apache/tinkerpop/gremlin/console/groovy/plugin/UtilitiesGremlinPluginScript.groovy
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/resources/org/apache/tinkerpop/gremlin/console/groovy/plugin/UtilitiesGremlinPluginScript.groovy b/gremlin-console/src/main/resources/org/apache/tinkerpop/gremlin/console/groovy/plugin/UtilitiesGremlinPluginScript.groovy
new file mode 100644
index 0000000..d4a2bbb
--- /dev/null
+++ b/gremlin-console/src/main/resources/org/apache/tinkerpop/gremlin/console/groovy/plugin/UtilitiesGremlinPluginScript.groovy
@@ -0,0 +1,52 @@
+/*
+ * 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.
+ */
+
+/**
+ * @author Daniel Kuppitz (http://thinkaurelius.com)
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+
+describeGraph = { Class<? extends com.tinkerpop.gremlin.structure.Graph> c ->
+ def lf = System.getProperty("line.separator")
+ def optIns = c.getAnnotationsByType(com.tinkerpop.gremlin.structure.Graph.OptIn)
+ def optOuts = c.getAnnotationsByType(com.tinkerpop.gremlin.structure.Graph.OptOut)
+
+ def optInCount = optIns != null ? optIns.size() : 0
+ def optOutCount = optOuts != null ? optOuts.size() : 0
+ def suitesSupported = optIns != null && optIns.size() > 0 ? optIns.collect { "> " + it.value() }.join(lf) : "> none"
+ def testsOptedOut = optOuts != null && optOuts.size() > 0 ? optOuts.collect { "> " + it.test() + "#" + it.method() + "${lf}\t\"" + it.reason() + "\"" }.join(lf) : "> none";
+
+ // not the use of {lf} here rather than triple quoted string is that groovy 2.4.0 seems to have trouble
+ // parsing that into groovysh - note the bug report here: https://jira.codehaus.org/browse/GROOVY-7290
+ return "${lf}" +
+"IMPLEMENTATION - ${c.getCanonicalName()} ${lf}" +
+"TINKERPOP TEST SUITE ${lf}" +
+"- Compliant with ($optInCount of 10 suites) + ${lf}" +
+"$suitesSupported ${lf}" +
+"- Opts out of $optOutCount individual tests ${lf}" +
+"$testsOptedOut ${lf}" +
+"- NOTE - ${lf}" +
+"The describeGraph() function shows information about a Graph implementation. ${lf}" +
+"It uses information found in Java Annotations on the implementation itself to ${lf}" +
+"determine this output and does not assess the actual code of the test cases of ${lf}" +
+"the implementation itself. Compliant implementations will faithfully and ${lf}" +
+"honestly supply these Annotations to provide the most accurate depiction of ${lf}" +
+"their support."
+}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/1545201f/gremlin-console/src/test/java/com/tinkerpop/gremlin/console/groovy/plugin/AbstractGremlinServerIntegrationTest.java
----------------------------------------------------------------------
diff --git a/gremlin-console/src/test/java/com/tinkerpop/gremlin/console/groovy/plugin/AbstractGremlinServerIntegrationTest.java b/gremlin-console/src/test/java/com/tinkerpop/gremlin/console/groovy/plugin/AbstractGremlinServerIntegrationTest.java
deleted file mode 100644
index 7565b86..0000000
--- a/gremlin-console/src/test/java/com/tinkerpop/gremlin/console/groovy/plugin/AbstractGremlinServerIntegrationTest.java
+++ /dev/null
@@ -1,81 +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 com.tinkerpop.gremlin.console.groovy.plugin;
-
-import com.tinkerpop.gremlin.server.GremlinServer;
-import com.tinkerpop.gremlin.server.Settings;
-import org.junit.After;
-import org.junit.Before;
-
-import java.io.File;
-import java.io.InputStream;
-
-/**
- * Starts and stops an instance for each executed test.
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-public abstract class AbstractGremlinServerIntegrationTest {
- private GremlinServer server;
-
- public Settings overrideSettings(final Settings settings) {
- return settings;
- }
-
- public InputStream getSettingsInputStream() {
- return AbstractGremlinServerIntegrationTest.class.getResourceAsStream("gremlin-server-integration.yaml");
- }
-
- @Before
- public void setUp() throws Exception {
- final InputStream stream = getSettingsInputStream();
- final Settings settings = Settings.read(stream);
-
- final Settings overridenSettings = overrideSettings(settings);
- this.server = new GremlinServer(overridenSettings);
-
- server.start().join();
- }
-
- @After
- public void tearDown() throws Exception {
- stopServer();
- }
-
- public void stopServer() throws Exception {
- server.stop().join();
- }
-
- public static boolean deleteDirectory(final File directory) {
- if (directory.exists()) {
- final File[] files = directory.listFiles();
- if (null != files) {
- for (int i = 0; i < files.length; i++) {
- if (files[i].isDirectory()) {
- deleteDirectory(files[i]);
- } else {
- files[i].delete();
- }
- }
- }
- }
-
- return (directory.delete());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/1545201f/gremlin-console/src/test/java/com/tinkerpop/gremlin/console/groovy/plugin/DriverGremlinPluginTest.java
----------------------------------------------------------------------
diff --git a/gremlin-console/src/test/java/com/tinkerpop/gremlin/console/groovy/plugin/DriverGremlinPluginTest.java b/gremlin-console/src/test/java/com/tinkerpop/gremlin/console/groovy/plugin/DriverGremlinPluginTest.java
deleted file mode 100644
index f960d82..0000000
--- a/gremlin-console/src/test/java/com/tinkerpop/gremlin/console/groovy/plugin/DriverGremlinPluginTest.java
+++ /dev/null
@@ -1,67 +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 com.tinkerpop.gremlin.console.groovy.plugin;
-
-import org.codehaus.groovy.tools.shell.Groovysh;
-import org.codehaus.groovy.tools.shell.IO;
-import org.junit.Test;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import static org.hamcrest.CoreMatchers.containsString;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-
-/**
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-public class DriverGremlinPluginTest {
- @Test
- public void shouldPluginToAndDoImports() throws Exception {
- final DriverGremlinPlugin plugin = new DriverGremlinPlugin();
- final SpyPluginAcceptor spy = new SpyPluginAcceptor();
- plugin.pluginTo(spy);
-
- assertEquals(4, spy.getImports().size());
- spy.getImports().forEach(importString -> assertThat(importString, containsString("com.tinkerpop.gremlin.driver")));
- }
-
- @Test
- public void shouldConstructEmptyRemoteAcceptorWhenNotInConsoleEnvironment() throws Exception {
- final DriverGremlinPlugin plugin = new DriverGremlinPlugin();
- final SpyPluginAcceptor spy = new SpyPluginAcceptor();
- plugin.pluginTo(spy);
-
- assertThat(plugin.remoteAcceptor().isPresent(), is(false));
- }
-
- @Test
- public void shouldConstructRemoteAcceptorWhenInConsoleEnvironment() throws Exception {
- final DriverGremlinPlugin plugin = new DriverGremlinPlugin();
- final Map<String, Object> env = new HashMap<>();
- env.put("ConsolePluginAcceptor.io", new IO());
- env.put("ConsolePluginAcceptor.shell", new Groovysh());
- final SpyPluginAcceptor spy = new SpyPluginAcceptor(() -> env);
- plugin.pluginTo(spy);
-
- assertThat(plugin.remoteAcceptor().isPresent(), is(true));
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/1545201f/gremlin-console/src/test/java/com/tinkerpop/gremlin/console/groovy/plugin/DriverRemoteAcceptorIntegrateTest.java
----------------------------------------------------------------------
diff --git a/gremlin-console/src/test/java/com/tinkerpop/gremlin/console/groovy/plugin/DriverRemoteAcceptorIntegrateTest.java b/gremlin-console/src/test/java/com/tinkerpop/gremlin/console/groovy/plugin/DriverRemoteAcceptorIntegrateTest.java
deleted file mode 100644
index c2faa57..0000000
--- a/gremlin-console/src/test/java/com/tinkerpop/gremlin/console/groovy/plugin/DriverRemoteAcceptorIntegrateTest.java
+++ /dev/null
@@ -1,113 +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 com.tinkerpop.gremlin.console.groovy.plugin;
-
-import com.tinkerpop.gremlin.TestHelper;
-import com.tinkerpop.gremlin.driver.Result;
-import com.tinkerpop.gremlin.server.Settings;
-import com.tinkerpop.gremlin.util.StreamFactory;
-import org.codehaus.groovy.tools.shell.Groovysh;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestName;
-
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-import java.util.stream.Collectors;
-
-import static org.hamcrest.CoreMatchers.startsWith;
-import static org.hamcrest.Matchers.contains;
-import static org.hamcrest.Matchers.hasSize;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-
-/**
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-public class DriverRemoteAcceptorIntegrateTest extends AbstractGremlinServerIntegrationTest {
- private final Groovysh groovysh = new Groovysh();
- private DriverRemoteAcceptor acceptor;
-
- @Rule
- public TestName name = new TestName();
-
- /**
- * Configure specific Gremlin Server settings for specific tests.
- */
- @Override
- public Settings overrideSettings(final Settings settings) {
- try {
- final String tinkerGraphConfig = TestHelper.generateTempFileFromResource(this.getClass(), "tinkergraph-empty.properties", ".tmp").getAbsolutePath();
- settings.graphs.put("g", tinkerGraphConfig);
- return settings;
- } catch (Exception ex) {
- throw new RuntimeException(ex);
- }
- }
-
- @Before
- public void before() throws Exception {
- acceptor = new DriverRemoteAcceptor(groovysh);
- }
-
- @After
- public void after() {
- try {
- acceptor.close();
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }
-
- @Test
- public void shouldConnect() throws Exception {
- assertThat(acceptor.connect(Arrays.asList(TestHelper.generateTempFileFromResource(this.getClass(), "remote.yaml", ".tmp").getAbsolutePath())).toString(), startsWith("Connected - "));
- }
-
- @Test
- public void shouldConnectAndSubmitSimple() throws Exception {
- assertThat(acceptor.connect(Arrays.asList(TestHelper.generateTempFileFromResource(this.getClass(), "remote.yaml", ".tmp").getAbsolutePath())).toString(), startsWith("Connected - "));
- assertEquals("2", ((Iterator) acceptor.submit(Arrays.asList("1+1"))).next());
- assertEquals("2", ((List<Result>) groovysh.getInterp().getContext().getProperty(DriverRemoteAcceptor.RESULT)).iterator().next().getString());
- }
-
- @Test
- public void shouldConnectAndSubmitSimpleList() throws Exception {
- assertThat(acceptor.connect(Arrays.asList(TestHelper.generateTempFileFromResource(this.getClass(), "remote.yaml", ".tmp").getAbsolutePath())).toString(), startsWith("Connected - "));
- assertThat(StreamFactory.stream(((Iterator<String>) acceptor.submit(Arrays.asList("[1,2,3,4,5]")))).collect(Collectors.toList()), contains("1", "2", "3", "4", "5"));
- assertThat(((List<Result>) groovysh.getInterp().getContext().getProperty(DriverRemoteAcceptor.RESULT)).stream().map(Result::getString).collect(Collectors.toList()), contains("1", "2", "3", "4", "5"));
- }
-
- @Test
- public void shouldConnectAndReturnVertices() throws Exception {
- assertThat(acceptor.connect(Arrays.asList(TestHelper.generateTempFileFromResource(this.getClass(), "remote.yaml", ".tmp").getAbsolutePath())).toString(), startsWith("Connected - "));
- assertThat(StreamFactory.stream(((Iterator<String>) acceptor.submit(Arrays.asList("g.addVertex('name','stephen');g.addVertex('name','marko');g.V()")))).collect(Collectors.toList()), hasSize(2));
- assertThat(((List<Result>) groovysh.getInterp().getContext().getProperty(DriverRemoteAcceptor.RESULT)).stream().map(Result::getString).collect(Collectors.toList()), hasSize(2));
- }
-
- @Test
- public void shouldConnectAndSubmitForNull() throws Exception {
- assertThat(acceptor.connect(Arrays.asList(TestHelper.generateTempFileFromResource(this.getClass(), "remote.yaml", ".tmp").getAbsolutePath())).toString(), startsWith("Connected - "));
- assertThat(StreamFactory.stream(((Iterator<String>) acceptor.submit(Arrays.asList("g.V().remove()")))).collect(Collectors.toList()), contains("null"));
- assertThat(((List<Result>) groovysh.getInterp().getContext().getProperty(DriverRemoteAcceptor.RESULT)).stream().map(Result::getObject).collect(Collectors.toList()), contains("null"));
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/1545201f/gremlin-console/src/test/java/com/tinkerpop/gremlin/console/groovy/plugin/DriverRemoteAcceptorTest.java
----------------------------------------------------------------------
diff --git a/gremlin-console/src/test/java/com/tinkerpop/gremlin/console/groovy/plugin/DriverRemoteAcceptorTest.java b/gremlin-console/src/test/java/com/tinkerpop/gremlin/console/groovy/plugin/DriverRemoteAcceptorTest.java
deleted file mode 100644
index 9ba667c..0000000
--- a/gremlin-console/src/test/java/com/tinkerpop/gremlin/console/groovy/plugin/DriverRemoteAcceptorTest.java
+++ /dev/null
@@ -1,77 +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 com.tinkerpop.gremlin.console.groovy.plugin;
-
-import com.tinkerpop.gremlin.TestHelper;
-import com.tinkerpop.gremlin.groovy.plugin.RemoteException;
-import org.codehaus.groovy.tools.shell.Groovysh;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-
-import static org.hamcrest.CoreMatchers.startsWith;
-import static org.junit.Assert.assertThat;
-
-/**
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-public class DriverRemoteAcceptorTest {
-
- private final Groovysh groovysh = new Groovysh();
- private DriverRemoteAcceptor acceptor;
-
- @Before
- public void setUp() {
- acceptor = new DriverRemoteAcceptor(groovysh);
- }
-
- @After
- public void tearDown() {
- try {
- acceptor.close();
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }
-
- @Test(expected = RemoteException.class)
- public void shouldNotConnectWithEmptyArgs() throws Exception {
- acceptor.connect(new ArrayList<>());
- }
-
- @Test(expected = RemoteException.class)
- public void shouldNotConnectWithTooManyArgs() throws Exception {
- acceptor.connect(Arrays.asList("two", "too", "many"));
- }
-
- @Test(expected = RemoteException.class)
- public void shouldNotConnectWithInvalidConfigFile() throws Exception {
- acceptor.connect(Arrays.asList("this-isnt-real.yaml"));
- }
-
- @Test
- public void shouldConnect() throws Exception {
- // there is no gremlin server running for this test, but gremlin-driver lazily connects so this should
- // be ok to just validate that a connection is created
- assertThat(acceptor.connect(Arrays.asList(TestHelper.generateTempFileFromResource(this.getClass(), "remote.yaml", ".tmp").getAbsolutePath())).toString(), startsWith("Connected - "));
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/1545201f/gremlin-console/src/test/java/com/tinkerpop/gremlin/console/groovy/plugin/SpyPluginAcceptor.java
----------------------------------------------------------------------
diff --git a/gremlin-console/src/test/java/com/tinkerpop/gremlin/console/groovy/plugin/SpyPluginAcceptor.java b/gremlin-console/src/test/java/com/tinkerpop/gremlin/console/groovy/plugin/SpyPluginAcceptor.java
deleted file mode 100644
index b6684c5..0000000
--- a/gremlin-console/src/test/java/com/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 com.tinkerpop.gremlin.console.groovy.plugin;
-
-import com.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/incubator-tinkerpop/blob/1545201f/gremlin-console/src/test/java/com/tinkerpop/gremlin/console/groovy/plugin/SugarGremlinPluginTest.java
----------------------------------------------------------------------
diff --git a/gremlin-console/src/test/java/com/tinkerpop/gremlin/console/groovy/plugin/SugarGremlinPluginTest.java b/gremlin-console/src/test/java/com/tinkerpop/gremlin/console/groovy/plugin/SugarGremlinPluginTest.java
deleted file mode 100644
index 900c5b2..0000000
--- a/gremlin-console/src/test/java/com/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 com.tinkerpop.gremlin.console.groovy.plugin;
-
-import com.tinkerpop.gremlin.groovy.plugin.SugarGremlinPlugin;
-import com.tinkerpop.gremlin.groovy.util.MetaRegistryUtil;
-import com.tinkerpop.gremlin.process.graph.traversal.GraphTraversal;
-import com.tinkerpop.gremlin.tinkergraph.structure.TinkerFactory;
-import com.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.V()")).count().next());
- assertEquals(6l, ((GraphTraversal) groovysh.execute("g.V")).count().next());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/1545201f/gremlin-console/src/test/java/com/tinkerpop/gremlin/console/groovy/plugin/UtilitiesGremlinPluginTest.java
----------------------------------------------------------------------
diff --git a/gremlin-console/src/test/java/com/tinkerpop/gremlin/console/groovy/plugin/UtilitiesGremlinPluginTest.java b/gremlin-console/src/test/java/com/tinkerpop/gremlin/console/groovy/plugin/UtilitiesGremlinPluginTest.java
deleted file mode 100644
index 99f1af7..0000000
--- a/gremlin-console/src/test/java/com/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 com.tinkerpop.gremlin.console.groovy.plugin;
-
-import com.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(com.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph)").toString(), containsString("IMPLEMENTATION - com.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph"));
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/1545201f/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/AbstractGremlinServerIntegrationTest.java
----------------------------------------------------------------------
diff --git a/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/AbstractGremlinServerIntegrationTest.java b/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/AbstractGremlinServerIntegrationTest.java
new file mode 100644
index 0000000..7565b86
--- /dev/null
+++ b/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/AbstractGremlinServerIntegrationTest.java
@@ -0,0 +1,81 @@
+/*
+ * 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 com.tinkerpop.gremlin.console.groovy.plugin;
+
+import com.tinkerpop.gremlin.server.GremlinServer;
+import com.tinkerpop.gremlin.server.Settings;
+import org.junit.After;
+import org.junit.Before;
+
+import java.io.File;
+import java.io.InputStream;
+
+/**
+ * Starts and stops an instance for each executed test.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public abstract class AbstractGremlinServerIntegrationTest {
+ private GremlinServer server;
+
+ public Settings overrideSettings(final Settings settings) {
+ return settings;
+ }
+
+ public InputStream getSettingsInputStream() {
+ return AbstractGremlinServerIntegrationTest.class.getResourceAsStream("gremlin-server-integration.yaml");
+ }
+
+ @Before
+ public void setUp() throws Exception {
+ final InputStream stream = getSettingsInputStream();
+ final Settings settings = Settings.read(stream);
+
+ final Settings overridenSettings = overrideSettings(settings);
+ this.server = new GremlinServer(overridenSettings);
+
+ server.start().join();
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ stopServer();
+ }
+
+ public void stopServer() throws Exception {
+ server.stop().join();
+ }
+
+ public static boolean deleteDirectory(final File directory) {
+ if (directory.exists()) {
+ final File[] files = directory.listFiles();
+ if (null != files) {
+ for (int i = 0; i < files.length; i++) {
+ if (files[i].isDirectory()) {
+ deleteDirectory(files[i]);
+ } else {
+ files[i].delete();
+ }
+ }
+ }
+ }
+
+ return (directory.delete());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/1545201f/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/DriverGremlinPluginTest.java
----------------------------------------------------------------------
diff --git a/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/DriverGremlinPluginTest.java b/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/DriverGremlinPluginTest.java
new file mode 100644
index 0000000..f960d82
--- /dev/null
+++ b/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/DriverGremlinPluginTest.java
@@ -0,0 +1,67 @@
+/*
+ * 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 com.tinkerpop.gremlin.console.groovy.plugin;
+
+import org.codehaus.groovy.tools.shell.Groovysh;
+import org.codehaus.groovy.tools.shell.IO;
+import org.junit.Test;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class DriverGremlinPluginTest {
+ @Test
+ public void shouldPluginToAndDoImports() throws Exception {
+ final DriverGremlinPlugin plugin = new DriverGremlinPlugin();
+ final SpyPluginAcceptor spy = new SpyPluginAcceptor();
+ plugin.pluginTo(spy);
+
+ assertEquals(4, spy.getImports().size());
+ spy.getImports().forEach(importString -> assertThat(importString, containsString("com.tinkerpop.gremlin.driver")));
+ }
+
+ @Test
+ public void shouldConstructEmptyRemoteAcceptorWhenNotInConsoleEnvironment() throws Exception {
+ final DriverGremlinPlugin plugin = new DriverGremlinPlugin();
+ final SpyPluginAcceptor spy = new SpyPluginAcceptor();
+ plugin.pluginTo(spy);
+
+ assertThat(plugin.remoteAcceptor().isPresent(), is(false));
+ }
+
+ @Test
+ public void shouldConstructRemoteAcceptorWhenInConsoleEnvironment() throws Exception {
+ final DriverGremlinPlugin plugin = new DriverGremlinPlugin();
+ final Map<String, Object> env = new HashMap<>();
+ env.put("ConsolePluginAcceptor.io", new IO());
+ env.put("ConsolePluginAcceptor.shell", new Groovysh());
+ final SpyPluginAcceptor spy = new SpyPluginAcceptor(() -> env);
+ plugin.pluginTo(spy);
+
+ assertThat(plugin.remoteAcceptor().isPresent(), is(true));
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/1545201f/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/DriverRemoteAcceptorIntegrateTest.java
----------------------------------------------------------------------
diff --git a/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/DriverRemoteAcceptorIntegrateTest.java b/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/DriverRemoteAcceptorIntegrateTest.java
new file mode 100644
index 0000000..c2faa57
--- /dev/null
+++ b/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/DriverRemoteAcceptorIntegrateTest.java
@@ -0,0 +1,113 @@
+/*
+ * 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 com.tinkerpop.gremlin.console.groovy.plugin;
+
+import com.tinkerpop.gremlin.TestHelper;
+import com.tinkerpop.gremlin.driver.Result;
+import com.tinkerpop.gremlin.server.Settings;
+import com.tinkerpop.gremlin.util.StreamFactory;
+import org.codehaus.groovy.tools.shell.Groovysh;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TestName;
+
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import static org.hamcrest.CoreMatchers.startsWith;
+import static org.hamcrest.Matchers.contains;
+import static org.hamcrest.Matchers.hasSize;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class DriverRemoteAcceptorIntegrateTest extends AbstractGremlinServerIntegrationTest {
+ private final Groovysh groovysh = new Groovysh();
+ private DriverRemoteAcceptor acceptor;
+
+ @Rule
+ public TestName name = new TestName();
+
+ /**
+ * Configure specific Gremlin Server settings for specific tests.
+ */
+ @Override
+ public Settings overrideSettings(final Settings settings) {
+ try {
+ final String tinkerGraphConfig = TestHelper.generateTempFileFromResource(this.getClass(), "tinkergraph-empty.properties", ".tmp").getAbsolutePath();
+ settings.graphs.put("g", tinkerGraphConfig);
+ return settings;
+ } catch (Exception ex) {
+ throw new RuntimeException(ex);
+ }
+ }
+
+ @Before
+ public void before() throws Exception {
+ acceptor = new DriverRemoteAcceptor(groovysh);
+ }
+
+ @After
+ public void after() {
+ try {
+ acceptor.close();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ @Test
+ public void shouldConnect() throws Exception {
+ assertThat(acceptor.connect(Arrays.asList(TestHelper.generateTempFileFromResource(this.getClass(), "remote.yaml", ".tmp").getAbsolutePath())).toString(), startsWith("Connected - "));
+ }
+
+ @Test
+ public void shouldConnectAndSubmitSimple() throws Exception {
+ assertThat(acceptor.connect(Arrays.asList(TestHelper.generateTempFileFromResource(this.getClass(), "remote.yaml", ".tmp").getAbsolutePath())).toString(), startsWith("Connected - "));
+ assertEquals("2", ((Iterator) acceptor.submit(Arrays.asList("1+1"))).next());
+ assertEquals("2", ((List<Result>) groovysh.getInterp().getContext().getProperty(DriverRemoteAcceptor.RESULT)).iterator().next().getString());
+ }
+
+ @Test
+ public void shouldConnectAndSubmitSimpleList() throws Exception {
+ assertThat(acceptor.connect(Arrays.asList(TestHelper.generateTempFileFromResource(this.getClass(), "remote.yaml", ".tmp").getAbsolutePath())).toString(), startsWith("Connected - "));
+ assertThat(StreamFactory.stream(((Iterator<String>) acceptor.submit(Arrays.asList("[1,2,3,4,5]")))).collect(Collectors.toList()), contains("1", "2", "3", "4", "5"));
+ assertThat(((List<Result>) groovysh.getInterp().getContext().getProperty(DriverRemoteAcceptor.RESULT)).stream().map(Result::getString).collect(Collectors.toList()), contains("1", "2", "3", "4", "5"));
+ }
+
+ @Test
+ public void shouldConnectAndReturnVertices() throws Exception {
+ assertThat(acceptor.connect(Arrays.asList(TestHelper.generateTempFileFromResource(this.getClass(), "remote.yaml", ".tmp").getAbsolutePath())).toString(), startsWith("Connected - "));
+ assertThat(StreamFactory.stream(((Iterator<String>) acceptor.submit(Arrays.asList("g.addVertex('name','stephen');g.addVertex('name','marko');g.V()")))).collect(Collectors.toList()), hasSize(2));
+ assertThat(((List<Result>) groovysh.getInterp().getContext().getProperty(DriverRemoteAcceptor.RESULT)).stream().map(Result::getString).collect(Collectors.toList()), hasSize(2));
+ }
+
+ @Test
+ public void shouldConnectAndSubmitForNull() throws Exception {
+ assertThat(acceptor.connect(Arrays.asList(TestHelper.generateTempFileFromResource(this.getClass(), "remote.yaml", ".tmp").getAbsolutePath())).toString(), startsWith("Connected - "));
+ assertThat(StreamFactory.stream(((Iterator<String>) acceptor.submit(Arrays.asList("g.V().remove()")))).collect(Collectors.toList()), contains("null"));
+ assertThat(((List<Result>) groovysh.getInterp().getContext().getProperty(DriverRemoteAcceptor.RESULT)).stream().map(Result::getObject).collect(Collectors.toList()), contains("null"));
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/1545201f/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/DriverRemoteAcceptorTest.java
----------------------------------------------------------------------
diff --git a/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/DriverRemoteAcceptorTest.java b/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/DriverRemoteAcceptorTest.java
new file mode 100644
index 0000000..9ba667c
--- /dev/null
+++ b/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/DriverRemoteAcceptorTest.java
@@ -0,0 +1,77 @@
+/*
+ * 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 com.tinkerpop.gremlin.console.groovy.plugin;
+
+import com.tinkerpop.gremlin.TestHelper;
+import com.tinkerpop.gremlin.groovy.plugin.RemoteException;
+import org.codehaus.groovy.tools.shell.Groovysh;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import static org.hamcrest.CoreMatchers.startsWith;
+import static org.junit.Assert.assertThat;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class DriverRemoteAcceptorTest {
+
+ private final Groovysh groovysh = new Groovysh();
+ private DriverRemoteAcceptor acceptor;
+
+ @Before
+ public void setUp() {
+ acceptor = new DriverRemoteAcceptor(groovysh);
+ }
+
+ @After
+ public void tearDown() {
+ try {
+ acceptor.close();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ @Test(expected = RemoteException.class)
+ public void shouldNotConnectWithEmptyArgs() throws Exception {
+ acceptor.connect(new ArrayList<>());
+ }
+
+ @Test(expected = RemoteException.class)
+ public void shouldNotConnectWithTooManyArgs() throws Exception {
+ acceptor.connect(Arrays.asList("two", "too", "many"));
+ }
+
+ @Test(expected = RemoteException.class)
+ public void shouldNotConnectWithInvalidConfigFile() throws Exception {
+ acceptor.connect(Arrays.asList("this-isnt-real.yaml"));
+ }
+
+ @Test
+ public void shouldConnect() throws Exception {
+ // there is no gremlin server running for this test, but gremlin-driver lazily connects so this should
+ // be ok to just validate that a connection is created
+ assertThat(acceptor.connect(Arrays.asList(TestHelper.generateTempFileFromResource(this.getClass(), "remote.yaml", ".tmp").getAbsolutePath())).toString(), startsWith("Connected - "));
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/1545201f/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
new file mode 100644
index 0000000..b6684c5
--- /dev/null
+++ b/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/SpyPluginAcceptor.java
@@ -0,0 +1,87 @@
+/*
+ * 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 com.tinkerpop.gremlin.console.groovy.plugin;
+
+import com.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/incubator-tinkerpop/blob/1545201f/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
new file mode 100644
index 0000000..900c5b2
--- /dev/null
+++ b/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/SugarGremlinPluginTest.java
@@ -0,0 +1,63 @@
+/*
+ * 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 com.tinkerpop.gremlin.console.groovy.plugin;
+
+import com.tinkerpop.gremlin.groovy.plugin.SugarGremlinPlugin;
+import com.tinkerpop.gremlin.groovy.util.MetaRegistryUtil;
+import com.tinkerpop.gremlin.process.graph.traversal.GraphTraversal;
+import com.tinkerpop.gremlin.tinkergraph.structure.TinkerFactory;
+import com.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.V()")).count().next());
+ assertEquals(6l, ((GraphTraversal) groovysh.execute("g.V")).count().next());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/1545201f/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
new file mode 100644
index 0000000..99f1af7
--- /dev/null
+++ b/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/UtilitiesGremlinPluginTest.java
@@ -0,0 +1,72 @@
+/*
+ * 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 com.tinkerpop.gremlin.console.groovy.plugin;
+
+import com.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(com.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph)").toString(), containsString("IMPLEMENTATION - com.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph"));
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/1545201f/gremlin-console/src/test/resources/com/tinkerpop/gremlin/console/groovy/plugin/gremlin-server-integration.yaml
----------------------------------------------------------------------
diff --git a/gremlin-console/src/test/resources/com/tinkerpop/gremlin/console/groovy/plugin/gremlin-server-integration.yaml b/gremlin-console/src/test/resources/com/tinkerpop/gremlin/console/groovy/plugin/gremlin-server-integration.yaml
deleted file mode 100644
index cdcb062..0000000
--- a/gremlin-console/src/test/resources/com/tinkerpop/gremlin/console/groovy/plugin/gremlin-server-integration.yaml
+++ /dev/null
@@ -1,41 +0,0 @@
-host: localhost
-port: 8182
-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],
- scripts: [scripts/sample.groovy]},
- nashorn: {
- imports: [java.lang.Math],
- staticImports: [java.lang.Math.PI]}}
-serializers:
- - { className: com.tinkerpop.gremlin.driver.ser.KryoMessageSerializerV1d0, config: { custom: [groovy.json.JsonBuilder;com.tinkerpop.gremlin.driver.ser.JsonBuilderKryoSerializer]}}
- - { className: com.tinkerpop.gremlin.driver.ser.KryoMessageSerializerV1d0, config: { serializeResultToString: true}}
- - { className: com.tinkerpop.gremlin.driver.ser.JsonMessageSerializerGremlinV1d0 }
- - { className: com.tinkerpop.gremlin.driver.ser.JsonMessageSerializerV1d0 }
-processors:
- - { className: com.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/incubator-tinkerpop/blob/1545201f/gremlin-console/src/test/resources/com/tinkerpop/gremlin/console/groovy/plugin/remote.yaml
----------------------------------------------------------------------
diff --git a/gremlin-console/src/test/resources/com/tinkerpop/gremlin/console/groovy/plugin/remote.yaml b/gremlin-console/src/test/resources/com/tinkerpop/gremlin/console/groovy/plugin/remote.yaml
deleted file mode 100644
index 078607c..0000000
--- a/gremlin-console/src/test/resources/com/tinkerpop/gremlin/console/groovy/plugin/remote.yaml
+++ /dev/null
@@ -1,3 +0,0 @@
-hosts: [localhost]
-port: 8182
-serializer: { className: com.tinkerpop.gremlin.driver.ser.KryoMessageSerializerV1d0, config: { serializeResultToString: true }}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/1545201f/gremlin-console/src/test/resources/com/tinkerpop/gremlin/console/groovy/plugin/tinkergraph-empty.properties
----------------------------------------------------------------------
diff --git a/gremlin-console/src/test/resources/com/tinkerpop/gremlin/console/groovy/plugin/tinkergraph-empty.properties b/gremlin-console/src/test/resources/com/tinkerpop/gremlin/console/groovy/plugin/tinkergraph-empty.properties
deleted file mode 100644
index f0ad15c..0000000
--- a/gremlin-console/src/test/resources/com/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=com.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/1545201f/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
new file mode 100644
index 0000000..cdcb062
--- /dev/null
+++ b/gremlin-console/src/test/resources/org/apache/tinkerpop/gremlin/console/groovy/plugin/gremlin-server-integration.yaml
@@ -0,0 +1,41 @@
+host: localhost
+port: 8182
+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],
+ scripts: [scripts/sample.groovy]},
+ nashorn: {
+ imports: [java.lang.Math],
+ staticImports: [java.lang.Math.PI]}}
+serializers:
+ - { className: com.tinkerpop.gremlin.driver.ser.KryoMessageSerializerV1d0, config: { custom: [groovy.json.JsonBuilder;com.tinkerpop.gremlin.driver.ser.JsonBuilderKryoSerializer]}}
+ - { className: com.tinkerpop.gremlin.driver.ser.KryoMessageSerializerV1d0, config: { serializeResultToString: true}}
+ - { className: com.tinkerpop.gremlin.driver.ser.JsonMessageSerializerGremlinV1d0 }
+ - { className: com.tinkerpop.gremlin.driver.ser.JsonMessageSerializerV1d0 }
+processors:
+ - { className: com.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/incubator-tinkerpop/blob/1545201f/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
new file mode 100644
index 0000000..078607c
--- /dev/null
+++ b/gremlin-console/src/test/resources/org/apache/tinkerpop/gremlin/console/groovy/plugin/remote.yaml
@@ -0,0 +1,3 @@
+hosts: [localhost]
+port: 8182
+serializer: { className: com.tinkerpop.gremlin.driver.ser.KryoMessageSerializerV1d0, config: { serializeResultToString: true }}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/1545201f/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
new file mode 100644
index 0000000..f0ad15c
--- /dev/null
+++ b/gremlin-console/src/test/resources/org/apache/tinkerpop/gremlin/console/groovy/plugin/tinkergraph-empty.properties
@@ -0,0 +1,18 @@
+# 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=com.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/1545201f/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/FastNoSuchElementException.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/FastNoSuchElementException.java b/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/FastNoSuchElementException.java
deleted file mode 100644
index 0773791..0000000
--- a/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/FastNoSuchElementException.java
+++ /dev/null
@@ -1,46 +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 com.tinkerpop.gremlin.process;
-
-import java.util.NoSuchElementException;
-
-/**
- * Retrieve a singleton, fast {@link java.util.NoSuchElementException} without a stack trace.
- */
-public final class FastNoSuchElementException extends NoSuchElementException {
-
- private static final long serialVersionUID = 2303108654138257697L;
- private static final FastNoSuchElementException INSTANCE = new FastNoSuchElementException();
-
- private FastNoSuchElementException() {
- }
-
- /**
- * Retrieve a singleton, fast {@link NoSuchElementException} without a stack trace.
- */
- public static NoSuchElementException instance() {
- return INSTANCE;
- }
-
- @Override
- public synchronized Throwable fillInStackTrace() {
- return this;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/1545201f/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/Path.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/Path.java b/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/Path.java
deleted file mode 100644
index f892401..0000000
--- a/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/Path.java
+++ /dev/null
@@ -1,179 +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 com.tinkerpop.gremlin.process;
-
-import org.javatuples.Pair;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-import java.util.function.BiConsumer;
-import java.util.function.Consumer;
-import java.util.stream.IntStream;
-import java.util.stream.Stream;
-
-/**
- * A Path denotes a particular walk through a {@link com.tinkerpop.gremlin.structure.Graph} as defined by a {@link Traverser}.
- * In abstraction, any Path implementation maintains two lists: a list of sets of labels and a list of objects.
- * The list of labels are the labels of the steps traversed.
- * The list of objects are the objects traversed.
- *
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public interface Path extends Cloneable {
-
- /**
- * Get the number of step in the path.
- *
- * @return the size of the path
- */
- public default int size() {
- return this.objects().size();
- }
-
- /**
- * Add a new step to the path with an object and any number of associated labels.
- *
- * @param object the new head of the path
- * @param labels the labels at the head of the path
- * @return the extended path
- */
- public Path extend(final Object object, final String... labels);
-
- /**
- * Get the object associated with the particular label of the path.
- * If the path as multiple labels of the type, then return a {@link List} of those objects.
- *
- * @param label the label of the path
- * @param <A> the type of the object associated with the label
- * @return the object associated with the label of the path
- * @throws IllegalArgumentException if the path does not contain the label
- */
- public default <A> A get(final String label) throws IllegalArgumentException {
- final List<Object> objects = this.objects();
- final List<Set<String>> labels = this.labels();
- Object object = null;
- for (int i = 0; i < labels.size(); i++) {
- if (labels.get(i).contains(label)) {
- if (null == object) {
- object = objects.get(i);
- } else if (object instanceof List) {
- ((List) object).add(objects.get(i));
- } else {
- final List list = new ArrayList(2);
- list.add(object);
- list.add(objects.get(i));
- object = list;
- }
- }
- }
- if (null == object)
- throw Path.Exceptions.stepWithProvidedLabelDoesNotExist(label);
- return (A) object;
- }
-
- /**
- * Get the object associated with the specified index into the path.
- *
- * @param index the index of the path
- * @param <A> the type of the object associated with the index
- * @return the object associated with the index of the path
- */
- public default <A> A get(final int index) {
- return (A) this.objects().get(index);
- }
-
- /**
- * Return true if the path has the specified label, else return false.
- *
- * @param label the label to search for
- * @return true if the label exists in the path
- */
- public default boolean hasLabel(final String label) {
- return this.labels().stream().filter(labels -> labels.contains(label)).findAny().isPresent();
- }
-
- /**
- * Add label to the current head of the path.
- *
- * @param label the label to add to the head of the path
- */
- public void addLabel(final String label);
-
- /**
- * An ordered list of the objects in the path.
- *
- * @return the objects of the path
- */
- public List<Object> objects();
-
- /**
- * An ordered list of the labels associated with the path
- *
- * @return the labels of the path
- */
- public List<Set<String>> labels();
-
- /**
- * {@inheritDoc}
- */
- public Path clone() throws CloneNotSupportedException;
-
- /**
- * Determines whether the path is a simple or not.
- * A simple path has no cycles and thus, no repeated objects.
- *
- * @return Whether the path is simple or not
- */
- public default boolean isSimple() {
- final List<Object> objects = this.objects();
- for (int i = 0; i < objects.size() - 1; i++) {
- for (int j = i + 1; j < objects.size(); j++) {
- if (objects.get(i).equals(objects.get(j)))
- return false;
- }
- }
- return true;
- }
-
- public default void forEach(final Consumer<Object> consumer) {
- this.objects().forEach(consumer);
- }
-
- public default void forEach(final BiConsumer<Object, Set<String>> consumer) {
- final List<Object> objects = this.objects();
- final List<Set<String>> labels = this.labels();
- for (int i = 0; i < objects.size(); i++) {
- consumer.accept(objects.get(i), labels.get(i));
- }
- }
-
- public default Stream<Pair<Object, Set<String>>> stream() {
- final List<Set<String>> labels = this.labels();
- final List<Object> objects = this.objects();
- return IntStream.range(0, this.size()).mapToObj(i -> Pair.with(objects.get(i), labels.get(i)));
- }
-
- public static class Exceptions {
-
- public static IllegalArgumentException stepWithProvidedLabelDoesNotExist(final String label) {
- return new IllegalArgumentException("The step with label " + label + " does not exist");
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/1545201f/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/Scope.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/Scope.java b/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/Scope.java
deleted file mode 100644
index 3bf881d..0000000
--- a/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/Scope.java
+++ /dev/null
@@ -1,27 +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 com.tinkerpop.gremlin.process;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public enum Scope {
-
- global, local
-}