You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by ok...@apache.org on 2016/08/17 20:41:45 UTC

[1/2] tinkerpop git commit: to be consistent with Gremlin-Java, WebSocketsRemoteConnection.py is now DriverRemoteConnection.py. Its all about alignment alignment alignment. Keeping all these names consistent between the variants will make our lives and o

Repository: tinkerpop
Updated Branches:
  refs/heads/TINKERPOP-1278 b42fc2af9 -> ae17fd812


to be consistent with Gremlin-Java, WebSocketsRemoteConnection.py is now DriverRemoteConnection.py. Its all about alignment alignment alignment. Keeping all these names consistent between the variants will make our lives and our users lives so much easier. Manual tests against GremlinServer executed.


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/3900429d
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/3900429d
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/3900429d

Branch: refs/heads/TINKERPOP-1278
Commit: 3900429daf57f49ec41196a12a7ffc4d5293c218
Parents: 4a66455
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Wed Aug 17 14:41:10 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Wed Aug 17 14:41:10 2016 -0600

----------------------------------------------------------------------
 docs/preprocessor/awk/init-code-blocks.awk      |   2 +-
 docs/src/reference/gremlin-variants.asciidoc    |   6 +-
 .../jython/gremlin_python/driver/__init__.py    |   2 +-
 .../driver/driver_remote_connection.py          | 167 +++++++++++++++++++
 .../driver/websocket_remote_connection.py       | 167 -------------------
 .../driver/DriverRemoteConnectionTest.java      | 121 ++++++++++++++
 .../driver/WebSocketRemoteConnectionTest.java   | 121 --------------
 .../python/jsr223/JythonScriptEngineSetup.java  |   2 +-
 8 files changed, 294 insertions(+), 294 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3900429d/docs/preprocessor/awk/init-code-blocks.awk
----------------------------------------------------------------------
diff --git a/docs/preprocessor/awk/init-code-blocks.awk b/docs/preprocessor/awk/init-code-blocks.awk
index 7065df8a..e37af2e 100644
--- a/docs/preprocessor/awk/init-code-blocks.awk
+++ b/docs/preprocessor/awk/init-code-blocks.awk
@@ -63,7 +63,7 @@ BEGIN {
     print "jython.eval('from gremlin_python.structure.graph import Graph')"
     print "jython.eval('from gremlin_python.process.graphson import GraphSONWriter')"
     # print "jython.eval('from gremlin_python.process.graphson import serializers')"
-    # print "jython.eval('from gremlin_python.driver.websocket_remote_connection import WebSocketRemoteConnection')"
+    # print "jython.eval('from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection')"
     print "jython.eval('statics.load_statics(globals())')"
     print "jythonBindings = jython.createBindings()"
     print "jythonBindings.put('g', jython.eval('Graph().traversal()'))"

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3900429d/docs/src/reference/gremlin-variants.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/gremlin-variants.asciidoc b/docs/src/reference/gremlin-variants.asciidoc
index 0d4ab03..be7d3ed 100644
--- a/docs/src/reference/gremlin-variants.asciidoc
+++ b/docs/src/reference/gremlin-variants.asciidoc
@@ -61,13 +61,13 @@ Gremlin-Python users will typically make use of the following classes.
 [source,python]
 >>> from gremlin_python import statics
 >>> from gremlin_python.structure.graph import Graph
->>> from gremlin_python.driver.websocket_remote_connection import WebSocketRemoteConnection
+>>> from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection
 
 In Gremlin-Python there exists `GraphTraversalSource`, `GraphTraversal`, and `__` which mirror the respective classes in Gremlin-Java.
 The `GraphTraversalSource` requires a driver in order to communicate with <<gremlin-server,GremlinServer>> (or any <<connecting-via-remotegraph,`RemoteConnection`>>-enabled server).
 The `gremlin_rest_driver` is provided with Apache TinkerPop and it serves as a simple (though verbose) driver that sends traversals to GremlinServer
 via HTTP POST (using link:http://docs.python-requests.org/[requests]) and in return, is provided <<graphson-reader-writer,GraphSON>>-encoded results.
-`WebSocketRemoteConnection` extends the abstract class `RemoteConnection` in `gremlin_python.driver`.
+`DriverRemoteConnection` extends the abstract class `RemoteConnection` in `gremlin_python.driver`.
 
 IMPORTANT: For developers wishing to provide another *driver implementation*, be sure to extend `RemoteConnection` in
 `gremlin_python.driver` so it can then be used by Gremlin-Python's `GraphTraversal`.
@@ -100,7 +100,7 @@ Within the CPython console, it is possible to evaluate the following.
 
 [source,python]
 >>> graph = Graph()
->>> g = graph.traversal().withRemote(WebSocketRemoteConnection('ws://localhost:8182','g'))
+>>> g = graph.traversal().withRemote(DriverRemoteConnection('ws://localhost:8182','g'))
 
 When a traversal spawned from the `GraphTraversalSource` above is iterated, the traveral's `Bytecode` is sent over the wire
 via the registered `RemoteConnection`. The bytecode is used to construct the equivalent traversal at the remote traversal source.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3900429d/gremlin-python/src/main/jython/gremlin_python/driver/__init__.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/gremlin_python/driver/__init__.py b/gremlin-python/src/main/jython/gremlin_python/driver/__init__.py
index 4f06e4e..5d41e2e 100644
--- a/gremlin-python/src/main/jython/gremlin_python/driver/__init__.py
+++ b/gremlin-python/src/main/jython/gremlin_python/driver/__init__.py
@@ -21,7 +21,7 @@ from .remote_connection import RemoteStrategy
 from .remote_connection import RemoteTraversal
 
 try:
-    from .websocket_remote_connection import WebSocketRemoteConnection
+    from .driver_remote_connection import DriverRemoteConnection
 except ImportError:
     pass
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3900429d/gremlin-python/src/main/jython/gremlin_python/driver/driver_remote_connection.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/gremlin_python/driver/driver_remote_connection.py b/gremlin-python/src/main/jython/gremlin_python/driver/driver_remote_connection.py
new file mode 100644
index 0000000..1b42af4
--- /dev/null
+++ b/gremlin-python/src/main/jython/gremlin_python/driver/driver_remote_connection.py
@@ -0,0 +1,167 @@
+'''
+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.
+'''
+import json
+import uuid
+from tornado import gen
+from tornado import ioloop
+from tornado import websocket
+
+from .remote_connection import RemoteConnection
+from .remote_connection import RemoteTraversal
+from ..process.graphson import GraphSONWriter
+from ..process.traversal import Traverser
+
+
+class GremlinServerError(Exception):
+    pass
+
+
+class DriverRemoteConnection(RemoteConnection):
+    """Remote connection to the Gremlin Server"""
+
+    def __init__(self, url, traversal_source, loop=None, username='', password=''):
+        super(DriverRemoteConnection, self).__init__(url, traversal_source)
+        if loop is None:
+            self._loop = ioloop.IOLoop.current()
+        self._ws = self._loop.run_sync(lambda: websocket.websocket_connect(self.url))
+        self._username = username
+        self._password = password
+
+    def submit(self,
+               bytecode,
+               op="bytecode",
+               processor="traversal",
+               session=None):
+        traversers = self._loop.run_sync(lambda: self._submit(bytecode, op, processor, session))
+        return RemoteTraversal(iter(traversers), {})
+
+    @gen.coroutine
+    def _submit(self, bytecode, op, processor, session):
+        """
+        Submit bytecode to Gremlin Server
+
+        :param str gremlin: Gremlin script to submit to server.
+        :param str lang: Language of scripts submitted to the server.
+            "gremlin-groovy" by default
+        :param str op: Gremlin Server op argument. "eval" by default.
+        :param str processor: Gremlin Server processor argument. "" by default.
+        :param str session: Session id (optional). Typically a uuid
+
+        :returns: :py:class:`Response` object
+        """
+        request_id = str(uuid.uuid4())
+        message = self._prepare_message(bytecode, op, processor, session, request_id)
+        if self._ws.protocol is None:
+            self._ws = yield websocket.websocket_connect(self.url)
+        self._ws.write_message(message, binary=True)
+        resp = Response(self._ws, processor, session, self._username, self._password)
+        traversers = []
+        while True:
+            msg = yield resp.receive()
+            if msg is None:
+                break
+            traversers += msg
+        raise gen.Return(traversers)
+
+    def close(self):
+        """Close underlying connection and mark as closed."""
+        self._ws.close()
+
+    def _prepare_message(self, bytecode, op, processor, session, request_id):
+        message = {
+            "requestId": request_id,
+            "op": op,
+            "processor": processor,
+            "args": {
+                "gremlin": GraphSONWriter.writeObject(bytecode),
+                "aliases": {'g': self.traversal_source}
+            }
+        }
+        message = self._finalize_message(message, processor, session)
+        return message
+
+    def _authenticate(self, username, password, processor, session):
+        auth = b"".join([b"\x00", username.encode("utf-8"),
+                         b"\x00", password.encode("utf-8")])
+        message = {
+            "requestId": str(uuid.uuid4()),
+            "op": "authentication",
+            "processor": "",
+            "args": {
+                "sasl": base64.b64encode(auth).decode()
+            }
+        }
+        message = self._finalize_message(message, processor, session)
+        self._ws.send_message(message, binary=True)
+
+    def _finalize_message(self, message, processor, session):
+        if processor == "session":
+            if session is None:
+                raise RuntimeError("session processor requires a session id")
+            else:
+                message["args"].update({"session": session})
+        message = json.dumps(message)
+        return self._set_message_header(message, "application/json")
+
+    @staticmethod
+    def _set_message_header(message, mime_type):
+        if mime_type == "application/json":
+            mime_len = b"\x10"
+            mime_type = b"application/json"
+        else:
+            raise ValueError("Unknown mime type.")
+        return b"".join([mime_len, mime_type, message.encode("utf-8")])
+
+
+class Response:
+    def __init__(self, ws, processor, session, username, password):
+        self._ws = ws
+        self._closed = False
+        self._processor = processor
+        self._session = session
+        self._username = username
+        self._password = password
+
+    @gen.coroutine
+    def receive(self):
+        if self._closed:
+            return
+        data = yield self._ws.read_message()
+        message = json.loads(data)
+        status_code = message['status']['code']
+        data = message["result"]["data"]
+        msg = message["status"]["message"]
+        if status_code == 407:
+            self._authenticate(self._username, self._password, self._processor,
+                               self._session)
+            traversers = yield self.receive()
+        elif status_code == 204:
+            self._closed = True
+            return
+        elif status_code in [200, 206]:
+            traversers = []
+            for result in data:
+                traversers.append(Traverser(result['value'], result['bulk']))
+            if status_code == 200:
+                self._closed = True
+        else:
+            self._closed = True
+            raise GremlinServerError(
+                "{0}: {1}".format(status_code, msg))
+        raise gen.Return(traversers)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3900429d/gremlin-python/src/main/jython/gremlin_python/driver/websocket_remote_connection.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/gremlin_python/driver/websocket_remote_connection.py b/gremlin-python/src/main/jython/gremlin_python/driver/websocket_remote_connection.py
deleted file mode 100644
index 926f867..0000000
--- a/gremlin-python/src/main/jython/gremlin_python/driver/websocket_remote_connection.py
+++ /dev/null
@@ -1,167 +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.
-'''
-import json
-import uuid
-from tornado import gen
-from tornado import ioloop
-from tornado import websocket
-
-from .remote_connection import RemoteConnection
-from .remote_connection import RemoteTraversal
-from ..process.graphson import GraphSONWriter
-from ..process.traversal import Traverser
-
-
-class GremlinServerError(Exception):
-    pass
-
-
-class WebSocketRemoteConnection(RemoteConnection):
-    """Remote connection to the Gremlin Server"""
-
-    def __init__(self, url, traversal_source, loop=None, username='', password=''):
-        super(WebSocketRemoteConnection, self).__init__(url, traversal_source)
-        if loop is None:
-            self._loop = ioloop.IOLoop.current()
-        self._ws = self._loop.run_sync(lambda: websocket.websocket_connect(self.url))
-        self._username = username
-        self._password = password
-
-    def submit(self,
-               bytecode,
-               op="bytecode",
-               processor="traversal",
-               session=None):
-        traversers = self._loop.run_sync(lambda: self._submit(bytecode, op, processor, session))
-        return RemoteTraversal(iter(traversers), {})
-
-    @gen.coroutine
-    def _submit(self, bytecode, op, processor, session):
-        """
-        Submit bytecode to Gremlin Server
-
-        :param str gremlin: Gremlin script to submit to server.
-        :param str lang: Language of scripts submitted to the server.
-            "gremlin-groovy" by default
-        :param str op: Gremlin Server op argument. "eval" by default.
-        :param str processor: Gremlin Server processor argument. "" by default.
-        :param str session: Session id (optional). Typically a uuid
-
-        :returns: :py:class:`Response` object
-        """
-        request_id = str(uuid.uuid4())
-        message = self._prepare_message(bytecode, op, processor, session, request_id)
-        if self._ws.protocol is None:
-            self._ws = yield websocket.websocket_connect(self.url)
-        self._ws.write_message(message, binary=True)
-        resp = Response(self._ws, processor, session, self._username, self._password)
-        traversers = []
-        while True:
-            msg = yield resp.receive()
-            if msg is None:
-                break
-            traversers += msg
-        raise gen.Return(traversers)
-
-    def close(self):
-        """Close underlying connection and mark as closed."""
-        self._ws.close()
-
-    def _prepare_message(self, bytecode, op, processor, session, request_id):
-        message = {
-            "requestId": request_id,
-            "op": op,
-            "processor": processor,
-            "args": {
-                "gremlin": GraphSONWriter.writeObject(bytecode),
-                "aliases": {'g': self.traversal_source}
-            }
-        }
-        message = self._finalize_message(message, processor, session)
-        return message
-
-    def _authenticate(self, username, password, processor, session):
-        auth = b"".join([b"\x00", username.encode("utf-8"),
-                         b"\x00", password.encode("utf-8")])
-        message = {
-            "requestId": str(uuid.uuid4()),
-            "op": "authentication",
-            "processor": "",
-            "args": {
-                "sasl": base64.b64encode(auth).decode()
-            }
-        }
-        message = self._finalize_message(message, processor, session)
-        self._ws.send_message(message, binary=True)
-
-    def _finalize_message(self, message, processor, session):
-        if processor == "session":
-            if session is None:
-                raise RuntimeError("session processor requires a session id")
-            else:
-                message["args"].update({"session": session})
-        message = json.dumps(message)
-        return self._set_message_header(message, "application/json")
-
-    @staticmethod
-    def _set_message_header(message, mime_type):
-        if mime_type == "application/json":
-            mime_len = b"\x10"
-            mime_type = b"application/json"
-        else:
-            raise ValueError("Unknown mime type.")
-        return b"".join([mime_len, mime_type, message.encode("utf-8")])
-
-
-class Response:
-    def __init__(self, ws, processor, session, username, password):
-        self._ws = ws
-        self._closed = False
-        self._processor = processor
-        self._session = session
-        self._username = username
-        self._password = password
-
-    @gen.coroutine
-    def receive(self):
-        if self._closed:
-            return
-        data = yield self._ws.read_message()
-        message = json.loads(data)
-        status_code = message['status']['code']
-        data = message["result"]["data"]
-        msg = message["status"]["message"]
-        if status_code == 407:
-            self._authenticate(self._username, self._password, self._processor,
-                               self._session)
-            traversers = yield self.receive()
-        elif status_code == 204:
-            self._closed = True
-            return
-        elif status_code in [200, 206]:
-            traversers = []
-            for result in data:
-                traversers.append(Traverser(result['value'], result['bulk']))
-            if status_code == 200:
-                self._closed = True
-        else:
-            self._closed = True
-            raise GremlinServerError(
-                "{0}: {1}".format(status_code, msg))
-        raise gen.Return(traversers)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3900429d/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/driver/DriverRemoteConnectionTest.java
----------------------------------------------------------------------
diff --git a/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/driver/DriverRemoteConnectionTest.java b/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/driver/DriverRemoteConnectionTest.java
new file mode 100644
index 0000000..cec9be5
--- /dev/null
+++ b/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/driver/DriverRemoteConnectionTest.java
@@ -0,0 +1,121 @@
+/*
+ *  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.python.driver;
+
+import org.apache.tinkerpop.gremlin.python.jsr223.JythonScriptEngineSetup;
+import org.apache.tinkerpop.gremlin.server.GremlinServer;
+import org.apache.tinkerpop.gremlin.server.Settings;
+import org.apache.tinkerpop.gremlin.util.ScriptEngineCache;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import javax.script.ScriptContext;
+import javax.script.ScriptEngine;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Set;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public class DriverRemoteConnectionTest {
+
+    private static final ScriptEngine jython = ScriptEngineCache.get("jython");
+
+    private final List<String> aliases = Arrays.asList("g", "j");
+
+    @BeforeClass
+    public static void setup() {
+        try {
+            JythonScriptEngineSetup.setup();
+            jython.getContext().getBindings(ScriptContext.ENGINE_SCOPE)
+                    .put("g", jython.eval("Graph().traversal().withRemote(DriverRemoteConnection('ws://localhost:8182','g'))"));
+            jython.getContext().getBindings(ScriptContext.ENGINE_SCOPE)
+                    .put("j", jython.eval("Graph().traversal().withRemote(DriverRemoteConnection('ws://localhost:8182','g'))"));
+            new GremlinServer(Settings.read(DriverRemoteConnectionTest.class.getResourceAsStream("gremlin-server-rest-modern.yaml"))).start().join();
+        } catch (final Exception ex) {
+            ex.printStackTrace();
+        }
+    }
+
+    @Test
+    @org.junit.Ignore
+    public void testGraphTraversalNext() throws Exception {
+        for (final String alias : this.aliases) {
+            final String result = (String) jython.eval(alias + ".V().repeat(__.out()).times(2).name.next()");
+            assertTrue(result.equals("lop") || result.equals("ripple"));
+        }
+    }
+
+    @Test
+    @org.junit.Ignore
+    public void testGraphTraversalToList() throws Exception {
+        for (final String alias : this.aliases) {
+            final List<String> results = (List) jython.eval(alias + ".V().repeat(__.out()).times(2).name.toList()");
+            assertEquals(2, results.size());
+            assertTrue(results.contains("lop"));
+            assertTrue(results.contains("ripple"));
+        }
+    }
+
+    @Test
+    @org.junit.Ignore
+    public void testGraphTraversalToSet() throws Exception {
+        for (final String alias : this.aliases) {
+            final Set<String> results = (Set) jython.eval(alias + ".V().repeat(__.both()).times(4).hasLabel('software').name.toSet()");
+            assertEquals(2, results.size());
+            assertTrue(results.contains("lop"));
+            assertTrue(results.contains("ripple"));
+        }
+    }
+
+    @Test
+    @org.junit.Ignore
+    public void testGraphTraversalNextAmount() throws Exception {
+        for (final String alias : this.aliases) {
+            List<String> results = (List) jython.eval(alias + ".V().repeat(__.out()).times(2).name.next(2)");
+            assertEquals(2, results.size());
+            assertTrue(results.contains("lop"));
+            assertTrue(results.contains("ripple"));
+            //
+            results = (List) jython.eval(alias + ".V().repeat(__.out()).times(2).name.next(4)");
+            assertEquals(2, results.size());
+            assertTrue(results.contains("lop"));
+            assertTrue(results.contains("ripple"));
+        }
+    }
+
+    @Test
+    @org.junit.Ignore
+    public void testRemoteConnectionBindings() throws Exception {
+        for (final String alias : this.aliases) {
+            final String traversalScript = jython.eval(alias + ".V().out(('a','knows'),'created')").toString();
+            assertEquals(traversalScript, "g.V().out(a, \"created\")"); // ensure the traversal string is binding based
+            final List<String> results = (List) jython.eval(alias + ".V().out(('a','knows')).out('created').name.next(2)");
+            assertEquals(2, results.size());
+            assertTrue(results.contains("lop"));
+            assertTrue(results.contains("ripple"));
+
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3900429d/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/driver/WebSocketRemoteConnectionTest.java
----------------------------------------------------------------------
diff --git a/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/driver/WebSocketRemoteConnectionTest.java b/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/driver/WebSocketRemoteConnectionTest.java
deleted file mode 100644
index aa595c3..0000000
--- a/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/driver/WebSocketRemoteConnectionTest.java
+++ /dev/null
@@ -1,121 +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.python.driver;
-
-import org.apache.tinkerpop.gremlin.python.jsr223.JythonScriptEngineSetup;
-import org.apache.tinkerpop.gremlin.server.GremlinServer;
-import org.apache.tinkerpop.gremlin.server.Settings;
-import org.apache.tinkerpop.gremlin.util.ScriptEngineCache;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import javax.script.ScriptContext;
-import javax.script.ScriptEngine;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Set;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public class WebSocketRemoteConnectionTest {
-
-    private static final ScriptEngine jython = ScriptEngineCache.get("jython");
-
-    private final List<String> aliases = Arrays.asList("g", "j");
-
-    @BeforeClass
-    public static void setup() {
-        try {
-            JythonScriptEngineSetup.setup();
-            jython.getContext().getBindings(ScriptContext.ENGINE_SCOPE)
-                    .put("g", jython.eval("Graph().traversal().withRemote(WebSocketRemoteConnection('ws://localhost:8182','g'))"));
-            jython.getContext().getBindings(ScriptContext.ENGINE_SCOPE)
-                    .put("j", jython.eval("Graph().traversal().withRemote(WebSocketRemoteConnection('ws://localhost:8182','g'))"));
-            new GremlinServer(Settings.read(WebSocketRemoteConnectionTest.class.getResourceAsStream("gremlin-server-rest-modern.yaml"))).start().join();
-        } catch (final Exception ex) {
-            ex.printStackTrace();
-        }
-    }
-
-    @Test
-    @org.junit.Ignore
-    public void testGraphTraversalNext() throws Exception {
-        for (final String alias : this.aliases) {
-            final String result = (String) jython.eval(alias + ".V().repeat(__.out()).times(2).name.next()");
-            assertTrue(result.equals("lop") || result.equals("ripple"));
-        }
-    }
-
-    @Test
-    @org.junit.Ignore
-    public void testGraphTraversalToList() throws Exception {
-        for (final String alias : this.aliases) {
-            final List<String> results = (List) jython.eval(alias + ".V().repeat(__.out()).times(2).name.toList()");
-            assertEquals(2, results.size());
-            assertTrue(results.contains("lop"));
-            assertTrue(results.contains("ripple"));
-        }
-    }
-
-    @Test
-    @org.junit.Ignore
-    public void testGraphTraversalToSet() throws Exception {
-        for (final String alias : this.aliases) {
-            final Set<String> results = (Set) jython.eval(alias + ".V().repeat(__.both()).times(4).hasLabel('software').name.toSet()");
-            assertEquals(2, results.size());
-            assertTrue(results.contains("lop"));
-            assertTrue(results.contains("ripple"));
-        }
-    }
-
-    @Test
-    @org.junit.Ignore
-    public void testGraphTraversalNextAmount() throws Exception {
-        for (final String alias : this.aliases) {
-            List<String> results = (List) jython.eval(alias + ".V().repeat(__.out()).times(2).name.next(2)");
-            assertEquals(2, results.size());
-            assertTrue(results.contains("lop"));
-            assertTrue(results.contains("ripple"));
-            //
-            results = (List) jython.eval(alias + ".V().repeat(__.out()).times(2).name.next(4)");
-            assertEquals(2, results.size());
-            assertTrue(results.contains("lop"));
-            assertTrue(results.contains("ripple"));
-        }
-    }
-
-    @Test
-    @org.junit.Ignore
-    public void testRemoteConnectionBindings() throws Exception {
-        for (final String alias : this.aliases) {
-            final String traversalScript = jython.eval(alias + ".V().out(('a','knows'),'created')").toString();
-            assertEquals(traversalScript, "g.V().out(a, \"created\")"); // ensure the traversal string is binding based
-            final List<String> results = (List) jython.eval(alias + ".V().out(('a','knows')).out('created').name.next(2)");
-            assertEquals(2, results.size());
-            assertTrue(results.contains("lop"));
-            assertTrue(results.contains("ripple"));
-
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3900429d/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/jsr223/JythonScriptEngineSetup.java
----------------------------------------------------------------------
diff --git a/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/jsr223/JythonScriptEngineSetup.java b/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/jsr223/JythonScriptEngineSetup.java
index 75e9ce0..f4bf61c 100644
--- a/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/jsr223/JythonScriptEngineSetup.java
+++ b/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/jsr223/JythonScriptEngineSetup.java
@@ -43,7 +43,7 @@ public class JythonScriptEngineSetup {
             jythonEngine.eval("from gremlin_python.process.traversal import *");
             jythonEngine.eval("from gremlin_python.process.graph_traversal import *");
             jythonEngine.eval("from gremlin_python.process.graph_traversal import __");
-            // jythonEngine.eval("from gremlin_python.driver.websocket_remote_connection import WebSocketRemoteConnection");
+            // jythonEngine.eval("from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection");
             jythonEngine.eval("from gremlin_python.process.traversal import Bytecode");
             jythonEngine.eval("from gremlin_python.structure.graph import Graph");
             jythonEngine.eval("from gremlin_python.process.graphson import GraphSONWriter");


[2/2] tinkerpop git commit: Merge branch 'TINKERPOP-1278' of https://git-wip-us.apache.org/repos/asf/tinkerpop into TINKERPOP-1278

Posted by ok...@apache.org.
Merge branch 'TINKERPOP-1278' of https://git-wip-us.apache.org/repos/asf/tinkerpop into TINKERPOP-1278


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/ae17fd81
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/ae17fd81
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/ae17fd81

Branch: refs/heads/TINKERPOP-1278
Commit: ae17fd812da979abb64e5f48b95946aaa92b7643
Parents: 3900429 b42fc2a
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Wed Aug 17 14:41:36 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Wed Aug 17 14:41:36 2016 -0600

----------------------------------------------------------------------
 .../src/reference/gremlin-applications.asciidoc | 52 ++++++++++----------
 .../process/traversal/TraversalSource.java      | 12 ++---
 .../tinkerpop/gremlin/util/CoreImports.java     |  2 +
 .../driver/remote/DriverRemoteConnection.java   | 20 ++++----
 .../driver/remote/RemoteGraphProvider.java      |  5 +-
 5 files changed, 45 insertions(+), 46 deletions(-)
----------------------------------------------------------------------