This is an automated email from the ASF dual-hosted git repository.

spmallette pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git

commit 4fa7083bde9057db0faf790d43f864c2fbb0dc7d
Merge: 8b5d7b3 7dc8def
Author: Stephen Mallette <[email protected]>
AuthorDate: Thu Jul 1 14:58:47 2021 -0400

    Merge branch '3.4-dev' into 3.5-dev

 CHANGELOG.asciidoc                                 |  2 ++
 docs/src/reference/intro.asciidoc                  | 16 +++++++++++++---
 .../Driver/Remote/DriverRemoteConnection.cs        | 22 ++++++++++++++++++++++
 .../Docs/Reference/IntroTests.cs                   |  5 ++---
 .../gremlin-javascript/package-lock.json           |  4 ++--
 .../driver/driver_remote_connection.py             |  2 +-
 gremlin-python/src/main/python/tests/conftest.py   |  2 +-
 7 files changed, 43 insertions(+), 10 deletions(-)

diff --cc 
gremlin-javascript/src/main/javascript/gremlin-javascript/package-lock.json
index 896bf5d,fc9e9e3..41c6b17
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/package-lock.json
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/package-lock.json
@@@ -120,9 -3483,7 +120,9 @@@
        "dev": true
      },
      "async-limiter": {
 -      "version": "1.0.1"
 +      "version": "1.0.1",
 +      "resolved": 
"https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz";,
-       "integrity": 
"sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ=="
++      "integrity": "sha1-3TeelPDbgxCwgpH51kwyCXZmF/0="
      },
      "atob": {
        "version": "2.1.2",
@@@ -2599,9 -5813,7 +2599,9 @@@
        "dev": true
      },
      "ws": {
 -      "version": "6.2.1",
 +      "version": "6.2.2",
 +      "resolved": "https://registry.npmjs.org/ws/-/ws-6.2.2.tgz";,
-       "integrity": 
"sha512-zmhltoSR8u1cnDsD43TX59mzoMZsLKqUweyYBAIvTngR3shc0W6aOZylZmq/7hqyVxPdi+5Ud2QInblgyE72fw==",
++      "integrity": "sha1-3Vzb1XqZeZFgl2UtePHMX66gwy4=",
        "requires": {
          "async-limiter": "~1.0.0"
        }
diff --cc 
gremlin-python/src/main/python/gremlin_python/driver/driver_remote_connection.py
index d5e4660,0000000..abc4a2c
mode 100644,000000..100644
--- 
a/gremlin-python/src/main/python/gremlin_python/driver/driver_remote_connection.py
+++ 
b/gremlin-python/src/main/python/gremlin_python/driver/driver_remote_connection.py
@@@ -1,87 -1,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.
 +#
 +from concurrent.futures import Future
 +
 +from gremlin_python.driver import client, serializer
 +from gremlin_python.driver.remote_connection import (
 +    RemoteConnection, RemoteTraversal)
 +from gremlin_python.process.strategies import OptionsStrategy
 +
 +__author__ = 'David M. Brown ([email protected])'
 +
 +
 +class DriverRemoteConnection(RemoteConnection):
 +
-     def __init__(self, url, traversal_source, protocol_factory=None,
++    def __init__(self, url, traversal_source = "g", protocol_factory=None,
 +                 transport_factory=None, pool_size=None, max_workers=None,
 +                 username="", password="", kerberized_service='',
 +                 message_serializer=None, graphson_reader=None,
 +                 graphson_writer=None, headers=None,
 +                 **transport_kwargs):
 +        if message_serializer is None:
 +            message_serializer = serializer.GraphSONMessageSerializer(
 +                reader=graphson_reader,
 +                writer=graphson_writer)
 +        self._client = client.Client(url, traversal_source,
 +                                     protocol_factory=protocol_factory,
 +                                     transport_factory=transport_factory,
 +                                     pool_size=pool_size,
 +                                     max_workers=max_workers,
 +                                     message_serializer=message_serializer,
 +                                     username=username,
 +                                     password=password,
 +                                     kerberized_service=kerberized_service,
 +                                     headers=headers,
 +                                     **transport_kwargs)
 +        self._url = self._client._url
 +        self._traversal_source = self._client._traversal_source
 +
 +    def close(self):
 +        self._client.close()
 +
 +    def submit(self, bytecode):
 +        result_set = self._client.submit(bytecode, 
request_options=self._extract_request_options(bytecode))
 +        results = result_set.all().result()
 +        return RemoteTraversal(iter(results))
 +
 +    def submitAsync(self, bytecode):
 +        future = Future()
 +        future_result_set = self._client.submitAsync(bytecode, 
request_options=self._extract_request_options(bytecode))
 +
 +        def cb(f):
 +            try:
 +                result_set = f.result()
 +                results = result_set.all().result()
 +                future.set_result(RemoteTraversal(iter(results)))
 +            except Exception as e:
 +                future.set_exception(e)
 +
 +        future_result_set.add_done_callback(cb)
 +        return future
 +
 +    @staticmethod
 +    def _extract_request_options(bytecode):
 +        options_strategy = next((x for x in bytecode.source_instructions
 +                                 if x[0] == "withStrategies" and type(x[1]) 
is OptionsStrategy), None)
 +        request_options = None
 +        if options_strategy:
 +            allowed_keys = ['evaluationTimeout', 'scriptEvaluationTimeout', 
'batchSize', 'requestId', 'userAgent']
 +            request_options = {allowed: 
options_strategy[1].configuration[allowed] for allowed in allowed_keys
 +                               if allowed in 
options_strategy[1].configuration}
 +        return request_options
diff --cc gremlin-python/src/main/python/tests/conftest.py
index 4f20a44,0000000..d858219
mode 100644,000000..100644
--- a/gremlin-python/src/main/python/tests/conftest.py
+++ b/gremlin-python/src/main/python/tests/conftest.py
@@@ -1,176 -1,0 +1,176 @@@
 +#
 +# 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 concurrent.futures
 +import ssl
 +import pytest
 +import sys
 +import socket
 +
 +from six.moves import queue
 +
 +from gremlin_python.driver.client import Client
 +from gremlin_python.driver.connection import Connection
 +from gremlin_python.driver import serializer
 +from gremlin_python.driver.driver_remote_connection import (
 +    DriverRemoteConnection)
 +from gremlin_python.driver.protocol import GremlinServerWSProtocol
 +from gremlin_python.driver.serializer import (
 +    GraphSONMessageSerializer, GraphSONSerializersV2d0, 
GraphSONSerializersV3d0,
 +    GraphBinarySerializersV1)
 +from gremlin_python.driver.aiohttp.transport import AiohttpTransport
 +
 +gremlin_server_url = 'ws://localhost:{}/gremlin'
 +anonymous_url = gremlin_server_url.format(45940)
 +basic_url = 'wss://localhost:{}/gremlin'.format(45941)
 +kerberos_url = gremlin_server_url.format(45942)
 +kerberized_service = 'test-service@{}'.format(socket.gethostname())
 +
 +
 [email protected]
 +def connection(request):
 +    protocol = GremlinServerWSProtocol(
 +        GraphSONMessageSerializer(),
 +        username='stephen', password='password')
 +    executor = concurrent.futures.ThreadPoolExecutor(5)
 +    pool = queue.Queue()
 +    try:
 +        conn = Connection(anonymous_url, 'gmodern', protocol,
 +                          lambda: AiohttpTransport(), executor, pool)
 +    except OSError:
 +        executor.shutdown()
 +        pytest.skip('Gremlin Server is not running')
 +    else:
 +        def fin():
 +            executor.shutdown()
 +            conn.close()
 +        request.addfinalizer(fin)
 +        return conn
 +
 +
 [email protected]
 +def client(request):
 +    try:
 +        client = Client(anonymous_url, 'gmodern')
 +    except OSError:
 +        pytest.skip('Gremlin Server is not running')
 +    else:
 +        def fin():
 +            client.close()
 +        request.addfinalizer(fin)
 +        return client
 +
 +
 [email protected](params=['basic', 'kerberos'])
 +def authenticated_client(request):
 +    try:
 +        if request.param == 'basic':
 +            # turn off certificate verification for testing purposes only
 +            ssl_opts = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)
 +            ssl_opts.verify_mode = ssl.CERT_NONE
 +            client = Client(basic_url, 'gmodern', username='stephen', 
password='password',
 +                            transport_factory=lambda: 
AiohttpTransport(ssl_options=ssl_opts))
 +        elif request.param == 'kerberos':
 +            client = Client(kerberos_url, 'gmodern', 
kerberized_service=kerberized_service)
 +        else:
 +            raise ValueError("Invalid authentication option - " + 
request.param)
 +    except OSError:
 +        pytest.skip('Gremlin Server is not running')
 +    else:
 +        def fin():
 +            client.close()
 +        request.addfinalizer(fin)
 +        return client
 +
 +
 [email protected](params=['graphsonv2', 'graphsonv3', 'graphbinaryv1'])
 +def remote_connection(request):
 +    try:
 +        if request.param == 'graphbinaryv1':
 +            remote_conn = DriverRemoteConnection(anonymous_url, 'gmodern',
 +                                                 
message_serializer=serializer.GraphBinarySerializersV1())
 +        elif request.param == 'graphsonv2':
 +            remote_conn = DriverRemoteConnection(anonymous_url, 'gmodern',
 +                                                 
message_serializer=serializer.GraphSONSerializersV2d0())
 +        elif request.param == 'graphsonv3':
 +            remote_conn = DriverRemoteConnection(anonymous_url, 'gmodern',
 +                                                 
message_serializer=serializer.GraphSONSerializersV3d0())
 +        else:
 +            raise ValueError("Invalid serializer option - " + request.param)
 +    except OSError:
 +        pytest.skip('Gremlin Server is not running')
 +    else:
 +        def fin():
 +            remote_conn.close()
 +        request.addfinalizer(fin)
 +        return remote_conn
 +
 +
 [email protected](params=['basic', 'kerberos'])
 +def remote_connection_authenticated(request):
 +    try:
 +        if request.param == 'basic':
 +            # turn off certificate verification for testing purposes only
 +            ssl_opts = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)
 +            ssl_opts.verify_mode = ssl.CERT_NONE
 +            remote_conn = DriverRemoteConnection(basic_url, 'gmodern',
 +                                                 username='stephen', 
password='password',
 +                                                 
message_serializer=serializer.GraphSONSerializersV2d0(),
 +                                                 transport_factory=lambda: 
AiohttpTransport(ssl_options=ssl_opts))
 +        elif request.param == 'kerberos':
 +            remote_conn = DriverRemoteConnection(kerberos_url, 'gmodern', 
kerberized_service=kerberized_service,
 +                                                 
message_serializer=serializer.GraphSONSerializersV2d0())
 +        else:
 +            raise ValueError("Invalid authentication option - " + 
request.param)
 +    except OSError:
 +        pytest.skip('Gremlin Server is not running')
 +    else:
 +        def fin():
 +            remote_conn.close()
 +        request.addfinalizer(fin)
 +        return remote_conn
 +
 +
 [email protected]
 +def remote_connection_graphsonV2(request):
 +    try:
-         remote_conn = DriverRemoteConnection(anonymous_url, 'g',
++        remote_conn = DriverRemoteConnection(anonymous_url,
 +                                             
message_serializer=serializer.GraphSONSerializersV2d0())
 +    except OSError:
 +        pytest.skip('Gremlin Server is not running')
 +    else:
 +        def fin():
 +            remote_conn.close()
 +        request.addfinalizer(fin)
 +        return remote_conn
 +
 +
 [email protected]
 +def graphson_serializer_v2(request):
 +    return GraphSONSerializersV2d0()
 +
 +
 [email protected]
 +def graphson_serializer_v3(request):
 +    return GraphSONSerializersV3d0()
 +
 +
 [email protected]
 +def graphbinary_serializer_v1(request):
 +    return GraphBinarySerializersV1()

Reply via email to