Merge branch 'tp32' into tp33
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/8ca27786 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/8ca27786 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/8ca27786 Branch: refs/heads/master Commit: 8ca277863861699ca2fa7913735687f6e65b486b Parents: c10bde3 b440742 Author: Florian Hockmann <f...@florian-hockmann.de> Authored: Wed Oct 3 12:31:08 2018 +0200 Committer: Florian Hockmann <f...@florian-hockmann.de> Committed: Wed Oct 3 12:31:08 2018 +0200 ---------------------------------------------------------------------- CHANGELOG.asciidoc | 1 + .../src/Gremlin.Net/Driver/Connection.cs | 6 +++-- .../src/Gremlin.Net/Driver/ConnectionFactory.cs | 7 ++++-- .../src/Gremlin.Net/Driver/GremlinClient.cs | 11 +++++++-- .../Gremlin.Net/Driver/WebSocketConnection.cs | 9 +++++-- .../Driver/GremlinClientTests.cs | 25 ++++++++++++++++++++ 6 files changed, 51 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8ca27786/CHANGELOG.asciidoc ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8ca27786/gremlin-dotnet/src/Gremlin.Net/Driver/Connection.cs ---------------------------------------------------------------------- diff --cc gremlin-dotnet/src/Gremlin.Net/Driver/Connection.cs index 279c708,f63e20b..b79f0e6 --- a/gremlin-dotnet/src/Gremlin.Net/Driver/Connection.cs +++ b/gremlin-dotnet/src/Gremlin.Net/Driver/Connection.cs @@@ -36,21 -37,21 +37,22 @@@ namespace Gremlin.Net.Drive { private readonly GraphSONReader _graphSONReader; private readonly GraphSONWriter _graphSONWriter; - private readonly JsonMessageSerializer _messageSerializer = new JsonMessageSerializer(); + private readonly JsonMessageSerializer _messageSerializer; private readonly Uri _uri; - private readonly WebSocketConnection _webSocketConnection = new WebSocketConnection(); + private readonly WebSocketConnection _webSocketConnection; private readonly string _username; private readonly string _password; public Connection(Uri uri, string username, string password, GraphSONReader graphSONReader, - GraphSONWriter graphSONWriter, string mimeType) - GraphSONWriter graphSONWriter, Action<ClientWebSocketOptions> webSocketConfiguration) ++ GraphSONWriter graphSONWriter, string mimeType, Action<ClientWebSocketOptions> webSocketConfiguration) { _uri = uri; _username = username; _password = password; _graphSONReader = graphSONReader; _graphSONWriter = graphSONWriter; + _messageSerializer = new JsonMessageSerializer(mimeType); + _webSocketConnection = new WebSocketConnection(webSocketConfiguration); } public async Task<IReadOnlyCollection<T>> SubmitAsync<T>(RequestMessage requestMessage) http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8ca27786/gremlin-dotnet/src/Gremlin.Net/Driver/ConnectionFactory.cs ---------------------------------------------------------------------- diff --cc gremlin-dotnet/src/Gremlin.Net/Driver/ConnectionFactory.cs index e2ff5b7,8b14ed9..7a6c2d5 --- a/gremlin-dotnet/src/Gremlin.Net/Driver/ConnectionFactory.cs +++ b/gremlin-dotnet/src/Gremlin.Net/Driver/ConnectionFactory.cs @@@ -30,22 -31,22 +31,24 @@@ namespace Gremlin.Net.Drive { private readonly GraphSONReader _graphSONReader; private readonly GraphSONWriter _graphSONWriter; + private readonly Action<ClientWebSocketOptions> _webSocketConfiguration; private readonly GremlinServer _gremlinServer; + private readonly string _mimeType; public ConnectionFactory(GremlinServer gremlinServer, GraphSONReader graphSONReader, - GraphSONWriter graphSONWriter, string mimeType) - GraphSONWriter graphSONWriter, Action<ClientWebSocketOptions> webSocketConfiguration) ++ GraphSONWriter graphSONWriter, string mimeType, Action<ClientWebSocketOptions> webSocketConfiguration) { _gremlinServer = gremlinServer; - _graphSONReader = graphSONReader; - _graphSONWriter = graphSONWriter; + _mimeType = mimeType; + _graphSONReader = graphSONReader ?? throw new ArgumentNullException(nameof(graphSONReader)); + _graphSONWriter = graphSONWriter ?? throw new ArgumentNullException(nameof(graphSONWriter)); + _webSocketConfiguration = webSocketConfiguration; } public Connection CreateConnection() { return new Connection(_gremlinServer.Uri, _gremlinServer.Username, _gremlinServer.Password, _graphSONReader, - _graphSONWriter, _mimeType); - _graphSONWriter, _webSocketConfiguration); ++ _graphSONWriter, _mimeType, _webSocketConfiguration); } } } http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8ca27786/gremlin-dotnet/src/Gremlin.Net/Driver/GremlinClient.cs ---------------------------------------------------------------------- diff --cc gremlin-dotnet/src/Gremlin.Net/Driver/GremlinClient.cs index 2b47cbc,a5cb46c..54d7634 --- a/gremlin-dotnet/src/Gremlin.Net/Driver/GremlinClient.cs +++ b/gremlin-dotnet/src/Gremlin.Net/Driver/GremlinClient.cs @@@ -52,13 -43,16 +53,19 @@@ namespace Gremlin.Net.Drive /// <param name="gremlinServer">The <see cref="GremlinServer" /> the requests should be sent to.</param> /// <param name="graphSONReader">A <see cref="GraphSONReader" /> instance to read received GraphSON data.</param> /// <param name="graphSONWriter">a <see cref="GraphSONWriter" /> instance to write GraphSON data.</param> + /// <param name="mimeType">The GraphSON version mime type, defaults to latest supported by the server.</param> + /// <param name="webSocketConfiguration"> + /// A delegate that will be invoked with the <see cref="ClientWebSocketOptions" /> + /// object used to configure WebSocket connections. + /// </param> public GremlinClient(GremlinServer gremlinServer, GraphSONReader graphSONReader = null, - GraphSONWriter graphSONWriter = null, string mimeType = null) - GraphSONWriter graphSONWriter = null, Action<ClientWebSocketOptions> webSocketConfiguration = null) ++ GraphSONWriter graphSONWriter = null, string mimeType = null, ++ Action<ClientWebSocketOptions> webSocketConfiguration = null) { - var reader = graphSONReader ?? new GraphSONReader(); - var writer = graphSONWriter ?? new GraphSONWriter(); - var connectionFactory = new ConnectionFactory(gremlinServer, reader, writer, webSocketConfiguration); + var reader = graphSONReader ?? new GraphSON3Reader(); + var writer = graphSONWriter ?? new GraphSON3Writer(); - var connectionFactory = new ConnectionFactory(gremlinServer, reader, writer, mimeType ?? DefaultMimeType); ++ var connectionFactory = new ConnectionFactory(gremlinServer, reader, writer, mimeType ?? DefaultMimeType, ++ webSocketConfiguration); _connectionPool = new ConnectionPool(connectionFactory); }