You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by jo...@apache.org on 2017/11/23 09:20:56 UTC

[18/50] [abbrv] tinkerpop git commit: TINKERPOP-1784 Added aliasing to .NET driver

TINKERPOP-1784 Added aliasing to .NET driver

Tests were failing as a result of the change to using the mix server configuration that had all the graphs. On the way to dealing with that, I noticed the driver didn't seem to have aliasing capability which prevented it from choosing the correct graph traversal source on the server. For some reason, asserting longs on ids seemed to be a problem as well after this change and I'm pretty sure it has something to do with the configuration of the TinkerGraph in this new mixed mode configuration and not something in serialization.


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

Branch: refs/heads/TINKERPOP-1489
Commit: 314ab67b6bff2c33e7d1e0fb93cffd62d638707a
Parents: 3325899
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Sat Nov 11 06:17:19 2017 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Tue Nov 21 15:53:14 2017 -0500

----------------------------------------------------------------------
 .../Driver/Remote/DriverRemoteConnection.cs         | 16 ++++++++++++++--
 .../DriverRemoteConnection/GraphTraversalTests.cs   |  8 ++++----
 .../RemoteConnectionFactory.cs                      |  8 +++++++-
 gremlin-dotnet/test/pom.xml                         |  6 +++++-
 4 files changed, 30 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/314ab67b/gremlin-dotnet/src/Gremlin.Net/Driver/Remote/DriverRemoteConnection.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Driver/Remote/DriverRemoteConnection.cs b/gremlin-dotnet/src/Gremlin.Net/Driver/Remote/DriverRemoteConnection.cs
index 0a8b93f..80bd100 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Driver/Remote/DriverRemoteConnection.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Driver/Remote/DriverRemoteConnection.cs
@@ -36,15 +36,27 @@ namespace Gremlin.Net.Driver.Remote
     public class DriverRemoteConnection : IRemoteConnection, IDisposable
     {
         private readonly IGremlinClient _client;
+        private readonly string _traversalSource;
 
         /// <summary>
         ///     Initializes a new <see cref="IRemoteConnection" />.
         /// </summary>
         /// <param name="client">The <see cref="IGremlinClient" /> that will be used for the connection.</param>
         /// <exception cref="ArgumentNullException">Thrown when client is null.</exception>
-        public DriverRemoteConnection(IGremlinClient client)
+        public DriverRemoteConnection(IGremlinClient client):this(client, "g")
+        {
+        }
+
+        /// <summary>
+        ///     Initializes a new <see cref="IRemoteConnection" />.
+        /// </summary>
+        /// <param name="client">The <see cref="IGremlinClient" /> that will be used for the connection.</param>
+        /// <param name="traversalSource">The name of the traversal source on the server to bind to.</param>
+        /// <exception cref="ArgumentNullException">Thrown when client is null.</exception>
+        public DriverRemoteConnection(IGremlinClient client, string traversalSource)
         {
             _client = client ?? throw new ArgumentNullException(nameof(client));
+            _traversalSource = traversalSource;
         }
 
         /// <summary>
@@ -66,7 +78,7 @@ namespace Gremlin.Net.Driver.Remote
                     .Processor(Tokens.ProcessorTraversal)
                     .OverrideRequestId(requestid)
                     .AddArgument(Tokens.ArgsGremlin, bytecode)
-                    .AddArgument(Tokens.ArgsAliases, new Dictionary<string, string> {{"g", "g"}})
+                    .AddArgument(Tokens.ArgsAliases, new Dictionary<string, string> {{"g", _traversalSource}})
                     .Create();
             return await _client.SubmitAsync<Traverser>(requestMsg).ConfigureAwait(false);
         }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/314ab67b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/DriverRemoteConnection/GraphTraversalTests.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/DriverRemoteConnection/GraphTraversalTests.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/DriverRemoteConnection/GraphTraversalTests.cs
index 84a44a7..d9c47f1 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/DriverRemoteConnection/GraphTraversalTests.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/DriverRemoteConnection/GraphTraversalTests.cs
@@ -55,8 +55,8 @@ namespace Gremlin.Net.IntegrationTest.Process.Traversal.DriverRemoteConnection
 
             var vertex = g.V(1).Next();
 
-            Assert.Equal(new Vertex((long) 1), vertex);
-            Assert.Equal((long) 1, vertex.Id);
+            Assert.Equal(new Vertex(1), vertex);
+            Assert.Equal(1, vertex.Id);
         }
 
         [Fact]
@@ -68,7 +68,7 @@ namespace Gremlin.Net.IntegrationTest.Process.Traversal.DriverRemoteConnection
 
             var traverser = g.V(1).NextTraverser();
 
-            Assert.Equal(new Traverser(new Vertex((long)1)), traverser);
+            Assert.Equal(new Traverser(new Vertex(1)), traverser);
         }
 
         [Fact]
@@ -138,7 +138,7 @@ namespace Gremlin.Net.IntegrationTest.Process.Traversal.DriverRemoteConnection
                 g.V(5).Repeat(__.Both().SimplePath()).Until(__.HasId(6)).Limit(1).Path().Next();
 
             Assert.Equal(4, shortestPath.Count);
-            Assert.Equal(new Vertex((long) 6), shortestPath[3]);
+            Assert.Equal(new Vertex(6), shortestPath[3]);
         }
 
         [Fact]

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/314ab67b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/DriverRemoteConnection/RemoteConnectionFactory.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/DriverRemoteConnection/RemoteConnectionFactory.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/DriverRemoteConnection/RemoteConnectionFactory.cs
index ab67c26..47d4f06 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/DriverRemoteConnection/RemoteConnectionFactory.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/DriverRemoteConnection/RemoteConnectionFactory.cs
@@ -34,8 +34,14 @@ namespace Gremlin.Net.IntegrationTest.Process.Traversal.DriverRemoteConnection
 
         public IRemoteConnection CreateRemoteConnection()
         {
+            // gmodern is the standard test traversalsource that the main body of test uses
+            return CreateRemoteConnection("gmodern");
+        }
+
+        public IRemoteConnection CreateRemoteConnection(string traversalSource)
+        {
             return new Net.Driver.Remote.DriverRemoteConnection(
-                new GremlinClient(new GremlinServer(TestHost, TestPort)));
+                new GremlinClient(new GremlinServer(TestHost, TestPort)), traversalSource);
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/314ab67b/gremlin-dotnet/test/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/pom.xml b/gremlin-dotnet/test/pom.xml
index db585f4..ad931aa 100644
--- a/gremlin-dotnet/test/pom.xml
+++ b/gremlin-dotnet/test/pom.xml
@@ -134,12 +134,16 @@ limitations under the License.
                                             <value>${skipTests}</value>
                                         </property>
                                         <property>
+                                            <name>python</name>
+                                            <value>false</value>
+                                        </property>
+                                        <property>
                                             <name>gremlinServerDir</name>
                                             <value>${gremlin.server.dir}</value>
                                         </property>
                                         <property>
                                             <name>settingsFile</name>
-                                            <value>${gremlin.server.dir}/conf/gremlin-server-modern.yaml</value>
+                                            <value>${gremlin.server.dir}/src/test/resources/org/apache/tinkerpop/gremlin/driver/remote/gremlin-server-integration.yaml</value>
                                         </property>
                                         <property>
                                             <name>executionName</name>