You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by dk...@apache.org on 2017/12/15 21:32:08 UTC

[01/39] tinkerpop git commit: Invoke traversal methods with generic parameters [Forced Update!]

Repository: tinkerpop
Updated Branches:
  refs/heads/TINKERPOP-1447 8d58b3f7c -> 24dc1b7c1 (forced update)


Invoke traversal methods with generic parameters


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

Branch: refs/heads/TINKERPOP-1447
Commit: 19105a755353959d56359ef09757b52015c893bf
Parents: 6d8ff7d
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Fri Oct 27 10:55:20 2017 +0200
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Thu Nov 30 10:00:07 2017 +0100

----------------------------------------------------------------------
 .../TraversalEvaluation/ITokenParameter.cs      | 13 ++-
 .../TraversalEvaluation/NumericParameter.cs     | 10 +++
 .../StaticTraversalParameter.cs                 | 11 +++
 .../TraversalEvaluation/StringParameter.cs      | 10 +++
 .../Gherkin/TraversalEvaluation/Token.cs        | 15 ++--
 .../TraversalEvaluationTests.cs                 | 23 ++++--
 .../TraversalEvaluation/TraversalParser.cs      | 86 ++++++++++++++++----
 .../TraversalPredicateParameter.cs              | 11 +++
 .../TraversalTokenParameter.cs                  | 11 +++
 .../Gremlin.Net.IntegrationTest.csproj          |  6 +-
 10 files changed, 164 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/19105a75/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ITokenParameter.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ITokenParameter.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ITokenParameter.cs
index 1c940db..5c8197f 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ITokenParameter.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ITokenParameter.cs
@@ -21,10 +21,21 @@
 
 #endregion
 
+using System;
+
 namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
 {
     public interface ITokenParameter
     {
-        
+        /// <summary>
+        /// Gets the value of the parameter 
+        /// </summary>
+        object GetValue();
+
+        /// <summary>
+        /// Gets the type of the parameter
+        /// </summary>
+        /// <returns></returns>
+        Type GetParameterType();
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/19105a75/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/NumericParameter.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/NumericParameter.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/NumericParameter.cs
index 9effc17..378680c 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/NumericParameter.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/NumericParameter.cs
@@ -56,6 +56,16 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
         {
             return $"NumericParameter<{typeof(T).Name}>({Value})";
         }
+
+        public object GetValue()
+        {
+            return Value;
+        }
+
+        public Type GetParameterType()
+        {
+            return typeof(T);
+        }
     }
 
     internal static class NumericParameter

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/19105a75/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/StaticTraversalParameter.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/StaticTraversalParameter.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/StaticTraversalParameter.cs
index b054cbc..8e0fbf9 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/StaticTraversalParameter.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/StaticTraversalParameter.cs
@@ -24,6 +24,7 @@
 using System;
 using System.Collections.Generic;
 using System.Linq;
+using Gremlin.Net.Process.Traversal;
 
 namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
 {
@@ -47,6 +48,16 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
             return Parts != null ? Parts.GetHashCode() : 0;
         }
 
+        public object GetValue()
+        {
+            throw new NotImplementedException();
+        }
+
+        public Type GetParameterType()
+        {
+            return typeof(ITraversal);
+        }
+
         public IList<Token> Parts { get; }
         
         public StaticTraversalParameter(IList<Token> parts)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/19105a75/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/StringParameter.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/StringParameter.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/StringParameter.cs
index ad182b5..82f6cd9 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/StringParameter.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/StringParameter.cs
@@ -65,5 +65,15 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
         {
             return $"{GetType().Name}({Value})";
         }
+
+        public object GetValue()
+        {
+            return Value;
+        }
+
+        public Type GetParameterType()
+        {
+            return typeof(string);
+        }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/19105a75/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/Token.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/Token.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/Token.cs
index 633e2b5..539be89 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/Token.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/Token.cs
@@ -23,13 +23,15 @@
 
 using System;
 using System.Collections.Generic;
+using System.Collections.ObjectModel;
 using System.Linq;
 
 namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
 {
     internal class Token : IEquatable<Token>
     {
-        private static readonly IList<ITokenParameter> EmptyParameters = new ITokenParameter[0];
+        private static readonly IList<ITokenParameter> EmptyParameters =
+            new ReadOnlyCollection<ITokenParameter>(new ITokenParameter[0]);
         
         public bool Equals(Token other)
         {
@@ -37,7 +39,7 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
             {
                 return false;
             }
-            return  (Parameters ?? EmptyParameters).SequenceEqual(other.Parameters ?? EmptyParameters);
+            return  (Parameters).SequenceEqual(other.Parameters);
         }
 
         public override bool Equals(object obj)
@@ -59,12 +61,15 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
 
         public string Name { get; }
 
-        public ICollection<ITokenParameter> Parameters { get; }
+        /// <summary>
+        /// Returns the collection of parameters, can not be null.
+        /// </summary>
+        public IList<ITokenParameter> Parameters { get; }
             
-        public Token(string name, ICollection<ITokenParameter> parameters = null)
+        public Token(string name, IList<ITokenParameter> parameters = null)
         {
             Name = name;
-            Parameters = parameters;
+            Parameters = parameters ?? EmptyParameters;
         }
             
         public Token(string name, ITokenParameter parameter)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/19105a75/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEvaluationTests.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEvaluationTests.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEvaluationTests.cs
index ea65cd2..0949ad5 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEvaluationTests.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEvaluationTests.cs
@@ -22,12 +22,10 @@
 #endregion
 
 using System;
-using System.Collections.Generic;
-using System.Diagnostics;
 using System.Linq;
+using Gremlin.Net.Structure;
 using Xunit;
 using Xunit.Abstractions;
-using Xunit.Sdk;
 
 namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
 {
@@ -41,7 +39,7 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
         }
         
         [Fact]
-        public void Traversal_Parser_Should_Parse_Parts()
+        public void Traversal_Parser_Should_Parse_Into_Tokens()
         {
             var items = new[]
             {
@@ -64,7 +62,7 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
             };
             foreach (var item in items)
             {
-                var parts = TraversalParser.ParseParts(item.Item1);
+                var parts = TraversalParser.ParseTraversal(item.Item1);
                 _output.WriteLine("Parsing " + item.Item1);
                 if (parts[parts.Count-1].Parameters != null)
                 {
@@ -75,5 +73,20 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
                 Assert.Equal(new[] {new Token("g"), new Token("V")}.Concat(item.Item2), parts);
             }
         }
+
+        [Fact]
+        public void GetTraversal_Should_Invoke_Traversal_Methods()
+        {
+            var traversalTexts = new string[]
+            {
+                "g.V().count()",
+                "g.V().constant(123)"
+            };
+            var g = new Graph().Traversal();
+            foreach (var text in traversalTexts)
+            {
+                TraversalParser.GetTraversal(text, g);
+            }
+        }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/19105a75/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
index 0ac97ff..65ca103 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
@@ -56,49 +56,103 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
 
         private static ITraversal BuildFromMethods(string traversalText, GraphTraversalSource g)
         {
-            var parts = traversalText.Split('.');
-            if (parts[0] != "g")
+            var parts = ParseTraversal(traversalText);
+            if (parts[0].Name != "g")
             {
                 throw BuildException(traversalText);
             }
             ITraversal traversal;
-            switch (parts[1])
+            switch (parts[1].Name)
             {
-                case "V()":
+                case "V":
+                    //TODO: support V() parameters
                     traversal = g.V();
                     break;
-                case "E()":
+                case "E":
                     traversal = g.E();
                     break;
                 default:
                     throw BuildException(traversalText);
             }
-            for (var i = 2; i < parts.Length; i++)
+            for (var i = 2; i < parts.Count; i++)
             {
-                var name = GetCsharpName(parts[i], traversalText);
+                var token = parts[i];
+                var name = GetCsharpName(token.Name);
                 var method = traversal.GetType().GetMethod(name);
                 if (method == null)
                 {
                     throw new InvalidOperationException($"Traversal method '{parts[i]}' not found for testing");
                 }
-                if (method.IsGenericMethod)
+                var parameters = BuildParameters(method, token, out var genericParameters);
+                method = BuildGenericMethod(method, genericParameters);
+                traversal = (ITraversal) method.Invoke(traversal, parameters);
+            }
+            return traversal;
+        }
+
+        private static MethodInfo BuildGenericMethod(MethodInfo method, IDictionary<string, Type> genericParameters)
+        {
+            if (!method.IsGenericMethod)
+            {
+                return method;
+            }
+            var genericArgs = method.GetGenericArguments();
+            var types = new Type[genericArgs.Length];
+            for (var i = 0; i < genericArgs.Length; i++)
+            {
+                var name = genericArgs[i].Name;
+                if (genericParameters.TryGetValue(name, out var type))
+                {
+                    types[i] = type;
+                }
+                //TODO: Try to infer it from the name based on modern schema
+                else
                 {
                     throw new InvalidOperationException(
-                        $"Can not build traversal to test as '{name}()' method is generic");
+                        $"Can not build traversal to test as '{method.Name}()' method is generic and type '{name}'" +
+                        $" can not be inferred");
                 }
-                traversal = (ITraversal) method.Invoke(traversal, new object[] { new object[0]});
             }
-            return traversal;
+            return method.MakeGenericMethod(types);
         }
 
-        private static string GetCsharpName(string part, string traversalText)
+        private static object[] BuildParameters(MethodInfo method, Token token,
+                                                out IDictionary<string, Type> genericParameterTypes)
         {
-            if (!part.EndsWith("()"))
+            var paramsInfo = method.GetParameters();
+            var parameters = new object[paramsInfo.Length];
+            genericParameterTypes = new Dictionary<string, Type>();
+            for (var i = 0; i < paramsInfo.Length; i++)
             {
-                throw BuildException(traversalText);
+                var info = paramsInfo[i];
+                object value = null;
+                if (token.Parameters.Count > i)
+                {
+                    var tokenParameter = token.Parameters[i];
+                    value =  tokenParameter.GetValue();
+                    if (info.ParameterType.IsGenericParameter)
+                    {
+                        // We've provided a value for parameter of a generic type, we can infer the
+                        // type of the generic argument based on the parameter.
+                        // For example, in the case of `Constant<E2>(E2 value)`
+                        // if we have the type of value we have the type of E2. 
+                        genericParameterTypes.Add(info.ParameterType.Name, tokenParameter.GetParameterType());
+                    }
+                }
+                parameters[i] = value ?? GetDefault(info.ParameterType);
             }
+            return parameters;
+        }
+
+        public static object GetDefault(Type type)
+        {
+            return type.GetTypeInfo().IsValueType ? Activator.CreateInstance(type) : null;
+        }
+
+        private static string GetCsharpName(string part)
+        {
             // Transform to PascalCasing and remove the parenthesis
-            return char.ToUpper(part[0]) + part.Substring(1, part.Length - 3);
+            return char.ToUpper(part[0]) + part.Substring(1);
         }
 
         private static Exception BuildException(string traversalText)
@@ -106,7 +160,7 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
             return new InvalidOperationException($"Can not build a traversal to test from '{traversalText}'");
         }
 
-        internal static IList<Token> ParseParts(string traversalText)
+        internal static IList<Token> ParseTraversal(string traversalText)
         {
             var index = 0;
             return ParseTokens(traversalText, ref index);

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/19105a75/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalPredicateParameter.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalPredicateParameter.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalPredicateParameter.cs
index d9bf061..8c040b9 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalPredicateParameter.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalPredicateParameter.cs
@@ -24,6 +24,7 @@
 using System;
 using System.Collections.Generic;
 using System.Linq;
+using Gremlin.Net.Process.Traversal;
 
 namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
 {
@@ -50,6 +51,16 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
             return Parts != null ? Parts.GetHashCode() : 0;
         }
 
+        public object GetValue()
+        {
+            throw new NotImplementedException();
+        }
+
+        public Type GetParameterType()
+        {
+            return typeof(TraversalPredicate);
+        }
+
         public IList<Token> Parts { get; }
         
         public TraversalPredicateParameter(IList<Token> parts)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/19105a75/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalTokenParameter.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalTokenParameter.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalTokenParameter.cs
index 5a5e8c1..9291cd6 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalTokenParameter.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalTokenParameter.cs
@@ -24,6 +24,7 @@
 using System;
 using System.Collections.Generic;
 using System.Linq;
+using TEnum = Gremlin.Net.Process.Traversal.T;
 
 namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
 {
@@ -50,6 +51,16 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
             return Parts != null ? Parts.GetHashCode() : 0;
         }
 
+        public object GetValue()
+        {
+            throw new NotImplementedException();
+        }
+
+        public Type GetParameterType()
+        {
+            return typeof(TEnum);
+        }
+
         public IList<Token> Parts { get; }
         
         public TraversalTokenParameter(IList<Token> parts)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/19105a75/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gremlin.Net.IntegrationTest.csproj
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gremlin.Net.IntegrationTest.csproj b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gremlin.Net.IntegrationTest.csproj
index 40552ad..c929575 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gremlin.Net.IntegrationTest.csproj
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gremlin.Net.IntegrationTest.csproj
@@ -18,6 +18,7 @@
     <ProjectReference Include="..\..\src\Gremlin.Net\Gremlin.Net.csproj" />
   </ItemGroup>
   <ItemGroup>
+    <PackageReference Include="gherkin" Version="5.0.0" />
     <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0" />
     <PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" />
     <PackageReference Include="xunit" Version="2.2.0" />
@@ -30,9 +31,4 @@
   <ItemGroup>
     <Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
   </ItemGroup>
-  <ItemGroup>
-    <Reference Include="Gherkin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
-      <HintPath>..\..\..\..\temp\Gherkin.dll</HintPath>
-    </Reference>
-  </ItemGroup>
 </Project>
\ No newline at end of file


[15/39] tinkerpop git commit: Ignore tests for mapping coersion issue

Posted by dk...@apache.org.
Ignore tests for mapping coersion issue


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

Branch: refs/heads/TINKERPOP-1447
Commit: aab0e5c536c3c29d94694f2d9158edc2e215cd22
Parents: 71433a4
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Mon Nov 20 09:24:49 2017 +0100
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Thu Nov 30 10:00:10 2017 +0100

----------------------------------------------------------------------
 .../Gherkin/GherkinTestRunner.cs                | 48 +++++++++++---------
 .../ModernGraphTypeInformation.cs               |  6 +++
 2 files changed, 33 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/aab0e5c5/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs
index c5d8631..cd03eca 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs
@@ -49,6 +49,12 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
                     IgnoreReason.MapCoersionIssue},
                 { "g_V_outXcreatedX_unionXasXprojectX_inXcreatedX_hasXname_markoX_selectXprojectX__asXprojectX_inXcreatedX_inXknowsX_hasXname_markoX_selectXprojectXX_groupCount_byXnameX",
                     IgnoreReason.MapCoersionIssue},
+                { "g_V_outXcreatedX_name_groupCount", IgnoreReason.MapCoersionIssue},
+                { "g_V_outXcreatedX_groupCount_byXnameX", IgnoreReason.MapCoersionIssue},
+                { "g_V_chooseXlabel_is_person__unionX__out_lang__out_nameX__in_labelX_groupCount", IgnoreReason
+                .MapCoersionIssue},
+                { "g_V_coalesceXoutXlikesX_outXknowsX_inXcreatedXX_groupCount_byXnameX", IgnoreReason.MapCoersionIssue},
+                
                 { "g_withSackX0X_V_outE_sackXsumX_byXweightX_inV_sack_sum", IgnoreReason.ScenarioDesignMapNumbers},
                 { "g_V_hasLabelXsoftwareX_group_byXnameX_byXbothE_weight_meanX", IgnoreReason.ScenarioDesignMapNumbers},
                 { "g_V_groupXaX_byXlabelX_byXoutE_weight_sumX_capXaX", IgnoreReason.ScenarioDesignMapNumbers}
@@ -364,28 +370,28 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
             WriteOutput(path);
             WriteOutput("------");
 
-            var files = new []
-            {
-                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/Sum.feature",
-//                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/Coalesce.feature",
-                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/AddEdge.feature",
-                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/AddVertex.feature",
-                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/ValueMap.feature",
-                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/Select.feature",
-                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/Project.feature",
-                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/Path.feature",
-                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/Map.feature",
-                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/Match.feature",
-                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/Max.feature",
-                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/Mean.feature",
-                
-                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/sideEffect/Sack.feature",
-                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/sideEffect/Group.feature",
-//                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/sideEffect/GroupCount.feature",
-//                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/sideEffect/Inject.feature",
-            };
+//            var files = new []
+//            {
+//                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/Sum.feature",
+////                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/Coalesce.feature",
+//                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/AddEdge.feature",
+//                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/AddVertex.feature",
+//                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/ValueMap.feature",
+//                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/Select.feature",
+//                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/Project.feature",
+//                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/Path.feature",
+//                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/Map.feature",
+//                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/Match.feature",
+//                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/Max.feature",
+//                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/Mean.feature",
+//                
+//                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/sideEffect/Sack.feature",
+//                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/sideEffect/Group.feature",
+////                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/sideEffect/GroupCount.feature",
+////                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/sideEffect/Inject.feature",
+//            };
 //            var files = new [] {"/Users/jorge/workspace/temp/count.feature"};
-//            var files = Directory.GetFiles(path, "*.feature", SearchOption.AllDirectories);
+            var files = Directory.GetFiles(path, "*.feature", SearchOption.AllDirectories);
             foreach (var gherkinFile in files)
             {
                 var parser = new Parser();

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/aab0e5c5/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ModernGraphTypeInformation.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ModernGraphTypeInformation.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ModernGraphTypeInformation.cs
index 74b5382..3125aab 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ModernGraphTypeInformation.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ModernGraphTypeInformation.cs
@@ -83,6 +83,12 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
                 case nameof(GraphTraversal<object,object>.Mean):
                 case nameof(GraphTraversal<object,object>.Cap):
                 case nameof(GraphTraversal<object,object>.Constant):
+                case nameof(GraphTraversal<object,object>.Branch):
+                case nameof(GraphTraversal<object,object>.Local):
+                case nameof(GraphTraversal<object,object>.Tail):
+                case nameof(GraphTraversal<object,object>.Range):
+                case nameof(GraphTraversal<object,object>.Value):
+                case nameof(GraphTraversal<object,object>.Fold):
                     // default to object for this methods
                     return typeof(object);
             }


[16/39] tinkerpop git commit: Parse numeric values with suffix

Posted by dk...@apache.org.
Parse numeric values with suffix


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

Branch: refs/heads/TINKERPOP-1447
Commit: 71433a4ba89ae6d87e11659f2870e56438b93129
Parents: 33e87aa
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Fri Nov 17 15:48:16 2017 +0100
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Thu Nov 30 10:00:10 2017 +0100

----------------------------------------------------------------------
 .../Gherkin/CommonSteps.cs                      | 32 +++++++++++++++++---
 .../Gherkin/GherkinTestRunner.cs                | 25 +++++----------
 .../ModernGraphTypeInformation.cs               |  3 +-
 3 files changed, 36 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/71433a4b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
index 4b99fd8..9bc36a6 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
@@ -47,8 +47,7 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
         private static readonly IDictionary<Regex, Func<string, string, object>> Parsers =
             new Dictionary<string, Func<string, string, object>>
             {
-                {@"d\[(\d+)\]", (x, _) => Convert.ToInt32(x)},
-                {@"d\[(\d+(?:\.\d+)?)\]", (x, _) => Convert.ToDouble(x)},
+                {@"d\[([\d.]+)\]\.([ilfd])", ToNumber},
                 {@"v\[(.+)\]", ToVertex},
                 {@"v\[(.+)\]\.id", (x, graphName) => ToVertex(x, graphName).Id},
                 {@"v\[(.+)\]\.sid", (x, graphName) => ToVertex(x, graphName).Id.ToString()},
@@ -62,6 +61,15 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
                 {@"c\[(.+)\]", ToLambda}
             }.ToDictionary(kv => new Regex("^" + kv.Key + "$", RegexOptions.Compiled), kv => kv.Value);
 
+        private static readonly IDictionary<char, Func<string, object>> NumericParsers =
+            new Dictionary<char, Func<string, object>>
+            {
+                { 'i', s => Convert.ToInt32(s) },
+                { 'l', s => Convert.ToInt64(s) },
+                { 'f', s => Convert.ToSingle(s) },
+                { 'd', s => Convert.ToDouble(s) }
+            };
+
         [Given("the (\\w+) graph")]
         public void ChooseModernGraph(string graphName)
         {
@@ -193,10 +201,9 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
             
         }
 
-        private static IDictionary ToMap(string stringMap, string graphName)
+        private static object ToMap(string stringMap, string graphName)
         {
-            IDictionary<string, JToken> jsonMap = JObject.Parse(stringMap);
-            return jsonMap.ToDictionary(kv => kv.Key, kv => ParseMapValue(kv.Value, graphName));
+            return ParseMapValue(JObject.Parse(stringMap), graphName);
         }
 
         private static object ToLambda(string stringLambda, string graphName)
@@ -204,8 +211,19 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
             throw new IgnoreException(IgnoreReason.LambdaNotSupported);
         }
 
+        private static object ToNumber(string stringNumber, string graphName)
+        {
+            return NumericParsers[stringNumber[stringNumber.Length - 1]](
+                stringNumber.Substring(0, stringNumber.Length - 1));
+        }
+
         private static object ParseMapValue(JToken value, string graphName)
         {
+            if (value.Type == JTokenType.Object)
+            {
+                IDictionary<string, JToken> jsonMap = (JObject)value; 
+                return jsonMap.ToDictionary(kv => kv.Key, kv => ParseMapValue(kv.Value, graphName));
+            }
             if (value.Type == JTokenType.Array)
             {
                 return value.Select(v => ParseMapValue(v, graphName)).ToArray();
@@ -259,6 +277,10 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
                 {
                     parser = kv.Value;
                     extractedValue = match.Groups[1].Value;
+                    if (match.Groups.Count > 2)
+                    {
+                        extractedValue += match.Groups[2].Value;
+                    }
                     break;
                 }
             }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/71433a4b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs
index a3748ee..c5d8631 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs
@@ -31,10 +31,7 @@ using Xunit;
 using Gherkin;
 using Gherkin.Ast;
 using Gremlin.Net.IntegrationTest.Gherkin.Attributes;
-using Microsoft.VisualStudio.TestPlatform.Utilities;
-using Newtonsoft.Json.Serialization;
 using Xunit.Abstractions;
-using Xunit.Sdk;
 
 namespace Gremlin.Net.IntegrationTest.Gherkin
 {
@@ -43,26 +40,18 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
         private static readonly IDictionary<string, IgnoreReason> IgnoredScenarios =
             new Dictionary<string, IgnoreReason>
             {
-                { "g_V_hasLabelXpersonX_projectXa_bX_byXoutE_countX_byXageX", IgnoreReason.ScenarioDesignMapNumbers },
                 { "g_V_matchXa_knows_b__b_created_cX", IgnoreReason.MapCoersionIssue},
                 { "g_V_valueMap_matchXa_selectXnameX_bX", IgnoreReason.MapCoersionIssue},
                 { "g_V_matchXa_out_bX", IgnoreReason.MapCoersionIssue},
-                { "g_V_outXcreatedX_unionXasXprojectX_inXcreatedX_hasXname_markoX_selectXprojectX__asXprojectX_inXcreatedX_inXknowsX_hasXname_markoX_selectXprojectXX_groupCount_byXnameX",
-                    IgnoreReason.ScenarioDesignMapNumbers},
-                { "g_V_hasLabelXpersonX_asXpX_mapXbothE_label_groupCountX_asXrX_selectXp_rX",
-                    IgnoreReason.ScenarioDesignMapNumbers},
-                { "g_V_label_groupCount_asXxX_selectXxX", IgnoreReason.ScenarioDesignMapNumbers},
-                { "g_V_outXfollowedByX_group_byXsongTypeX_byXbothE_group_byXlabelX_byXweight_sumXX",
-                    IgnoreReason.ScenarioDesignMapNumbers},
-                { "g_V_repeatXbothXfollowedByXX_timesX2X_groupXaX_byXsongTypeX_byXcountX_capXaX",
-                    IgnoreReason.ScenarioDesignMapNumbers},
-                { "g_V_repeatXbothXfollowedByXX_timesX2X_group_byXsongTypeX_byXcountX",
-                    IgnoreReason.ScenarioDesignMapNumbers},
-                { "g_V_repeatXout_groupXaX_byXnameX_byXcountX_timesX2X_capXaX", IgnoreReason.ScenarioDesignMapNumbers},
-                { "g_V_hasXlangX_group_byXlangX_byXcountX", IgnoreReason.ScenarioDesignMapNumbers},
-                { "g_V_hasLabelXsongX_group_byXnameX_byXproperties_groupCount_byXlabelXX", IgnoreReason.MapCoersionIssue},
+                { "g_V_hasLabelXsongX_group_byXnameX_byXproperties_groupCount_byXlabelXX",
+                    IgnoreReason.MapCoersionIssue},
                 { "g_V_hasLabelXsongX_groupXaX_byXnameX_byXproperties_groupCount_byXlabelXX_out_capXaX",
                     IgnoreReason.MapCoersionIssue},
+                { "g_V_outXcreatedX_unionXasXprojectX_inXcreatedX_hasXname_markoX_selectXprojectX__asXprojectX_inXcreatedX_inXknowsX_hasXname_markoX_selectXprojectXX_groupCount_byXnameX",
+                    IgnoreReason.MapCoersionIssue},
+                { "g_withSackX0X_V_outE_sackXsumX_byXweightX_inV_sack_sum", IgnoreReason.ScenarioDesignMapNumbers},
+                { "g_V_hasLabelXsoftwareX_group_byXnameX_byXbothE_weight_meanX", IgnoreReason.ScenarioDesignMapNumbers},
+                { "g_V_groupXaX_byXlabelX_byXoutE_weight_sumX_capXaX", IgnoreReason.ScenarioDesignMapNumbers}
             };
         
         private static class Keywords

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/71433a4b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ModernGraphTypeInformation.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ModernGraphTypeInformation.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ModernGraphTypeInformation.cs
index abc3f2b..74b5382 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ModernGraphTypeInformation.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ModernGraphTypeInformation.cs
@@ -60,9 +60,10 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
                 case nameof(GraphTraversal<object,object>.Group) when genericTypeIndex == 0:
                     // Use IDictionary<string, object> for Group
                     return typeof(string);
+                case nameof(GraphTraversal<object,object>.Sum):
+                    return typeof(long);
                 case nameof(GraphTraversal<object,object>.Limit):
                 case nameof(GraphTraversal<object,object>.Optional):
-                case nameof(GraphTraversal<object,object>.Sum):
                 case nameof(GraphTraversal<object,object>.Coalesce):
                 case nameof(GraphTraversal<object,object>.Match):
                     // Maintain the same type


[17/39] tinkerpop git commit: Decimal serialization support and avoid dynamic conversion

Posted by dk...@apache.org.
Decimal serialization support and avoid dynamic conversion


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

Branch: refs/heads/TINKERPOP-1447
Commit: 5d15f2e420fe769066c97ae2a1dc3771a80320f1
Parents: aab0e5c
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Tue Nov 21 11:39:38 2017 +0100
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Thu Nov 30 10:01:18 2017 +0100

----------------------------------------------------------------------
 .../Structure/IO/GraphSON/DecimalConverter.cs   | 34 ++++++++++++++++++++
 .../Structure/IO/GraphSON/GraphSONReader.cs     | 15 +++++++--
 .../Structure/IO/GraphSON/GraphSONWriter.cs     |  1 +
 .../Structure/IO/GraphSON/NumberConverter.cs    |  3 +-
 4 files changed, 49 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5d15f2e4/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/DecimalConverter.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/DecimalConverter.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/DecimalConverter.cs
new file mode 100644
index 0000000..82cc646
--- /dev/null
+++ b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/DecimalConverter.cs
@@ -0,0 +1,34 @@
+#region License
+
+/*
+ * 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.
+ */
+
+#endregion
+
+using System;
+
+namespace Gremlin.Net.Structure.IO.GraphSON
+{
+    internal class DecimalConverter : NumberConverter
+    {
+        protected override string GraphSONTypeName => "BigDecimal";
+        protected override Type HandledType => typeof(decimal);
+        protected override string Prefix => "gx";
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5d15f2e4/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONReader.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONReader.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONReader.cs
index aa1fc48..60bafed 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONReader.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONReader.cs
@@ -48,7 +48,8 @@ namespace Gremlin.Net.Structure.IO.GraphSON
                 {"g:Edge", new EdgeDeserializer()},
                 {"g:Property", new PropertyDeserializer()},
                 {"g:VertexProperty", new VertexPropertyDeserializer()},
-                {"g:Path", new PathDeserializer()}
+                {"g:Path", new PathDeserializer()},
+                {"gx:BigDecimal", new DecimalConverter()}
             };
 
         /// <summary>
@@ -89,9 +90,17 @@ namespace Gremlin.Net.Structure.IO.GraphSON
         public dynamic ToObject(JToken jToken)
         {
             if (jToken is JArray)
+            {
                 return jToken.Select(t => ToObject(t));
-            if (!jToken.HasValues) return ((JValue) jToken).Value;
-            if (!HasTypeKey(jToken)) return ReadDictionary(jToken);
+            }
+            if (jToken is JValue jValue)
+            {
+                return jValue.Value;
+            }
+            if (!HasTypeKey(jToken))
+            {
+                return ReadDictionary(jToken);
+            }
             return ReadTypedValue(jToken);
         }
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5d15f2e4/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONWriter.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONWriter.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONWriter.cs
index 3c17d14..ab7e7d0 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONWriter.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONWriter.cs
@@ -49,6 +49,7 @@ namespace Gremlin.Net.Structure.IO.GraphSON
                 {typeof(long), new Int64Converter()},
                 {typeof(float), new FloatConverter()},
                 {typeof(double), new DoubleConverter()},
+                {typeof(decimal), new DecimalConverter()},
                 {typeof(Guid), new UuidSerializer()},
                 {typeof(DateTime), new DateSerializer()},
                 {typeof(Type), new ClassSerializer()},

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5d15f2e4/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/NumberConverter.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/NumberConverter.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/NumberConverter.cs
index 579d202..294db12 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/NumberConverter.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/NumberConverter.cs
@@ -31,6 +31,7 @@ namespace Gremlin.Net.Structure.IO.GraphSON
     {
         protected abstract string GraphSONTypeName { get; }
         protected abstract Type HandledType { get; }
+        protected virtual string Prefix => "g";
 
         public dynamic Objectify(JToken graphsonObject, GraphSONReader reader)
         {
@@ -39,7 +40,7 @@ namespace Gremlin.Net.Structure.IO.GraphSON
 
         public Dictionary<string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer)
         {
-            return GraphSONUtil.ToTypedValue(GraphSONTypeName, objectData);
+            return GraphSONUtil.ToTypedValue(GraphSONTypeName, objectData, Prefix);
         }
     }
 }
\ No newline at end of file


[31/39] tinkerpop git commit: Merge branch 'TINKERPOP-1825' into tp32

Posted by dk...@apache.org.
Merge branch 'TINKERPOP-1825' into tp32


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

Branch: refs/heads/TINKERPOP-1447
Commit: b3adadc321f96ce4645021af7b3a8b0c90df5610
Parents: 7e17d4f aa14928
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Tue Dec 5 14:15:05 2017 +0100
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Tue Dec 5 14:15:05 2017 +0100

----------------------------------------------------------------------
 .travis.yml                                     |  2 +-
 gremlin-dotnet/glv/generate.groovy              | 58 +++++++++++++-------
 .../Process/Traversal/GraphTraversal.cs         |  4 +-
 .../src/Gremlin.Net/Process/Traversal/__.cs     |  4 +-
 4 files changed, 44 insertions(+), 24 deletions(-)
----------------------------------------------------------------------



[06/39] tinkerpop git commit: Gremlin.Net.IntegrationTest project as an unsigned assembly

Posted by dk...@apache.org.
Gremlin.Net.IntegrationTest project as an unsigned assembly


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

Branch: refs/heads/TINKERPOP-1447
Commit: 8fc2b84b05d536f358fc9f315904ff65779d04b2
Parents: 69a710c
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Thu Nov 2 12:27:55 2017 +0100
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Thu Nov 30 10:00:08 2017 +0100

----------------------------------------------------------------------
 .../Gherkin/TraversalEvaluation/TraversalParser.cs                | 2 +-
 .../Gremlin.Net.IntegrationTest.csproj                            | 3 ---
 2 files changed, 1 insertion(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8fc2b84b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
index 4cf7b4a..2bd92bc 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
@@ -34,7 +34,7 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
         private static readonly IDictionary<string, Func<GraphTraversalSource, ITraversal>> FixedTranslations = 
             new Dictionary<string, Func<GraphTraversalSource, ITraversal>>
             {
-                { "g.V().fold().count(Scope.local)", g => g.V().Fold<object>().Count(Scope.Local)}
+                { "g.V().fold().count(Scope.local)", g => g.V().Fold().Count(Scope.Local)}
             };
 
         private static readonly Regex RegexNumeric =

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8fc2b84b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gremlin.Net.IntegrationTest.csproj
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gremlin.Net.IntegrationTest.csproj b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gremlin.Net.IntegrationTest.csproj
index c929575..82727fd 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gremlin.Net.IntegrationTest.csproj
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gremlin.Net.IntegrationTest.csproj
@@ -5,9 +5,6 @@
     <AssemblyName>Gremlin.Net.IntegrationTest</AssemblyName>
     <PackageId>Gremlin.Net.IntegrationTest</PackageId>
     <RuntimeFrameworkVersion>1.0.4</RuntimeFrameworkVersion>
-    <AssemblyOriginatorKeyFile>../../build/tinkerpop.snk</AssemblyOriginatorKeyFile>
-    <SignAssembly>true</SignAssembly>
-    <PublicSign Condition="'$(OS)' != 'Windows_NT'">true</PublicSign>
   </PropertyGroup>
   <ItemGroup>
     <None Update="appsettings.json">


[05/39] tinkerpop git commit: Improved method overload matching

Posted by dk...@apache.org.
Improved method overload matching


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

Branch: refs/heads/TINKERPOP-1447
Commit: f38c2d004e4683adcc65dd1c5ab9e9aa84e1e2be
Parents: 8fc2b84
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Thu Nov 2 18:05:04 2017 +0100
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Thu Nov 30 10:00:08 2017 +0100

----------------------------------------------------------------------
 .../Process/Traversal/Instruction.cs            |   6 +-
 .../ContextBasedParameter.cs                    |   5 +-
 .../TraversalEvaluation/ITokenParameter.cs      |   8 +-
 .../TraversalEvaluation/LiteralParameter.cs     |  87 ++++++++++++
 .../ModernGraphTypeInformation.cs               |   4 +-
 .../TraversalEvaluation/NumericParameter.cs     |  84 ------------
 .../StaticTraversalParameter.cs                 |  20 ++-
 .../TraversalEvaluation/StringParameter.cs      |   7 +-
 .../Gherkin/TraversalEvaluation/Token.cs        |  11 ++
 .../TraversalEnumParameter.cs                   |   7 +-
 .../TraversalEvaluationTests.cs                 |  15 ++-
 .../TraversalEvaluation/TraversalParser.cs      | 135 +++++++++++++++++--
 .../TraversalPredicateParameter.cs              |  19 ++-
 13 files changed, 279 insertions(+), 129 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f38c2d00/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Instruction.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Instruction.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Instruction.cs
index a9163be..65847c5 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Instruction.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Instruction.cs
@@ -27,9 +27,7 @@ namespace Gremlin.Net.Process.Traversal
     ///     Represents a <see cref="Bytecode" /> instruction by an operator name and its arguments.
     /// </summary>
     public class Instruction
-    {
-        private static readonly object[] EmptyArgs = new object[0];
-        
+    {   
         /// <summary>
         ///     Initializes a new instance of the <see cref="Instruction" /> class.
         /// </summary>
@@ -38,7 +36,7 @@ namespace Gremlin.Net.Process.Traversal
         public Instruction(string operatorName, params dynamic[] arguments)
         {
             OperatorName = operatorName;
-            Arguments = arguments ??  EmptyArgs;
+            Arguments = arguments;
         }
 
         /// <summary>

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f38c2d00/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ContextBasedParameter.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ContextBasedParameter.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ContextBasedParameter.cs
index 4f837d4..fa8f3f1 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ContextBasedParameter.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ContextBasedParameter.cs
@@ -57,7 +57,7 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
             _name = name;
         }
 
-        private void SetValue(IDictionary<string, object> parameterValues)
+        public void SetContextParameterValues(IDictionary<string, object> parameterValues)
         {
             if (parameterValues == null || !parameterValues.TryGetValue(_name, out var value))
             {
@@ -66,9 +66,8 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
             _value = value;
         }
         
-        public object GetValue(IDictionary<string, object> contextParameterValues)
+        public object GetValue()
         {
-            SetValue(contextParameterValues);
             return _value;
         }
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f38c2d00/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ITokenParameter.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ITokenParameter.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ITokenParameter.cs
index 9b06e80..357e35b 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ITokenParameter.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ITokenParameter.cs
@@ -31,12 +31,16 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
         /// <summary>
         /// Gets the value of the parameter 
         /// </summary>
-        object GetValue(IDictionary<string, object> contextParameterValues);
+        object GetValue();
 
         /// <summary>
         /// Gets the type of the parameter
         /// </summary>
-        /// <returns></returns>
         Type GetParameterType();
+
+        /// <summary>
+        /// Sets the context parameter values by a given name, ie: "v1Id" = 1
+        /// </summary>
+        void SetContextParameterValues(IDictionary<string, object> values);
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f38c2d00/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/LiteralParameter.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/LiteralParameter.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/LiteralParameter.cs
new file mode 100644
index 0000000..da0ac24
--- /dev/null
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/LiteralParameter.cs
@@ -0,0 +1,87 @@
+#region License
+
+/*
+ * 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.
+ */
+
+#endregion
+
+using System;
+using System.Collections.Generic;
+
+namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
+{
+    /// <summary>
+    /// Represents a literal (number / boolean) that is allowed as a gremlin parameter.
+    /// </summary>
+    public class LiteralParameter<T> : ITokenParameter, IEquatable<LiteralParameter<T>> where T : struct
+    {
+        public bool Equals(LiteralParameter<T> other)
+        {
+            return Value.Equals(other.Value);
+        }
+
+        public override bool Equals(object obj)
+        {
+            if (ReferenceEquals(null, obj)) return false;
+            if (ReferenceEquals(this, obj)) return true;
+            if (obj.GetType() != GetType()) return false;
+            return Equals((LiteralParameter<T>) obj);
+        }
+
+        public override int GetHashCode()
+        {
+            return Value.GetHashCode();
+        }
+
+        public T Value { get; }
+        
+        public LiteralParameter(T value)
+        {
+            Value = value;
+        }
+
+        public override string ToString()
+        {
+            return $"NumericParameter<{typeof(T).Name}>({Value})";
+        }
+
+        public object GetValue()
+        {
+            return Value;
+        }
+
+        public Type GetParameterType()
+        {
+            return typeof(T);
+        }
+
+        public void SetContextParameterValues(IDictionary<string, object> parameterValues)
+        {
+
+        }
+    }
+
+    internal static class LiteralParameter
+    {
+        public static LiteralParameter<TType> Create<TType>(TType value) where TType : struct
+        {
+            return new LiteralParameter<TType>(value);
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f38c2d00/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ModernGraphTypeInformation.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ModernGraphTypeInformation.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ModernGraphTypeInformation.cs
index bce3449..e26ec5f 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ModernGraphTypeInformation.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ModernGraphTypeInformation.cs
@@ -47,7 +47,6 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
         {
             switch (method.Name)
             {
-                case nameof(GraphTraversal<object,object>.ValueMap):
                 case nameof(GraphTraversal<object,object>.Values) when parameterValues.Length == 1:
                     // The parameter contains the element property names
                     var properties = ((IEnumerable) parameterValues[parameterValues.Length - 1]).Cast<string>();
@@ -57,6 +56,9 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
                         return types[0];
                     }
                     return typeof(object);
+                case nameof(GraphTraversal<object,object>.ValueMap):
+                    // Use IDictionary<string, object> for value maps
+                    return typeof(object);
             }
             return null;
         }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f38c2d00/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/NumericParameter.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/NumericParameter.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/NumericParameter.cs
deleted file mode 100644
index 7428cc2..0000000
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/NumericParameter.cs
+++ /dev/null
@@ -1,84 +0,0 @@
-#region License
-
-/*
- * 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.
- */
-
-#endregion
-
-using System;
-using System.Collections.Generic;
-
-namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
-{
-    public class NumericParameter<T> : ITokenParameter, IEquatable<NumericParameter<T>> where T : struct
-    {
-        public bool Equals(NumericParameter<T> other)
-        {
-            return Value.Equals(other.Value);
-        }
-
-        public override bool Equals(object obj)
-        {
-            if (ReferenceEquals(null, obj)) return false;
-            if (ReferenceEquals(this, obj)) return true;
-            if (obj.GetType() != GetType()) return false;
-            return Equals((NumericParameter<T>) obj);
-        }
-
-        public override int GetHashCode()
-        {
-            return Value.GetHashCode();
-        }
-
-        public T Value { get; }
-        
-        public NumericParameter(T value)
-        {
-            Value = value;
-        }
-
-        public override string ToString()
-        {
-            return $"NumericParameter<{typeof(T).Name}>({Value})";
-        }
-
-        public object GetValue(IDictionary<string, object> contextParameterValues)
-        {
-            return Value;
-        }
-
-        public Type GetParameterType()
-        {
-            return typeof(T);
-        }
-    }
-
-    internal static class NumericParameter
-    {
-        public static NumericParameter<TType> Create<TType>(TType value) where TType : struct
-        {
-            return new NumericParameter<TType>(value);
-        }
-
-        public static NumericParameter<long> CreateLong(string value)
-        {
-            return NumericParameter.Create(Convert.ToInt64(value.Substring(0, value.Length - 1)));
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f38c2d00/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/StaticTraversalParameter.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/StaticTraversalParameter.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/StaticTraversalParameter.cs
index dd38dca..d8fad5b 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/StaticTraversalParameter.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/StaticTraversalParameter.cs
@@ -31,6 +31,15 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
     internal class StaticTraversalParameter : ITokenParameter, IEquatable<StaticTraversalParameter>
     {
         private readonly string _traversalText;
+        private IDictionary<string, object> _contextParameterValues;
+
+        public IList<Token> Tokens { get; }
+        
+        public StaticTraversalParameter(IList<Token> tokens, string traversalText)
+        {
+            _traversalText = traversalText;
+            Tokens = tokens;
+        }
 
         public bool Equals(StaticTraversalParameter other)
         {
@@ -50,9 +59,9 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
             return Tokens != null ? Tokens.GetHashCode() : 0;
         }
 
-        public object GetValue(IDictionary<string, object> contextParameterValues)
+        public object GetValue()
         {
-            return TraversalParser.GetTraversalFromTokens(Tokens, null, contextParameterValues, _traversalText);
+            return TraversalParser.GetTraversalFromTokens(Tokens, null, _contextParameterValues, _traversalText);
         }
 
         public Type GetParameterType()
@@ -60,12 +69,9 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
             return typeof(ITraversal);
         }
 
-        public IList<Token> Tokens { get; }
-        
-        public StaticTraversalParameter(IList<Token> tokens, string traversalText)
+        public void SetContextParameterValues(IDictionary<string, object> parameterValues)
         {
-            _traversalText = traversalText;
-            Tokens = tokens;
+            _contextParameterValues = parameterValues;
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f38c2d00/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/StringParameter.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/StringParameter.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/StringParameter.cs
index 430c2d2..716a2ce 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/StringParameter.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/StringParameter.cs
@@ -67,7 +67,7 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
             return $"{GetType().Name}({Value})";
         }
 
-        public object GetValue(IDictionary<string, object> contextParameterValues)
+        public object GetValue()
         {
             return Value;
         }
@@ -76,5 +76,10 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
         {
             return typeof(string);
         }
+
+        public void SetContextParameterValues(IDictionary<string, object> parameterValues)
+        {
+
+        }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f38c2d00/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/Token.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/Token.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/Token.cs
index 539be89..e0acf4b 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/Token.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/Token.cs
@@ -77,5 +77,16 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
             Name = name;
             Parameters = new[] {parameter};
         }
+
+        /// <summary>
+        /// Sets the context parameter values by a given name, ie: "v1Id" = 1
+        /// </summary>
+        public void SetContextParameterValues(IDictionary<string, object> values)
+        {
+            foreach (var tokenParameter in Parameters)
+            {
+                tokenParameter.SetContextParameterValues(values);
+            }
+        }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f38c2d00/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEnumParameter.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEnumParameter.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEnumParameter.cs
index c99fc95..c305df7 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEnumParameter.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEnumParameter.cs
@@ -85,7 +85,7 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
             return _text.GetHashCode();
         }
 
-        public object GetValue(IDictionary<string, object> contextParameterValues)
+        public object GetValue()
         {
             return _value;
         }
@@ -94,5 +94,10 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
         {
             return _type;
         }
+
+        public void SetContextParameterValues(IDictionary<string, object> parameterValues)
+        {
+
+        }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f38c2d00/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEvaluationTests.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEvaluationTests.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEvaluationTests.cs
index be5f444..d2a62b4 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEvaluationTests.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEvaluationTests.cs
@@ -23,6 +23,7 @@
 
 using System;
 using System.Linq;
+using Gremlin.Net.Process.Traversal;
 using Gremlin.Net.Structure;
 using Xunit;
 using Xunit.Abstractions;
@@ -40,13 +41,13 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
                 Tuple.Create("g.V().values(\"name\")",
                     new[] {new Token("values", new StringParameter("name"))}),
                 Tuple.Create("g.V().constant(123l)", 
-                    new[] {new Token("constant", new[] {NumericParameter.Create(123L)})}),
+                    new[] {new Token("constant", new[] {LiteralParameter.Create(123L)})}),
                 Tuple.Create("g.V().constant(123)", 
-                    new[] {new Token("constant", new[] {NumericParameter.Create(123)})}),
+                    new[] {new Token("constant", new[] {LiteralParameter.Create(123)})}),
                 Tuple.Create("g.V().constant(123.1)", 
-                    new[] {new Token("constant", new[] {NumericParameter.Create(123.1)})}),
+                    new[] {new Token("constant", new[] {LiteralParameter.Create(123.1)})}),
                 Tuple.Create("g.V().constant(123.1f)", 
-                    new[] {new Token("constant", new[] {NumericParameter.Create(123.1f)})}),
+                    new[] {new Token("constant", new[] {LiteralParameter.Create(123.1f)})}),
                 Tuple.Create("g.V().has(\"no\").count()",
                     new[] {new Token("has", new StringParameter("no")), new Token("count")}),
                 Tuple.Create("g.V().has(\"lang\", \"java\")",
@@ -57,7 +58,7 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
                 Tuple.Create("g.V().has(\"age\",P.gt(27))", 
                     new[] {new Token("has", new ITokenParameter[] { new StringParameter("age"),
                         new TraversalPredicateParameter(
-                            new[] { new Token("P"), new Token("gt", NumericParameter.Create(27)) }) })}),
+                            new[] { new Token("P"), new Token("gt", LiteralParameter.Create(27)) }) })}),
                 Tuple.Create("g.V().count(Scope.local)", 
                     new[] { new Token("count", new TraversalEnumParameter("Scope.local"))})
             };
@@ -74,10 +75,10 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
             var traversalTexts = new []
             {
                 Tuple.Create("g.V().count()", 2),
-//                //"g.V().constant(123L)", Can be parsed using the new type-safe API
+//                Tuple.Create("g.V().constant(123L)", 2), // Can be parsed using the new type-safe API
                 Tuple.Create("g.V().has(\"no\").count()", 3),
                 Tuple.Create("g.V().values(\"age\")", 2),
-                Tuple.Create("g.V().valueMap(\"name\", \"age\")", 2),
+                Tuple.Create("g.V().valueMap(true, \"name\", \"age\")", 2),
                 Tuple.Create("g.V().where(__.in(\"created\").count().is(1)).values(\"name\")", 3),
                 Tuple.Create("g.V().count(Scope.local)", 2),
                 Tuple.Create("g.V().values(\"age\").is(P.lte(30))", 3)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f38c2d00/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
index 2bd92bc..bb0aac8 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
@@ -23,6 +23,7 @@
 
 using System;
 using System.Collections.Generic;
+using System.Linq;
 using System.Reflection;
 using System.Text.RegularExpressions;
 using Gremlin.Net.Process.Traversal;
@@ -78,13 +79,16 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
             for (var i = 1; i < tokens.Count; i++)
             {
                 var token = tokens[i];
+                token.SetContextParameterValues(contextParameterValues);
                 var name = GetCsharpName(token.Name);
-                var method = instanceType.GetMethod(name);
+                var methods = instanceType.GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static)
+                    .Where(m => m.Name == name).ToList();
+                var method = GetClosestMethod(methods, token.Parameters);
                 if (method == null)
                 {
-                    throw new InvalidOperationException($"Traversal method '{tokens[i]}' not found for testing");
+                    throw new InvalidOperationException($"Traversal method '{tokens[i].Name}' not found for testing");
                 }
-                var parameterValues = BuildParameters(method, token, contextParameterValues, out var genericParameters);
+                var parameterValues = BuildParameters(method, token, out var genericParameters);
                 method = BuildGenericMethod(method, genericParameters, parameterValues);
                 instance = method.Invoke(instance, parameterValues);
                 instanceType = instance.GetType();
@@ -92,6 +96,84 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
             return (ITraversal) instance;
         }
 
+        /// <summary>
+        /// Find the method that supports the amount of parameters provided
+        /// </summary>
+        private static MethodInfo GetClosestMethod(IList<MethodInfo> methods, IList<ITokenParameter> tokenParameters)
+        {
+            if (methods.Count == 0)
+            {
+                return null;
+            }
+            if (methods.Count == 1)
+            {
+                return methods[0];
+            }
+            var ordered = methods.OrderBy(m => m.GetParameters().Length);
+            if (tokenParameters.Count == 0)
+            {
+                return ordered.First();
+            }
+            MethodInfo lastMethod = null;
+            var compatibleMethods = new Dictionary<int, MethodInfo>();
+            foreach (var method in ordered)
+            {
+                lastMethod = method;
+                var parameters = method.GetParameters();
+                if (tokenParameters.Count < parameters.Length)
+                {
+                    continue;
+                }
+                var matched = true;
+                var exactMatches = 0;
+                for (var i = 0; i < tokenParameters.Count; i++)
+                {
+                    if (parameters.Length <= i)
+                    {
+                        // The method contains less parameters (and no params array) than provided
+                        matched = false;
+                        break;
+                    }
+                    var methodParameter = parameters[i];
+                    var tokenParameterType = tokenParameters[i].GetParameterType();
+                    // Match either the same parameter type
+                    matched = methodParameter.ParameterType == tokenParameterType;
+                    if (matched)
+                    {
+                        exactMatches++;
+                    }
+                    else if (IsParamsArray(methodParameter))
+                    {
+                        matched = methodParameter.ParameterType == typeof(object[]) ||
+                                  methodParameter.ParameterType.GetElementType() == tokenParameterType;
+                        // The method has params array, no further parameters are going to be defined
+                        break;
+                    }
+                    else
+                    {
+                        if (!methodParameter.ParameterType.GetTypeInfo().IsAssignableFrom(tokenParameterType))
+                        {
+                            break;   
+                        }
+                        // Is assignable to the parameter type
+                        matched = true;
+                    }
+                }
+                if (matched)
+                {
+                    compatibleMethods[exactMatches] = method;
+                }
+            }
+            // Attempt to use the method with the higher number of matches or the last one
+            return compatibleMethods.OrderByDescending(kv => kv.Key).Select(kv => kv.Value).FirstOrDefault() ??
+                   lastMethod;
+        }
+
+        private static bool IsParamsArray(ParameterInfo methodParameter)
+        {
+            return methodParameter.IsDefined(typeof(ParamArrayAttribute), false);
+        }
+
         private static MethodInfo BuildGenericMethod(MethodInfo method, IDictionary<string, Type> genericParameters,
                                                      object[] parameterValues)
         {
@@ -114,7 +196,7 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
                 {
                     throw new InvalidOperationException(
                         $"Can not build traversal to test as '{method.Name}()' method is generic and type '{name}'" +
-                        $" can not be inferred");
+                         " can not be inferred");
                 }
                 types[i] = type;
             }
@@ -122,7 +204,6 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
         }
 
         private static object[] BuildParameters(MethodInfo method, Token token,
-                                                IDictionary<string, object> contextParameterValues,
                                                 out IDictionary<string, Type> genericParameterTypes)
         {
             var paramsInfo = method.GetParameters();
@@ -135,7 +216,7 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
                 if (token.Parameters.Count > i)
                 {
                     var tokenParameter = token.Parameters[i];
-                    value =  tokenParameter.GetValue(contextParameterValues);
+                    value =  tokenParameter.GetValue();
                     if (info.ParameterType.IsGenericParameter)
                     {
                         // We've provided a value for parameter of a generic type, we can infer the
@@ -144,9 +225,26 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
                         // if we have the type of value we have the type of E2. 
                         genericParameterTypes.Add(info.ParameterType.Name, tokenParameter.GetParameterType());
                     }
-                    else if (info.ParameterType == typeof(object[]))
+                }
+                if (IsParamsArray(info))
+                {
+                    // For `params type[] value` we should provide an empty array
+                    if (value == null)
+                    {
+                        // An empty array
+                        value = Array.CreateInstance(info.ParameterType.GetElementType(), 0);
+                    }
+                    else if (!value.GetType().IsArray)
                     {
-                        value = new [] {value};
+                        // An array with the parameter values
+                        // No more method parameters after this one
+                        var arr = Array.CreateInstance(info.ParameterType.GetElementType(), token.Parameters.Count - i);
+                        arr.SetValue(value, 0);
+                        for (var j = 1; j < token.Parameters.Count - i; j++)
+                        {
+                            arr.SetValue(token.Parameters[i + j].GetValue(), j);   
+                        }
+                        value = arr;
                     }
                 }
                 parameters[i] = value ?? GetDefault(info.ParameterType);
@@ -282,10 +380,21 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
                 return new TraversalPredicateParameter(ParseTokens(text, ref i));
             }
             var parameterText = text.Substring(i, text.IndexOf(')', i) - i);
-            if (string.IsNullOrWhiteSpace(parameterText))
+            var separatorIndex = parameterText.IndexOf(',');
+            if (separatorIndex >= 0)
+            {
+                parameterText = parameterText.Substring(0, separatorIndex);
+            }
+            parameterText = parameterText.Trim();
+            if (parameterText == "")
             {
                 return null;
             }
+            if (parameterText == "true" || parameterText == "false")
+            {
+                i += parameterText.Length - 1;
+                return LiteralParameter.Create(Convert.ToBoolean(parameterText));
+            }
             if (RegexEnum.IsMatch(parameterText))
             {
                 i += parameterText.Length - 1;
@@ -311,18 +420,18 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
             i += match.Value.Length - 1;
             if (numericText.EndsWith("L"))
             {
-                return NumericParameter.Create(Convert.ToInt64(match.Value.Substring(0, match.Value.Length - 1)));
+                return LiteralParameter.Create(Convert.ToInt64(match.Value.Substring(0, match.Value.Length - 1)));
             }
             if (numericText.EndsWith("F"))
             {
-                return NumericParameter.Create(Convert.ToSingle(match.Value.Substring(0, match.Value.Length-1)));
+                return LiteralParameter.Create(Convert.ToSingle(match.Value.Substring(0, match.Value.Length-1)));
             }
             if (match.Groups[1].Value != "")
             {
                 // Captured text with the decimal separator
-                return NumericParameter.Create(Convert.ToDouble(match.Value));
+                return LiteralParameter.Create(Convert.ToDouble(match.Value));
             }
-            return NumericParameter.Create(Convert.ToInt32(match.Value));
+            return LiteralParameter.Create(Convert.ToInt32(match.Value));
         }
         
         private enum ParsingPart

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f38c2d00/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalPredicateParameter.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalPredicateParameter.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalPredicateParameter.cs
index 83060c7..57262c1 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalPredicateParameter.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalPredicateParameter.cs
@@ -34,6 +34,14 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
     /// </summary>
     internal class TraversalPredicateParameter : ITokenParameter, IEquatable<TraversalPredicateParameter>
     {
+        private IDictionary<string, object> _contextParameterValues;
+        public IList<Token> Tokens { get; }
+        
+        public TraversalPredicateParameter(IList<Token> tokens)
+        {
+            Tokens = tokens;
+        }
+
         public bool Equals(TraversalPredicateParameter other)
         {
             return Tokens.SequenceEqual(other.Tokens);
@@ -52,13 +60,14 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
             return Tokens != null ? Tokens.GetHashCode() : 0;
         }
 
-        public object GetValue(IDictionary<string, object> contextParameterValues)
+        public object GetValue()
         {
             var type = typeof(P);
             object instance = null;
             for (var i = 1; i < Tokens.Count; i++)
             {
                 var token = Tokens[i];
+                token.SetContextParameterValues(_contextParameterValues);
                 var method = type.GetMethod(TraversalParser.GetCsharpName(token.Name),
                     BindingFlags.Static | BindingFlags.Public);
                 if (method == null)
@@ -66,7 +75,7 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
                     throw new InvalidOperationException($"Predicate (P) method '{token}' not found for testing");
                 }
                 instance = method.Invoke(instance,
-                    new object[] {token.Parameters.Select(p => p.GetValue(contextParameterValues)).ToArray()});
+                    new object[] {token.Parameters.Select(p => p.GetValue()).ToArray()});
             }
             return instance;
         }
@@ -76,11 +85,9 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
             return typeof(TraversalPredicate);
         }
 
-        public IList<Token> Tokens { get; }
-        
-        public TraversalPredicateParameter(IList<Token> tokens)
+        public void SetContextParameterValues(IDictionary<string, object> parameterValues)
         {
-            Tokens = tokens;
+            _contextParameterValues = parameterValues;
         }
     }
 }
\ No newline at end of file


[33/39] tinkerpop git commit: Merge branch 'TINKERPOP-1848' into tp32

Posted by dk...@apache.org.
Merge branch 'TINKERPOP-1848' into tp32


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

Branch: refs/heads/TINKERPOP-1447
Commit: eb69fec488627d266f9414126e18cd68590fd9d8
Parents: 6e60a29 7f3ecf2
Author: Robert Dale <ro...@gmail.com>
Authored: Wed Dec 6 13:00:07 2017 -0500
Committer: Robert Dale <ro...@gmail.com>
Committed: Wed Dec 6 13:00:07 2017 -0500

----------------------------------------------------------------------
 .../main/jython/gremlin_python/structure/io/graphson.py   |  3 +--
 .../src/main/jython/tests/structure/io/test_graphson.py   | 10 ++++++++--
 2 files changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------



[35/39] tinkerpop git commit: Cleaned up the python build.

Posted by dk...@apache.org.
Cleaned up the python build.

Docs were broken as a result of the jython maven plugin being disabled (it was disabled a while ago because it no longer works given authentication changes in pypi and a new plugin has not yet been released to support it). Removed some dead file coping which was no longer relevant. Included import of aenum so that docs would work - didn't seem necessary for compile. CTR


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

Branch: refs/heads/TINKERPOP-1447
Commit: 97bb97f3d19b856f2f027d61d3de23e94ae86e8e
Parents: eb69fec
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Dec 11 10:31:26 2017 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Dec 11 10:34:09 2017 -0500

----------------------------------------------------------------------
 docs/preprocessor/awk/init-code-blocks.awk |  2 +-
 gremlin-python/pom.xml                     | 32 +++----------------------
 2 files changed, 4 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/97bb97f3/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 4f1c184..60696fc 100644
--- a/docs/preprocessor/awk/init-code-blocks.awk
+++ b/docs/preprocessor/awk/init-code-blocks.awk
@@ -58,7 +58,7 @@ BEGIN {
       print "jython.eval('os.chdir(\"" TP_HOME "\")')"
       print "jython.eval('import sys')"
       print "jython.eval('sys.path.append(\"" PYTHONPATH "\")')"
-      print "jython.eval('sys.path.append(\"" TP_HOME "/gremlin-python/target/test-classes/Lib\")')"
+      print "jython.eval('sys.path.append(\"" TP_HOME "/gremlin-python/target/python2/env/lib/python2.7/site-packages\")')"
       print "jython.eval('from gremlin_python import statics')"
       print "jython.eval('from gremlin_python.process.traversal import *')"
       print "jython.eval('from gremlin_python.process.strategies import *')"

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/97bb97f3/gremlin-python/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-python/pom.xml b/gremlin-python/pom.xml
index a1aee4a..c2ae070 100644
--- a/gremlin-python/pom.xml
+++ b/gremlin-python/pom.xml
@@ -264,29 +264,6 @@ limitations under the License.
                             </systemPropertyVariables>
                         </configuration>
                     </plugin>
-                    <!--
-                    <plugin>
-                        <groupId>net.sf.mavenjython</groupId>
-                        <artifactId>jython-compile-maven-plugin</artifactId>
-                        <version>1.4</version>
-                        <executions>
-                            <execution>
-                                <phase>process-resources</phase>
-                                <goals>
-                                    <goal>jython</goal>
-                                </goals>
-                                <configuration>
-                                    <libraries>
-                                        <param>aenum>=1.4.5</param>
-                                        <param>tornado>=4.4.1</param>
-                                        <param>six>=1.10.0</param>
-                                        <param>futures>=3.0.5</param>
-                                    </libraries>
-                                </configuration>
-                            </execution>
-                        </executions>
-                    </plugin>
-                    -->
                     <!-- need to create python-reports directory at this point or else pytest can't write the report to it -->
                     <plugin>
                         <groupId>org.apache.maven.plugins</groupId>
@@ -301,7 +278,6 @@ limitations under the License.
                                 <configuration>
                                     <tasks>
                                         <mkdir dir="${project.build.directory}/python-reports"/>
-                                        <mkdir dir="${project.build.directory}/python/env"/>
                                         <mkdir dir="${project.build.directory}/python-packaged/env"/>
                                     </tasks>
                                 </configuration>
@@ -341,7 +317,7 @@ limitations under the License.
                                         </exec>
                                         <exec dir="${project.build.directory}/python2" executable="env/bin/pip"
                                               failonerror="true">
-                                            <arg line="install wheel radish-bdd PyHamcrest"/>
+                                            <arg line="install wheel radish-bdd PyHamcrest aenum"/>
                                         </exec>
                                         <exec dir="${project.build.directory}/python3" executable="virtualenv"
                                               failonerror="true">
@@ -349,7 +325,7 @@ limitations under the License.
                                         </exec>
                                         <exec dir="${project.build.directory}/python3" executable="env/bin/pip"
                                               failonerror="true">
-                                            <arg line="install wheel radish-bdd PyHamcrest"/>
+                                            <arg line="install wheel radish-bdd PyHamcrest aenum"/>
                                         </exec>
                                         <exec dir="${project.build.directory}/python-packaged" executable="virtualenv"
                                               failonerror="true">
@@ -359,9 +335,6 @@ limitations under the License.
                                               failonerror="true">
                                             <arg line="install wheel"/>
                                         </exec>
-                                        <copy todir="${project.build.directory}/jython">
-                                            <fileset dir="src/main/jython"/>
-                                        </copy>
                                     </tasks>
                                 </configuration>
                             </execution>
@@ -376,6 +349,7 @@ limitations under the License.
                                         <exec executable="env/bin/python" dir="${project.build.directory}/python2"
                                               failonerror="true">
                                             <env key="PYTHONPATH" value=""/>
+                                            <!-- oddly the "build-lib" needs to be in place or else docs won't generate -->
                                             <arg line="setup.py build --build-lib ${project.build.outputDirectory}/Lib"/>
                                         </exec>
                                     </target>


[21/39] tinkerpop git commit: Include skipped tests

Posted by dk...@apache.org.
Include skipped tests


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

Branch: refs/heads/TINKERPOP-1447
Commit: 7e9d527f3ea0536736bf968e6856d017b13d7566
Parents: af6e336
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Thu Nov 30 10:19:20 2017 +0100
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Thu Nov 30 10:19:20 2017 +0100

----------------------------------------------------------------------
 .../Gherkin/GherkinTestRunner.cs                  | 18 +-----------------
 .../Gherkin/IgnoreException.cs                    | 11 +----------
 2 files changed, 2 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7e9d527f/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs
index dd5fbca..3610199 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs
@@ -38,23 +38,7 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
     public class GherkinTestRunner
     {
         private static readonly IDictionary<string, IgnoreReason> IgnoredScenarios =
-            new Dictionary<string, IgnoreReason>
-            {
-                { "g_V_matchXa_knows_b__b_created_cX", IgnoreReason.MapCoersionIssue},
-                { "g_V_valueMap_matchXa_selectXnameX_bX", IgnoreReason.MapCoersionIssue},
-                { "g_V_matchXa_out_bX", IgnoreReason.MapCoersionIssue},
-                { "g_V_hasLabelXsongX_group_byXnameX_byXproperties_groupCount_byXlabelXX",
-                    IgnoreReason.MapCoersionIssue},
-                { "g_V_hasLabelXsongX_groupXaX_byXnameX_byXproperties_groupCount_byXlabelXX_out_capXaX",
-                    IgnoreReason.MapCoersionIssue},
-                { "g_V_outXcreatedX_unionXasXprojectX_inXcreatedX_hasXname_markoX_selectXprojectX__asXprojectX_inXcreatedX_inXknowsX_hasXname_markoX_selectXprojectXX_groupCount_byXnameX",
-                    IgnoreReason.MapCoersionIssue},
-                { "g_V_outXcreatedX_name_groupCount", IgnoreReason.MapCoersionIssue},
-                { "g_V_outXcreatedX_groupCount_byXnameX", IgnoreReason.MapCoersionIssue},
-                { "g_V_chooseXlabel_is_person__unionX__out_lang__out_nameX__in_labelX_groupCount", IgnoreReason
-                .MapCoersionIssue},
-                { "g_V_coalesceXoutXlikesX_outXknowsX_inXcreatedXX_groupCount_byXnameX", IgnoreReason.MapCoersionIssue}
-            };
+            new Dictionary<string, IgnoreReason>();
         
         private static class Keywords
         {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7e9d527f/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/IgnoreException.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/IgnoreException.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/IgnoreException.cs
index a19d856..ae236c7 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/IgnoreException.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/IgnoreException.cs
@@ -43,13 +43,6 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
                 case IgnoreReason.LambdaNotSupported:
                     reasonSuffix = " because lambdas are not supported in Gremlin.NET";
                     break;
-                case IgnoreReason.MapCoersionIssue:
-                    reasonSuffix = " because there is conversion issue for IDictionary<K, V> instaces in" +
-                                   " Gremlin.NET (TINKERPOP-1837)";
-                    break;
-                case IgnoreReason.ScenarioDesignMapNumbers:
-                    reasonSuffix = " because the expected result contains lenient numeric numbers";
-                    break;
             }
             return $"Scenario ignored" + reasonSuffix;
         }
@@ -57,8 +50,6 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
     
     public enum IgnoreReason
     {
-        LambdaNotSupported,
-        ScenarioDesignMapNumbers,
-        MapCoersionIssue
+        LambdaNotSupported
     }
 }
\ No newline at end of file


[02/39] tinkerpop git commit: Traversal parser for tests

Posted by dk...@apache.org.
Traversal parser for tests


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

Branch: refs/heads/TINKERPOP-1447
Commit: 6d8ff7d7a4151948696a08eecdd73f334b464f7f
Parents: cee6859
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Thu Oct 26 13:06:04 2017 +0200
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Thu Nov 30 10:00:07 2017 +0100

----------------------------------------------------------------------
 .../Gherkin/CommonSteps.cs                      |  13 +-
 .../Gherkin/GherkinTestRunner.cs                |  45 +++-
 .../TraversalEvaluation/ITokenParameter.cs      |  30 +++
 .../TraversalEvaluation/NumericParameter.cs     |  68 +++++
 .../StaticTraversalParameter.cs                 |  57 ++++
 .../TraversalEvaluation/StringParameter.cs      |  69 +++++
 .../Gherkin/TraversalEvaluation/Token.cs        |  76 ++++++
 .../TraversalEvaluationTests.cs                 |  79 ++++++
 .../TraversalEvaluation/TraversalParser.cs      | 261 +++++++++++++++++++
 .../TraversalPredicateParameter.cs              |  60 +++++
 .../TraversalTokenParameter.cs                  |  60 +++++
 .../Gherkin/TraversalTranslations.cs            | 102 --------
 12 files changed, 810 insertions(+), 110 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6d8ff7d7/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
index 50ea9b8..16aef9d 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
@@ -29,6 +29,7 @@ using System.Net.Http.Headers;
 using System.Runtime.CompilerServices;
 using Gherkin.Ast;
 using Gremlin.Net.IntegrationTest.Gherkin.Attributes;
+using Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation;
 using Gremlin.Net.Process.Traversal;
 using Gremlin.Net.Structure;
 using Newtonsoft.Json;
@@ -67,6 +68,16 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
             _result = enumerable.Cast<object>().ToArray();
         }
 
+        [When("iterated next")]
+        public void IterateNext()
+        {
+            if (!(_traversal is ITraversal))
+            {
+                throw new InvalidOperationException("Traversal should be set before iterating");
+            }
+            _result = _traversal.Next();
+        }
+
         [Given("the traversal of")]
         public void TranslateTraversal(string traversalText)
         {
@@ -74,7 +85,7 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
             {
                 throw new InvalidOperationException("g should be a traversal source");
             }
-            _traversal = TraversalTranslations.GetTraversal(traversalText, _g);
+            _traversal = TraversalParser.GetTraversal(traversalText, _g);
         }
 
         [Then("the result should be (\\w+)")]

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6d8ff7d7/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs
index e1df3a8..7523b0b 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs
@@ -24,6 +24,7 @@
 using System;
 using System.Collections;
 using System.Collections.Generic;
+using System.IO;
 using System.Linq;
 using System.Reflection;
 using System.Text.RegularExpressions;
@@ -146,8 +147,7 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
                     WriteOutput($"  Scenario: {resultScenario.Key.Name}");
                     foreach (var step in resultScenario.Key.Steps)
                     {
-                        Exception failure;
-                        resultScenario.Value.TryGetValue(step, out failure);
+                        resultScenario.Value.TryGetValue(step, out var failure);
                         if (failure == null)
                         {
                             WriteOutput($"    {step.Keyword} {step.Text}");
@@ -295,11 +295,42 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
 
         private IEnumerable<Feature> GetFeatures()
         {
-            // TODO: go through all the .feature files
-            const string gherkinFile = "/Users/jorge/workspace/temp/count.feature";
-            var parser = new Parser();
-            var doc = parser.Parse(gherkinFile);
-            yield return doc.Feature;
+            var rootPath = GetRootPath();
+            var path = Path.Combine(rootPath, "gremlin-test", "features");
+            WriteOutput(path);
+            WriteOutput("------");
+
+            var files = new [] {"/Users/jorge/workspace/temp/count.feature"};
+            //var files = Directory.GetFiles(path, "*.feature", SearchOption.AllDirectories);
+            foreach (var gherkinFile in files)
+            {
+                var parser = new Parser();
+                WriteOutput("Parsing " + gherkinFile);
+                var doc = parser.Parse(gherkinFile);
+                yield return doc.Feature;   
+            }
+        }
+
+        private string GetRootPath()
+        {
+            var codeBaseUrl = new Uri(GetType().GetTypeInfo().Assembly.CodeBase);
+            var codeBasePath = Uri.UnescapeDataString(codeBaseUrl.AbsolutePath);
+            DirectoryInfo rootDir = null;
+            for (var dir = Directory.GetParent(Path.GetDirectoryName(codeBasePath));
+                dir.Parent != null;
+                dir = dir.Parent)
+            {
+                if (dir.Name == "gremlin-dotnet" && dir.Parent?.Name == "tinkerpop")
+                {
+                    rootDir = dir.Parent;
+                    break;
+                }   
+            }
+            if (rootDir == null)
+            {
+                throw new FileNotFoundException("tinkerpop root not found in path");
+            }
+            return rootDir.FullName;
         }
 
         private void PrintGherkin()

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6d8ff7d7/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ITokenParameter.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ITokenParameter.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ITokenParameter.cs
new file mode 100644
index 0000000..1c940db
--- /dev/null
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ITokenParameter.cs
@@ -0,0 +1,30 @@
+#region License
+
+/*
+ * 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.
+ */
+
+#endregion
+
+namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
+{
+    public interface ITokenParameter
+    {
+        
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6d8ff7d7/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/NumericParameter.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/NumericParameter.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/NumericParameter.cs
new file mode 100644
index 0000000..9effc17
--- /dev/null
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/NumericParameter.cs
@@ -0,0 +1,68 @@
+#region License
+
+/*
+ * 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.
+ */
+
+#endregion
+
+using System;
+
+namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
+{
+    public class NumericParameter<T> : ITokenParameter, IEquatable<NumericParameter<T>> where T : struct
+    {
+        public bool Equals(NumericParameter<T> other)
+        {
+            return Value.Equals(other.Value);
+        }
+
+        public override bool Equals(object obj)
+        {
+            if (ReferenceEquals(null, obj)) return false;
+            if (ReferenceEquals(this, obj)) return true;
+            if (obj.GetType() != GetType()) return false;
+            return Equals((NumericParameter<T>) obj);
+        }
+
+        public override int GetHashCode()
+        {
+            return Value.GetHashCode();
+        }
+
+        public T Value { get; }
+        
+        public NumericParameter(T value)
+        {
+            Value = value;
+        }
+
+        public override string ToString()
+        {
+            return $"NumericParameter<{typeof(T).Name}>({Value})";
+        }
+    }
+
+    internal static class NumericParameter
+    {
+        public static NumericParameter<TType> Create<TType>(TType value) where TType : struct
+        {
+            return new NumericParameter<TType>(value);
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6d8ff7d7/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/StaticTraversalParameter.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/StaticTraversalParameter.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/StaticTraversalParameter.cs
new file mode 100644
index 0000000..b054cbc
--- /dev/null
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/StaticTraversalParameter.cs
@@ -0,0 +1,57 @@
+#region License
+
+/*
+ * 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.
+ */
+
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
+{
+    internal class StaticTraversalParameter : ITokenParameter, IEquatable<StaticTraversalParameter>
+    {
+        public bool Equals(StaticTraversalParameter other)
+        {
+            return Parts.SequenceEqual(other.Parts);
+        }
+
+        public override bool Equals(object obj)
+        {
+            if (ReferenceEquals(null, obj)) return false;
+            if (ReferenceEquals(this, obj)) return true;
+            if (obj.GetType() != GetType()) return false;
+            return Equals((StaticTraversalParameter) obj);
+        }
+
+        public override int GetHashCode()
+        {
+            return Parts != null ? Parts.GetHashCode() : 0;
+        }
+
+        public IList<Token> Parts { get; }
+        
+        public StaticTraversalParameter(IList<Token> parts)
+        {
+            Parts = parts;
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6d8ff7d7/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/StringParameter.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/StringParameter.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/StringParameter.cs
new file mode 100644
index 0000000..ad182b5
--- /dev/null
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/StringParameter.cs
@@ -0,0 +1,69 @@
+#region License
+
+/*
+ * 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.
+ */
+
+#endregion
+
+using System;
+
+namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
+{
+    internal class StringParameter : ITokenParameter, IEquatable<StringParameter>
+    {
+        public bool Equals(StringParameter other)
+        {
+            return string.Equals(Value, other.Value);
+        }
+
+        public override bool Equals(object obj)
+        {
+            if (ReferenceEquals(null, obj)) return false;
+            if (ReferenceEquals(this, obj)) return true;
+            if (obj.GetType() != GetType()) return false;
+            return Equals((StringParameter) obj);
+        }
+
+        public override int GetHashCode()
+        {
+            return (Value != null ? Value.GetHashCode() : 0);
+        }
+
+        public string Value { get; }
+
+        public StringParameter(string value)
+        {
+            Value = value;
+        }
+
+        public static StringParameter Parse(string text, ref int i)
+        {
+            i++;
+            var endIndex = text.IndexOf('"', i);
+            var result = new StringParameter(text.Substring(i, endIndex - i));
+            i = endIndex;
+            return result;
+        }
+
+        public override string ToString()
+        {
+            return $"{GetType().Name}({Value})";
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6d8ff7d7/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/Token.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/Token.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/Token.cs
new file mode 100644
index 0000000..633e2b5
--- /dev/null
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/Token.cs
@@ -0,0 +1,76 @@
+#region License
+
+/*
+ * 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.
+ */
+
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
+{
+    internal class Token : IEquatable<Token>
+    {
+        private static readonly IList<ITokenParameter> EmptyParameters = new ITokenParameter[0];
+        
+        public bool Equals(Token other)
+        {
+            if (!string.Equals(Name, other.Name))
+            {
+                return false;
+            }
+            return  (Parameters ?? EmptyParameters).SequenceEqual(other.Parameters ?? EmptyParameters);
+        }
+
+        public override bool Equals(object obj)
+        {
+            if (ReferenceEquals(null, obj)) return false;
+            if (ReferenceEquals(this, obj)) return true;
+            if (obj.GetType() != GetType()) return false;
+            return Equals((Token) obj);
+        }
+
+        public override int GetHashCode()
+        {
+            unchecked
+            {
+                return ((Name != null ? Name.GetHashCode() : 0) * 397) ^
+                       (Parameters != null ? Parameters.GetHashCode() : 0);
+            }
+        }
+
+        public string Name { get; }
+
+        public ICollection<ITokenParameter> Parameters { get; }
+            
+        public Token(string name, ICollection<ITokenParameter> parameters = null)
+        {
+            Name = name;
+            Parameters = parameters;
+        }
+            
+        public Token(string name, ITokenParameter parameter)
+        {
+            Name = name;
+            Parameters = new[] {parameter};
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6d8ff7d7/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEvaluationTests.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEvaluationTests.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEvaluationTests.cs
new file mode 100644
index 0000000..ea65cd2
--- /dev/null
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEvaluationTests.cs
@@ -0,0 +1,79 @@
+#region License
+
+/*
+ * 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.
+ */
+
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using Xunit;
+using Xunit.Abstractions;
+using Xunit.Sdk;
+
+namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
+{
+    public class TraversalEvaluationTests
+    {
+        private readonly ITestOutputHelper _output;
+
+        public TraversalEvaluationTests(ITestOutputHelper output)
+        {
+            _output = output;
+        }
+        
+        [Fact]
+        public void Traversal_Parser_Should_Parse_Parts()
+        {
+            var items = new[]
+            {
+                Tuple.Create("g.V().count()", new[] {new Token("count")}),
+                Tuple.Create("g.V().values(\"name\")",
+                    new[] {new Token("values", new StringParameter("name"))}),
+                Tuple.Create("g.V().constant(123l)", 
+                    new[] {new Token("constant", new[] {NumericParameter.Create(123L)})}),
+                Tuple.Create("g.V().has(\"no\").count()",
+                    new[] {new Token("has", new StringParameter("no")), new Token("count")}),
+                Tuple.Create("g.V().has(\"lang\", \"java\")",
+                    new[] {new Token("has", new[] {new StringParameter("lang"), new StringParameter("java")})}),
+                Tuple.Create("g.V().where(__.in(\"knows\"))",
+                    new[] {new Token("where", new[] {new StaticTraversalParameter(
+                        new[] {new Token("__"), new Token("in", new StringParameter("knows"))})})}),
+                Tuple.Create("g.V().has(\"age\", P.gt(27)", 
+                    new[] {new Token("has", new ITokenParameter[] { new StringParameter("age"),
+                        new TraversalPredicateParameter(
+                            new[] { new Token("P"), new Token("gt", NumericParameter.Create(27)) }) })})
+            };
+            foreach (var item in items)
+            {
+                var parts = TraversalParser.ParseParts(item.Item1);
+                _output.WriteLine("Parsing " + item.Item1);
+                if (parts[parts.Count-1].Parameters != null)
+                {
+                    _output.WriteLine("{0}", parts[parts.Count-1].Parameters.Count);
+                    _output.WriteLine("Values: " +
+                                      string.Join(", ", parts[parts.Count - 1].Parameters.Select(p => p.ToString())));
+                }
+                Assert.Equal(new[] {new Token("g"), new Token("V")}.Concat(item.Item2), parts);
+            }
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6d8ff7d7/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
new file mode 100644
index 0000000..0ac97ff
--- /dev/null
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
@@ -0,0 +1,261 @@
+#region License
+
+/*
+ * 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.
+ */
+
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using System.Text.RegularExpressions;
+using Gremlin.Net.Process.Traversal;
+
+namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
+{
+    public class TraversalParser
+    {
+        private static readonly IDictionary<string, Func<GraphTraversalSource, ITraversal>> FixedTranslations = 
+            new Dictionary<string, Func<GraphTraversalSource, ITraversal>>
+            {
+                { "g.V().has(\"no\").count()", g => g.V().Has("no").Count() },
+                { "g.V().fold().count(Scope.local)", g => g.V().Fold<object>().Count(Scope.Local)}
+            };
+        
+        private static readonly Regex RegexInteger = new Regex(@"\d+", RegexOptions.Compiled);
+        private static readonly Regex RegexDouble = new Regex(@"\d+\.\d+", RegexOptions.Compiled);
+        private static readonly Regex RegexFloat =
+            new Regex(@"\d+\.\d+f", RegexOptions.Compiled | RegexOptions.IgnoreCase);
+        private static readonly Regex RegexLong = new Regex(@"\d+l", RegexOptions.Compiled | RegexOptions.IgnoreCase);
+
+        internal static ITraversal GetTraversal(string traversalText, GraphTraversalSource g)
+        {
+            Func<GraphTraversalSource, ITraversal> traversalBuilder;
+            if (!FixedTranslations.TryGetValue(traversalText, out traversalBuilder))
+            {
+                return BuildFromMethods(traversalText, g);
+            }
+            return traversalBuilder(g);
+        }
+
+        private static ITraversal BuildFromMethods(string traversalText, GraphTraversalSource g)
+        {
+            var parts = traversalText.Split('.');
+            if (parts[0] != "g")
+            {
+                throw BuildException(traversalText);
+            }
+            ITraversal traversal;
+            switch (parts[1])
+            {
+                case "V()":
+                    traversal = g.V();
+                    break;
+                case "E()":
+                    traversal = g.E();
+                    break;
+                default:
+                    throw BuildException(traversalText);
+            }
+            for (var i = 2; i < parts.Length; i++)
+            {
+                var name = GetCsharpName(parts[i], traversalText);
+                var method = traversal.GetType().GetMethod(name);
+                if (method == null)
+                {
+                    throw new InvalidOperationException($"Traversal method '{parts[i]}' not found for testing");
+                }
+                if (method.IsGenericMethod)
+                {
+                    throw new InvalidOperationException(
+                        $"Can not build traversal to test as '{name}()' method is generic");
+                }
+                traversal = (ITraversal) method.Invoke(traversal, new object[] { new object[0]});
+            }
+            return traversal;
+        }
+
+        private static string GetCsharpName(string part, string traversalText)
+        {
+            if (!part.EndsWith("()"))
+            {
+                throw BuildException(traversalText);
+            }
+            // Transform to PascalCasing and remove the parenthesis
+            return char.ToUpper(part[0]) + part.Substring(1, part.Length - 3);
+        }
+
+        private static Exception BuildException(string traversalText)
+        {
+            return new InvalidOperationException($"Can not build a traversal to test from '{traversalText}'");
+        }
+
+        internal static IList<Token> ParseParts(string traversalText)
+        {
+            var index = 0;
+            return ParseTokens(traversalText, ref index);
+        }
+
+        private static IList<Token> ParseTokens(string text, ref int i)
+        {
+            var result = new List<Token>();
+            var startIndex = i;
+            var parsing = ParsingPart.Name;
+            string name = null;
+            var parameters = new List<ITokenParameter>();
+            while (i < text.Length)
+            {
+                switch (text[i])
+                {
+                    case '.':
+                        if (name == null)
+                        {
+                            name = text.Substring(startIndex, i - startIndex);
+                        }
+                        startIndex = i + 1;
+                        result.Add(new Token(name, parameters));
+                        name = null;
+                        parameters = new List<ITokenParameter>();
+                        parsing = ParsingPart.Name;
+                        break;
+                    case '(':
+                    {
+                        name = text.Substring(startIndex, i - startIndex);
+                        i++;
+                        parsing = ParsingPart.StartParameters;
+                        var param = ParseParameter(text, ref i);
+                        if (param == null)
+                        {
+                            parsing = ParsingPart.EndParameters;
+                        }
+                        else
+                        {
+                            parameters.Add(param);
+                        }
+                        break;
+                    }
+                    case ',' when text[i+1] != ' ':
+                    case ' ' when text[i+1] != ' ':
+                    {
+                        if (parsing != ParsingPart.StartParameters)
+                        {
+                            throw new InvalidOperationException(
+                                "Can not parse space or comma chars outside parameters");
+                        }
+                        i++;
+                        var param = ParseParameter(text, ref i);
+                        if (param == null)
+                        {
+                            parsing = ParsingPart.EndParameters;
+                        }
+                        else
+                        {
+                            parameters.Add(param);
+                        }
+                        break;
+                    }
+                    case ')' when parsing != ParsingPart.StartParameters:
+                        // The traversal already ended
+                        i--;
+                        if (name != null)
+                        {
+                            result.Add(new Token(name, parameters));
+                        }
+                        return result;
+                    case ')':
+                        parsing = ParsingPart.EndParameters;
+                        break;
+                }
+                i++;
+            }
+            if (name != null)
+            {
+                result.Add(new Token(name, parameters));
+            }
+            return result;
+        }
+
+        private static ITokenParameter ParseParameter(string text, ref int i)
+        {
+            var firstChar = text[i];
+            if (firstChar == ')')
+            {
+                return null;
+            }
+            if (firstChar == '"')
+            {
+                return StringParameter.Parse(text, ref i);
+            }
+            if (char.IsDigit(firstChar))
+            {
+                return ParseNumber(text, ref i);
+            }
+            if (text.Substring(i, 3).StartsWith("__."))
+            {
+                return new StaticTraversalParameter(ParseTokens(text, ref i));
+            }
+            if (text.Substring(i, 2).StartsWith("T."))
+            {
+                return new TraversalTokenParameter(ParseTokens(text, ref i));
+            }
+            if (text.Substring(i, 2).StartsWith("P."))
+            {
+                return new TraversalPredicateParameter(ParseTokens(text, ref i));
+            }
+            return null;
+        }
+        
+        private static ITokenParameter ParseNumber(string text, ref int i)
+        {
+            var match = RegexLong.Match(text.Substring(i));
+            if (match.Success)
+            {
+                i += match.Value.Length - 1;
+                return NumericParameter.Create(Convert.ToInt64(match.Value.Substring(0, match.Value.Length-1)));
+            }
+            match = RegexFloat.Match(text.Substring(i));
+            if (match.Success)
+            {
+                i += match.Value.Length - 1;
+                return NumericParameter.Create(Convert.ToSingle(match.Value.Substring(0, match.Value.Length-1)));
+            }
+            match = RegexDouble.Match(text.Substring(i));
+            if (match.Success)
+            {
+                i += match.Value.Length;
+                return NumericParameter.Create(Convert.ToSingle(match.Value));
+            }
+            match = RegexInteger.Match(text.Substring(i));
+            if (!match.Success)
+            {
+                throw new InvalidOperationException(
+                    $"Could not parse numeric value from the beginning of {text.Substring(i)}");
+            }
+            i += match.Value.Length;
+            return NumericParameter.Create(Convert.ToInt32(match.Value));
+        }
+        
+        private enum ParsingPart
+        {
+            Name,
+            StartParameters,
+            EndParameters
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6d8ff7d7/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalPredicateParameter.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalPredicateParameter.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalPredicateParameter.cs
new file mode 100644
index 0000000..d9bf061
--- /dev/null
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalPredicateParameter.cs
@@ -0,0 +1,60 @@
+#region License
+
+/*
+ * 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.
+ */
+
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
+{
+    /// <summary>
+    /// Represents a parameter for a traversal predicate (ie: P.gt())
+    /// </summary>
+    internal class TraversalPredicateParameter : ITokenParameter, IEquatable<TraversalPredicateParameter>
+    {
+        public bool Equals(TraversalPredicateParameter other)
+        {
+            return Parts.SequenceEqual(other.Parts);
+        }
+
+        public override bool Equals(object obj)
+        {
+            if (ReferenceEquals(null, obj)) return false;
+            if (ReferenceEquals(this, obj)) return true;
+            if (obj.GetType() != GetType()) return false;
+            return Equals((TraversalPredicateParameter) obj);
+        }
+
+        public override int GetHashCode()
+        {
+            return Parts != null ? Parts.GetHashCode() : 0;
+        }
+
+        public IList<Token> Parts { get; }
+        
+        public TraversalPredicateParameter(IList<Token> parts)
+        {
+            Parts = parts;
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6d8ff7d7/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalTokenParameter.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalTokenParameter.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalTokenParameter.cs
new file mode 100644
index 0000000..5a5e8c1
--- /dev/null
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalTokenParameter.cs
@@ -0,0 +1,60 @@
+#region License
+
+/*
+ * 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.
+ */
+
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
+{
+    /// <summary>
+    /// Represents a parameter for a traversal token (ie: T.label)
+    /// </summary>
+    internal class TraversalTokenParameter : ITokenParameter, IEquatable<TraversalTokenParameter>
+    {
+        public bool Equals(TraversalTokenParameter other)
+        {
+            return Parts.SequenceEqual(other.Parts);
+        }
+
+        public override bool Equals(object obj)
+        {
+            if (ReferenceEquals(null, obj)) return false;
+            if (ReferenceEquals(this, obj)) return true;
+            if (obj.GetType() != GetType()) return false;
+            return Equals((TraversalTokenParameter) obj);
+        }
+
+        public override int GetHashCode()
+        {
+            return Parts != null ? Parts.GetHashCode() : 0;
+        }
+
+        public IList<Token> Parts { get; }
+        
+        public TraversalTokenParameter(IList<Token> parts)
+        {
+            Parts = parts;
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6d8ff7d7/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalTranslations.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalTranslations.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalTranslations.cs
deleted file mode 100644
index af02b8c..0000000
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalTranslations.cs
+++ /dev/null
@@ -1,102 +0,0 @@
-#region License
-
-/*
- * 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.
- */
-
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.Reflection;
-using Gremlin.Net.Process.Traversal;
-
-namespace Gremlin.Net.IntegrationTest.Gherkin
-{
-    internal class TraversalTranslations
-    {
-        private static readonly IDictionary<string, Func<GraphTraversalSource, ITraversal>> FixedTranslations = 
-            new Dictionary<string, Func<GraphTraversalSource, ITraversal>>
-            {
-                { "g.V().has(\"no\").count()", g => g.V().Has("no").Count() },
-                { "g.V().fold().count(Scope.local)", g => g.V().Fold<object>().Count(Scope.Local)}
-            };
-
-        internal static ITraversal GetTraversal(string traversalText, GraphTraversalSource g)
-        {
-            Func<GraphTraversalSource, ITraversal> traversalBuilder;
-            if (!FixedTranslations.TryGetValue(traversalText, out traversalBuilder))
-            {
-                return BuildFromMethods(traversalText, g);
-            }
-            return traversalBuilder(g);
-        }
-
-        private static ITraversal BuildFromMethods(string traversalText, GraphTraversalSource g)
-        {
-            var parts = traversalText.Split('.');
-            if (parts[0] != "g")
-            {
-                throw BuildException(traversalText);
-            }
-            ITraversal traversal;
-            switch (parts[1])
-            {
-                case "V()":
-                    traversal = g.V();
-                    break;
-                case "E()":
-                    traversal = g.E();
-                    break;
-                default:
-                    throw BuildException(traversalText);
-            }
-            for (var i = 2; i < parts.Length; i++)
-            {
-                var name = GetCsharpName(parts[i], traversalText);
-                var method = traversal.GetType().GetMethod(name);
-                if (method == null)
-                {
-                    throw new InvalidOperationException($"Traversal method '{parts[i]}' not found for testing");
-                }
-                if (method.IsGenericMethod)
-                {
-                    throw new InvalidOperationException(
-                        $"Can not build traversal to test as '{name}()' method is generic");
-                }
-                traversal = (ITraversal) method.Invoke(traversal, new object[] { new object[0]});
-            }
-            return traversal;
-        }
-
-        private static string GetCsharpName(string part, string traversalText)
-        {
-            if (!part.EndsWith("()"))
-            {
-                throw BuildException(traversalText);
-            }
-            // Transform to PascalCasing and remove the parenthesis
-            return char.ToUpper(part[0]) + part.Substring(1, part.Length - 3);
-        }
-
-        private static Exception BuildException(string traversalText)
-        {
-            return new InvalidOperationException($"Can not build a traversal to test from '{traversalText}'");
-        }
-    }
-}
\ No newline at end of file


[24/39] tinkerpop git commit: TINKERPOP-1846 Fixed bug in LambdaRestrictionStrategy

Posted by dk...@apache.org.
TINKERPOP-1846 Fixed bug in LambdaRestrictionStrategy

Traversals using Lambda scripts were not triggering this strategy. The strategy expected the word "lambda" in the toString() of the step that held it. Lambda objects weren't including that word.


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

Branch: refs/heads/TINKERPOP-1447
Commit: f5f4a046f211851e901d303c6593975314171e55
Parents: 7cde98c
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Nov 30 09:26:51 2017 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Nov 30 09:26:51 2017 -0500

----------------------------------------------------------------------
 CHANGELOG.asciidoc                                                | 1 +
 .../java/org/apache/tinkerpop/gremlin/util/function/Lambda.java   | 2 +-
 .../strategy/verification/LambdaRestrictionStrategyTest.java      | 3 +++
 3 files changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f5f4a046/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 8e29593..8a9f1fa 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,6 +26,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 * Added core GraphSON classes for Gremlin-Python: `UUID`, `Date`, and `Timestamp`.
 * Provided a method to configure detachment options with `EventStrategy`.
 * Fixed a race condition in `TinkerIndex`.
+* Fixed bug in `LambdaRestrictionStrategy` where traversals using `Lambda` scripts weren't causing the strategy to trigger.
 * Improved error messaging for bytecode deserialization errors in Gremlin Server.
 * Fixed an `ArrayOutOfBoundsException` in `hasId()` for the rare situation when the provided collection is empty.
 * Bump to Netty 4.0.53

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f5f4a046/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/function/Lambda.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/function/Lambda.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/function/Lambda.java
index a259eb3..1031156 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/function/Lambda.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/function/Lambda.java
@@ -66,7 +66,7 @@ public interface Lambda extends Serializable {
 
         @Override
         public String toString() {
-            return this.lambdaSource;
+            return "lambda[" + this.lambdaSource + "]";
         }
 
         @Override

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f5f4a046/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/LambdaRestrictionStrategyTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/LambdaRestrictionStrategyTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/LambdaRestrictionStrategyTest.java
index 767211c..b79d2c9 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/LambdaRestrictionStrategyTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/LambdaRestrictionStrategyTest.java
@@ -29,6 +29,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversalStrat
 import org.apache.tinkerpop.gremlin.structure.Column;
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.T;
+import org.apache.tinkerpop.gremlin.util.function.Lambda;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
@@ -50,6 +51,8 @@ public class LambdaRestrictionStrategyTest {
     @Parameterized.Parameters(name = "{0}")
     public static Iterable<Object[]> data() {
         return Arrays.asList(new Object[][]{
+                {"map(Lambda.function('true')}", __.map(Lambda.function("true")), false},
+                {"filter(Lambda.predicate('true')}", __.filter(Lambda.predicate("true")), false},
                 {"filter(x->true)", __.filter(x -> true), false},
                 {"map(Traverser::get)", __.map(Traverser::get), false},
                 {"sideEffect(x -> {int i = 1+1;})", __.sideEffect(x -> {


[19/39] tinkerpop git commit: Workaround gherkin parser quote issue

Posted by dk...@apache.org.
Workaround gherkin parser quote issue


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

Branch: refs/heads/TINKERPOP-1447
Commit: 7c9c30306bdca3bdc021b25a66c72e61b9ddf873
Parents: 9672dd0
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Wed Nov 22 11:45:54 2017 +0100
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Thu Nov 30 10:01:21 2017 +0100

----------------------------------------------------------------------
 .../test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs        | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7c9c3030/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
index fda44b8..0011eda 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
@@ -296,6 +296,8 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
 
         private static object ParseValue(string stringValue, string graphName)
         {
+            // Parser issue: quotes are not normalized
+            stringValue = stringValue.Replace("\\\"", "\"");
             Func<string, string, object> parser = null;
             string extractedValue = null;
             foreach (var kv in Parsers)


[25/39] tinkerpop git commit: Gremlin.Net: fix generation of Constant() and Fold() steps

Posted by dk...@apache.org.
Gremlin.Net: fix generation of Constant() and Fold() steps


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

Branch: refs/heads/TINKERPOP-1447
Commit: aa14928245ed98565dcd4e7f6d21b1a573d76a56
Parents: bc515bb
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Fri Dec 1 12:52:15 2017 +0100
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Fri Dec 1 12:54:46 2017 +0100

----------------------------------------------------------------------
 .travis.yml                                     |  2 +-
 gremlin-dotnet/glv/generate.groovy              | 58 +++++++++++++-------
 .../Process/Traversal/GraphTraversal.cs         |  4 +-
 .../src/Gremlin.Net/Process/Traversal/__.cs     |  4 +-
 4 files changed, 44 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/aa149282/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index b626b17..9b7029c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -15,4 +15,4 @@ before_install:
 jobs:
   include:
     - script: "mvn clean install -Dci"
-    - script: "touch gremlin-dotnet/src/.glv && touch gremlin-dotnet/test/.glv && mvn clean install -pl :gremlin-dotnet-tests -P gremlin-dotnet -DskipIntegrationTests=false"
\ No newline at end of file
+    - script: "touch gremlin-dotnet/src/.glv && touch gremlin-dotnet/test/.glv && mvn clean install -pl :gremlin-dotnet,:gremlin-dotnet-tests -P gremlin-dotnet -DskipIntegrationTests=false"
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/aa149282/gremlin-dotnet/glv/generate.groovy
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/glv/generate.groovy b/gremlin-dotnet/glv/generate.groovy
index ad22116..52ca165 100644
--- a/gremlin-dotnet/glv/generate.groovy
+++ b/gremlin-dotnet/glv/generate.groovy
@@ -25,6 +25,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.P
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__
 import org.apache.tinkerpop.gremlin.structure.Direction
 import java.lang.reflect.Modifier
+import java.lang.reflect.TypeVariable
 
 def toCSharpTypeMap = ["Long": "long",
                        "Integer": "int",
@@ -115,8 +116,17 @@ def getJavaParameterTypeNames = { method ->
             } 
 }
 
-def toCSharpParamString = { param ->
-    csharpParamTypeName = toCSharpType(param.type.simpleName)
+def toCSharpParamString = { param, genTypeName ->
+    String csharpParamTypeName = genTypeName;
+    if (csharpParamTypeName == null){
+        csharpParamTypeName = toCSharpType(param.type.simpleName)
+    }
+    else if (csharpParamTypeName == "M") {
+        csharpParamTypeName = "object";
+    }
+    else if (csharpParamTypeName == "A" || csharpParamTypeName == "B") {
+        csharpParamTypeName = "E2";
+    }
     "${csharpParamTypeName} ${param.name}"
     }
 
@@ -131,22 +141,32 @@ def getCSharpParamTypeString = { method ->
             }.join(",")
 }
 
-def getCSharpParamString = { method ->
+def getCSharpParamString = { method, useGenericParams ->
     def parameters = method.parameters;
     if (parameters.length == 0)
-        return ""        
+        return ""
+
+    def genericTypes = method.getGenericParameterTypes();
     def csharpParameters = parameters.
-            init().
-            collect { param ->
-                toCSharpParamString(param)
-            };
-    def lastCSharpParam = "";
-    if (method.isVarArgs())
-        lastCSharpParam += "params ";
-    lastCSharpParam += toCSharpParamString(parameters.last())
-    csharpParameters += lastCSharpParam
-    csharpParamString = csharpParameters.join(", ")
-    csharpParamString
+            toList().indexed().
+            collect { index, param ->
+                String genTypeName = null
+                if (useGenericParams) {
+                    def genType = genericTypes[index]
+                    if (genType instanceof TypeVariable<?>) {
+                        genTypeName = ((TypeVariable<?>)genType).name
+                    }
+                }
+                toCSharpParamString(param, genTypeName)
+            }.
+            toArray();
+
+    if (method.isVarArgs()) {
+        def lastIndex = csharpParameters.length-1;
+        csharpParameters[lastIndex] = "params " + csharpParameters[lastIndex];
+    }
+
+    csharpParameters.join(", ")
 }
 
 def getParamNames = { parameters ->
@@ -209,7 +229,7 @@ def binding = ["pmethods": P.class.getMethods().
                         sort { a, b -> a.name <=> b.name ?: getJavaParamTypeString(a) <=> getJavaParamTypeString(b) }.
                         unique { a,b -> a.name <=> b.name ?: getCSharpParamTypeString(a) <=> getCSharpParamTypeString(b) }.
                         collect { javaMethod ->
-                            def parameters = getCSharpParamString(javaMethod)
+                            def parameters = getCSharpParamString(javaMethod, false)
                             def paramNames = getParamNames(javaMethod.parameters)
                             return ["methodName": javaMethod.name, "parameters":parameters, "paramNames":paramNames]
                         },
@@ -220,7 +240,7 @@ def binding = ["pmethods": P.class.getMethods().
                         unique { a,b -> a.name <=> b.name ?: getCSharpParamTypeString(a) <=> getCSharpParamTypeString(b) }.
                         collect { javaMethod ->
                             def typeArguments = javaMethod.genericReturnType.actualTypeArguments.collect{t -> ((java.lang.Class)t).simpleName}
-                            def parameters = getCSharpParamString(javaMethod)
+                            def parameters = getCSharpParamString(javaMethod, false)
                             def paramNames = getParamNames(javaMethod.parameters)
                             return ["methodName": javaMethod.name, "typeArguments": typeArguments, "parameters":parameters, "paramNames":paramNames]
                         },
@@ -235,7 +255,7 @@ def binding = ["pmethods": P.class.getMethods().
                             def t1 = toCSharpType(typeNames[0])
                             def t2 = toCSharpType(typeNames[1])
                             def tParam = getCSharpGenericTypeParam(t2)
-                            def parameters = getCSharpParamString(javaMethod)
+                            def parameters = getCSharpParamString(javaMethod, true)
                             def paramNames = getParamNames(javaMethod.parameters)
                             return ["methodName": javaMethod.name, "t1":t1, "t2":t2, "tParam":tParam, "parameters":parameters, "paramNames":paramNames]
                         },
@@ -255,7 +275,7 @@ def binding = ["pmethods": P.class.getMethods().
                                 t2 = specificTypes[0]
                                 tParam = specificTypes.size() > 1 ? "<" + specificTypes[1] + ">" : ""
                             }
-                            def parameters = getCSharpParamString(javaMethod)
+                            def parameters = getCSharpParamString(javaMethod, true)
                             def paramNames = getParamNames(javaMethod.parameters)
                             def callGenericTypeArg = hasMethodNoGenericCounterPartInGraphTraversal(javaMethod) ? "" : tParam
                             def graphTraversalT2 = getGraphTraversalT2ForT2(t2)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/aa149282/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs
index 601e381..e3eb190 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs
@@ -420,7 +420,7 @@ namespace Gremlin.Net.Process.Traversal
         /// <summary>
         ///     Adds the constant step to this <see cref="GraphTraversal{SType, EType}" />.
         /// </summary>
-        public GraphTraversal< S , E2 > Constant<E2> (object e)
+        public GraphTraversal< S , E2 > Constant<E2> (E2 e)
         {
             Bytecode.AddStep("constant", e);
             return Wrap< S , E2 >(this);
@@ -559,7 +559,7 @@ namespace Gremlin.Net.Process.Traversal
         /// <summary>
         ///     Adds the fold step to this <see cref="GraphTraversal{SType, EType}" />.
         /// </summary>
-        public GraphTraversal< S , E2 > Fold<E2> (object seed, object foldFunction)
+        public GraphTraversal< S , E2 > Fold<E2> (E2 seed, object foldFunction)
         {
             Bytecode.AddStep("fold", seed, foldFunction);
             return Wrap< S , E2 >(this);

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/aa149282/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/__.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/__.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/__.cs
index c9ced7b..1788bad 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/__.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/__.cs
@@ -289,7 +289,7 @@ namespace Gremlin.Net.Process.Traversal
         /// <summary>
         ///     Spawns a <see cref="GraphTraversal{SType, EType}" /> and adds the constant step to that traversal.
         /// </summary>
-        public static GraphTraversal<object, E2> Constant<E2>(object a)
+        public static GraphTraversal<object, E2> Constant<E2>(E2 a)
         {
             return new GraphTraversal<object, E2>().Constant<E2>(a);            
         }
@@ -413,7 +413,7 @@ namespace Gremlin.Net.Process.Traversal
         /// <summary>
         ///     Spawns a <see cref="GraphTraversal{SType, EType}" /> and adds the fold step to that traversal.
         /// </summary>
-        public static GraphTraversal<object, E2> Fold<E2>(object seed, object foldFunction)
+        public static GraphTraversal<object, E2> Fold<E2>(E2 seed, object foldFunction)
         {
             return new GraphTraversal<object, E2>().Fold<E2>(seed, foldFunction);            
         }


[34/39] tinkerpop git commit: TINKERPOP-1851 Minor fix to allow long forms of -e and -i to work

Posted by dk...@apache.org.
TINKERPOP-1851 Minor fix to allow long forms of -e and -i to work

There was some special handling of the short forms that wasn't accounted for with the long forms. Pretty simple fix. Added lots of tests to ensure the different options were covered.


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

Branch: refs/heads/TINKERPOP-1447
Commit: d217b821b30f34649b876fa1086bb6b21d364bf8
Parents: a883746
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Dec 8 15:40:13 2017 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Dec 8 15:40:13 2017 -0500

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |  1 +
 .../tinkerpop/gremlin/console/Console.groovy    |  6 +-
 .../src/test/python/tests/test_console.py       | 68 ++++++++++++++++++++
 3 files changed, 72 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d217b821/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 2f1a5c6..7de8639 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -27,6 +27,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 * Documented the recommended method for constructing DSLs with Gremlin.Net.
 * Provided a method to configure detachment options with `EventStrategy`.
 * Fixed a race condition in `TinkerIndex`.
+* Fixed bug in handling of the long forms of `-e` and `-i` (`--execute` and `--interactive` respectively) for Gremlin Console.
 * Fixed bug in `LambdaRestrictionStrategy` where traversals using `Lambda` scripts weren't causing the strategy to trigger.
 * Improved error messaging for bytecode deserialization errors in Gremlin Server.
 * Fixed an `ArrayOutOfBoundsException` in `hasId()` for the rare situation when the provided collection is empty.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d217b821/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy
index 59de0b3..5eb5039 100644
--- a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy
+++ b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy
@@ -477,7 +477,7 @@ class Console {
         if (args.length == 1 && !args[0].startsWith("-")) {
             new Console(io, [[args[0]]], true)
         } else {
-            def scriptAndArgs = parseArgs(options.e ? "-e" : "-i", args, cli)
+            def scriptAndArgs = parseArgs(options.e ? ["-e", "--execute"] : ["-i", "--interactive"], args, cli)
             new Console(io, scriptAndArgs, !options.e)
         }
     }
@@ -487,10 +487,10 @@ class Console {
      * argument list to allow for multiple {@code -e} and {@code -i} values and parses such parameters into a list
      * of lists where the inner list is a script file and its arguments.
      */
-    private static List<List<String>> parseArgs(final String option, final String[] args, final CliBuilder cli) {
+    private static List<List<String>> parseArgs(final List<String> options, final String[] args, final CliBuilder cli) {
         def parsed = []
         for (int ix = 0; ix < args.length; ix++) {
-            if (args[ix] == option) {
+            if (args[ix] in options) {
                 // increment the counter to move past the option that was found. should now be positioned on the
                 // first argument to that option
                 ix++

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d217b821/gremlin-console/src/test/python/tests/test_console.py
----------------------------------------------------------------------
diff --git a/gremlin-console/src/test/python/tests/test_console.py b/gremlin-console/src/test/python/tests/test_console.py
index 407b563..67e1a9e 100644
--- a/gremlin-console/src/test/python/tests/test_console.py
+++ b/gremlin-console/src/test/python/tests/test_console.py
@@ -41,6 +41,14 @@ class TestConsole(object):
         TestConsole._expect_prompt(child)
         TestConsole._close(child)
 
+    def test_just_dash_dash_interactive(self):
+        child = pexpect.spawn(TestConsole.gremlinsh + "--interactive x.script")
+        TestConsole._expect_gremlin_header(child)
+        TestConsole._send(child, "x")
+        child.expect("==>2\r\n")
+        TestConsole._expect_prompt(child)
+        TestConsole._close(child)
+
     def test_dash_i_with_args(self):
         child = pexpect.spawn(TestConsole.gremlinsh + "-i y.script 1 2 3")
         TestConsole._expect_gremlin_header(child)
@@ -49,6 +57,14 @@ class TestConsole(object):
         TestConsole._expect_prompt(child)
         TestConsole._close(child)
 
+    def test_dash_dash_interactive_with_args(self):
+        child = pexpect.spawn(TestConsole.gremlinsh + "--interactive y.script 1 2 3")
+        TestConsole._expect_gremlin_header(child)
+        TestConsole._send(child, "y")
+        child.expect("==>6\r\n")
+        TestConsole._expect_prompt(child)
+        TestConsole._close(child)
+
     def test_dash_i_multiple_scripts(self):
         child = pexpect.spawn(TestConsole.gremlinsh + "-i y.script 1 2 3 -i x.script -i \"z.script x -i --color -D\"")
         TestConsole._expect_gremlin_header(child)
@@ -63,16 +79,54 @@ class TestConsole(object):
         TestConsole._expect_prompt(child)
         TestConsole._close(child)
 
+    def test_dash_dash_interactive_multiple_scripts(self):
+        child = pexpect.spawn(TestConsole.gremlinsh + "--interactive y.script 1 2 3 --interactive x.script -i \"z.script x -i --color -D\"")
+        TestConsole._expect_gremlin_header(child)
+        TestConsole._send(child, "y")
+        child.expect("==>6\r\n")
+        TestConsole._expect_prompt(child)
+        TestConsole._send(child, "x")
+        child.expect("==>2\r\n")
+        TestConsole._expect_prompt(child)
+        TestConsole._send(child, "z")
+        child.expect("==>argument=\[x, -i, --color, -D\]\r\n")
+        TestConsole._expect_prompt(child)
+        TestConsole._close(child)
+
+    def test_mixed_interactive_long_short_opts_with_multiple_scripts(self):
+        child = pexpect.spawn(TestConsole.gremlinsh + "--interactive y.script 1 2 3 --interactive x.script -i \"z.script x -i --color -D\"")
+        TestConsole._expect_gremlin_header(child)
+        TestConsole._send(child, "y")
+        child.expect("==>6\r\n")
+        TestConsole._expect_prompt(child)
+        TestConsole._send(child, "x")
+        child.expect("==>2\r\n")
+        TestConsole._expect_prompt(child)
+        TestConsole._send(child, "z")
+        child.expect("==>argument=\[x, -i, --color, -D\]\r\n")
+        TestConsole._expect_prompt(child)
+        TestConsole._close(child)
+
     def test_just_dash_e(self):
         child = pexpect.spawn(TestConsole.gremlinsh + "-e x-printed.script")
         child.expect("2\r\n")
         TestConsole._close(child)
 
+    def test_just_dash_dash_execute(self):
+        child = pexpect.spawn(TestConsole.gremlinsh + "--execute x-printed.script")
+        child.expect("2\r\n")
+        TestConsole._close(child)
+
     def test_dash_e_with_args(self):
         child = pexpect.spawn(TestConsole.gremlinsh + "-e y-printed.script 1 2 3")
         child.expect("6\r\n")
         TestConsole._close(child)
 
+    def test_dash_dash_execute_with_args(self):
+        child = pexpect.spawn(TestConsole.gremlinsh + "--execute y-printed.script 1 2 3")
+        child.expect("6\r\n")
+        TestConsole._close(child)
+
     def test_dash_e_multiple_scripts(self):
         child = pexpect.spawn(TestConsole.gremlinsh + "-e y-printed.script 1 2 3 -e x-printed.script -e \"z-printed.script x -e --color -D\"")
         child.expect("6\r\n")
@@ -80,6 +134,20 @@ class TestConsole(object):
         child.expect("argument=\[x, -e, --color, -D\]\r\n")
         TestConsole._close(child)
 
+    def test_dash_dash_execute_multiple_scripts(self):
+        child = pexpect.spawn(TestConsole.gremlinsh + "--execute y-printed.script 1 2 3 --execute x-printed.script --execute \"z-printed.script x -e --color -D\"")
+        child.expect("6\r\n")
+        child.expect("2\r\n")
+        child.expect("argument=\[x, -e, --color, -D\]\r\n")
+        TestConsole._close(child)
+
+    def test_mixed_execute_long_short_opts_with_multiple_scripts(self):
+        child = pexpect.spawn(TestConsole.gremlinsh + "--execute y-printed.script 1 2 3 -e x-printed.script --execute \"z-printed.script x -e --color -D\"")
+        child.expect("6\r\n")
+        child.expect("2\r\n")
+        child.expect("argument=\[x, -e, --color, -D\]\r\n")
+        TestConsole._close(child)
+
     def test_no_mix_dash_i_and_dash_e(self):
         child = pexpect.spawn(TestConsole.gremlinsh + "-i y.script 1 2 3 -i x.script -e \"z.script x -i --color -D\"")
         child.expect("-i and -e options are mutually exclusive - provide one or the other")


[28/39] tinkerpop git commit: TINKERPOP-1848 use a generated datetime so that comparison can ignore timezone/dst differences

Posted by dk...@apache.org.
TINKERPOP-1848 use a generated datetime so that comparison can ignore timezone/dst differences


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

Branch: refs/heads/TINKERPOP-1447
Commit: 7f3ecf2662a5add9f24fbea37314b2412150319c
Parents: f015341
Author: Robert Dale <ro...@gmail.com>
Authored: Mon Dec 4 11:50:09 2017 -0500
Committer: Robert Dale <ro...@gmail.com>
Committed: Mon Dec 4 11:50:09 2017 -0500

----------------------------------------------------------------------
 .../main/jython/gremlin_python/structure/io/graphson.py   |  3 +--
 .../src/main/jython/tests/structure/io/test_graphson.py   | 10 ++++++++--
 2 files changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7f3ecf26/gremlin-python/src/main/jython/gremlin_python/structure/io/graphson.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/gremlin_python/structure/io/graphson.py b/gremlin-python/src/main/jython/gremlin_python/structure/io/graphson.py
index 04085ee..24e86bb 100644
--- a/gremlin-python/src/main/jython/gremlin_python/structure/io/graphson.py
+++ b/gremlin-python/src/main/jython/gremlin_python/structure/io/graphson.py
@@ -328,8 +328,7 @@ class DateIO(_GraphSONTypeIO):
             pts = obj.timestamp()
         else:
             # Hack for legacy Python
-            # Taken from:
-            # https://github.com/jaraco/backports.datetime_timestamp/blob/master/backports/datetime_timestamp/__init__.py
+            # timestamp() in Python 3.3
             pts = time.mktime((obj.year, obj.month, obj.day,
 			                   obj.hour, obj.minute, obj.second,
 			                   -1, -1, -1)) + obj.microsecond / 1e6

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7f3ecf26/gremlin-python/src/main/jython/tests/structure/io/test_graphson.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/tests/structure/io/test_graphson.py b/gremlin-python/src/main/jython/tests/structure/io/test_graphson.py
index 633dcf7..928b33f 100644
--- a/gremlin-python/src/main/jython/tests/structure/io/test_graphson.py
+++ b/gremlin-python/src/main/jython/tests/structure/io/test_graphson.py
@@ -19,6 +19,7 @@ under the License.
 
 __author__ = 'Marko A. Rodriguez (http://markorodriguez.com)'
 import datetime
+import time
 import json
 import uuid
 
@@ -126,10 +127,15 @@ class TestGraphSONReader(object):
         assert o is serdes.objectify()
 
     def test_datetime(self):
-        dt = self.graphson_reader.readObject(json.dumps({"@type": "g:Date", "@value": 1481750076295}))
+        expected = datetime.datetime(2016, 12, 14, 16, 14, 36, 295000)
+        pts = time.mktime((expected.year, expected.month, expected.day,
+                                           expected.hour, expected.minute, expected.second,
+                                           -1, -1, -1)) + expected.microsecond / 1e6
+        timestamp = int(round(pts * 1000))
+        dt = self.graphson_reader.readObject(json.dumps({"@type": "g:Date", "@value": timestamp}))
         assert isinstance(dt, datetime.datetime)
         # TINKERPOP-1848
-        # assert dt == datetime.datetime(2016, 12, 14, 16, 14, 36, 295000, tzinfo=None)
+        assert dt == expected
 
     def test_timestamp(self):
         dt = self.graphson_reader.readObject(json.dumps({"@type": "g:Timestamp", "@value": 1481750076295}))


[29/39] tinkerpop git commit: Merge branch 'TINKERPOP-1846' into tp32

Posted by dk...@apache.org.
Merge branch 'TINKERPOP-1846' into tp32


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

Branch: refs/heads/TINKERPOP-1447
Commit: a883746e6c00018ed522c2e9396cc9134cb3a1fe
Parents: f015341 f5f4a04
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Dec 4 16:08:45 2017 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Dec 4 16:08:45 2017 -0500

----------------------------------------------------------------------
 CHANGELOG.asciidoc                                                | 1 +
 .../java/org/apache/tinkerpop/gremlin/util/function/Lambda.java   | 2 +-
 .../strategy/verification/LambdaRestrictionStrategyTest.java      | 3 +++
 3 files changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a883746e/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --cc CHANGELOG.asciidoc
index a45ca8a,8a9f1fa..2f1a5c6
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@@ -24,9 -24,9 +24,10 @@@ image::https://raw.githubusercontent.co
  === TinkerPop 3.2.7 (Release Date: NOT OFFICIALLY RELEASED YET)
  
  * Added core GraphSON classes for Gremlin-Python: `UUID`, `Date`, and `Timestamp`.
 +* Documented the recommended method for constructing DSLs with Gremlin.Net.
  * Provided a method to configure detachment options with `EventStrategy`.
  * Fixed a race condition in `TinkerIndex`.
+ * Fixed bug in `LambdaRestrictionStrategy` where traversals using `Lambda` scripts weren't causing the strategy to trigger.
  * Improved error messaging for bytecode deserialization errors in Gremlin Server.
  * Fixed an `ArrayOutOfBoundsException` in `hasId()` for the rare situation when the provided collection is empty.
  * Bump to Netty 4.0.53


[26/39] tinkerpop git commit: Gremlin.Net: Use DateTimeOffset for g:Date and g:Timestamp

Posted by dk...@apache.org.
Gremlin.Net: Use DateTimeOffset for g:Date and g:Timestamp


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

Branch: refs/heads/TINKERPOP-1447
Commit: f1153077546bc1226309e1d04273e7912a744532
Parents: be86be0
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Fri Dec 1 15:04:26 2017 +0100
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Fri Dec 1 15:04:26 2017 +0100

----------------------------------------------------------------------
 .../Structure/IO/GraphSON/DateDeserializer.cs   | 43 --------------------
 .../Structure/IO/GraphSON/DateSerializer.cs     | 16 +++++---
 .../Structure/IO/GraphSON/GraphSONReader.cs     |  4 +-
 .../Structure/IO/GraphSON/GraphSONWriter.cs     |  2 +-
 .../IO/GraphSON/GraphSONReaderTests.cs          | 16 ++++----
 .../IO/GraphSON/GraphSONWriterTests.cs          |  6 +--
 .../Structure/IO/GraphSON/TestUtils.cs          |  8 ++--
 7 files changed, 28 insertions(+), 67 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f1153077/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/DateDeserializer.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/DateDeserializer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/DateDeserializer.cs
deleted file mode 100644
index d8879f8..0000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/DateDeserializer.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-#region License
-
-/*
- * 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.
- */
-
-#endregion
-
-using System;
-using Newtonsoft.Json.Linq;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
-    internal class DateDeserializer : IGraphSONDeserializer
-    {
-        public dynamic Objectify(JToken graphsonObject, GraphSONReader reader)
-        {
-            var javaTimestamp = graphsonObject.ToObject<long>();
-            return FromJavaTime(javaTimestamp);
-        }
-
-        private DateTime FromJavaTime(long javaTimestamp)
-        {
-            var epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
-            return epoch.AddMilliseconds(javaTimestamp);
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f1153077/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/DateSerializer.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/DateSerializer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/DateSerializer.cs
index 1438e02..3333f0c 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/DateSerializer.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/DateSerializer.cs
@@ -23,21 +23,25 @@
 
 using System;
 using System.Collections.Generic;
+using Newtonsoft.Json.Linq;
 
 namespace Gremlin.Net.Structure.IO.GraphSON
 {
-    internal class DateSerializer : IGraphSONSerializer
+    internal class DateSerializer : IGraphSONSerializer, IGraphSONDeserializer
     {
+        private static readonly DateTimeOffset UnixStart = new DateTimeOffset(1970, 1, 1, 0, 0, 0, 0, TimeSpan.Zero);
+        
         public Dictionary<string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer)
         {
-            DateTime dateTime = objectData;
-            return GraphSONUtil.ToTypedValue("Date", ToJavaTimestamp(dateTime));
+            DateTimeOffset value = objectData;
+            var ticks = (value - UnixStart).Ticks;
+            return GraphSONUtil.ToTypedValue("Date", ticks / TimeSpan.TicksPerMillisecond);
         }
 
-        private long ToJavaTimestamp(DateTime dateTime)
+        public dynamic Objectify(JToken graphsonObject, GraphSONReader reader)
         {
-            var epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
-            return Convert.ToInt64((dateTime - epoch).TotalMilliseconds);
+            var milliseconds = graphsonObject.ToObject<long>();
+            return UnixStart.AddTicks(TimeSpan.TicksPerMillisecond * milliseconds);
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f1153077/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONReader.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONReader.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONReader.cs
index aa1fc48..6402c43 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONReader.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONReader.cs
@@ -42,8 +42,8 @@ namespace Gremlin.Net.Structure.IO.GraphSON
                 {"g:Float", new FloatConverter()},
                 {"g:Double", new DoubleConverter()},
                 {"g:UUID", new UuidDeserializer()},
-                {"g:Date", new DateDeserializer()},
-                {"g:Timestamp", new DateDeserializer()},
+                {"g:Date", new DateSerializer()},
+                {"g:Timestamp", new DateSerializer()},
                 {"g:Vertex", new VertexDeserializer()},
                 {"g:Edge", new EdgeDeserializer()},
                 {"g:Property", new PropertyDeserializer()},

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f1153077/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONWriter.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONWriter.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONWriter.cs
index 3c17d14..4d99864 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONWriter.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONWriter.cs
@@ -50,7 +50,7 @@ namespace Gremlin.Net.Structure.IO.GraphSON
                 {typeof(float), new FloatConverter()},
                 {typeof(double), new DoubleConverter()},
                 {typeof(Guid), new UuidSerializer()},
-                {typeof(DateTime), new DateSerializer()},
+                {typeof(DateTimeOffset), new DateSerializer()},
                 {typeof(Type), new ClassSerializer()},
                 {typeof(Enum), new EnumSerializer()},
                 {typeof(TraversalPredicate), new TraversalPredicateSerializer()},

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f1153077/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONReaderTests.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONReaderTests.cs b/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONReaderTests.cs
index 747a94e..cb70530 100644
--- a/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONReaderTests.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONReaderTests.cs
@@ -72,15 +72,15 @@ namespace Gremlin.Net.UnitTest.Structure.IO.GraphSON
         }
 
         [Fact]
-        public void ShouldDeserializeDateToDateTime()
+        public void ShouldDeserializeDateToDateTimeOffset()
         {
             var graphSon = "{\"@type\":\"g:Date\",\"@value\":1475583442552}";
             var reader = CreateStandardGraphSONReader();
 
-            DateTime readDateTime = reader.ToObject(JObject.Parse(graphSon));
+            DateTimeOffset deserializedValue = reader.ToObject(JObject.Parse(graphSon));
 
-            var expectedDateTime = TestUtils.FromJavaTime(1475583442552);
-            Assert.Equal(expectedDateTime, readDateTime);
+            var expectedDateTimeOffset = TestUtils.FromJavaTime(1475583442552);
+            Assert.Equal(expectedDateTimeOffset, deserializedValue);
         }
 
         [Fact]
@@ -211,15 +211,15 @@ namespace Gremlin.Net.UnitTest.Structure.IO.GraphSON
         }
 
         [Fact]
-        public void ShouldDeserializeTimestampToDateTime()
+        public void ShouldDeserializeTimestampToDateTimeOffset()
         {
             var graphSon = "{\"@type\":\"g:Timestamp\",\"@value\":1475583442558}";
             var reader = CreateStandardGraphSONReader();
 
-            DateTime readDateTime = reader.ToObject(JObject.Parse(graphSon));
+            DateTimeOffset deserializedValue = reader.ToObject(JObject.Parse(graphSon));
 
-            var expectedDateTime = TestUtils.FromJavaTime(1475583442558);
-            Assert.Equal(expectedDateTime, readDateTime);
+            var expectedDateTimeOffset = TestUtils.FromJavaTime(1475583442558);
+            Assert.Equal(expectedDateTimeOffset, deserializedValue);
         }
 
         [Fact]

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f1153077/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONWriterTests.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONWriterTests.cs b/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONWriterTests.cs
index 4cd831f..1f5e087 100644
--- a/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONWriterTests.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONWriterTests.cs
@@ -145,12 +145,12 @@ namespace Gremlin.Net.UnitTest.Structure.IO.GraphSON
         }
 
         [Fact]
-        public void ShouldSerializeDateTime()
+        public void ShouldSerializeDateTimeOffset()
         {
             var writer = CreateStandardGraphSONWriter();
-            var dateTime = TestUtils.FromJavaTime(1475583442552);
+            var dateTimeOffset = TestUtils.FromJavaTime(1475583442552);
 
-            var graphSon = writer.WriteObject(dateTime);
+            var graphSon = writer.WriteObject(dateTimeOffset);
 
             const string expected = "{\"@type\":\"g:Date\",\"@value\":1475583442552}";
             Assert.Equal(expected, graphSon);

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f1153077/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/TestUtils.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/TestUtils.cs b/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/TestUtils.cs
index 7ed7542..78e2386 100644
--- a/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/TestUtils.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/TestUtils.cs
@@ -25,12 +25,12 @@ using System;
 
 namespace Gremlin.Net.UnitTest.Structure.IO.GraphSON
 {
-    internal class TestUtils
+    internal static class TestUtils
     {
-        public static DateTime FromJavaTime(long javaTimestamp)
+        public static DateTimeOffset FromJavaTime(long milliseconds)
         {
-            var epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
-            return epoch.AddMilliseconds(javaTimestamp);
+            var epoch = new DateTimeOffset(1970, 1, 1, 0, 0, 0, 0, TimeSpan.Zero);
+            return epoch.AddTicks(TimeSpan.TicksPerMillisecond * milliseconds);
         }
     }
 }
\ No newline at end of file


[10/39] tinkerpop git commit: Ignore specific scenarios

Posted by dk...@apache.org.
Ignore specific scenarios


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

Branch: refs/heads/TINKERPOP-1447
Commit: 33e87aa2135498319ed0e8442254733748a96b23
Parents: bfd9d57
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Fri Nov 17 13:59:42 2017 +0100
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Thu Nov 30 10:00:09 2017 +0100

----------------------------------------------------------------------
 .../Gherkin/GherkinTestRunner.cs                | 33 ++++++++++++++++++++
 .../Gherkin/IgnoreException.cs                  | 11 ++++++-
 2 files changed, 43 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/33e87aa2/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs
index b03211c..a3748ee 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs
@@ -40,6 +40,31 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
 {
     public class GherkinTestRunner
     {
+        private static readonly IDictionary<string, IgnoreReason> IgnoredScenarios =
+            new Dictionary<string, IgnoreReason>
+            {
+                { "g_V_hasLabelXpersonX_projectXa_bX_byXoutE_countX_byXageX", IgnoreReason.ScenarioDesignMapNumbers },
+                { "g_V_matchXa_knows_b__b_created_cX", IgnoreReason.MapCoersionIssue},
+                { "g_V_valueMap_matchXa_selectXnameX_bX", IgnoreReason.MapCoersionIssue},
+                { "g_V_matchXa_out_bX", IgnoreReason.MapCoersionIssue},
+                { "g_V_outXcreatedX_unionXasXprojectX_inXcreatedX_hasXname_markoX_selectXprojectX__asXprojectX_inXcreatedX_inXknowsX_hasXname_markoX_selectXprojectXX_groupCount_byXnameX",
+                    IgnoreReason.ScenarioDesignMapNumbers},
+                { "g_V_hasLabelXpersonX_asXpX_mapXbothE_label_groupCountX_asXrX_selectXp_rX",
+                    IgnoreReason.ScenarioDesignMapNumbers},
+                { "g_V_label_groupCount_asXxX_selectXxX", IgnoreReason.ScenarioDesignMapNumbers},
+                { "g_V_outXfollowedByX_group_byXsongTypeX_byXbothE_group_byXlabelX_byXweight_sumXX",
+                    IgnoreReason.ScenarioDesignMapNumbers},
+                { "g_V_repeatXbothXfollowedByXX_timesX2X_groupXaX_byXsongTypeX_byXcountX_capXaX",
+                    IgnoreReason.ScenarioDesignMapNumbers},
+                { "g_V_repeatXbothXfollowedByXX_timesX2X_group_byXsongTypeX_byXcountX",
+                    IgnoreReason.ScenarioDesignMapNumbers},
+                { "g_V_repeatXout_groupXaX_byXnameX_byXcountX_timesX2X_capXaX", IgnoreReason.ScenarioDesignMapNumbers},
+                { "g_V_hasXlangX_group_byXlangX_byXcountX", IgnoreReason.ScenarioDesignMapNumbers},
+                { "g_V_hasLabelXsongX_group_byXnameX_byXproperties_groupCount_byXlabelXX", IgnoreReason.MapCoersionIssue},
+                { "g_V_hasLabelXsongX_groupXaX_byXnameX_byXproperties_groupCount_byXlabelXX_out_capXaX",
+                    IgnoreReason.MapCoersionIssue},
+            };
+        
         private static class Keywords
         {
             public const string Given = "GIVEN";
@@ -84,6 +109,11 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
                 {
                     var failedSteps = new Dictionary<Step, Exception>();
                     resultFeature.Scenarios[scenario] = failedSteps;
+                    if (IgnoredScenarios.TryGetValue(scenario.Name, out var reason))
+                    {
+                        failedSteps.Add(scenario.Steps.First(), new IgnoreException(reason));
+                        break;
+                    }
                     StepBlock? currentStep = null;
                     StepDefinition stepDefinition = null;
                     foreach (var step in scenario.Steps)
@@ -361,6 +391,9 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
                 "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/Mean.feature",
                 
                 "/Users/jorge/workspace/tinkerpop/gremlin-test/features/sideEffect/Sack.feature",
+                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/sideEffect/Group.feature",
+//                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/sideEffect/GroupCount.feature",
+//                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/sideEffect/Inject.feature",
             };
 //            var files = new [] {"/Users/jorge/workspace/temp/count.feature"};
 //            var files = Directory.GetFiles(path, "*.feature", SearchOption.AllDirectories);

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/33e87aa2/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/IgnoreException.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/IgnoreException.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/IgnoreException.cs
index ae236c7..a19d856 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/IgnoreException.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/IgnoreException.cs
@@ -43,6 +43,13 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
                 case IgnoreReason.LambdaNotSupported:
                     reasonSuffix = " because lambdas are not supported in Gremlin.NET";
                     break;
+                case IgnoreReason.MapCoersionIssue:
+                    reasonSuffix = " because there is conversion issue for IDictionary<K, V> instaces in" +
+                                   " Gremlin.NET (TINKERPOP-1837)";
+                    break;
+                case IgnoreReason.ScenarioDesignMapNumbers:
+                    reasonSuffix = " because the expected result contains lenient numeric numbers";
+                    break;
             }
             return $"Scenario ignored" + reasonSuffix;
         }
@@ -50,6 +57,8 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
     
     public enum IgnoreReason
     {
-        LambdaNotSupported
+        LambdaNotSupported,
+        ScenarioDesignMapNumbers,
+        MapCoersionIssue
     }
 }
\ No newline at end of file


[11/39] tinkerpop git commit: Support Ignore exceptions

Posted by dk...@apache.org.
Support Ignore exceptions


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

Branch: refs/heads/TINKERPOP-1447
Commit: bfd9d573e5cc06168420d23f9ec261a4762a1948
Parents: 4fbfb99
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Fri Nov 17 12:59:46 2017 +0100
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Thu Nov 30 10:00:09 2017 +0100

----------------------------------------------------------------------
 .../Gherkin/CommonSteps.cs                      |  8 +-
 .../Gherkin/GherkinTestRunner.cs                | 83 +++++++++++++-------
 .../Gherkin/IgnoreException.cs                  | 55 +++++++++++++
 .../ModernGraphTypeInformation.cs               |  9 +++
 4 files changed, 127 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bfd9d573/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
index 1c2c8fa..4b99fd8 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
@@ -58,7 +58,8 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
                 {@"p\[(.+)\]", ToPath},
                 {@"l\[(.+)\]", ToList},
                 {@"s\[(.+)\]", ToSet},
-                {@"m\[(.+)\]", ToMap}
+                {@"m\[(.+)\]", ToMap},
+                {@"c\[(.+)\]", ToLambda}
             }.ToDictionary(kv => new Regex("^" + kv.Key + "$", RegexOptions.Compiled), kv => kv.Value);
 
         [Given("the (\\w+) graph")]
@@ -198,6 +199,11 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
             return jsonMap.ToDictionary(kv => kv.Key, kv => ParseMapValue(kv.Value, graphName));
         }
 
+        private static object ToLambda(string stringLambda, string graphName)
+        {
+            throw new IgnoreException(IgnoreReason.LambdaNotSupported);
+        }
+
         private static object ParseMapValue(JToken value, string graphName)
         {
             if (value.Type == JTokenType.Array)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bfd9d573/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs
index 5527705..b03211c 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs
@@ -40,8 +40,6 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
 {
     public class GherkinTestRunner
     {
-        private readonly ITestOutputHelper _output;
-
         private static class Keywords
         {
             public const string Given = "GIVEN";
@@ -64,6 +62,8 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
             { StepBlock.When, typeof(WhenAttribute) },
             { StepBlock.Then, typeof(ThenAttribute) }
         };
+        
+        private readonly ITestOutputHelper _output;
 
         public GherkinTestRunner(ITestOutputHelper output)
         {
@@ -73,7 +73,7 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
         [Fact]
         public void RunGherkinBasedTests()
         {
-            Console.WriteLine("Starting Gherkin-based tests");
+            WriteOutput("Starting Gherkin-based tests");
             var stepDefinitionTypes = GetStepDefinitionTypes();
             var results = new List<ResultFeature>();
             foreach (var feature in GetFeatures())
@@ -104,6 +104,8 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
                         if (result != null)
                         {
                             failedSteps.Add(step, result);
+                            // Stop processing scenario
+                            break;
                         }
                     }
                 }
@@ -115,35 +117,26 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
 
         private void WriteOutput(string line)
         {
+#if DEBUG
             _output.WriteLine(line);
+#else
+            Console.WriteLine(line);
+#endif
         }
 
         private void OutputResults(List<ResultFeature> results)
         {
-            var totalScenarios = results.Sum(f => f.Scenarios.Count);
-            var totalFailedScenarios = results.Sum(f => f.Scenarios.Count(s => s.Value.Count > 0));
-            Console.WriteLine("Gherkin tests summary");
-            Console.WriteLine($"Total scenarios: {totalScenarios}. " +
-                              $"Passed: {totalScenarios-totalFailedScenarios}. Failed: {totalFailedScenarios}.");
-            if (totalFailedScenarios == 0)
-            {
-                return;
-            }
+            WriteOutput("Gherkin tests result");
             var identifier = 0;
-            var failures = new List<Exception>();
+            var failures = new List<Tuple<string, Exception>>();
+            var totalScenarios = 0;
+            var totalFailed = 0;
+            var totalIgnored = 0;
             foreach (var resultFeature in results)
             {
-                var failedScenarios = resultFeature.Scenarios.Where(s => s.Value.Count > 0).ToArray();
-                if (failedScenarios.Length > 0)
-                {
-                    WriteOutput($"Feature: {resultFeature.Feature.Name}");   
-                }
-                else
-                {
-                    continue;
-                }
-                foreach (var resultScenario in failedScenarios)
+                foreach (var resultScenario in resultFeature.Scenarios)
                 {
+                    totalScenarios++;
                     WriteOutput($"  Scenario: {resultScenario.Key.Name}");
                     foreach (var step in resultScenario.Key.Steps)
                     {
@@ -154,16 +147,44 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
                         }
                         else
                         {
-                            WriteOutput($"    {++identifier}) {step.Keyword} {step.Text} (failed)");
-                            failures.Add(failure);
+                            if (failure is IgnoreException)
+                            {
+                                totalIgnored++;
+                                WriteOutput($"    {++identifier}) {step.Keyword} {step.Text} (ignored)");
+                            }
+                            else
+                            {
+                                totalFailed++;
+                                WriteOutput($"    {++identifier}) {step.Keyword} {step.Text} (failed)");
+                            }
+                            failures.Add(Tuple.Create(resultScenario.Key.Name, failure));
                         }
                     }
                 }
             }
-            WriteOutput("Failures:");
+            if (totalFailed > 0)
+            {
+                WriteOutput("Failures" + (totalIgnored > 0 ? " and skipped scenarios" : "") + ":");
+            }
+            else if (totalIgnored > 0)
+            {
+                WriteOutput("Skipped scenarios:");
+            }
             for (var index = 0; index < failures.Count; index++)
             {
-                WriteOutput($"{index+1}) {failures[index]}");
+                var failure = failures[index];
+                var message = failure.Item2 is IgnoreException
+                    ? ": " + failure.Item2.Message
+                    : ": Failed\n" + failure.Item2;
+                WriteOutput($"{index+1}) {failure.Item1}{message}");
+            }
+            WriteOutput("-----------------");
+            WriteOutput($"Total scenarios: {totalScenarios}." +
+                              $" Passed: {totalScenarios-totalFailed-totalIgnored}." +
+                              $" Failed: {totalFailed}. Skipped: {totalIgnored}.");
+            if (totalFailed == 0)
+            {
+                return;
             }
             throw new Exception($"Gherkin test failed, see summary above for more detail");
         }
@@ -332,6 +353,14 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
                 "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/AddVertex.feature",
                 "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/ValueMap.feature",
                 "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/Select.feature",
+                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/Project.feature",
+                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/Path.feature",
+                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/Map.feature",
+                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/Match.feature",
+                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/Max.feature",
+                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/Mean.feature",
+                
+                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/sideEffect/Sack.feature",
             };
 //            var files = new [] {"/Users/jorge/workspace/temp/count.feature"};
 //            var files = Directory.GetFiles(path, "*.feature", SearchOption.AllDirectories);

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bfd9d573/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/IgnoreException.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/IgnoreException.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/IgnoreException.cs
new file mode 100644
index 0000000..ae236c7
--- /dev/null
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/IgnoreException.cs
@@ -0,0 +1,55 @@
+#region License
+
+/*
+ * 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.
+ */
+
+#endregion
+
+using System;
+
+namespace Gremlin.Net.IntegrationTest.Gherkin
+{
+    /// <summary>
+    /// Represents a test exception that should be ignored, given a reason (ie: feature not supported in the .NET GLV)
+    /// </summary>
+    public class IgnoreException : Exception
+    {
+        public IgnoreException(IgnoreReason reason) : base(GetMessage(reason))
+        {
+            
+        }
+
+        private static string GetMessage(IgnoreReason reason)
+        {
+            string reasonSuffix = null;
+            switch (reason)
+            {
+                case IgnoreReason.LambdaNotSupported:
+                    reasonSuffix = " because lambdas are not supported in Gremlin.NET";
+                    break;
+            }
+            return $"Scenario ignored" + reasonSuffix;
+        }
+    }
+    
+    public enum IgnoreReason
+    {
+        LambdaNotSupported
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bfd9d573/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ModernGraphTypeInformation.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ModernGraphTypeInformation.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ModernGraphTypeInformation.cs
index f96b9bf..abc3f2b 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ModernGraphTypeInformation.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ModernGraphTypeInformation.cs
@@ -64,6 +64,7 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
                 case nameof(GraphTraversal<object,object>.Optional):
                 case nameof(GraphTraversal<object,object>.Sum):
                 case nameof(GraphTraversal<object,object>.Coalesce):
+                case nameof(GraphTraversal<object,object>.Match):
                     // Maintain the same type
                     return method.DeclaringType.GetGenericArguments()[1];
                 case nameof(GraphTraversal<object,object>.ValueMap):
@@ -73,6 +74,14 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
                 case nameof(GraphTraversal<object,object>.Unfold):
                 case nameof(GraphTraversal<object,object>.Choose):
                 case nameof(GraphTraversal<object,object>.Union):
+                case nameof(GraphTraversal<object,object>.Project):
+                case nameof(GraphTraversal<object,object>.Sack):
+                case nameof(GraphTraversal<object,object>.Map):
+                case nameof(GraphTraversal<object,object>.Max):
+                case nameof(GraphTraversal<object,object>.Min):
+                case nameof(GraphTraversal<object,object>.Mean):
+                case nameof(GraphTraversal<object,object>.Cap):
+                case nameof(GraphTraversal<object,object>.Constant):
                     // default to object for this methods
                     return typeof(object);
             }


[23/39] tinkerpop git commit: Fix Match scenario result

Posted by dk...@apache.org.
Fix Match scenario result


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

Branch: refs/heads/TINKERPOP-1447
Commit: 74d7ad66df788c65c7674fe7204ee873555f169f
Parents: 6cac107
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Thu Nov 30 11:12:16 2017 +0100
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Thu Nov 30 11:12:16 2017 +0100

----------------------------------------------------------------------
 gremlin-test/features/map/Match.feature | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/74d7ad66/gremlin-test/features/map/Match.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/map/Match.feature b/gremlin-test/features/map/Match.feature
index c55a3825..e3f04d5 100644
--- a/gremlin-test/features/map/Match.feature
+++ b/gremlin-test/features/map/Match.feature
@@ -58,12 +58,12 @@ Feature: Step - match()
     When iterated to list
     Then the result should be unordered
       | result |
-      | d[3].l |
-      | d[2].l |
-      | d[4].l |
-      | d[5].l |
-      | d[3].l |
-      | d[3].l |
+      | d[3].i |
+      | d[2].i |
+      | d[4].i |
+      | d[5].i |
+      | d[3].i |
+      | d[3].i |
 
   Scenario: g_V_matchXa_knows_b__b_created_cX
     Given the modern graph


[30/39] tinkerpop git commit: Merge branch 'TINKERPOP-1745' into tp32

Posted by dk...@apache.org.
Merge branch 'TINKERPOP-1745' into tp32


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

Branch: refs/heads/TINKERPOP-1447
Commit: 7e17d4fa0887a4918984e8bc0cdf701152a93d38
Parents: a883746 f115307
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Tue Dec 5 14:03:16 2017 +0100
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Tue Dec 5 14:03:16 2017 +0100

----------------------------------------------------------------------
 .../Structure/IO/GraphSON/DateDeserializer.cs   | 43 --------------------
 .../Structure/IO/GraphSON/DateSerializer.cs     | 16 +++++---
 .../Structure/IO/GraphSON/GraphSONReader.cs     |  4 +-
 .../Structure/IO/GraphSON/GraphSONWriter.cs     |  2 +-
 .../IO/GraphSON/GraphSONReaderTests.cs          | 16 ++++----
 .../IO/GraphSON/GraphSONWriterTests.cs          |  6 +--
 .../Structure/IO/GraphSON/TestUtils.cs          |  8 ++--
 7 files changed, 28 insertions(+), 67 deletions(-)
----------------------------------------------------------------------



[20/39] tinkerpop git commit: Use invariant culture for numeric parsing

Posted by dk...@apache.org.
Use invariant culture for numeric parsing


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

Branch: refs/heads/TINKERPOP-1447
Commit: af6e336c3c3e58f5980218f5123c5e70ca76a3ae
Parents: 7c9c303
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Mon Nov 27 09:10:51 2017 +0100
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Thu Nov 30 10:01:22 2017 +0100

----------------------------------------------------------------------
 .../test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs   | 7 ++++---
 .../Gherkin/TraversalEvaluation/TraversalParser.cs            | 6 ++++--
 2 files changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/af6e336c/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
index 0011eda..0abc247 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
@@ -24,6 +24,7 @@
 using System;
 using System.Collections;
 using System.Collections.Generic;
+using System.Globalization;
 using System.Linq;
 using System.Text.RegularExpressions;
 using Gherkin.Ast;
@@ -66,9 +67,9 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
             {
                 { 'i', s => Convert.ToInt32(s) },
                 { 'l', s => Convert.ToInt64(s) },
-                { 'f', s => Convert.ToSingle(s) },
-                { 'd', s => Convert.ToDouble(s) },
-                { 'm', s => Convert.ToDecimal(s)}
+                { 'f', s => Convert.ToSingle(s, CultureInfo.InvariantCulture) },
+                { 'd', s => Convert.ToDouble(s, CultureInfo.InvariantCulture) },
+                { 'm', s => Convert.ToDecimal(s, CultureInfo.InvariantCulture) }
             };
 
         [Given("the (\\w+) graph")]

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/af6e336c/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
index 827960d..118fcea 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
@@ -23,6 +23,7 @@
 
 using System;
 using System.Collections.Generic;
+using System.Globalization;
 using System.Linq;
 using System.Reflection;
 using System.Text.RegularExpressions;
@@ -452,12 +453,13 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
             }
             if (numericText.EndsWith("F"))
             {
-                return LiteralParameter.Create(Convert.ToSingle(match.Value.Substring(0, match.Value.Length-1)));
+                return LiteralParameter.Create(Convert.ToSingle(match.Value.Substring(0, match.Value.Length - 1),
+                    CultureInfo.InvariantCulture));
             }
             if (match.Groups[1].Value != "")
             {
                 // Captured text with the decimal separator
-                return LiteralParameter.Create(Convert.ToDecimal(match.Value));
+                return LiteralParameter.Create(Convert.ToDecimal(match.Value, CultureInfo.InvariantCulture));
             }
             return LiteralParameter.Create(Convert.ToInt32(match.Value));
         }


[04/39] tinkerpop git commit: Edge and Path result parsing

Posted by dk...@apache.org.
Edge and Path result parsing


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

Branch: refs/heads/TINKERPOP-1447
Commit: 17d6876b48632dd24c57d681476b1232adea8d1d
Parents: f38c2d0
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Fri Nov 3 16:00:50 2017 +0100
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Thu Nov 30 10:00:08 2017 +0100

----------------------------------------------------------------------
 .../Gherkin/CommonSteps.cs                      |  8 +++----
 .../Gherkin/ScenarioData.cs                     | 25 +++++++++++++++++---
 .../ModernGraphTypeInformation.cs               |  4 ++++
 .../TraversalEvaluationTests.cs                 |  3 ++-
 .../TraversalEvaluation/TraversalParser.cs      | 17 +++++++++++--
 5 files changed, 47 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/17d6876b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
index 235f1ba..8b27567 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
@@ -182,14 +182,14 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
             return ScenarioData.Instance.ModernVertices[name];
         }
 
-        private static Edge ToEdge(string s)
+        private static Edge ToEdge(string name)
         {
-            throw new NotImplementedException();
+            return ScenarioData.Instance.ModernEdges[name];
         }
 
-        private static Path ToPath(string arg)
+        private static Path ToPath(string value)
         {
-            throw new NotImplementedException();
+            return new Path(new List<List<string>>(0), value.Split(',').Select(ParseValue).ToList());
         }
 
         private static object ParseValue(string stringValue)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/17d6876b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/ScenarioData.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/ScenarioData.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/ScenarioData.cs
index c45ed12..d9f66ff 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/ScenarioData.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/ScenarioData.cs
@@ -24,6 +24,7 @@
 using System;
 using System.Collections.Generic;
 using System.Linq;
+using System.Text.RegularExpressions;
 using Gremlin.Net.IntegrationTest.Process.Traversal.DriverRemoteConnection;
 using Gremlin.Net.Process.Traversal;
 using Gremlin.Net.Structure;
@@ -35,6 +36,10 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
         private static readonly Lazy<ScenarioData> Lazy = new Lazy<ScenarioData>(Load);
         
         public static ScenarioData Instance => Lazy.Value;
+        
+        private static readonly Regex EdgeORegex = new Regex("o=(.+?)[,}]", RegexOptions.Compiled);
+        private static readonly Regex EdgeLRegex = new Regex("l=(.+?)[,}]", RegexOptions.Compiled);
+        private static readonly Regex EdgeIRegex = new Regex("i=(.+?)[,}]", RegexOptions.Compiled);
 
         public IDictionary<string, Vertex> ModernVertices { get; }
         
@@ -50,10 +55,24 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
         {
             var connectionFactory = new RemoteConnectionFactory();
             var g = new Graph().Traversal().WithRemote(connectionFactory.CreateRemoteConnection());
-            //TODO: Remove workaround once Group() is fixed TINKERPOP-1752
-            var vertices = g.V().ToList().ToDictionary(v => g.V(v.Id).Values<string>("name").Next(), v => v);
+            var vertices = g.V().Group<string, object>().By("name").By(__.Tail<Vertex>()).Next()
+                .ToDictionary(kv => kv.Key, kv => (Vertex)kv.Value);
+            var edges = g.E().Group<string, object>()
+                .By(__.Project<Edge>("o", "l", "i")
+                    .By(__.OutV().Values<string>("name")).By(__.Label()).By(__.InV().Values<string>("name")))
+                .By(__.Tail<object>())
+                .Next()
+                .ToDictionary(kv => GetEdgeKey(kv.Key), kv => (Edge)kv.Value);
             connectionFactory.Dispose();
-            return new ScenarioData(vertices, null);
+            return new ScenarioData(vertices, edges);
+        }
+
+        private static string GetEdgeKey(string key)
+        {
+            var o = EdgeORegex.Match(key).Groups[1].Value;
+            var l = EdgeLRegex.Match(key).Groups[1].Value;
+            var i = EdgeIRegex.Match(key).Groups[1].Value;
+            return o + "-" + l + "->" + i;
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/17d6876b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ModernGraphTypeInformation.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ModernGraphTypeInformation.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ModernGraphTypeInformation.cs
index e26ec5f..7e2bee1 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ModernGraphTypeInformation.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ModernGraphTypeInformation.cs
@@ -59,6 +59,10 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
                 case nameof(GraphTraversal<object,object>.ValueMap):
                     // Use IDictionary<string, object> for value maps
                     return typeof(object);
+                case nameof(GraphTraversal<object,object>.Limit):
+                case nameof(GraphTraversal<object,object>.Optional):
+                    // Maintain the same type
+                    return method.DeclaringType.GetGenericArguments()[1];
             }
             return null;
         }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/17d6876b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEvaluationTests.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEvaluationTests.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEvaluationTests.cs
index d2a62b4..aaca93f 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEvaluationTests.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEvaluationTests.cs
@@ -81,7 +81,8 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
                 Tuple.Create("g.V().valueMap(true, \"name\", \"age\")", 2),
                 Tuple.Create("g.V().where(__.in(\"created\").count().is(1)).values(\"name\")", 3),
                 Tuple.Create("g.V().count(Scope.local)", 2),
-                Tuple.Create("g.V().values(\"age\").is(P.lte(30))", 3)
+                Tuple.Create("g.V().values(\"age\").is(P.lte(30))", 3),
+                Tuple.Create("g.V().optional(__.out().optional(__.out())).path().limit(1)", 4)
             };
             var g = new Graph().Traversal();
             foreach (var tuple in traversalTexts)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/17d6876b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
index bb0aac8..b5efb8d 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
@@ -44,6 +44,11 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
         private static readonly Regex RegexEnum = new Regex(@"\w+\.\w+", RegexOptions.Compiled);
 
         private static readonly Regex RegexParam = new Regex(@"\w+", RegexOptions.Compiled);
+        
+        private static readonly HashSet<Type> NumericTypes = new HashSet<Type>
+        {
+            typeof(int), typeof(long), typeof(double), typeof(float), typeof(short), typeof(decimal), typeof(byte)
+        };
 
         internal static ITraversal GetTraversal(string traversalText, GraphTraversalSource g,
                                                 IDictionary<string, object> contextParameterValues)
@@ -151,9 +156,15 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
                     }
                     else
                     {
-                        if (!methodParameter.ParameterType.GetTypeInfo().IsAssignableFrom(tokenParameterType))
+                        if (IsNumeric(methodParameter.ParameterType) && IsNumeric(tokenParameterType))
                         {
-                            break;   
+                            // Acount for implicit conversion of numeric values as an exact match 
+                            exactMatches++;
+                        }
+                        else if (!methodParameter.ParameterType.GetTypeInfo().IsAssignableFrom(tokenParameterType))
+                        {
+                            // Not a match
+                            break;
                         }
                         // Is assignable to the parameter type
                         matched = true;
@@ -169,6 +180,8 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
                    lastMethod;
         }
 
+        private static bool IsNumeric(Type t) => NumericTypes.Contains(t);
+
         private static bool IsParamsArray(ParameterInfo methodParameter)
         {
             return methodParameter.IsDefined(typeof(ParamArrayAttribute), false);


[08/39] tinkerpop git commit: Context parameters support

Posted by dk...@apache.org.
Context parameters support


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

Branch: refs/heads/TINKERPOP-1447
Commit: 69a710c813f4347365d8938df8f4b619ef531538
Parents: ee33016
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Tue Oct 31 17:33:03 2017 +0100
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Thu Nov 30 10:00:08 2017 +0100

----------------------------------------------------------------------
 .../Process/Traversal/Instruction.cs            |   4 +-
 .../Gherkin/CommonSteps.cs                      | 113 ++++++++++-----
 .../Gherkin/GherkinTestRunner.cs                |  32 +----
 .../Gherkin/ScenarioData.cs                     |  59 ++++++++
 .../ContextBasedParameter.cs                    |  84 +++++++++++
 .../TraversalEvaluation/ITokenParameter.cs      |   3 +-
 .../TraversalEvaluation/NumericParameter.cs     |   8 +-
 .../StaticTraversalParameter.cs                 |   4 +-
 .../TraversalEvaluation/StringParameter.cs      |   3 +-
 .../TraversalEnumParameter.cs                   |   2 +-
 .../TraversalEvaluationTests.cs                 |  46 +++---
 .../TraversalEvaluation/TraversalParser.cs      | 143 +++++++++----------
 .../TraversalPredicateParameter.cs              |   5 +-
 13 files changed, 330 insertions(+), 176 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/69a710c8/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Instruction.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Instruction.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Instruction.cs
index 195b7bf..a9163be 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Instruction.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Instruction.cs
@@ -28,6 +28,8 @@ namespace Gremlin.Net.Process.Traversal
     /// </summary>
     public class Instruction
     {
+        private static readonly object[] EmptyArgs = new object[0];
+        
         /// <summary>
         ///     Initializes a new instance of the <see cref="Instruction" /> class.
         /// </summary>
@@ -36,7 +38,7 @@ namespace Gremlin.Net.Process.Traversal
         public Instruction(string operatorName, params dynamic[] arguments)
         {
             OperatorName = operatorName;
-            Arguments = arguments;
+            Arguments = arguments ??  EmptyArgs;
         }
 
         /// <summary>

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/69a710c8/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
index 16aef9d..235f1ba 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
@@ -25,15 +25,12 @@ using System;
 using System.Collections;
 using System.Collections.Generic;
 using System.Linq;
-using System.Net.Http.Headers;
-using System.Runtime.CompilerServices;
+using System.Text.RegularExpressions;
 using Gherkin.Ast;
 using Gremlin.Net.IntegrationTest.Gherkin.Attributes;
 using Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation;
 using Gremlin.Net.Process.Traversal;
 using Gremlin.Net.Structure;
-using Newtonsoft.Json;
-using Newtonsoft.Json.Linq;
 using Xunit;
 
 namespace Gremlin.Net.IntegrationTest.Gherkin
@@ -41,14 +38,26 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
     internal class GeneralDefinitions : StepDefinition
     {
         private GraphTraversalSource _g;
+        private readonly IDictionary<string, object> _parameters = new Dictionary<string, object>();
         private dynamic _traversal;
         private object[] _result;
 
-        private static readonly IDictionary<string, Func<GraphTraversalSource, ITraversal>> FixedTranslations = 
-            new Dictionary<string, Func<GraphTraversalSource, ITraversal>>
+        private static readonly IDictionary<Regex, Func<string, object>> Parsers =
+            new Dictionary<string, Func<string, object>>
             {
-                { "g.V().has(\"no\").count()", g => g.V().Has("no").Count() }
-            };
+                {@"d\[(\d+)\]", x => Convert.ToInt64(x)},
+                {@"d\[(\d+(?:\.\d+)?)\]", x => Convert.ToDouble(x)},
+                {@"v\[(.+)\]", ToVertex},
+                {@"v\[(.+)\]\.id", x => ToVertex(x).Id},
+                {@"v\[(.+)\]\.sid", x => ToVertex(x).Id.ToString()},
+                {@"e\[(.+)\]", ToEdge},
+                {@"e\[(.+)\].id", s => ToEdge(s).Id},
+                {@"e\[(.+)\].sid", s => ToEdge(s).Id.ToString()},
+                {@"p\[(.+)\]", ToPath},
+                {@"l\[(.+)\]", ToList},
+                {@"s\[(.+)\]", ToSet},
+                {@"m\[(.+)\]", ToMap},
+            }.ToDictionary(kv => new Regex("^" + kv.Key + "$", RegexOptions.Compiled), kv => kv.Value);
         
         [Given("the modern graph")]
         public void ChooseModernGraph()
@@ -57,6 +66,22 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
             _g = new Graph().Traversal().WithRemote(connection);
         }
 
+        [Given("using the parameter (\\w+) defined as \"(.*)\"")]
+        public void UsingParameter(string name, string value)
+        {
+            _parameters.Add(name, ParseValue(value));
+        }
+
+        [Given("the traversal of")]
+        public void TranslateTraversal(string traversalText)
+        {
+            if (_g == null)
+            {
+                throw new InvalidOperationException("g should be a traversal source");
+            }
+            _traversal = TraversalParser.GetTraversal(traversalText, _g, _parameters);
+        }
+
         [When("iterated to list")]
         public void IterateToList()
         {
@@ -78,16 +103,6 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
             _result = _traversal.Next();
         }
 
-        [Given("the traversal of")]
-        public void TranslateTraversal(string traversalText)
-        {
-            if (_g == null)
-            {
-                throw new InvalidOperationException("g should be a traversal source");
-            }
-            _traversal = TraversalParser.GetTraversal(traversalText, _g);
-        }
-
         [Then("the result should be (\\w+)")]
         public void AssertResult(string characterizedAs, DataTable table)
         {
@@ -104,9 +119,8 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
                     {
                         var row = rows[i];
                         var cells = row.Cells.ToArray();
-                        var typeName = cells[0].Value;
-                        var expectedValue = ConvertExpectedToType(typeName, cells[1].Value);
-                        var resultItem = ConvertResultItem(typeName, _result[i]);
+                        var expectedValue = ParseValue(cells[0].Value);
+                        var resultItem = ConvertResultItem(null, _result[i]);
                         Assert.Equal(expectedValue, resultItem);
                     }
                     break;
@@ -116,10 +130,9 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
                     foreach (var row in rows)
                     {
                         var cells = row.Cells.ToArray();
-                        var typeName = cells[0].Value;
-                        var expectedValue = ConvertExpectedToType(typeName, cells[1].Value);
+                        var expectedValue = ParseValue(cells[0].Value);
                         // Convert all the values in the result to the type
-                        var convertedResult = _result.Select(item => ConvertResultItem(typeName, item));
+                        var convertedResult = _result.Select(item => ConvertResultItem(null, item));
                         Assert.Contains(expectedValue, convertedResult);
                     }
                     break;
@@ -149,19 +162,51 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
             return result;
         }
 
-        private object ConvertExpectedToType(string typeName, string stringValue)
+        private static IDictionary ToMap(string arg)
+        {
+            throw new NotImplementedException();
+        }
+
+        private static ICollection ToSet(string arg)
+        {
+            throw new NotImplementedException();
+        }
+
+        private static IList ToList(string arg)
+        {
+            throw new NotImplementedException();
+        }
+
+        private static Vertex ToVertex(string name)
         {
-            switch (typeName)
+            return ScenarioData.Instance.ModernVertices[name];
+        }
+
+        private static Edge ToEdge(string s)
+        {
+            throw new NotImplementedException();
+        }
+
+        private static Path ToPath(string arg)
+        {
+            throw new NotImplementedException();
+        }
+
+        private static object ParseValue(string stringValue)
+        {
+            Func<string, object> parser = null;
+            string extractedValue = null;
+            foreach (var kv in Parsers)
             {
-                case "numeric":
-                    return Convert.ToInt64(stringValue);
-                case "string":
-                    return stringValue;
-                case "map":
-                    IDictionary<string, JToken> jsonObject = JObject.Parse(stringValue);
-                    return jsonObject.ToDictionary(item => item.Key, item => item.Value.ToString());
+                var match = kv.Key.Match(stringValue);
+                if (match.Success)
+                {
+                    parser = kv.Value;
+                    extractedValue = match.Groups[1].Value;
+                    break;
+                }
             }
-            throw new NotSupportedException($"Data table result with subtype of {typeName} not supported");
+            return parser != null ? parser(extractedValue) : stringValue;
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/69a710c8/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs
index 7523b0b..d850d08 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs
@@ -307,7 +307,7 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
                 var parser = new Parser();
                 WriteOutput("Parsing " + gherkinFile);
                 var doc = parser.Parse(gherkinFile);
-                yield return doc.Feature;   
+                yield return doc.Feature;
             }
         }
 
@@ -332,35 +332,5 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
             }
             return rootDir.FullName;
         }
-
-        private void PrintGherkin()
-        {
-            var gherkinFile = "/Users/jorge/workspace/temp/count.feature";
-            var parser = new Parser();
-            GherkinDocument doc = parser.Parse(gherkinFile);
-            foreach (var scenario in doc.Feature.Children)
-            {
-                WriteOutput("--------");
-                WriteOutput("Scenario: " + scenario.Name);
-                foreach (var step in scenario.Steps)
-                {
-                    WriteOutput("  Step");
-                    WriteOutput("    Keyword: " + step.Keyword);
-                    WriteOutput("    Text: " + step.Text);
-                    WriteOutput("    Argument: " + step.Argument);
-                    if (step.Argument is DocString)
-                    {
-                        WriteOutput("      " + ((DocString)step.Argument).Content);
-                    }
-                    if (step.Argument is DataTable)
-                    {
-                        foreach (var row in ((DataTable)step.Argument).Rows)
-                        {
-                            WriteOutput("      Row: " + string.Join(", ", row.Cells.Select(x => x.Value)));   
-                        }
-                    }
-                }
-            }
-        }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/69a710c8/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/ScenarioData.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/ScenarioData.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/ScenarioData.cs
new file mode 100644
index 0000000..c45ed12
--- /dev/null
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/ScenarioData.cs
@@ -0,0 +1,59 @@
+#region License
+
+/*
+ * 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.
+ */
+
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Gremlin.Net.IntegrationTest.Process.Traversal.DriverRemoteConnection;
+using Gremlin.Net.Process.Traversal;
+using Gremlin.Net.Structure;
+
+namespace Gremlin.Net.IntegrationTest.Gherkin
+{
+    public class ScenarioData
+    {
+        private static readonly Lazy<ScenarioData> Lazy = new Lazy<ScenarioData>(Load);
+        
+        public static ScenarioData Instance => Lazy.Value;
+
+        public IDictionary<string, Vertex> ModernVertices { get; }
+        
+        public IDictionary<string, Edge> ModernEdges { get; }
+        
+        private ScenarioData(IDictionary<string, Vertex> modernVertices, IDictionary<string, Edge> modernEdges)
+        {
+            ModernVertices = modernVertices;
+            ModernEdges = modernEdges;
+        }
+
+        private static ScenarioData Load()
+        {
+            var connectionFactory = new RemoteConnectionFactory();
+            var g = new Graph().Traversal().WithRemote(connectionFactory.CreateRemoteConnection());
+            //TODO: Remove workaround once Group() is fixed TINKERPOP-1752
+            var vertices = g.V().ToList().ToDictionary(v => g.V(v.Id).Values<string>("name").Next(), v => v);
+            connectionFactory.Dispose();
+            return new ScenarioData(vertices, null);
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/69a710c8/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ContextBasedParameter.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ContextBasedParameter.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ContextBasedParameter.cs
new file mode 100644
index 0000000..4f837d4
--- /dev/null
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ContextBasedParameter.cs
@@ -0,0 +1,84 @@
+#region License
+
+/*
+ * 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.
+ */
+
+#endregion
+
+using System;
+using System.Collections.Generic;
+
+namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
+{
+    public class ContextBasedParameter : ITokenParameter, IEquatable<ContextBasedParameter>
+    {
+        public bool Equals(ContextBasedParameter other)
+        {
+            return string.Equals(_name, other._name) && Equals(_value, other._value);
+        }
+
+        public override bool Equals(object obj)
+        {
+            if (ReferenceEquals(null, obj)) return false;
+            if (ReferenceEquals(this, obj)) return true;
+            if (obj.GetType() != GetType()) return false;
+            return Equals((ContextBasedParameter) obj);
+        }
+
+        public override int GetHashCode()
+        {
+            unchecked
+            {
+                return ((_name != null ? _name.GetHashCode() : 0) * 397) ^ (_value != null ? _value.GetHashCode() : 0);
+            }
+        }
+
+        private readonly string _name;
+        private object _value;
+
+        public ContextBasedParameter(string name)
+        {
+            _name = name;
+        }
+
+        private void SetValue(IDictionary<string, object> parameterValues)
+        {
+            if (parameterValues == null || !parameterValues.TryGetValue(_name, out var value))
+            {
+                throw new InvalidOperationException($"Parameter \"{_name}\" was not provided");
+            }
+            _value = value;
+        }
+        
+        public object GetValue(IDictionary<string, object> contextParameterValues)
+        {
+            SetValue(contextParameterValues);
+            return _value;
+        }
+
+        public Type GetParameterType()
+        {
+            if (_value == null)
+            {
+                throw new NullReferenceException($"Value for parameter \"{_name}\" was not set");
+            }
+            return _value.GetType();
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/69a710c8/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ITokenParameter.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ITokenParameter.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ITokenParameter.cs
index 5c8197f..9b06e80 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ITokenParameter.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ITokenParameter.cs
@@ -22,6 +22,7 @@
 #endregion
 
 using System;
+using System.Collections.Generic;
 
 namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
 {
@@ -30,7 +31,7 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
         /// <summary>
         /// Gets the value of the parameter 
         /// </summary>
-        object GetValue();
+        object GetValue(IDictionary<string, object> contextParameterValues);
 
         /// <summary>
         /// Gets the type of the parameter

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/69a710c8/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/NumericParameter.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/NumericParameter.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/NumericParameter.cs
index 378680c..7428cc2 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/NumericParameter.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/NumericParameter.cs
@@ -22,6 +22,7 @@
 #endregion
 
 using System;
+using System.Collections.Generic;
 
 namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
 {
@@ -57,7 +58,7 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
             return $"NumericParameter<{typeof(T).Name}>({Value})";
         }
 
-        public object GetValue()
+        public object GetValue(IDictionary<string, object> contextParameterValues)
         {
             return Value;
         }
@@ -74,5 +75,10 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
         {
             return new NumericParameter<TType>(value);
         }
+
+        public static NumericParameter<long> CreateLong(string value)
+        {
+            return NumericParameter.Create(Convert.ToInt64(value.Substring(0, value.Length - 1)));
+        }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/69a710c8/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/StaticTraversalParameter.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/StaticTraversalParameter.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/StaticTraversalParameter.cs
index dca691b..dd38dca 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/StaticTraversalParameter.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/StaticTraversalParameter.cs
@@ -50,9 +50,9 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
             return Tokens != null ? Tokens.GetHashCode() : 0;
         }
 
-        public object GetValue()
+        public object GetValue(IDictionary<string, object> contextParameterValues)
         {
-            return TraversalParser.GetTraversalFromTokens(Tokens, null, _traversalText);
+            return TraversalParser.GetTraversalFromTokens(Tokens, null, contextParameterValues, _traversalText);
         }
 
         public Type GetParameterType()

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/69a710c8/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/StringParameter.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/StringParameter.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/StringParameter.cs
index 82f6cd9..430c2d2 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/StringParameter.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/StringParameter.cs
@@ -22,6 +22,7 @@
 #endregion
 
 using System;
+using System.Collections.Generic;
 
 namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
 {
@@ -66,7 +67,7 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
             return $"{GetType().Name}({Value})";
         }
 
-        public object GetValue()
+        public object GetValue(IDictionary<string, object> contextParameterValues)
         {
             return Value;
         }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/69a710c8/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEnumParameter.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEnumParameter.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEnumParameter.cs
index 663928a..c99fc95 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEnumParameter.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEnumParameter.cs
@@ -85,7 +85,7 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
             return _text.GetHashCode();
         }
 
-        public object GetValue()
+        public object GetValue(IDictionary<string, object> contextParameterValues)
         {
             return _value;
         }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/69a710c8/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEvaluationTests.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEvaluationTests.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEvaluationTests.cs
index 9cbceb9..be5f444 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEvaluationTests.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEvaluationTests.cs
@@ -31,13 +31,6 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
 {
     public class TraversalEvaluationTests
     {
-        private readonly ITestOutputHelper _output;
-
-        public TraversalEvaluationTests(ITestOutputHelper output)
-        {
-            _output = output;
-        }
-        
         [Fact]
         public void Traversal_Parser_Should_Parse_Into_Tokens()
         {
@@ -48,6 +41,12 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
                     new[] {new Token("values", new StringParameter("name"))}),
                 Tuple.Create("g.V().constant(123l)", 
                     new[] {new Token("constant", new[] {NumericParameter.Create(123L)})}),
+                Tuple.Create("g.V().constant(123)", 
+                    new[] {new Token("constant", new[] {NumericParameter.Create(123)})}),
+                Tuple.Create("g.V().constant(123.1)", 
+                    new[] {new Token("constant", new[] {NumericParameter.Create(123.1)})}),
+                Tuple.Create("g.V().constant(123.1f)", 
+                    new[] {new Token("constant", new[] {NumericParameter.Create(123.1f)})}),
                 Tuple.Create("g.V().has(\"no\").count()",
                     new[] {new Token("has", new StringParameter("no")), new Token("count")}),
                 Tuple.Create("g.V().has(\"lang\", \"java\")",
@@ -55,7 +54,7 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
                 Tuple.Create("g.V().where(__.in(\"knows\"))",
                     new[] {new Token("where", new[] {new StaticTraversalParameter(
                         new[] {new Token("__"), new Token("in", new StringParameter("knows"))}, "__.in(\"knows\")")})}),
-                Tuple.Create("g.V().has(\"age\", P.gt(27)", 
+                Tuple.Create("g.V().has(\"age\",P.gt(27))", 
                     new[] {new Token("has", new ITokenParameter[] { new StringParameter("age"),
                         new TraversalPredicateParameter(
                             new[] { new Token("P"), new Token("gt", NumericParameter.Create(27)) }) })}),
@@ -65,14 +64,7 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
             foreach (var item in items)
             {
                 var parts = TraversalParser.ParseTraversal(item.Item1);
-                _output.WriteLine("Parsing " + item.Item1);
-                if (parts[parts.Count-1].Parameters != null)
-                {
-                    _output.WriteLine("{0}", parts[parts.Count-1].Parameters.Count);
-                    _output.WriteLine("Values: " +
-                                      string.Join(", ", parts[parts.Count - 1].Parameters.Select(p => p.ToString())));
-                }
-                Assert.Equal(new[] {new Token("g"), new Token("V")}.Concat(item.Item2), parts);
+                Assert.Equal(item.Item2, parts.Skip(2));
             }
         }
 
@@ -81,21 +73,21 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
         {
             var traversalTexts = new []
             {
-                "g.V().count()",
-                //"g.V().constant(123L)", Can be parsed using the new type-safe API
-                "g.V().has(\"no\").count()",
-                "g.V().values(\"age\")",
-                "g.V().valueMap(\"name\", \"age\")",
-                "g.V().where(__.in(\"created\").count().is(1)).values(\"name\")",
-                "g.V().count(Scope.local)",
-                "g.V().values(\"age\").is(P.lte(30))"
+                Tuple.Create("g.V().count()", 2),
+//                //"g.V().constant(123L)", Can be parsed using the new type-safe API
+                Tuple.Create("g.V().has(\"no\").count()", 3),
+                Tuple.Create("g.V().values(\"age\")", 2),
+                Tuple.Create("g.V().valueMap(\"name\", \"age\")", 2),
+                Tuple.Create("g.V().where(__.in(\"created\").count().is(1)).values(\"name\")", 3),
+                Tuple.Create("g.V().count(Scope.local)", 2),
+                Tuple.Create("g.V().values(\"age\").is(P.lte(30))", 3)
             };
             var g = new Graph().Traversal();
-            foreach (var text in traversalTexts)
+            foreach (var tuple in traversalTexts)
             {
-                var traversal = TraversalParser.GetTraversal(text, g);
+                var traversal = TraversalParser.GetTraversal(tuple.Item1, g, null);
                 Assert.NotNull(traversal);
-                Assert.True(traversal.Bytecode.StepInstructions.Count > 0);
+                Assert.Equal(tuple.Item2, traversal.Bytecode.StepInstructions.Count);
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/69a710c8/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
index 9880a64..4cf7b4a 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
@@ -36,71 +36,60 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
             {
                 { "g.V().fold().count(Scope.local)", g => g.V().Fold<object>().Count(Scope.Local)}
             };
-        
-        private static readonly Regex RegexInteger = new Regex(@"\d+", RegexOptions.Compiled);
-        private static readonly Regex RegexDouble = new Regex(@"\d+\.\d+", RegexOptions.Compiled);
-        private static readonly Regex RegexFloat =
-            new Regex(@"\d+\.\d+f", RegexOptions.Compiled | RegexOptions.IgnoreCase);
-        private static readonly Regex RegexLong = new Regex(@"\d+l", RegexOptions.Compiled | RegexOptions.IgnoreCase);
+
+        private static readonly Regex RegexNumeric =
+            new Regex(@"\d+(\.\d+)?(?:l|f)?", RegexOptions.Compiled | RegexOptions.IgnoreCase);
+
         private static readonly Regex RegexEnum = new Regex(@"\w+\.\w+", RegexOptions.Compiled);
 
-        internal static ITraversal GetTraversal(string traversalText, GraphTraversalSource g)
+        private static readonly Regex RegexParam = new Regex(@"\w+", RegexOptions.Compiled);
+
+        internal static ITraversal GetTraversal(string traversalText, GraphTraversalSource g,
+                                                IDictionary<string, object> contextParameterValues)
         {
             if (!FixedTranslations.TryGetValue(traversalText, out var traversalBuilder))
             {
                 var tokens = ParseTraversal(traversalText);
-                return GetTraversalFromTokens(tokens, g, traversalText);
+                return GetTraversalFromTokens(tokens, g, contextParameterValues, traversalText);
             }
             return traversalBuilder(g);
         }
 
         internal static ITraversal GetTraversalFromTokens(IList<Token> tokens, GraphTraversalSource g,
-                                                         string traversalText)
+                                                          IDictionary<string, object> contextParameterValues,
+                                                          string traversalText)
         {
-            ITraversal traversal;
-            Type traversalType;
-            var initialIndex = 2;
+            object instance;
+            Type instanceType;
             if (tokens[0].Name == "g")
             {
-                switch (tokens[1].Name)
-                {
-                    case "V":
-                        //TODO: support V() parameters
-                        traversal = g.V();
-                        break;
-                    case "E":
-                        traversal = g.E();
-                        break;
-                    default:
-                        throw BuildException(traversalText);
-                }
-                traversalType = traversal.GetType();
+                instance = g;
+                instanceType = g.GetType();
             }
             else if (tokens[0].Name == "__")
             {
-                traversal = null;
-                traversalType = typeof(__);
-                initialIndex = 1;
+                instance = null;
+                instanceType = typeof(__);
             }
             else
             {
                 throw BuildException(traversalText);
             }
-            for (var i = initialIndex; i < tokens.Count; i++)
+            for (var i = 1; i < tokens.Count; i++)
             {
                 var token = tokens[i];
                 var name = GetCsharpName(token.Name);
-                var method = traversalType.GetMethod(name);
+                var method = instanceType.GetMethod(name);
                 if (method == null)
                 {
                     throw new InvalidOperationException($"Traversal method '{tokens[i]}' not found for testing");
                 }
-                var parameterValues = BuildParameters(method, token, out var genericParameters);
+                var parameterValues = BuildParameters(method, token, contextParameterValues, out var genericParameters);
                 method = BuildGenericMethod(method, genericParameters, parameterValues);
-                traversal = (ITraversal) method.Invoke(traversal, parameterValues);
-                traversalType = traversal.GetType();
+                instance = method.Invoke(instance, parameterValues);
+                instanceType = instance.GetType();
             }
-            return traversal;
+            return (ITraversal) instance;
         }
 
         private static MethodInfo BuildGenericMethod(MethodInfo method, IDictionary<string, Type> genericParameters,
@@ -133,6 +122,7 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
         }
 
         private static object[] BuildParameters(MethodInfo method, Token token,
+                                                IDictionary<string, object> contextParameterValues,
                                                 out IDictionary<string, Type> genericParameterTypes)
         {
             var paramsInfo = method.GetParameters();
@@ -145,7 +135,7 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
                 if (token.Parameters.Count > i)
                 {
                     var tokenParameter = token.Parameters[i];
-                    value =  tokenParameter.GetValue();
+                    value =  tokenParameter.GetValue(contextParameterValues);
                     if (info.ParameterType.IsGenericParameter)
                     {
                         // We've provided a value for parameter of a generic type, we can infer the
@@ -191,41 +181,40 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
             var result = new List<Token>();
             var startIndex = i;
             var parsing = ParsingPart.Name;
-            string name = null;
             var parameters = new List<ITokenParameter>();
+            string name = null;
             while (i < text.Length)
             {
                 switch (text[i])
                 {
                     case '.':
-                        if (name == null)
+                        if (parsing == ParsingPart.Name)
                         {
-                            name = text.Substring(startIndex, i - startIndex);
+                            // The previous token was an object property, not a method
+                            result.Add(new Token(text.Substring(startIndex, i - startIndex)));
                         }
                         startIndex = i + 1;
-                        result.Add(new Token(name, parameters));
-                        name = null;
                         parameters = new List<ITokenParameter>();
                         parsing = ParsingPart.Name;
                         break;
                     case '(':
                     {
                         name = text.Substring(startIndex, i - startIndex);
-                        i++;
                         parsing = ParsingPart.StartParameters;
+                        // Start parsing from the next index
+                        i++;
                         var param = ParseParameter(text, ref i);
                         if (param == null)
                         {
-                            parsing = ParsingPart.EndParameters;
-                        }
-                        else
-                        {
-                            parameters.Add(param);
+                            // The next character was a ')', empty params
+                            // Evaluate the current position
+                            continue;
                         }
+                        parameters.Add(param);
                         break;
                     }
                     case ',' when text[i+1] != ' ':
-                    case ' ' when text[i+1] != ' ':
+                    case ' ' when text[i+1] != ' ' && text[i+1] != ')':
                     {
                         if (parsing != ParsingPart.StartParameters)
                         {
@@ -236,31 +225,33 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
                         var param = ParseParameter(text, ref i);
                         if (param == null)
                         {
-                            parsing = ParsingPart.EndParameters;
-                        }
-                        else
-                        {
-                            parameters.Add(param);
+                            // The next character was a ')', empty params
+                            // Evaluate the current position
+                            continue;
                         }
+                        parameters.Add(param);
                         break;
                     }
                     case ')' when parsing != ParsingPart.StartParameters:
-                        // The traversal already ended
-                        i--;
-                        if (name != null)
+                        // The current nested object already ended
+                        if (parsing == ParsingPart.Name)
                         {
-                            result.Add(new Token(name, parameters));
+                            // The previous token was an object property, not a method and finished
+                            result.Add(new Token(text.Substring(startIndex, i - startIndex)));
                         }
+                        i--;
                         return result;
                     case ')':
                         parsing = ParsingPart.EndParameters;
+                        result.Add(new Token(name, parameters));
                         break;
                 }
                 i++;
             }
-            if (name != null)
+            if (parsing == ParsingPart.Name)
             {
-                result.Add(new Token(name, parameters));
+                // The previous token was an object property, not a method and finished
+                result.Add(new Token(text.Substring(startIndex, i - startIndex)));
             }
             return result;
         }
@@ -297,38 +288,40 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
             }
             if (RegexEnum.IsMatch(parameterText))
             {
+                i += parameterText.Length - 1;
                 return new TraversalEnumParameter(parameterText);
             }
+            if (RegexParam.IsMatch(parameterText))
+            {
+                i += parameterText.Length - 1;
+                return new ContextBasedParameter(parameterText);
+            }
             throw new NotSupportedException($"Parameter {parameterText} not supported");
         }
         
         private static ITokenParameter ParseNumber(string text, ref int i)
         {
-            var match = RegexLong.Match(text.Substring(i));
-            if (match.Success)
+            var match = RegexNumeric.Match(text, i);
+            if (!match.Success)
             {
-                i += match.Value.Length - 1;
-                return NumericParameter.Create(Convert.ToInt64(match.Value.Substring(0, match.Value.Length-1)));
+                throw new InvalidOperationException(
+                    $"Could not parse numeric value from the beginning of {text.Substring(i)}");
             }
-            match = RegexFloat.Match(text.Substring(i));
-            if (match.Success)
+            var numericText = match.Value.ToUpper();
+            i += match.Value.Length - 1;
+            if (numericText.EndsWith("L"))
             {
-                i += match.Value.Length - 1;
-                return NumericParameter.Create(Convert.ToSingle(match.Value.Substring(0, match.Value.Length-1)));
+                return NumericParameter.Create(Convert.ToInt64(match.Value.Substring(0, match.Value.Length - 1)));
             }
-            match = RegexDouble.Match(text.Substring(i));
-            if (match.Success)
+            if (numericText.EndsWith("F"))
             {
-                i += match.Value.Length;
-                return NumericParameter.Create(Convert.ToSingle(match.Value));
+                return NumericParameter.Create(Convert.ToSingle(match.Value.Substring(0, match.Value.Length-1)));
             }
-            match = RegexInteger.Match(text.Substring(i));
-            if (!match.Success)
+            if (match.Groups[1].Value != "")
             {
-                throw new InvalidOperationException(
-                    $"Could not parse numeric value from the beginning of {text.Substring(i)}");
+                // Captured text with the decimal separator
+                return NumericParameter.Create(Convert.ToDouble(match.Value));
             }
-            i += match.Value.Length;
             return NumericParameter.Create(Convert.ToInt32(match.Value));
         }
         

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/69a710c8/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalPredicateParameter.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalPredicateParameter.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalPredicateParameter.cs
index 0d0dc49..83060c7 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalPredicateParameter.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalPredicateParameter.cs
@@ -52,7 +52,7 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
             return Tokens != null ? Tokens.GetHashCode() : 0;
         }
 
-        public object GetValue()
+        public object GetValue(IDictionary<string, object> contextParameterValues)
         {
             var type = typeof(P);
             object instance = null;
@@ -65,7 +65,8 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
                 {
                     throw new InvalidOperationException($"Predicate (P) method '{token}' not found for testing");
                 }
-                instance = method.Invoke(instance, new object[] {token.Parameters.Select(p => p.GetValue()).ToArray()});
+                instance = method.Invoke(instance,
+                    new object[] {token.Parameters.Select(p => p.GetValue(contextParameterValues)).ToArray()});
             }
             return instance;
         }


[36/39] tinkerpop git commit: Merge branch 'TINKERPOP-1851' into tp32

Posted by dk...@apache.org.
Merge branch 'TINKERPOP-1851' into tp32


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

Branch: refs/heads/TINKERPOP-1447
Commit: 97e3d1c07a6084134d0b9b365265661410d8460a
Parents: 97bb97f d217b82
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Dec 11 12:34:33 2017 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Dec 11 12:34:33 2017 -0500

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |  1 +
 .../tinkerpop/gremlin/console/Console.groovy    |  6 +-
 .../src/test/python/tests/test_console.py       | 68 ++++++++++++++++++++
 3 files changed, 72 insertions(+), 3 deletions(-)
----------------------------------------------------------------------



[27/39] tinkerpop git commit: Features discovery fix and DecimalConverter tests

Posted by dk...@apache.org.
Features discovery fix and DecimalConverter tests


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

Branch: refs/heads/TINKERPOP-1447
Commit: 2e5d893f7fb73b9f8877e35bfacd12cb4eca4483
Parents: 74d7ad6
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Mon Dec 4 12:10:55 2017 +0100
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Mon Dec 4 12:10:55 2017 +0100

----------------------------------------------------------------------
 .../Structure/IO/GraphSON/DecimalConverter.cs   |  1 +
 .../Structure/IO/GraphSON/GraphSONReader.cs     |  6 ++++-
 .../Structure/IO/GraphSON/NumberConverter.cs    |  8 ++++++-
 .../Gherkin/GherkinTestRunner.cs                |  4 ++--
 .../IO/GraphSON/GraphSONReaderTests.cs          | 24 ++++++++++++++++++++
 .../IO/GraphSON/GraphSONWriterTests.cs          | 10 ++++++++
 6 files changed, 49 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2e5d893f/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/DecimalConverter.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/DecimalConverter.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/DecimalConverter.cs
index 82cc646..6860137 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/DecimalConverter.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/DecimalConverter.cs
@@ -30,5 +30,6 @@ namespace Gremlin.Net.Structure.IO.GraphSON
         protected override string GraphSONTypeName => "BigDecimal";
         protected override Type HandledType => typeof(decimal);
         protected override string Prefix => "gx";
+        protected override bool StringifyValue => true;
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2e5d893f/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONReader.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONReader.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONReader.cs
index 60bafed..10835c8 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONReader.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONReader.cs
@@ -113,7 +113,11 @@ namespace Gremlin.Net.Structure.IO.GraphSON
         private dynamic ReadTypedValue(JToken typedValue)
         {
             var graphSONType = (string) typedValue[GraphSONTokens.TypeKey];
-            return _deserializerByGraphSONType[graphSONType].Objectify(typedValue[GraphSONTokens.ValueKey], this);
+            if (!_deserializerByGraphSONType.TryGetValue(graphSONType, out var deserializer))
+            {
+                throw new InvalidOperationException($"Deserializer for \"{graphSONType}\" not found");
+            }
+            return deserializer.Objectify(typedValue[GraphSONTokens.ValueKey], this);
         }
 
         private dynamic ReadDictionary(JToken jtokenDict)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2e5d893f/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/NumberConverter.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/NumberConverter.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/NumberConverter.cs
index 294db12..53dad94 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/NumberConverter.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/NumberConverter.cs
@@ -32,6 +32,7 @@ namespace Gremlin.Net.Structure.IO.GraphSON
         protected abstract string GraphSONTypeName { get; }
         protected abstract Type HandledType { get; }
         protected virtual string Prefix => "g";
+        protected virtual bool StringifyValue => false;
 
         public dynamic Objectify(JToken graphsonObject, GraphSONReader reader)
         {
@@ -40,7 +41,12 @@ namespace Gremlin.Net.Structure.IO.GraphSON
 
         public Dictionary<string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer)
         {
-            return GraphSONUtil.ToTypedValue(GraphSONTypeName, objectData, Prefix);
+            object value = objectData;
+            if (StringifyValue)
+            {
+                value = value?.ToString();
+            }
+            return GraphSONUtil.ToTypedValue(GraphSONTypeName, value, Prefix);
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2e5d893f/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs
index 3610199..9cb3cf0 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs
@@ -365,11 +365,11 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
                 dir.Parent != null;
                 dir = dir.Parent)
             {
-                if (dir.Name == "gremlin-dotnet" && dir.Parent?.Name == "tinkerpop")
+                if (dir.Name == "gremlin-dotnet" && dir.GetFiles("pom.xml").Length == 1)
                 {
                     rootDir = dir.Parent;
                     break;
-                }   
+                }
             }
             if (rootDir == null)
             {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2e5d893f/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONReaderTests.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONReaderTests.cs b/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONReaderTests.cs
index 747a94e..d82dc86 100644
--- a/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONReaderTests.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONReaderTests.cs
@@ -164,6 +164,30 @@ namespace Gremlin.Net.UnitTest.Structure.IO.GraphSON
         }
 
         [Fact]
+        public void ShouldDeserializeDecimal()
+        {
+            var serializedValue = "{\"@type\":\"gx:BigDecimal\",\"@value\":-8.201}";
+            var reader = CreateStandardGraphSONReader();
+
+            var jObject = JObject.Parse(serializedValue);
+            decimal deserializedValue = reader.ToObject(jObject);
+
+            Assert.Equal(-8.201M, deserializedValue);
+        }
+
+        [Fact]
+        public void ShouldDeserializeDecimalValueAsString()
+        {
+            var serializedValue = "{\"@type\":\"gx:BigDecimal\",\"@value\":\"7.50\"}";
+            var reader = CreateStandardGraphSONReader();
+
+            var jObject = JObject.Parse(serializedValue);
+            decimal deserializedValue = reader.ToObject(jObject);
+
+            Assert.Equal(7.5M, deserializedValue);
+        }
+
+        [Fact]
         public void ShouldDeserializeList()
         {
             var serializedValue = "[{\"@type\":\"g:Int32\",\"@value\":5},{\"@type\":\"g:Int32\",\"@value\":6}]";

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2e5d893f/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONWriterTests.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONWriterTests.cs b/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONWriterTests.cs
index 4cd831f..cf17b3c 100644
--- a/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONWriterTests.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONWriterTests.cs
@@ -80,6 +80,16 @@ namespace Gremlin.Net.UnitTest.Structure.IO.GraphSON
         }
 
         [Fact]
+        public void ShouldSerializeDecimal()
+        {
+            var writer = CreateStandardGraphSONWriter();
+
+            var graphSon = writer.WriteObject(6.5M);
+
+            Assert.Equal("{\"@type\":\"gx:BigDecimal\",\"@value\":\"6.5\"}", graphSon);
+        }
+
+        [Fact]
         public void ShouldSerializeBoolean()
         {
             var writer = CreateStandardGraphSONWriter();


[39/39] tinkerpop git commit: Added automatic tab generation for code snippets in asciidoc files.

Posted by dk...@apache.org.
Added automatic tab generation for code snippets in asciidoc files.


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

Branch: refs/heads/TINKERPOP-1447
Commit: 24dc1b7c13f1dd78dc30acbfe44e7ce0737261e8
Parents: a86097d
Author: Daniel Kuppitz <da...@hotmail.com>
Authored: Fri Dec 15 14:30:59 2017 -0700
Committer: Daniel Kuppitz <da...@hotmail.com>
Committed: Fri Dec 15 14:30:59 2017 -0700

----------------------------------------------------------------------
 docs/postprocessor/processor.awk     |   4 +
 docs/preprocessor/awk/tabify.awk     | 108 ++++++++++++++++++
 docs/preprocessor/preprocess-file.sh |   3 +-
 docs/sass/compile                    |  30 +++++
 docs/sass/tabs.scss                  | 178 ++++++++++++++++++++++++++++++
 docs/stylesheets/tabs.css            |  19 ++++
 6 files changed, 341 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/24dc1b7c/docs/postprocessor/processor.awk
----------------------------------------------------------------------
diff --git a/docs/postprocessor/processor.awk b/docs/postprocessor/processor.awk
index e640273..7f9d420 100644
--- a/docs/postprocessor/processor.awk
+++ b/docs/postprocessor/processor.awk
@@ -33,6 +33,10 @@ BEGIN {
   }
 }
 
+/<body/ {
+  print "<link rel=\"stylesheet\" href=\"/docs/x.y.z/stylesheets/tabs.css\" />"
+}
+
 !/<span class="comment">/ {
   if (firstMatch || !isHeader) {
     print gensub(/(<b class="conum">)\(([0-9]+)\)(<\/b>)/,

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/24dc1b7c/docs/preprocessor/awk/tabify.awk
----------------------------------------------------------------------
diff --git a/docs/preprocessor/awk/tabify.awk b/docs/preprocessor/awk/tabify.awk
new file mode 100644
index 0000000..bc8d644
--- /dev/null
+++ b/docs/preprocessor/awk/tabify.awk
@@ -0,0 +1,108 @@
+# 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://gremlin.guru)
+#
+function print_tabs(next_id, tabs, blocks) {
+
+  num_tabs = length(tabs)
+  x = next_id
+
+  print "++++"
+  print "<section class=\"tabs tabs-" num_tabs "\">"
+
+  for (i in tabs) {
+    title = tabs[i]
+    print "  <input id=\"tab-" id_part "-" x "\" type=\"radio\" name=\"radio-set-" id_part "-" next_id "\" class=\"tab-selector-" i "\"" (i == 1 ? " checked=\"checked\"" : "") " />"
+    print "  <label for=\"tab-" id_part "-" x "\" class=\"tab-label-" i "\">" title "</label>"
+    x++
+  }
+
+  for (i in blocks) {
+    print "  <div class=\"tabcontent\">"
+    print "    <div class=\"tabcontent-" i "\">"
+    print "++++\n"
+    print blocks[i]
+    print "++++"
+    print "    </div>"
+    print "  </div>"
+  }
+
+  print "</section>"
+  print "++++\n"
+}
+
+BEGIN {
+  id_part=systime()
+  status = 0
+  next_id = 1
+  block[0] = 0 # initialize "blocks" as an array
+  delete blocks[0]
+}
+
+/^\[gremlin-/ {
+  status = 1
+  lang = gensub(/^\[gremlin-([^,\]]+).*/, "\\1", "g", $0)
+  code = ""
+}
+
+/^\[source,/ {
+  if (status == 3) {
+    status = 1
+    lang = gensub(/^\[source,([^\]]+).*/, "\\1", "g", $0)
+    code = ""
+  }
+}
+
+! /^\[source,/ {
+  if (status == 3 && $0 != "") {
+    print_tabs(next_id, tabs, blocks)
+    next_id = next_id + length(tabs)
+    for (i in tabs) {
+      delete tabs[i]
+      delete blocks[i]
+    }
+    status = 0
+  }
+}
+
+/^----$/ {
+  if (status == 1) {
+    status = 2
+  } else if (status == 2) {
+    status = 3
+  }
+}
+
+{ if (status == 3) {
+    if ($0 == "----") {
+      i = length(blocks) + 1
+      if (i == 1) {
+        tabs[i] = "console (" lang ")"
+        blocks[i] = code_header code "\n" $0 "\n"
+        i++
+      }
+      tabs[i] = lang
+      blocks[i] = "[source," lang "]" code "\n" $0 "\n"
+    }
+  } else {
+    if (status == 0) print
+    else if (status == 1) code_header = $0
+    else code = code "\n" $0
+  }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/24dc1b7c/docs/preprocessor/preprocess-file.sh
----------------------------------------------------------------------
diff --git a/docs/preprocessor/preprocess-file.sh b/docs/preprocessor/preprocess-file.sh
index 0ca534a..33608d1 100755
--- a/docs/preprocessor/preprocess-file.sh
+++ b/docs/preprocessor/preprocess-file.sh
@@ -129,6 +129,7 @@ if [ ! ${SKIP} ] && [ $(grep -c '^\[gremlin' ${input}) -gt 0 ]; then
   fi
 
   sed 's/\t/    /g' ${input} |
+  awk -f ${AWK_SCRIPTS}/tabify.awk |
   awk -f ${AWK_SCRIPTS}/prepare.awk |
   awk -f ${AWK_SCRIPTS}/init-code-blocks.awk -v TP_HOME="${TP_HOME}" -v PYTHONPATH="${TP_HOME}/gremlin-python/target/classes/Lib" |
   awk -f ${AWK_SCRIPTS}/progressbar.awk -v tpl=${AWK_SCRIPTS}/progressbar.groovy.template |
@@ -139,7 +140,7 @@ if [ ! ${SKIP} ] && [ $(grep -c '^\[gremlin' ${input}) -gt 0 ]; then
   ${lb} awk -f ${AWK_SCRIPTS}/language-variants.awk > ${output}
 
   ps=(${PIPESTATUS[@]})
-  for i in {0..6}; do
+  for i in {0..7}; do
     ec=${ps[i]}
     [ ${ec} -eq 0 ] || break
   done

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/24dc1b7c/docs/sass/compile
----------------------------------------------------------------------
diff --git a/docs/sass/compile b/docs/sass/compile
new file mode 100755
index 0000000..002954e
--- /dev/null
+++ b/docs/sass/compile
@@ -0,0 +1,30 @@
+#!/bin/bash
+#
+#
+# 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.
+#
+
+DIR=`dirname $0`
+
+IF="${DIR}/tabs.scss"
+OF="${DIR}/../stylesheets/tabs.css"
+TF=`mktemp`
+
+scss --sourcemap=none -t compressed -C ${IF} ${OF}
+
+cat ${DIR}/../stylesheets/tinkerpop.css | awk 'BEGIN {p=1} {if (p) print} /\*\// {p=0}' | cat - ${OF} > ${TF} && mv ${TF} ${OF}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/24dc1b7c/docs/sass/tabs.scss
----------------------------------------------------------------------
diff --git a/docs/sass/tabs.scss b/docs/sass/tabs.scss
new file mode 100644
index 0000000..39c88f4
--- /dev/null
+++ b/docs/sass/tabs.scss
@@ -0,0 +1,178 @@
+/*
+ * 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.
+ */
+
+$blue: #3f6b9d;
+$orange: #e08f24;
+$white: #fefefe;
+$black: #1a1a1a;
+$gray: #eee;
+
+$active: #609060;
+$inactive: #e9ffe9;
+
+$tabHeight: 50px;
+$minTabs: 2;
+$maxTabs: 4;
+
+@mixin single-transition($property:all, $speed:150ms, $ease:ease, $delay: 0s) {
+  -webkit-transition: $property $speed $ease $delay;  
+  transition: $property $speed $ease $delay;
+}
+
+.tabs {
+
+  position: relative;
+  margin: 40px auto;
+  width: 1024px;
+  max-width: 100%;
+  overflow: hidden;
+  padding-top: 10px;
+  margin-bottom: 60px;
+
+  input  {
+    position: absolute;
+    z-index: 1000;
+    height: $tabHeight;
+    left: 0;
+    top: 0;
+    opacity: 0;
+    -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
+    filter: alpha(opacity=0);
+    cursor: pointer;
+    margin: 0;
+    &:hover + label {
+      background: $orange;
+    }
+  }
+
+  label {
+    background: $inactive;
+    color: $black;
+    font-size: 15px;
+    line-height: $tabHeight;
+    height: $tabHeight + 10;
+    position: relative;
+    top: 0;
+    padding: 0 20px;
+    float: left;
+    display: block;
+    letter-spacing: 1px;
+    text-transform: uppercase;
+    font-weight: bold;
+    text-align: center;
+    box-shadow: 2px 0 2px rgba(0,0,0,0.1), -2px 0 2px rgba(0,0,0,0.1);
+    box-sizing: border-box;
+    @include single-transition();
+    &:hover{
+      cursor: pointer;
+    }
+    &:after {
+      content: '';
+      background: $active;
+      position: absolute;
+      bottom: -2px;
+      left: 0;
+      width: 100%;
+      height: 2px;
+      display: block;
+    }
+  }  
+}
+
+@for $n from $minTabs through $maxTabs {
+
+  .tabs-#{$n} {
+
+    input {
+      width: 100% / $n;
+      @for $i from 1 through $n {
+        &.tab-selector-#{$i}{
+          left: ($i - 1) * (100% / $n);
+        }
+      }
+    }
+
+    label {
+      width: 100% / $n;
+    }
+  }
+}
+
+.tabs label:first-of-type {
+  z-index: 4;
+}
+.tab-label-2 {
+  z-index: 4;
+}
+.tab-label-3 {
+  z-index: 3;
+}
+.tab-label-4 {
+  z-index: 2;
+}
+
+.tabs input:checked + label {
+  background: $active;
+  color: $white;
+  z-index: 6;
+}
+
+.clear-shadow {
+  clear: both;
+}
+
+.tabcontent {
+  height: auto;
+  width: 100%;
+  float: left;
+  position: relative;
+  z-index: 5;
+  background: $gray;
+  top: -10px;
+  box-sizing: border-box;
+  &>div{
+    position: relative;
+    float: left;
+    width: 0;
+    height: 0;
+    box-sizing: border-box;
+    top: 0;
+    left: 0;
+    z-index: 1;
+    opacity: 0;
+    background: $gray;
+  }
+  .CodeRay {
+    background-color: $white;
+  }
+}
+
+@for $i from 1 through $maxTabs {
+  .tabs .tab-selector-#{$i}:checked ~ .tabcontent .tabcontent-#{$i} {
+    z-index: 100;
+    -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
+    filter: alpha(opacity=100);
+    opacity: 1;
+    width: 100%;
+    height: auto;
+    width: 100%;
+    height: auto;
+    padding-top: 30px;
+  }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/24dc1b7c/docs/stylesheets/tabs.css
----------------------------------------------------------------------
diff --git a/docs/stylesheets/tabs.css b/docs/stylesheets/tabs.css
new file mode 100644
index 0000000..df508b7
--- /dev/null
+++ b/docs/stylesheets/tabs.css
@@ -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.
+ */
+.tabs{position:relative;margin:40px auto;width:1024px;max-width:100%;overflow:hidden;padding-top:10px;margin-bottom:60px}.tabs input{position:absolute;z-index:1000;height:50px;left:0;top:0;opacity:0;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";filter:alpha(opacity=0);cursor:pointer;margin:0}.tabs input:hover+label{background:#e08f24}.tabs label{background:#e9ffe9;color:#1a1a1a;font-size:15px;line-height:50px;height:60px;position:relative;top:0;padding:0 20px;float:left;display:block;letter-spacing:1px;text-transform:uppercase;font-weight:bold;text-align:center;box-shadow:2px 0 2px rgba(0,0,0,0.1),-2px 0 2px rgba(0,0,0,0.1);box-sizing:border-box;-webkit-transition:all 150ms ease 0s;transition:all 150ms ease 0s}.tabs label:hover{cursor:pointer}.tabs label:after{content:'';background:#609060;position:absolute;bottom:-2px;left:0;width:100%;height:2px;display:block}.tabs-2 input{width:50%}.tabs-2 input.tab-selector-1{left:0%}.tabs-2 input.tab-selector-2{left:50%}.tabs-
 2 label{width:50%}.tabs-3 input{width:33.33333%}.tabs-3 input.tab-selector-1{left:0%}.tabs-3 input.tab-selector-2{left:33.33333%}.tabs-3 input.tab-selector-3{left:66.66667%}.tabs-3 label{width:33.33333%}.tabs-4 input{width:25%}.tabs-4 input.tab-selector-1{left:0%}.tabs-4 input.tab-selector-2{left:25%}.tabs-4 input.tab-selector-3{left:50%}.tabs-4 input.tab-selector-4{left:75%}.tabs-4 label{width:25%}.tabs label:first-of-type{z-index:4}.tab-label-2{z-index:4}.tab-label-3{z-index:3}.tab-label-4{z-index:2}.tabs input:checked+label{background:#609060;color:#fefefe;z-index:6}.clear-shadow{clear:both}.tabcontent{height:auto;width:100%;float:left;position:relative;z-index:5;background:#eee;top:-10px;box-sizing:border-box}.tabcontent>div{position:relative;float:left;width:0;height:0;box-sizing:border-box;top:0;left:0;z-index:1;opacity:0;background:#eee}.tabcontent .CodeRay{background-color:#fefefe}.tabs .tab-selector-1:checked ~ .tabcontent .tabcontent-1{z-index:100;-ms-filter:"progid:DXImag
 eTransform.Microsoft.Alpha(Opacity=100)";filter:alpha(opacity=100);opacity:1;width:100%;height:auto;width:100%;height:auto;padding-top:30px}.tabs .tab-selector-2:checked ~ .tabcontent .tabcontent-2{z-index:100;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";filter:alpha(opacity=100);opacity:1;width:100%;height:auto;width:100%;height:auto;padding-top:30px}.tabs .tab-selector-3:checked ~ .tabcontent .tabcontent-3{z-index:100;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";filter:alpha(opacity=100);opacity:1;width:100%;height:auto;width:100%;height:auto;padding-top:30px}.tabs .tab-selector-4:checked ~ .tabcontent .tabcontent-4{z-index:100;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";filter:alpha(opacity=100);opacity:1;width:100%;height:auto;width:100%;height:auto;padding-top:30px}


[14/39] tinkerpop git commit: Add support for more steps

Posted by dk...@apache.org.
Add support for more steps


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

Branch: refs/heads/TINKERPOP-1447
Commit: bfb9df397dd47b5ac2ffaf52d5c452213c5319e0
Parents: 4b86d19
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Thu Nov 16 09:26:38 2017 +0100
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Thu Nov 30 10:00:09 2017 +0100

----------------------------------------------------------------------
 .../Process/Traversal/DefaultTraversal.cs       |   5 +
 .../Gremlin.Net/Process/Traversal/ITraversal.cs |  11 +-
 .../Gherkin/CommonSteps.cs                      | 153 +++++++++++--------
 .../Gherkin/GherkinTestRunner.cs                |  43 +++++-
 .../Gherkin/ScenarioData.cs                     |  96 ++++++++++--
 .../ModernGraphTypeInformation.cs               |  11 +-
 .../TraversalEvaluation/StringParameter.cs      |   4 +-
 .../TraversalEvaluationTests.cs                 |   4 +-
 .../TraversalEvaluation/TraversalParser.cs      |   8 +-
 .../GraphTraversalTests.cs                      |  17 ---
 10 files changed, 240 insertions(+), 112 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bfb9df39/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/DefaultTraversal.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/DefaultTraversal.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/DefaultTraversal.cs
index 180054e..58c3428 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/DefaultTraversal.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/DefaultTraversal.cs
@@ -51,6 +51,11 @@ namespace Gremlin.Net.Process.Traversal
         /// </summary>
         public IEnumerable<Traverser> Traversers { get; set; }
 
+        ITraversal ITraversal.Iterate()
+        {
+            return Iterate();
+        }
+
         /// <summary>
         ///     Gets or sets the <see cref="ITraversalStrategy" /> strategies of this traversal.
         /// </summary>

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bfb9df39/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/ITraversal.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/ITraversal.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/ITraversal.cs
index c519ee6..498ef7f 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/ITraversal.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/ITraversal.cs
@@ -22,6 +22,7 @@
 #endregion
 
 using System;
+using System.Collections;
 using System.Collections.Generic;
 using System.Threading.Tasks;
 
@@ -31,7 +32,7 @@ namespace Gremlin.Net.Process.Traversal
     /// Represents the basic information for a walk over a graph.
     /// </summary>
     /// <seealso cref="ITraversal{SType, EType}"/>
-    public interface ITraversal
+    public interface ITraversal: IEnumerator
     {
         /// <summary>
         ///     Gets the <see cref="Bytecode" /> representation of this traversal.
@@ -47,6 +48,12 @@ namespace Gremlin.Net.Process.Traversal
         ///     Gets or sets the <see cref="Traverser" />'s of this traversal that hold the results of the traversal.
         /// </summary>
         IEnumerable<Traverser> Traversers { get; set; }
+
+        /// <summary>
+        ///     Iterates all <see cref="Traverser" /> instances in the traversal.
+        /// </summary>
+        /// <returns>The fully drained traversal.</returns>
+        ITraversal Iterate();
     }
 
     /// <summary>
@@ -71,7 +78,7 @@ namespace Gremlin.Net.Process.Traversal
         ///     Iterates all <see cref="Traverser" /> instances in the traversal.
         /// </summary>
         /// <returns>The fully drained traversal.</returns>
-        ITraversal<S, E> Iterate();
+        new ITraversal<S, E> Iterate();
 
         /// <summary>
         ///     Gets the next <see cref="Traverser" />.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bfb9df39/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
index 4a4d18e..1ccf01d 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
@@ -31,47 +31,53 @@ using Gremlin.Net.IntegrationTest.Gherkin.Attributes;
 using Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation;
 using Gremlin.Net.Process.Traversal;
 using Gremlin.Net.Structure;
-using Newtonsoft.Json;
 using Newtonsoft.Json.Linq;
 using Xunit;
 
 namespace Gremlin.Net.IntegrationTest.Gherkin
 {
-    internal class GeneralDefinitions : StepDefinition
+    internal class CommonSteps : StepDefinition
     {
         private GraphTraversalSource _g;
+        private string _graphName;
         private readonly IDictionary<string, object> _parameters = new Dictionary<string, object>();
         private dynamic _traversal;
         private object[] _result;
 
-        private static readonly IDictionary<Regex, Func<string, object>> Parsers =
-            new Dictionary<string, Func<string, object>>
+        private static readonly IDictionary<Regex, Func<string, string, object>> Parsers =
+            new Dictionary<string, Func<string, string, object>>
             {
-                {@"d\[(\d+)\]", x => Convert.ToInt64(x)},
-                {@"d\[(\d+(?:\.\d+)?)\]", x => Convert.ToDouble(x)},
+                {@"d\[(\d+)\]", (x, _) => Convert.ToInt32(x)},
+                {@"d\[(\d+(?:\.\d+)?)\]", (x, _) => Convert.ToDouble(x)},
                 {@"v\[(.+)\]", ToVertex},
-                {@"v\[(.+)\]\.id", x => ToVertex(x).Id},
-                {@"v\[(.+)\]\.sid", x => ToVertex(x).Id.ToString()},
+                {@"v\[(.+)\]\.id", (x, graphName) => ToVertex(x, graphName).Id},
+                {@"v\[(.+)\]\.sid", (x, graphName) => ToVertex(x, graphName).Id.ToString()},
                 {@"e\[(.+)\]", ToEdge},
-                {@"e\[(.+)\].id", s => ToEdge(s).Id},
-                {@"e\[(.+)\].sid", s => ToEdge(s).Id.ToString()},
+                {@"e\[(.+)\].id", (x, graphName) => ToEdge(x, graphName).Id},
+                {@"e\[(.+)\].sid", (x, graphName) => ToEdge(x, graphName).Id.ToString()},
                 {@"p\[(.+)\]", ToPath},
                 {@"l\[(.+)\]", ToList},
                 {@"s\[(.+)\]", ToSet},
-                {@"m\[(.+)\]", ToMap},
+                {@"m\[(.+)\]", ToMap}
             }.ToDictionary(kv => new Regex("^" + kv.Key + "$", RegexOptions.Compiled), kv => kv.Value);
-        
-        [Given("the modern graph")]
-        public void ChooseModernGraph()
+
+        [Given("the (\\w+) graph")]
+        public void ChooseModernGraph(string graphName)
         {
-            var connection = ConnectionFactory.CreateRemoteConnection();
-            _g = new Graph().Traversal().WithRemote(connection);
+            if (graphName == "empty")
+            {
+                ScenarioData.CleanEmptyData();
+            }
+            var data = ScenarioData.GetByGraphName(graphName);
+            _graphName = graphName;
+            _g = new Graph().Traversal().WithRemote(data.Connection);
         }
 
         [Given("using the parameter (\\w+) defined as \"(.*)\"")]
         public void UsingParameter(string name, string value)
         {
-            _parameters.Add(name, ParseValue(value));
+            var parsedValue = ParseValue(value, _graphName);
+            _parameters.Add(name, parsedValue);
         }
 
         [Given("the traversal of")]
@@ -84,6 +90,25 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
             _traversal = TraversalParser.GetTraversal(traversalText, _g, _parameters);
         }
 
+        [Given("the graph initializer of")]
+        public void InitTraversal(string traversalText)
+        {
+            var traversal = TraversalParser.GetTraversal(traversalText, _g, _parameters);
+            traversal.Iterate();
+            
+            // We may have modified the so-called `empty` graph
+            if (_graphName == "empty")
+            {
+                ScenarioData.ReloadEmptyData();
+            }
+        }
+
+        [Given("an unsupported test")]
+        public void UnsupportedTest()
+        {
+            
+        }
+
         [When("iterated to list")]
         public void IterateToList()
         {
@@ -106,36 +131,29 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
         }
 
         [Then("the result should be (\\w+)")]
-        public void AssertResult(string characterizedAs, DataTable table)
+        public void AssertResult(string characterizedAs, DataTable table = null)
         {
-            TableRow[] rows;
+            var ordered = characterizedAs == "ordered";
             switch (characterizedAs)
             {
                 case "empty":
                     Assert.Equal(0, _result.Length);
                     return;
                 case "ordered":
-                    rows = table.Rows.ToArray();
-                    Assert.Equal(rows.Length, _result.Length);
-                    for (var i = 0; i < rows.Length; i++)
+                case "unordered":
+                    Assert.NotNull(table);
+                    var rows = table.Rows.ToArray();
+                    Assert.Equal("result", rows[0].Cells.First().Value);
+                    var expected = rows.Skip(1).Select(x => ParseValue(x.Cells.First().Value, _graphName));
+                    if (ordered)
                     {
-                        var row = rows[i];
-                        var cells = row.Cells.ToArray();
-                        var expectedValue = ParseValue(cells[0].Value);
-                        var resultItem = ConvertResultItem(null, _result[i]);
-                        Assert.Equal(expectedValue, resultItem);
+                        Assert.Equal(expected, _result);
                     }
-                    break;
-                case "unordered":
-                    rows = table.Rows.ToArray();
-                    Assert.Equal(rows.Length, _result.Length);
-                    foreach (var row in rows)
+                    else
                     {
-                        var cells = row.Cells.ToArray();
-                        var expectedValue = ParseValue(cells[0].Value);
-                        // Convert all the values in the result to the type
-                        var convertedResult = _result.Select(item => ConvertResultItem(null, item));
-                        Assert.Contains(expectedValue, convertedResult);
+                        var expectedArray = expected.OrderBy(x => x).ToArray();
+                        var resultArray = _result.OrderBy(x => x).ToArray();
+                        Assert.Equal(expectedArray, resultArray);
                     }
                     break;
                 default:
@@ -143,61 +161,68 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
             }
         }
 
-        private object ConvertResultItem(string typeName, object value)
+        [Then("the result should have a count of (\\d+)")]
+        public void AssertCount(int count)
         {
-            if (typeName == "map")
-            {
-                // We need to convert the original typed value into IDictionary<string, string>
-                return StringMap(
-                    Assert.IsAssignableFrom<IDictionary>(value));
-            }
-            return value;
+            Assert.Equal(count, _result.Length);
         }
 
-        private IDictionary<string, string> StringMap(IDictionary originalMap)
+        [Then("the graph should return (\\d+) for count of (.+)")]
+        public void AssertTraversalCount(int expectedCount, string traversalText)
         {
-            var result = new Dictionary<string, string>(originalMap.Count);
-            foreach (var key in originalMap.Keys)
+            if (traversalText.StartsWith("\""))
             {
-                result.Add(key.ToString(), originalMap[key]?.ToString());
+                traversalText = traversalText.Substring(1, traversalText.Length - 2);
             }
-            return result;
+            var traversal = TraversalParser.GetTraversal(traversalText, _g, _parameters);
+            var count = 0;
+            while (traversal.MoveNext())
+            {
+                count++;
+            }
+            Assert.Equal(expectedCount, count);
+        }
+
+        [Then("nothing should happen because")]
+        public void AssertNothing(string reason)
+        {
+            
         }
 
-        private static IDictionary ToMap(string stringMap)
+        private static IDictionary ToMap(string stringMap, string graphName)
         {
             var jsonMap = JObject.Parse(stringMap);
             return (IDictionary) jsonMap.ToObject<IDictionary<string, object>>();
         }
 
-        private static ISet<object> ToSet(string stringSet)
+        private static ISet<object> ToSet(string stringSet, string graphName)
         {
-            return new HashSet<object>(ToList(stringSet));
+            return new HashSet<object>(ToList(stringSet, graphName));
         }
 
-        private static IList<object> ToList(string stringList)
+        private static IList<object> ToList(string stringList, string graphName)
         {
-            return stringList.Split(',').Select(ParseValue).ToArray();
+            return stringList.Split(',').Select(x => ParseValue(x, graphName)).ToArray();
         }
 
-        private static Vertex ToVertex(string name)
+        private static Vertex ToVertex(string name, string graphName)
         {
-            return ScenarioData.Instance.ModernVertices[name];
+            return ScenarioData.GetByGraphName(graphName).Vertices[name];
         }
 
-        private static Edge ToEdge(string name)
+        private static Edge ToEdge(string name, string graphName)
         {
-            return ScenarioData.Instance.ModernEdges[name];
+            return ScenarioData.GetByGraphName(graphName).Edges[name];
         }
 
-        private static Path ToPath(string value)
+        private static Path ToPath(string value, string graphName)
         {
-            return new Path(new List<List<string>>(0), value.Split(',').Select(ParseValue).ToList());
+            return new Path(new List<List<string>>(0), value.Split(',').Select(x => ParseValue(x, graphName)).ToList());
         }
 
-        private static object ParseValue(string stringValue)
+        private static object ParseValue(string stringValue, string graphName)
         {
-            Func<string, object> parser = null;
+            Func<string, string, object> parser = null;
             string extractedValue = null;
             foreach (var kv in Parsers)
             {
@@ -209,7 +234,7 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
                     break;
                 }
             }
-            return parser != null ? parser(extractedValue) : stringValue;
+            return parser != null ? parser(extractedValue, graphName) : stringValue;
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bfb9df39/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs
index d850d08..fdee536 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs
@@ -111,6 +111,7 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
             }
             OutputResults(results);
             Console.WriteLine("Finished Gherkin-based tests");
+            ScenarioData.Shutdown();
         }
 
         private void WriteOutput(string line)
@@ -122,8 +123,8 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
         {
             var totalScenarios = results.Sum(f => f.Scenarios.Count);
             var totalFailedScenarios = results.Sum(f => f.Scenarios.Count(s => s.Value.Count > 0));
-            WriteOutput("Gherkin tests summary");
-            WriteOutput($"Total scenarios: {totalScenarios}. " +
+            Console.WriteLine("Gherkin tests summary");
+            Console.WriteLine($"Total scenarios: {totalScenarios}. " +
                               $"Passed: {totalScenarios-totalFailedScenarios}. Failed: {totalFailedScenarios}.");
             if (totalFailedScenarios == 0)
             {
@@ -188,6 +189,7 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
                 .Select(m =>
                 {
                     var attr = (BddAttribute) m.GetCustomAttribute(attribute);
+                    
                     if (attr == null)
                     {
                         return null;
@@ -210,7 +212,18 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
                     {
                         parameters.Add(step.Argument);
                     }
-                    if (m.GetParameters().Length != parameters.Count)
+                    var methodParameters = m.GetParameters();
+                    for (var i = parameters.Count; i < methodParameters.Length; i++)
+                    {
+                        // Try to complete with default parameter values
+                        var paramInfo = methodParameters[i];
+                        if (!paramInfo.HasDefaultValue)
+                        {
+                            break;
+                        }
+                        parameters.Add(paramInfo.DefaultValue);
+                    }
+                    if (methodParameters.Length != parameters.Count)
                     {
                         return null;
                     }
@@ -224,7 +237,19 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
             }
             try
             {
-                methodAndParameters.Item1.Invoke(instance, methodAndParameters.Item2);
+                var method = methodAndParameters.Item1;
+                var parameters = methodAndParameters.Item2;
+                var parameterInfos = method.GetParameters();
+                for (var i = 0; i < parameterInfos.Length; i++)
+                {
+                    var paramInfo = parameterInfos[i];
+                    // Do some minimal conversion => regex capturing groups to int
+                    if (paramInfo.ParameterType == typeof(int))
+                    {
+                        parameters[i] = Convert.ToInt32(parameters[i]);
+                    }
+                }
+                method.Invoke(instance, parameters);
             }
             catch (TargetInvocationException ex)
             {
@@ -300,8 +325,14 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
             WriteOutput(path);
             WriteOutput("------");
 
-            var files = new [] {"/Users/jorge/workspace/temp/count.feature"};
-            //var files = Directory.GetFiles(path, "*.feature", SearchOption.AllDirectories);
+            var files = new []
+            {
+                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/Sum.feature",
+//                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/Coalesce.feature",
+                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/AddEdge.feature"
+            };
+//            var files = new [] {"/Users/jorge/workspace/temp/count.feature"};
+//            var files = Directory.GetFiles(path, "*.feature", SearchOption.AllDirectories);
             foreach (var gherkinFile in files)
             {
                 var parser = new Parser();

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bfb9df39/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/ScenarioData.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/ScenarioData.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/ScenarioData.cs
index d9f66ff..919da0b 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/ScenarioData.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/ScenarioData.cs
@@ -26,45 +26,91 @@ using System.Collections.Generic;
 using System.Linq;
 using System.Text.RegularExpressions;
 using Gremlin.Net.IntegrationTest.Process.Traversal.DriverRemoteConnection;
+using Gremlin.Net.Process.Remote;
 using Gremlin.Net.Process.Traversal;
 using Gremlin.Net.Structure;
 
 namespace Gremlin.Net.IntegrationTest.Gherkin
 {
-    public class ScenarioData
+    internal class ScenarioData
     {
         private static readonly Lazy<ScenarioData> Lazy = new Lazy<ScenarioData>(Load);
         
-        public static ScenarioData Instance => Lazy.Value;
-        
         private static readonly Regex EdgeORegex = new Regex("o=(.+?)[,}]", RegexOptions.Compiled);
         private static readonly Regex EdgeLRegex = new Regex("l=(.+?)[,}]", RegexOptions.Compiled);
         private static readonly Regex EdgeIRegex = new Regex("i=(.+?)[,}]", RegexOptions.Compiled);
-
-        public IDictionary<string, Vertex> ModernVertices { get; }
         
-        public IDictionary<string, Edge> ModernEdges { get; }
+        private static readonly string[] GraphNames = {"modern", "classic", "crew", "grateful"};
+        
+        private static readonly RemoteConnectionFactory ConnectionFactory = new RemoteConnectionFactory();
+
+        public static ScenarioDataPerGraph GetByGraphName(string name)
+        {
+            if (name == null)
+            {
+                throw new ArgumentNullException(nameof(name), "Graph name can not be empty");
+            }
+            var dataPerGraph = Lazy.Value._dataPerGraph;
+            if (!dataPerGraph.TryGetValue(name, out var data))
+            {
+                throw new KeyNotFoundException($"Graph data with key '{name}' not found");
+            }
+            return data;
+        }
+
+        public static void Shutdown()
+        {
+            ConnectionFactory.Dispose();
+        }
+
+        public static void CleanEmptyData()
+        {
+            var g = new Graph().Traversal().WithRemote(GetByGraphName("empty").Connection);
+            g.V().Drop().Iterate();
+        }
+
+        public static void ReloadEmptyData()
+        {
+            var graphData = Lazy.Value._dataPerGraph["empty"];
+            var g = new Graph().Traversal().WithRemote(graphData.Connection);
+            graphData.Vertices = GetVertices(g);
+            graphData.Edges = GetEdges(g);
+        }
+
+        private readonly IDictionary<string, ScenarioDataPerGraph> _dataPerGraph;
         
-        private ScenarioData(IDictionary<string, Vertex> modernVertices, IDictionary<string, Edge> modernEdges)
+        private ScenarioData(IDictionary<string, ScenarioDataPerGraph> dataPerGraph)
         {
-            ModernVertices = modernVertices;
-            ModernEdges = modernEdges;
+            _dataPerGraph = new Dictionary<string, ScenarioDataPerGraph>(dataPerGraph);
+            var empty = new ScenarioDataPerGraph("empty", ConnectionFactory.CreateRemoteConnection("ggraph"),
+                new Dictionary<string, Vertex>(0), new Dictionary<string, Edge>());
+            _dataPerGraph.Add("empty", empty);
         }
 
         private static ScenarioData Load()
         {
-            var connectionFactory = new RemoteConnectionFactory();
-            var g = new Graph().Traversal().WithRemote(connectionFactory.CreateRemoteConnection());
-            var vertices = g.V().Group<string, object>().By("name").By(__.Tail<Vertex>()).Next()
+            return new ScenarioData(GraphNames.Select(name =>
+            {
+                var connection = ConnectionFactory.CreateRemoteConnection($"g{name}");
+                var g = new Graph().Traversal().WithRemote(connection);
+                return new ScenarioDataPerGraph(name, connection, GetVertices(g), GetEdges(g));
+            }).ToDictionary(x => x.Name));
+        }
+
+        private static IDictionary<string, Vertex> GetVertices(GraphTraversalSource g)
+        {
+            return g.V().Group<string, object>().By("name").By(__.Tail<Vertex>()).Next()
                 .ToDictionary(kv => kv.Key, kv => (Vertex)kv.Value);
-            var edges = g.E().Group<string, object>()
+        }
+
+        private static IDictionary<string, Edge> GetEdges(GraphTraversalSource g)
+        {
+            return g.E().Group<string, object>()
                 .By(__.Project<Edge>("o", "l", "i")
                     .By(__.OutV().Values<string>("name")).By(__.Label()).By(__.InV().Values<string>("name")))
                 .By(__.Tail<object>())
                 .Next()
                 .ToDictionary(kv => GetEdgeKey(kv.Key), kv => (Edge)kv.Value);
-            connectionFactory.Dispose();
-            return new ScenarioData(vertices, edges);
         }
 
         private static string GetEdgeKey(string key)
@@ -75,4 +121,24 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
             return o + "-" + l + "->" + i;
         }
     }
+
+    internal class ScenarioDataPerGraph
+    {
+        public ScenarioDataPerGraph(string name, IRemoteConnection connection, IDictionary<string, Vertex> vertices,
+                                    IDictionary<string, Edge> edges)
+        {
+            Name = name;
+            Connection = connection;
+            Vertices = vertices;
+            Edges = edges;
+        }
+
+        public string Name { get; }
+        
+        public IRemoteConnection Connection { get;  }
+        
+        public IDictionary<string, Vertex> Vertices { get; set; }
+        
+        public IDictionary<string, Edge> Edges { get; set; }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bfb9df39/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ModernGraphTypeInformation.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ModernGraphTypeInformation.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ModernGraphTypeInformation.cs
index 10d316d..a467519 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ModernGraphTypeInformation.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ModernGraphTypeInformation.cs
@@ -43,7 +43,7 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
         /// <summary>
         /// Gets the type argument information based on the modern graph.
         /// </summary>s
-        public static Type GetTypeArguments(MethodInfo method, object[] parameterValues)
+        public static Type GetTypeArguments(MethodInfo method, object[] parameterValues, int genericTypeIndex)
         {
             switch (method.Name)
             {
@@ -56,12 +56,19 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
                         return types[0];
                     }
                     return typeof(object);
+                case nameof(GraphTraversal<object,object>.Group) when genericTypeIndex == 0:
+                    // Use IDictionary<string, object> for Group
+                    return typeof(string);
                 case nameof(GraphTraversal<object,object>.ValueMap):
                 case nameof(GraphTraversal<object,object>.Select):
-                    // Use IDictionary<string, object> for value maps
+                case nameof(GraphTraversal<object,object>.Group):
+                case nameof(GraphTraversal<object,object>.Unfold):
+                    // default to object for this methods
                     return typeof(object);
                 case nameof(GraphTraversal<object,object>.Limit):
                 case nameof(GraphTraversal<object,object>.Optional):
+                case nameof(GraphTraversal<object,object>.Sum):
+                case nameof(GraphTraversal<object,object>.Coalesce):
                     // Maintain the same type
                     return method.DeclaringType.GetGenericArguments()[1];
             }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bfb9df39/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/StringParameter.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/StringParameter.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/StringParameter.cs
index 716a2ce..7cb9c95 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/StringParameter.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/StringParameter.cs
@@ -53,10 +53,10 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
             Value = value;
         }
 
-        public static StringParameter Parse(string text, ref int i)
+        public static StringParameter Parse(string text, char quoteChar, ref int i)
         {
             i++;
-            var endIndex = text.IndexOf('"', i);
+            var endIndex = text.IndexOf(quoteChar, i);
             var result = new StringParameter(text.Substring(i, endIndex - i));
             i = endIndex;
             return result;

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bfb9df39/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEvaluationTests.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEvaluationTests.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEvaluationTests.cs
index ade895c..a2dd888 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEvaluationTests.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEvaluationTests.cs
@@ -86,7 +86,9 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
                 Tuple.Create("g.V().count(Scope.local)", 2),
                 Tuple.Create("g.V().values(\"age\").is(P.lte(30))", 3),
                 Tuple.Create("g.V().optional(__.out().optional(__.out())).path().limit(1)", 4),
-                Tuple.Create("g.V(1).as(\"a\").out(\"knows\").as(\"b\").\n  select(\"a\", \"b\").by(\"name\")", 6)
+                Tuple.Create("g.V(1).as(\"a\").out(\"knows\").as(\"b\").\n  select(\"a\", \"b\").by(\"name\")", 6),
+                Tuple.Create(
+                    "g.V().hasLabel(\"software\").group().by(\"name\").by(__.bothE().values(\"weight\").sum())", 5)
             };
             var g = new Graph().Traversal();
             foreach (var tuple in traversalTexts)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bfb9df39/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
index 1f17ec8..d557c49 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
@@ -209,7 +209,7 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
                 if (!genericParameters.TryGetValue(name, out type))
                 {
                     // Try to infer it from the name based on modern graph
-                    type = ModernGraphTypeInformation.GetTypeArguments(method, parameterValues);
+                    type = ModernGraphTypeInformation.GetTypeArguments(method, parameterValues, i);
                 }
                 if (type == null)
                 {
@@ -295,6 +295,8 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
 
         private static IList<Token> ParseTokens(string text, ref int i)
         {
+            // Parser issue: quotes are not normalized
+            text = text.Replace("\\\"", "\"");
             var result = new List<Token>();
             var startIndex = i;
             var parsing = ParsingPart.Name;
@@ -379,9 +381,9 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
             {
                 return null;
             }
-            if (firstChar == '"')
+            if (firstChar == '"' || firstChar == '\'')
             {
-                return StringParameter.Parse(text, ref i);
+                return StringParameter.Parse(text, firstChar, ref i);
             }
             if (char.IsDigit(firstChar))
             {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bfb9df39/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 8118209..454ac68 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
@@ -96,23 +96,6 @@ namespace Gremlin.Net.IntegrationTest.Process.Traversal.DriverRemoteConnection
         }
 
         [Fact]
-        public void g_V_HasXname_markoX_ValueMap_Next()
-        {
-            var graph = new Graph();
-            var connection = _connectionFactory.CreateRemoteConnection();
-            var g = graph.Traversal().WithRemote(connection);
-
-            var receivedValueMap = g.V().Has("name", "marko").ValueMap<object>().Next();
-
-            var expectedValueMap = new Dictionary<string, object>
-            {
-                {"age", new List<object> {29}},
-                {"name", new List<object> {"marko"}}
-            };
-            Assert.Equal(expectedValueMap, receivedValueMap);
-        }
-
-        [Fact]
         public void g_V_RepeatXOutX_TimesX2X_ValuesXNameX()
         {
             var graph = new Graph();


[18/39] tinkerpop git commit: Use non-dynamic traversal evaluation and support numeric conversion

Posted by dk...@apache.org.
Use non-dynamic traversal evaluation and support numeric conversion


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

Branch: refs/heads/TINKERPOP-1447
Commit: 9672dd048b48a186df41b5f8309c95393f799c9e
Parents: 5d15f2e
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Tue Nov 21 11:44:03 2017 +0100
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Thu Nov 30 10:01:21 2017 +0100

----------------------------------------------------------------------
 .../Gherkin/CommonSteps.cs                      | 52 +++++++++++++++-----
 .../Gherkin/GherkinTestRunner.cs                | 33 +------------
 .../Gherkin/ScenarioData.cs                     | 40 ++++++++++++---
 .../ModernGraphTypeInformation.cs               | 29 +++--------
 .../TraversalEvaluationTests.cs                 | 10 ++--
 .../TraversalEvaluation/TraversalParser.cs      | 13 +++--
 6 files changed, 98 insertions(+), 79 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9672dd04/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
index 9bc36a6..fda44b8 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
@@ -41,13 +41,13 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
         private GraphTraversalSource _g;
         private string _graphName;
         private readonly IDictionary<string, object> _parameters = new Dictionary<string, object>();
-        private dynamic _traversal;
+        private ITraversal _traversal;
         private object[] _result;
 
         private static readonly IDictionary<Regex, Func<string, string, object>> Parsers =
             new Dictionary<string, Func<string, string, object>>
             {
-                {@"d\[([\d.]+)\]\.([ilfd])", ToNumber},
+                {@"d\[([\d.]+)\]\.([ilfdm])", ToNumber},
                 {@"v\[(.+)\]", ToVertex},
                 {@"v\[(.+)\]\.id", (x, graphName) => ToVertex(x, graphName).Id},
                 {@"v\[(.+)\]\.sid", (x, graphName) => ToVertex(x, graphName).Id.ToString()},
@@ -55,8 +55,8 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
                 {@"e\[(.+)\].id", (x, graphName) => ToEdge(x, graphName).Id},
                 {@"e\[(.+)\].sid", (x, graphName) => ToEdge(x, graphName).Id.ToString()},
                 {@"p\[(.+)\]", ToPath},
-                {@"l\[(.+)\]", ToList},
-                {@"s\[(.+)\]", ToSet},
+                {@"l\[(.*)\]", ToList},
+                {@"s\[(.*)\]", ToSet},
                 {@"m\[(.+)\]", ToMap},
                 {@"c\[(.+)\]", ToLambda}
             }.ToDictionary(kv => new Regex("^" + kv.Key + "$", RegexOptions.Compiled), kv => kv.Value);
@@ -67,7 +67,8 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
                 { 'i', s => Convert.ToInt32(s) },
                 { 'l', s => Convert.ToInt64(s) },
                 { 'f', s => Convert.ToSingle(s) },
-                { 'd', s => Convert.ToDouble(s) }
+                { 'd', s => Convert.ToDouble(s) },
+                { 'm', s => Convert.ToDecimal(s)}
             };
 
         [Given("the (\\w+) graph")]
@@ -121,22 +122,41 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
         [When("iterated to list")]
         public void IterateToList()
         {
-            if (!(_traversal is ITraversal))
+            if (_traversal == null)
             {
                 throw new InvalidOperationException("Traversal should be set before iterating");
             }
-            IEnumerable enumerable = _traversal.ToList();
-            _result = enumerable.Cast<object>().ToArray();
+            ITraversal t = _traversal;
+            var list = new List<object>();
+            while (t.MoveNext())
+            {
+                list.Add(t.Current);
+            }
+            _result = list.ToArray();
         }
 
         [When("iterated next")]
         public void IterateNext()
         {
-            if (!(_traversal is ITraversal))
+            if (_traversal == null)
             {
                 throw new InvalidOperationException("Traversal should be set before iterating");
             }
-            _result = _traversal.Next();
+            _traversal.MoveNext();
+            var result = _traversal.Current;
+            switch (result)
+            {
+                case null:
+                    _result = null;
+                    return;
+                case object[] arrayResult:
+                    _result = arrayResult;
+                    return;
+                case IEnumerable enumerableResult:
+                    _result = enumerableResult.Cast<object>().ToArray();
+                    return;
+            }
+            throw new InvalidCastException($"Can not convert instance of {result.GetType()} to object[]");
         }
 
         [Then("the result should be (\\w+)")]
@@ -150,6 +170,7 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
                     return;
                 case "ordered":
                 case "unordered":
+                case "of":
                     Assert.NotNull(table);
                     var rows = table.Rows.ToArray();
                     Assert.Equal("result", rows[0].Cells.First().Value);
@@ -165,7 +186,10 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
                         {
                             Assert.Contains(resultItem, expectedArray);
                         }
-                        Assert.Equal(expectedArray.Length, _result.Length);
+                        if (characterizedAs != "of")
+                        {
+                            Assert.Equal(expectedArray.Length, _result.Length);   
+                        }
                     }
                     break;
                 default:
@@ -248,7 +272,11 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
 
         private static IList<object> ToList(string stringList, string graphName)
         {
-            return stringList.Split(',').Select(x => ParseValue(x, graphName)).ToArray();
+            if (stringList == "")
+            {
+                return new List<object>(0);
+            }
+            return stringList.Split(',').Select(x => ParseValue(x, graphName)).ToList();
         }
 
         private static Vertex ToVertex(string name, string graphName)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9672dd04/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs
index cd03eca..dd5fbca 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs
@@ -53,11 +53,7 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
                 { "g_V_outXcreatedX_groupCount_byXnameX", IgnoreReason.MapCoersionIssue},
                 { "g_V_chooseXlabel_is_person__unionX__out_lang__out_nameX__in_labelX_groupCount", IgnoreReason
                 .MapCoersionIssue},
-                { "g_V_coalesceXoutXlikesX_outXknowsX_inXcreatedXX_groupCount_byXnameX", IgnoreReason.MapCoersionIssue},
-                
-                { "g_withSackX0X_V_outE_sackXsumX_byXweightX_inV_sack_sum", IgnoreReason.ScenarioDesignMapNumbers},
-                { "g_V_hasLabelXsoftwareX_group_byXnameX_byXbothE_weight_meanX", IgnoreReason.ScenarioDesignMapNumbers},
-                { "g_V_groupXaX_byXlabelX_byXoutE_weight_sumX_capXaX", IgnoreReason.ScenarioDesignMapNumbers}
+                { "g_V_coalesceXoutXlikesX_outXknowsX_inXcreatedXX_groupCount_byXnameX", IgnoreReason.MapCoersionIssue}
             };
         
         private static class Keywords
@@ -136,7 +132,7 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
                 }
             }
             OutputResults(results);
-            Console.WriteLine("Finished Gherkin-based tests");
+            WriteOutput("Finished Gherkin-based tests");
             ScenarioData.Shutdown();
         }
 
@@ -367,35 +363,10 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
         {
             var rootPath = GetRootPath();
             var path = Path.Combine(rootPath, "gremlin-test", "features");
-            WriteOutput(path);
-            WriteOutput("------");
-
-//            var files = new []
-//            {
-//                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/Sum.feature",
-////                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/Coalesce.feature",
-//                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/AddEdge.feature",
-//                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/AddVertex.feature",
-//                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/ValueMap.feature",
-//                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/Select.feature",
-//                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/Project.feature",
-//                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/Path.feature",
-//                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/Map.feature",
-//                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/Match.feature",
-//                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/Max.feature",
-//                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/Mean.feature",
-//                
-//                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/sideEffect/Sack.feature",
-//                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/sideEffect/Group.feature",
-////                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/sideEffect/GroupCount.feature",
-////                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/sideEffect/Inject.feature",
-//            };
-//            var files = new [] {"/Users/jorge/workspace/temp/count.feature"};
             var files = Directory.GetFiles(path, "*.feature", SearchOption.AllDirectories);
             foreach (var gherkinFile in files)
             {
                 var parser = new Parser();
-                WriteOutput("Parsing " + gherkinFile);
                 var doc = parser.Parse(gherkinFile);
                 yield return doc.Feature;
             }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9672dd04/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/ScenarioData.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/ScenarioData.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/ScenarioData.cs
index 919da0b..ed767d5 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/ScenarioData.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/ScenarioData.cs
@@ -23,8 +23,10 @@
 
 using System;
 using System.Collections.Generic;
+using System.Collections.ObjectModel;
 using System.Linq;
 using System.Text.RegularExpressions;
+using Gremlin.Net.Driver.Exceptions;
 using Gremlin.Net.IntegrationTest.Process.Traversal.DriverRemoteConnection;
 using Gremlin.Net.Process.Remote;
 using Gremlin.Net.Process.Traversal;
@@ -41,6 +43,12 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
         private static readonly Regex EdgeIRegex = new Regex("i=(.+?)[,}]", RegexOptions.Compiled);
         
         private static readonly string[] GraphNames = {"modern", "classic", "crew", "grateful"};
+
+        private static readonly IDictionary<string, Vertex> EmptyVertices =
+            new ReadOnlyDictionary<string, Vertex>(new Dictionary<string, Vertex>());
+        
+        private static readonly IDictionary<string, Edge> EmptyEdges =
+            new ReadOnlyDictionary<string, Edge>(new Dictionary<string, Edge>());
         
         private static readonly RemoteConnectionFactory ConnectionFactory = new RemoteConnectionFactory();
 
@@ -99,18 +107,34 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
 
         private static IDictionary<string, Vertex> GetVertices(GraphTraversalSource g)
         {
-            return g.V().Group<string, object>().By("name").By(__.Tail<Vertex>()).Next()
-                .ToDictionary(kv => kv.Key, kv => (Vertex)kv.Value);
+            try
+            {
+                return g.V().Group<string, object>().By("name").By(__.Tail<Vertex>()).Next()
+                    .ToDictionary(kv => kv.Key, kv => (Vertex) kv.Value);
+            }
+            catch (ResponseException)
+            {
+                // Property name might not exist
+                return EmptyVertices;
+            }
         }
 
         private static IDictionary<string, Edge> GetEdges(GraphTraversalSource g)
         {
-            return g.E().Group<string, object>()
-                .By(__.Project<Edge>("o", "l", "i")
-                    .By(__.OutV().Values<string>("name")).By(__.Label()).By(__.InV().Values<string>("name")))
-                .By(__.Tail<object>())
-                .Next()
-                .ToDictionary(kv => GetEdgeKey(kv.Key), kv => (Edge)kv.Value);
+            try
+            {
+                return g.E().Group<string, object>()
+                    .By(__.Project<Edge>("o", "l", "i")
+                        .By(__.OutV().Values<string>("name")).By(__.Label()).By(__.InV().Values<string>("name")))
+                    .By(__.Tail<object>())
+                    .Next()
+                    .ToDictionary(kv => GetEdgeKey(kv.Key), kv => (Edge)kv.Value);
+            }
+            catch (ResponseException)
+            {
+                // Property name might not exist
+                return EmptyEdges;
+            }
         }
 
         private static string GetEdgeKey(string key)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9672dd04/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ModernGraphTypeInformation.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ModernGraphTypeInformation.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ModernGraphTypeInformation.cs
index 3125aab..aec3d3e 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ModernGraphTypeInformation.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ModernGraphTypeInformation.cs
@@ -45,6 +45,12 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
         /// </summary>s
         public static Type GetTypeArguments(MethodInfo method, object[] parameterValues, int genericTypeIndex)
         {
+            var isGeneric = method.DeclaringType.GetTypeInfo().IsGenericType;
+            if (!isGeneric)
+            {
+                // Maintain object for anonymous traversal
+                return typeof(object);
+            }
             switch (method.Name)
             {
                 case nameof(GraphTraversal<object,object>.Properties):
@@ -68,31 +74,10 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
                 case nameof(GraphTraversal<object,object>.Match):
                     // Maintain the same type
                     return method.DeclaringType.GetGenericArguments()[1];
-                case nameof(GraphTraversal<object,object>.ValueMap):
-                case nameof(GraphTraversal<object,object>.Select):
-                case nameof(GraphTraversal<object,object>.Group):
-                case nameof(GraphTraversal<object,object>.GroupCount):
-                case nameof(GraphTraversal<object,object>.Unfold):
-                case nameof(GraphTraversal<object,object>.Choose):
-                case nameof(GraphTraversal<object,object>.Union):
-                case nameof(GraphTraversal<object,object>.Project):
-                case nameof(GraphTraversal<object,object>.Sack):
-                case nameof(GraphTraversal<object,object>.Map):
-                case nameof(GraphTraversal<object,object>.Max):
-                case nameof(GraphTraversal<object,object>.Min):
-                case nameof(GraphTraversal<object,object>.Mean):
-                case nameof(GraphTraversal<object,object>.Cap):
-                case nameof(GraphTraversal<object,object>.Constant):
-                case nameof(GraphTraversal<object,object>.Branch):
-                case nameof(GraphTraversal<object,object>.Local):
-                case nameof(GraphTraversal<object,object>.Tail):
-                case nameof(GraphTraversal<object,object>.Range):
-                case nameof(GraphTraversal<object,object>.Value):
-                case nameof(GraphTraversal<object,object>.Fold):
+                default:
                     // default to object for this methods
                     return typeof(object);
             }
-            return null;
         }
 
         private static Type GetElementPropertyType(string name)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9672dd04/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEvaluationTests.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEvaluationTests.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEvaluationTests.cs
index 3907dd2..94a8c99 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEvaluationTests.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEvaluationTests.cs
@@ -42,8 +42,8 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
                     new[] {new Token("constant", new[] {LiteralParameter.Create(123L)})}),
                 Tuple.Create("g.V().constant(123)", 
                     new[] {new Token("constant", new[] {LiteralParameter.Create(123)})}),
-                Tuple.Create("g.V().constant(123.1)", 
-                    new[] {new Token("constant", new[] {LiteralParameter.Create(123.1)})}),
+                Tuple.Create("g.V().constant(123.50)", 
+                    new[] {new Token("constant", new[] {LiteralParameter.Create(123.50m)})}),
                 Tuple.Create("g.V().constant(123.1f)", 
                     new[] {new Token("constant", new[] {LiteralParameter.Create(123.1f)})}),
                 Tuple.Create("g.V().has(\"no\").count()",
@@ -96,7 +96,11 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
                 Tuple.Create(
                     "g.V().hasLabel(\"software\").group().by(\"name\").by(__.bothE().values(\"weight\").sum())", 5),
                 Tuple.Create("g.V().choose(__.outE().count().is(0L),__.as(\"a\"),__.as(\"b\"))" +
-                                  "\n.choose(__.select(\"a\"),__.select(\"a\"),__.select(\"b\"))", 3)
+                                  "\n.choose(__.select(\"a\"),__.select(\"a\"),__.select(\"b\"))", 3),
+                Tuple.Create("g.V().repeat(__.out()).times(2) ", 3),
+                Tuple.Create("g.V().local(__.match(\n   __.as(\"project\").in(\"created\").as(\"person\"),\n__.as(\"person\").values(\"name\").as(\"name\"))).select(\"name\", \"project\").by().by(\"name\")", 5),
+                Tuple.Create("g.V().as(\"a\").out().as(\"a\").out().as(\"a\").select(\"a\").by(__.unfold().values(\"name\").fold()).tail(Scope.local, 2)", 9),
+                Tuple.Create("g.V().coin(1.0)", 2)
             };
             var g = new Graph().Traversal();
             foreach (var tuple in traversalTexts)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9672dd04/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
index 66aae70..827960d 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
@@ -244,6 +244,12 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
                         // if we have the type of value we have the type of E2. 
                         genericParameterTypes.Add(info.ParameterType.Name, tokenParameter.GetParameterType());
                     }
+                    if (info.ParameterType != tokenParameter.GetParameterType() && IsNumeric(info.ParameterType) &&
+                        IsNumeric(tokenParameter.GetParameterType()))
+                    {
+                        // Numeric conversion
+                        value = Convert.ChangeType(value, info.ParameterType);
+                    }
                 }
                 if (IsParamsArray(info))
                 {
@@ -332,8 +338,9 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
                         parameters.Add(param);
                         break;
                     }
-                    case ',' when text[i+1] != ' ' && parsing == ParsingPart.StartParameters:
-                    case ' ' when text[i+1] != ' ' && text[i+1] != ')' && parsing == ParsingPart.StartParameters:
+                    case ',' when parsing == ParsingPart.StartParameters && text.Length > i + 1 && text[i+1] != ' ':
+                    case ' ' when parsing == ParsingPart.StartParameters && text.Length > i + 1 && text[i+1] != ' ' &&
+                                  text[i+1] != ')':
                     {
                         i++;
                         var param = ParseParameter(text, ref i);
@@ -450,7 +457,7 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
             if (match.Groups[1].Value != "")
             {
                 // Captured text with the decimal separator
-                return LiteralParameter.Create(Convert.ToDouble(match.Value));
+                return LiteralParameter.Create(Convert.ToDecimal(match.Value));
             }
             return LiteralParameter.Create(Convert.ToInt32(match.Value));
         }


[32/39] tinkerpop git commit: Merge branch 'TINKERPOP-1827' into tp32

Posted by dk...@apache.org.
Merge branch 'TINKERPOP-1827' into tp32


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

Branch: refs/heads/TINKERPOP-1447
Commit: 6e60a290615aad406cf0a08049044f26b379dbac
Parents: b3adadc 2e5d893
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Tue Dec 5 14:21:18 2017 +0100
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Tue Dec 5 14:21:18 2017 +0100

----------------------------------------------------------------------
 .../Process/Traversal/DefaultTraversal.cs       |   5 +
 .../Gremlin.Net/Process/Traversal/ITraversal.cs |  11 +-
 .../Process/Traversal/Instruction.cs            |   2 +-
 .../Structure/IO/GraphSON/DecimalConverter.cs   |  35 ++
 .../Structure/IO/GraphSON/GraphSONReader.cs     |  21 +-
 .../Structure/IO/GraphSON/GraphSONWriter.cs     |   1 +
 .../Structure/IO/GraphSON/NumberConverter.cs    |   9 +-
 .../Gherkin/Attributes/BddAttribute.cs          |  37 ++
 .../Gherkin/Attributes/GivenAttribute.cs        |  33 ++
 .../Gherkin/Attributes/ThenAttribute.cs         |  33 ++
 .../Gherkin/Attributes/WhenAttribute.cs         |  33 ++
 .../Gherkin/CommonSteps.cs                      | 321 +++++++++++++
 .../Gherkin/GherkinTestRunner.cs                | 381 +++++++++++++++
 .../Gherkin/IgnoreException.cs                  |  55 +++
 .../Gherkin/ScenarioData.cs                     | 168 +++++++
 .../Gherkin/StepDefinition.cs                   |  39 ++
 .../ContextBasedParameter.cs                    |  83 ++++
 .../TraversalEvaluation/ITokenParameter.cs      |  46 ++
 .../TraversalEvaluation/LiteralParameter.cs     |  87 ++++
 .../ModernGraphTypeInformation.cs               |  89 ++++
 .../StaticTraversalParameter.cs                 |  77 +++
 .../TraversalEvaluation/StringParameter.cs      |  85 ++++
 .../Gherkin/TraversalEvaluation/Token.cs        |  92 ++++
 .../TraversalEnumParameter.cs                   | 103 ++++
 .../TraversalEvaluationTests.cs                 | 114 +++++
 .../TraversalEvaluation/TraversalParser.cs      | 474 +++++++++++++++++++
 .../TraversalPredicateParameter.cs              |  93 ++++
 .../Gremlin.Net.IntegrationTest.csproj          |  12 +-
 .../GraphTraversalTests.cs                      |  17 -
 .../RemoteConnectionFactory.cs                  |  18 +-
 .../IO/GraphSON/GraphSONReaderTests.cs          |  24 +
 .../IO/GraphSON/GraphSONWriterTests.cs          |  10 +
 gremlin-test/features/map/Match.feature         |  12 +-
 gremlin-test/features/sideEffect/Group.feature  |   2 +-
 34 files changed, 2578 insertions(+), 44 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6e60a290/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONReader.cs
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6e60a290/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONWriter.cs
----------------------------------------------------------------------
diff --cc gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONWriter.cs
index 4d99864,ab7e7d0..a60a558
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONWriter.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONWriter.cs
@@@ -49,8 -49,9 +49,9 @@@ namespace Gremlin.Net.Structure.IO.Grap
                  {typeof(long), new Int64Converter()},
                  {typeof(float), new FloatConverter()},
                  {typeof(double), new DoubleConverter()},
+                 {typeof(decimal), new DecimalConverter()},
                  {typeof(Guid), new UuidSerializer()},
 -                {typeof(DateTime), new DateSerializer()},
 +                {typeof(DateTimeOffset), new DateSerializer()},
                  {typeof(Type), new ClassSerializer()},
                  {typeof(Enum), new EnumSerializer()},
                  {typeof(TraversalPredicate), new TraversalPredicateSerializer()},

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6e60a290/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONReaderTests.cs
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6e60a290/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONWriterTests.cs
----------------------------------------------------------------------


[03/39] tinkerpop git commit: Gherkin-based test runner

Posted by dk...@apache.org.
Gherkin-based test runner


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

Branch: refs/heads/TINKERPOP-1447
Commit: cee68591c944fb23f1439b471db531f2823a8f9f
Parents: fe7b175
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Mon Sep 25 17:27:13 2017 +0200
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Thu Nov 30 10:00:07 2017 +0100

----------------------------------------------------------------------
 .../Gherkin/Attributes/BddAttribute.cs          |  37 ++
 .../Gherkin/Attributes/GivenAttribute.cs        |  33 ++
 .../Gherkin/Attributes/ThenAttribute.cs         |  33 ++
 .../Gherkin/Attributes/WhenAttribute.cs         |  33 ++
 .../Gherkin/CommonSteps.cs                      | 156 +++++++++
 .../Gherkin/GherkinTestRunner.cs                | 335 +++++++++++++++++++
 .../Gherkin/StepDefinition.cs                   |  39 +++
 .../Gherkin/TraversalTranslations.cs            | 102 ++++++
 .../Gremlin.Net.IntegrationTest.csproj          |  13 +-
 .../RemoteConnectionFactory.cs                  |  18 +-
 10 files changed, 790 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/cee68591/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/Attributes/BddAttribute.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/Attributes/BddAttribute.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/Attributes/BddAttribute.cs
new file mode 100644
index 0000000..1e9a242
--- /dev/null
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/Attributes/BddAttribute.cs
@@ -0,0 +1,37 @@
+#region License
+
+/*
+ * 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.
+ */
+
+#endregion
+
+using System;
+
+namespace Gremlin.Net.IntegrationTest.Gherkin.Attributes
+{
+    internal class BddAttribute : Attribute
+    {
+        public string Message { get; }
+
+        internal BddAttribute(string message)
+        {
+            Message = message;
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/cee68591/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/Attributes/GivenAttribute.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/Attributes/GivenAttribute.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/Attributes/GivenAttribute.cs
new file mode 100644
index 0000000..7266145
--- /dev/null
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/Attributes/GivenAttribute.cs
@@ -0,0 +1,33 @@
+#region License
+
+/*
+ * 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.
+ */
+
+#endregion
+
+namespace Gremlin.Net.IntegrationTest.Gherkin.Attributes
+{
+    internal class GivenAttribute : BddAttribute
+    {
+        public GivenAttribute(string message) : base(message)
+        {
+
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/cee68591/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/Attributes/ThenAttribute.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/Attributes/ThenAttribute.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/Attributes/ThenAttribute.cs
new file mode 100644
index 0000000..25e1932
--- /dev/null
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/Attributes/ThenAttribute.cs
@@ -0,0 +1,33 @@
+#region License
+
+/*
+ * 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.
+ */
+
+#endregion
+
+namespace Gremlin.Net.IntegrationTest.Gherkin.Attributes
+{
+    internal class ThenAttribute : BddAttribute
+    {
+        public ThenAttribute(string message) : base(message)
+        {
+
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/cee68591/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/Attributes/WhenAttribute.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/Attributes/WhenAttribute.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/Attributes/WhenAttribute.cs
new file mode 100644
index 0000000..26286c6
--- /dev/null
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/Attributes/WhenAttribute.cs
@@ -0,0 +1,33 @@
+#region License
+
+/*
+ * 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.
+ */
+
+#endregion
+
+namespace Gremlin.Net.IntegrationTest.Gherkin.Attributes
+{
+    internal class WhenAttribute : BddAttribute
+    {
+        public WhenAttribute(string message) : base(message)
+        {
+
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/cee68591/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
new file mode 100644
index 0000000..50ea9b8
--- /dev/null
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
@@ -0,0 +1,156 @@
+#region License
+
+/*
+ * 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.
+ */
+
+#endregion
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net.Http.Headers;
+using System.Runtime.CompilerServices;
+using Gherkin.Ast;
+using Gremlin.Net.IntegrationTest.Gherkin.Attributes;
+using Gremlin.Net.Process.Traversal;
+using Gremlin.Net.Structure;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using Xunit;
+
+namespace Gremlin.Net.IntegrationTest.Gherkin
+{
+    internal class GeneralDefinitions : StepDefinition
+    {
+        private GraphTraversalSource _g;
+        private dynamic _traversal;
+        private object[] _result;
+
+        private static readonly IDictionary<string, Func<GraphTraversalSource, ITraversal>> FixedTranslations = 
+            new Dictionary<string, Func<GraphTraversalSource, ITraversal>>
+            {
+                { "g.V().has(\"no\").count()", g => g.V().Has("no").Count() }
+            };
+        
+        [Given("the modern graph")]
+        public void ChooseModernGraph()
+        {
+            var connection = ConnectionFactory.CreateRemoteConnection();
+            _g = new Graph().Traversal().WithRemote(connection);
+        }
+
+        [When("iterated to list")]
+        public void IterateToList()
+        {
+            if (!(_traversal is ITraversal))
+            {
+                throw new InvalidOperationException("Traversal should be set before iterating");
+            }
+            IEnumerable enumerable = _traversal.ToList();
+            _result = enumerable.Cast<object>().ToArray();
+        }
+
+        [Given("the traversal of")]
+        public void TranslateTraversal(string traversalText)
+        {
+            if (_g == null)
+            {
+                throw new InvalidOperationException("g should be a traversal source");
+            }
+            _traversal = TraversalTranslations.GetTraversal(traversalText, _g);
+        }
+
+        [Then("the result should be (\\w+)")]
+        public void AssertResult(string characterizedAs, DataTable table)
+        {
+            TableRow[] rows;
+            switch (characterizedAs)
+            {
+                case "empty":
+                    Assert.Equal(0, _result.Length);
+                    return;
+                case "ordered":
+                    rows = table.Rows.ToArray();
+                    Assert.Equal(rows.Length, _result.Length);
+                    for (var i = 0; i < rows.Length; i++)
+                    {
+                        var row = rows[i];
+                        var cells = row.Cells.ToArray();
+                        var typeName = cells[0].Value;
+                        var expectedValue = ConvertExpectedToType(typeName, cells[1].Value);
+                        var resultItem = ConvertResultItem(typeName, _result[i]);
+                        Assert.Equal(expectedValue, resultItem);
+                    }
+                    break;
+                case "unordered":
+                    rows = table.Rows.ToArray();
+                    Assert.Equal(rows.Length, _result.Length);
+                    foreach (var row in rows)
+                    {
+                        var cells = row.Cells.ToArray();
+                        var typeName = cells[0].Value;
+                        var expectedValue = ConvertExpectedToType(typeName, cells[1].Value);
+                        // Convert all the values in the result to the type
+                        var convertedResult = _result.Select(item => ConvertResultItem(typeName, item));
+                        Assert.Contains(expectedValue, convertedResult);
+                    }
+                    break;
+                default:
+                    throw new NotSupportedException($"Result as '{characterizedAs}' not supported");
+            }
+        }
+
+        private object ConvertResultItem(string typeName, object value)
+        {
+            if (typeName == "map")
+            {
+                // We need to convert the original typed value into IDictionary<string, string>
+                return StringMap(
+                    Assert.IsAssignableFrom<IDictionary>(value));
+            }
+            return value;
+        }
+
+        private IDictionary<string, string> StringMap(IDictionary originalMap)
+        {
+            var result = new Dictionary<string, string>(originalMap.Count);
+            foreach (var key in originalMap.Keys)
+            {
+                result.Add(key.ToString(), originalMap[key]?.ToString());
+            }
+            return result;
+        }
+
+        private object ConvertExpectedToType(string typeName, string stringValue)
+        {
+            switch (typeName)
+            {
+                case "numeric":
+                    return Convert.ToInt64(stringValue);
+                case "string":
+                    return stringValue;
+                case "map":
+                    IDictionary<string, JToken> jsonObject = JObject.Parse(stringValue);
+                    return jsonObject.ToDictionary(item => item.Key, item => item.Value.ToString());
+            }
+            throw new NotSupportedException($"Data table result with subtype of {typeName} not supported");
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/cee68591/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs
new file mode 100644
index 0000000..e1df3a8
--- /dev/null
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs
@@ -0,0 +1,335 @@
+#region License
+
+/*
+ * 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.
+ */
+
+#endregion
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text.RegularExpressions;
+using Xunit;
+using Gherkin;
+using Gherkin.Ast;
+using Gremlin.Net.IntegrationTest.Gherkin.Attributes;
+using Microsoft.VisualStudio.TestPlatform.Utilities;
+using Newtonsoft.Json.Serialization;
+using Xunit.Abstractions;
+using Xunit.Sdk;
+
+namespace Gremlin.Net.IntegrationTest.Gherkin
+{
+    public class GherkinTestRunner
+    {
+        private readonly ITestOutputHelper _output;
+
+        private static class Keywords
+        {
+            public const string Given = "GIVEN";
+            public const string And = "AND";
+            public const string But = "BUT";
+            public const string When = "WHEN";
+            public const string Then = "THEN";
+        }
+
+        public enum StepBlock
+        {
+            Given,
+            When,
+            Then
+        }
+        
+        private static readonly IDictionary<StepBlock, Type> Attributes = new Dictionary<StepBlock, Type>
+        {
+            { StepBlock.Given, typeof(GivenAttribute) },
+            { StepBlock.When, typeof(WhenAttribute) },
+            { StepBlock.Then, typeof(ThenAttribute) }
+        };
+
+        public GherkinTestRunner(ITestOutputHelper output)
+        {
+            _output = output;
+        }
+
+        [Fact]
+        public void RunGherkinBasedTests()
+        {
+            Console.WriteLine("Starting Gherkin-based tests");
+            var stepDefinitionTypes = GetStepDefinitionTypes();
+            var results = new List<ResultFeature>();
+            foreach (var feature in GetFeatures())
+            {
+                var resultFeature = new ResultFeature(feature);
+                results.Add(resultFeature);
+                foreach (var scenario in feature.Children)
+                {
+                    var failedSteps = new Dictionary<Step, Exception>();
+                    resultFeature.Scenarios[scenario] = failedSteps;
+                    StepBlock? currentStep = null;
+                    StepDefinition stepDefinition = null;
+                    foreach (var step in scenario.Steps)
+                    {
+                        var previousStep = currentStep;
+                        currentStep = GetStepBlock(currentStep, step.Keyword);
+                        if (currentStep == StepBlock.Given && previousStep != StepBlock.Given)
+                        {
+                            stepDefinition?.Dispose();
+                            stepDefinition = GetStepDefinitionInstance(stepDefinitionTypes, step.Text);
+                        }
+                        if (stepDefinition == null)
+                        {
+                            throw new NotSupportedException(
+                                $"Step '{step.Text} not supported without a 'Given' step first");
+                        }
+                        var result = ExecuteStep(stepDefinition, currentStep.Value, step);
+                        if (result != null)
+                        {
+                            failedSteps.Add(step, result);
+                        }
+                    }
+                }
+            }
+            OutputResults(results);
+            Console.WriteLine("Finished Gherkin-based tests");
+        }
+
+        private void WriteOutput(string line)
+        {
+            _output.WriteLine(line);
+        }
+
+        private void OutputResults(List<ResultFeature> results)
+        {
+            var totalScenarios = results.Sum(f => f.Scenarios.Count);
+            var totalFailedScenarios = results.Sum(f => f.Scenarios.Count(s => s.Value.Count > 0));
+            WriteOutput("Gherkin tests summary");
+            WriteOutput($"Total scenarios: {totalScenarios}. " +
+                              $"Passed: {totalScenarios-totalFailedScenarios}. Failed: {totalFailedScenarios}.");
+            if (totalFailedScenarios == 0)
+            {
+                return;
+            }
+            var identifier = 0;
+            var failures = new List<Exception>();
+            foreach (var resultFeature in results)
+            {
+                var failedScenarios = resultFeature.Scenarios.Where(s => s.Value.Count > 0).ToArray();
+                if (failedScenarios.Length > 0)
+                {
+                    WriteOutput($"Feature: {resultFeature.Feature.Name}");   
+                }
+                else
+                {
+                    continue;
+                }
+                foreach (var resultScenario in failedScenarios)
+                {
+                    WriteOutput($"  Scenario: {resultScenario.Key.Name}");
+                    foreach (var step in resultScenario.Key.Steps)
+                    {
+                        Exception failure;
+                        resultScenario.Value.TryGetValue(step, out failure);
+                        if (failure == null)
+                        {
+                            WriteOutput($"    {step.Keyword} {step.Text}");
+                        }
+                        else
+                        {
+                            WriteOutput($"    {++identifier}) {step.Keyword} {step.Text} (failed)");
+                            failures.Add(failure);
+                        }
+                    }
+                }
+            }
+            WriteOutput("Failures:");
+            for (var index = 0; index < failures.Count; index++)
+            {
+                WriteOutput($"{index+1}) {failures[index]}");
+            }
+            throw new Exception($"Gherkin test failed, see summary above for more detail");
+        }
+
+        public class ResultFeature
+        {
+            public Feature Feature { get;}
+
+            public IDictionary<ScenarioDefinition, IDictionary<Step, Exception>> Scenarios { get; }
+
+            public ResultFeature(Feature feature)
+            {
+                Feature = feature;
+                Scenarios = new Dictionary<ScenarioDefinition, IDictionary<Step, Exception>>();
+            }
+        }
+
+        private Exception ExecuteStep(StepDefinition instance, StepBlock stepBlock, Step step)
+        {
+            var attribute = Attributes[stepBlock];
+            var methodAndParameters = instance.GetType().GetMethods()
+                .Select(m =>
+                {
+                    var attr = (BddAttribute) m.GetCustomAttribute(attribute);
+                    if (attr == null)
+                    {
+                        return null;
+                    }
+                    var match = Regex.Match(step.Text, attr.Message);
+                    if (!match.Success)
+                    {
+                        return null;
+                    }
+                    var parameters = new List<object>();
+                    for (var i = 1; i < match.Groups.Count; i++)
+                    {
+                        parameters.Add(match.Groups[i].Value);
+                    }
+                    if (step.Argument is DocString)
+                    {
+                        parameters.Add(((DocString) step.Argument).Content);
+                    }
+                    else if (step.Argument != null)
+                    {
+                        parameters.Add(step.Argument);
+                    }
+                    if (m.GetParameters().Length != parameters.Count)
+                    {
+                        return null;
+                    }
+                    return Tuple.Create(m, parameters.ToArray());
+                })
+                .FirstOrDefault(t => t != null);
+            if (methodAndParameters == null)
+            {
+                throw new InvalidOperationException(
+                    $"There is no step definition method for {stepBlock} '{step.Text}'");
+            }
+            try
+            {
+                methodAndParameters.Item1.Invoke(instance, methodAndParameters.Item2);
+            }
+            catch (TargetInvocationException ex)
+            {
+                // Exceptions should not be thrown
+                // Should be captured for result
+                return ex.InnerException;
+            }
+            catch (Exception ex)
+            {
+                return ex;
+            }
+            // Success
+            return null;
+        }
+
+        private static StepBlock GetStepBlock(StepBlock? currentStep, string stepKeyword)
+        {
+            switch (stepKeyword.Trim().ToUpper())
+            {
+                case Keywords.Given:
+                    return StepBlock.Given;
+                case Keywords.When:
+                    return StepBlock.When;
+                case Keywords.Then:
+                    return StepBlock.Then;
+                case Keywords.And:
+                case Keywords.But:
+                    if (currentStep == null)
+                    {
+                        throw new InvalidOperationException("'And' or 'But' is not supported outside a step");
+                    }
+                    return currentStep.Value;
+            }
+            throw new NotSupportedException($"Step with keyword {stepKeyword} not supported");
+        }
+
+        private static StepDefinition GetStepDefinitionInstance(IEnumerable<Type> stepDefinitionTypes, string stepText)
+        {
+            var type = stepDefinitionTypes
+                .FirstOrDefault(t => t.GetMethods().Any(m =>
+                {
+                    var attr = m.GetCustomAttribute<GivenAttribute>();
+                    if (attr == null)
+                    {
+                        return false;
+                    }
+                    return Regex.IsMatch(stepText, attr.Message);
+                }));
+            if (type == null)
+            {
+                throw new InvalidOperationException($"No step definition class matches Given '{stepText}'");
+            }
+            return (StepDefinition) Activator.CreateInstance(type);
+        }
+
+        private ICollection<Type> GetStepDefinitionTypes()
+        {
+            var assembly = GetType().GetTypeInfo().Assembly;
+            var types = assembly.GetTypes()
+                .Where(t => typeof(StepDefinition).IsAssignableFrom(t) && !t.GetTypeInfo().IsAbstract)
+                .ToArray();
+            if (types.Length == 0)
+            {
+                throw new InvalidOperationException($"No step definitions in {assembly.FullName}");
+            }
+            return types;
+        }
+
+        private IEnumerable<Feature> GetFeatures()
+        {
+            // TODO: go through all the .feature files
+            const string gherkinFile = "/Users/jorge/workspace/temp/count.feature";
+            var parser = new Parser();
+            var doc = parser.Parse(gherkinFile);
+            yield return doc.Feature;
+        }
+
+        private void PrintGherkin()
+        {
+            var gherkinFile = "/Users/jorge/workspace/temp/count.feature";
+            var parser = new Parser();
+            GherkinDocument doc = parser.Parse(gherkinFile);
+            foreach (var scenario in doc.Feature.Children)
+            {
+                WriteOutput("--------");
+                WriteOutput("Scenario: " + scenario.Name);
+                foreach (var step in scenario.Steps)
+                {
+                    WriteOutput("  Step");
+                    WriteOutput("    Keyword: " + step.Keyword);
+                    WriteOutput("    Text: " + step.Text);
+                    WriteOutput("    Argument: " + step.Argument);
+                    if (step.Argument is DocString)
+                    {
+                        WriteOutput("      " + ((DocString)step.Argument).Content);
+                    }
+                    if (step.Argument is DataTable)
+                    {
+                        foreach (var row in ((DataTable)step.Argument).Rows)
+                        {
+                            WriteOutput("      Row: " + string.Join(", ", row.Cells.Select(x => x.Value)));   
+                        }
+                    }
+                }
+            }
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/cee68591/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/StepDefinition.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/StepDefinition.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/StepDefinition.cs
new file mode 100644
index 0000000..3412fbd
--- /dev/null
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/StepDefinition.cs
@@ -0,0 +1,39 @@
+#region License
+
+/*
+ * 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.
+ */
+
+#endregion
+
+using System;
+using System.Dynamic;
+using Gremlin.Net.IntegrationTest.Process.Traversal.DriverRemoteConnection;
+
+namespace Gremlin.Net.IntegrationTest.Gherkin
+{
+    public abstract class StepDefinition : IDisposable
+    {
+        internal RemoteConnectionFactory ConnectionFactory = new RemoteConnectionFactory();
+
+        public virtual void Dispose()
+        {
+            ConnectionFactory.Dispose();
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/cee68591/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalTranslations.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalTranslations.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalTranslations.cs
new file mode 100644
index 0000000..af02b8c
--- /dev/null
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalTranslations.cs
@@ -0,0 +1,102 @@
+#region License
+
+/*
+ * 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.
+ */
+
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using Gremlin.Net.Process.Traversal;
+
+namespace Gremlin.Net.IntegrationTest.Gherkin
+{
+    internal class TraversalTranslations
+    {
+        private static readonly IDictionary<string, Func<GraphTraversalSource, ITraversal>> FixedTranslations = 
+            new Dictionary<string, Func<GraphTraversalSource, ITraversal>>
+            {
+                { "g.V().has(\"no\").count()", g => g.V().Has("no").Count() },
+                { "g.V().fold().count(Scope.local)", g => g.V().Fold<object>().Count(Scope.Local)}
+            };
+
+        internal static ITraversal GetTraversal(string traversalText, GraphTraversalSource g)
+        {
+            Func<GraphTraversalSource, ITraversal> traversalBuilder;
+            if (!FixedTranslations.TryGetValue(traversalText, out traversalBuilder))
+            {
+                return BuildFromMethods(traversalText, g);
+            }
+            return traversalBuilder(g);
+        }
+
+        private static ITraversal BuildFromMethods(string traversalText, GraphTraversalSource g)
+        {
+            var parts = traversalText.Split('.');
+            if (parts[0] != "g")
+            {
+                throw BuildException(traversalText);
+            }
+            ITraversal traversal;
+            switch (parts[1])
+            {
+                case "V()":
+                    traversal = g.V();
+                    break;
+                case "E()":
+                    traversal = g.E();
+                    break;
+                default:
+                    throw BuildException(traversalText);
+            }
+            for (var i = 2; i < parts.Length; i++)
+            {
+                var name = GetCsharpName(parts[i], traversalText);
+                var method = traversal.GetType().GetMethod(name);
+                if (method == null)
+                {
+                    throw new InvalidOperationException($"Traversal method '{parts[i]}' not found for testing");
+                }
+                if (method.IsGenericMethod)
+                {
+                    throw new InvalidOperationException(
+                        $"Can not build traversal to test as '{name}()' method is generic");
+                }
+                traversal = (ITraversal) method.Invoke(traversal, new object[] { new object[0]});
+            }
+            return traversal;
+        }
+
+        private static string GetCsharpName(string part, string traversalText)
+        {
+            if (!part.EndsWith("()"))
+            {
+                throw BuildException(traversalText);
+            }
+            // Transform to PascalCasing and remove the parenthesis
+            return char.ToUpper(part[0]) + part.Substring(1, part.Length - 3);
+        }
+
+        private static Exception BuildException(string traversalText)
+        {
+            return new InvalidOperationException($"Can not build a traversal to test from '{traversalText}'");
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/cee68591/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gremlin.Net.IntegrationTest.csproj
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gremlin.Net.IntegrationTest.csproj b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gremlin.Net.IntegrationTest.csproj
index c5e923d..40552ad 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gremlin.Net.IntegrationTest.csproj
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gremlin.Net.IntegrationTest.csproj
@@ -1,5 +1,4 @@
 <Project Sdk="Microsoft.NET.Sdk">
-
   <PropertyGroup>
     <TargetFramework>netcoreapp1.0</TargetFramework>
     <DebugType>portable</DebugType>
@@ -10,17 +9,14 @@
     <SignAssembly>true</SignAssembly>
     <PublicSign Condition="'$(OS)' != 'Windows_NT'">true</PublicSign>
   </PropertyGroup>
-
   <ItemGroup>
     <None Update="appsettings.json">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
   </ItemGroup>
-
   <ItemGroup>
     <ProjectReference Include="..\..\src\Gremlin.Net\Gremlin.Net.csproj" />
   </ItemGroup>
-
   <ItemGroup>
     <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0" />
     <PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" />
@@ -31,9 +27,12 @@
     <PackageReference Include="OpenCover" Version="4.6.519" />
     <PackageReference Include="coveralls.io" Version="1.3.4" />
   </ItemGroup>
-
   <ItemGroup>
     <Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
   </ItemGroup>
-
-</Project>
+  <ItemGroup>
+    <Reference Include="Gherkin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
+      <HintPath>..\..\..\..\temp\Gherkin.dll</HintPath>
+    </Reference>
+  </ItemGroup>
+</Project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/cee68591/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 47d4f06..249db60 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
@@ -22,16 +22,20 @@
 #endregion
 
 using System;
+using System.Collections.Generic;
 using Gremlin.Net.Driver;
 using Gremlin.Net.Process.Remote;
+using DriverRemoteConnectionImpl = Gremlin.Net.Driver.Remote.DriverRemoteConnection;
 
 namespace Gremlin.Net.IntegrationTest.Process.Traversal.DriverRemoteConnection
 {
-    internal class RemoteConnectionFactory
+    internal class RemoteConnectionFactory : IDisposable
     {
         private static readonly string TestHost = ConfigProvider.Configuration["TestServerIpAddress"];
         private static readonly int TestPort = Convert.ToInt32(ConfigProvider.Configuration["TestServerPort"]);
 
+        private readonly IList<DriverRemoteConnectionImpl> _connections = new List<DriverRemoteConnectionImpl>();
+
         public IRemoteConnection CreateRemoteConnection()
         {
             // gmodern is the standard test traversalsource that the main body of test uses
@@ -40,8 +44,18 @@ namespace Gremlin.Net.IntegrationTest.Process.Traversal.DriverRemoteConnection
 
         public IRemoteConnection CreateRemoteConnection(string traversalSource)
         {
-            return new Net.Driver.Remote.DriverRemoteConnection(
+            var c = new DriverRemoteConnectionImpl(
                 new GremlinClient(new GremlinServer(TestHost, TestPort)), traversalSource);
+            _connections.Add(c);
+            return c;
+        }
+
+        public void Dispose()
+        {
+            foreach (var connection in _connections)
+            {
+                connection.Dispose();
+            }
         }
     }
 }
\ No newline at end of file


[07/39] tinkerpop git commit: Get property information from modern graph

Posted by dk...@apache.org.
Get property information from modern graph


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

Branch: refs/heads/TINKERPOP-1447
Commit: a805845cc4a9531a11edd31bdd5ba5ae13252c7f
Parents: 19105a7
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Fri Oct 27 14:18:32 2017 +0200
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Thu Nov 30 10:00:08 2017 +0100

----------------------------------------------------------------------
 .../ModernGraphTypeInformation.cs               | 70 ++++++++++++++++++++
 .../TraversalEvaluationTests.cs                 | 10 ++-
 .../TraversalEvaluation/TraversalParser.cs      | 24 ++++---
 3 files changed, 92 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a805845c/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ModernGraphTypeInformation.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ModernGraphTypeInformation.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ModernGraphTypeInformation.cs
new file mode 100644
index 0000000..bce3449
--- /dev/null
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ModernGraphTypeInformation.cs
@@ -0,0 +1,70 @@
+#region License
+
+/*
+ * 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.
+ */
+
+#endregion
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using Gremlin.Net.Process.Traversal;
+
+namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
+{
+    internal class ModernGraphTypeInformation
+    {
+        private static readonly IDictionary<string, Type> PropertyInfos = new Dictionary<string, Type>
+        {
+            {"age", typeof(int)},
+            {"name", typeof(string)},
+            {"lang", typeof(string)},
+            {"weight", typeof(float)}
+        };
+        
+        /// <summary>
+        /// Gets the type argument information based on the modern graph.
+        /// </summary>s
+        public static Type GetTypeArguments(MethodInfo method, object[] parameterValues)
+        {
+            switch (method.Name)
+            {
+                case nameof(GraphTraversal<object,object>.ValueMap):
+                case nameof(GraphTraversal<object,object>.Values) when parameterValues.Length == 1:
+                    // The parameter contains the element property names
+                    var properties = ((IEnumerable) parameterValues[parameterValues.Length - 1]).Cast<string>();
+                    var types = properties.Select(GetElementPropertyType).ToArray();
+                    if (types.Distinct().Count() == 1)
+                    {
+                        return types[0];
+                    }
+                    return typeof(object);
+            }
+            return null;
+        }
+
+        private static Type GetElementPropertyType(string name)
+        {
+            PropertyInfos.TryGetValue(name, out var type);
+            return type;
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a805845c/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEvaluationTests.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEvaluationTests.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEvaluationTests.cs
index 0949ad5..4e3ec42 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEvaluationTests.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEvaluationTests.cs
@@ -77,15 +77,19 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
         [Fact]
         public void GetTraversal_Should_Invoke_Traversal_Methods()
         {
-            var traversalTexts = new string[]
+            var traversalTexts = new []
             {
                 "g.V().count()",
-                "g.V().constant(123)"
+                "g.V().constant(123)",
+                "g.V().has(\"no\").count()",
+                "g.V().values(\"age\")",
+                "g.V().valueMap(\"name\", \"age\")",
+                "g.V().repeat(__.both()).times(5)"
             };
             var g = new Graph().Traversal();
             foreach (var text in traversalTexts)
             {
-                TraversalParser.GetTraversal(text, g);
+                Assert.NotNull(TraversalParser.GetTraversal(text, g));
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a805845c/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
index 65ca103..11283c1 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
@@ -34,7 +34,6 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
         private static readonly IDictionary<string, Func<GraphTraversalSource, ITraversal>> FixedTranslations = 
             new Dictionary<string, Func<GraphTraversalSource, ITraversal>>
             {
-                { "g.V().has(\"no\").count()", g => g.V().Has("no").Count() },
                 { "g.V().fold().count(Scope.local)", g => g.V().Fold<object>().Count(Scope.Local)}
             };
         
@@ -83,14 +82,15 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
                 {
                     throw new InvalidOperationException($"Traversal method '{parts[i]}' not found for testing");
                 }
-                var parameters = BuildParameters(method, token, out var genericParameters);
-                method = BuildGenericMethod(method, genericParameters);
-                traversal = (ITraversal) method.Invoke(traversal, parameters);
+                var parameterValues = BuildParameters(method, token, out var genericParameters);
+                method = BuildGenericMethod(method, genericParameters, parameterValues);
+                traversal = (ITraversal) method.Invoke(traversal, parameterValues);
             }
             return traversal;
         }
 
-        private static MethodInfo BuildGenericMethod(MethodInfo method, IDictionary<string, Type> genericParameters)
+        private static MethodInfo BuildGenericMethod(MethodInfo method, IDictionary<string, Type> genericParameters,
+                                                     object[] parameterValues)
         {
             if (!method.IsGenericMethod)
             {
@@ -101,17 +101,19 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
             for (var i = 0; i < genericArgs.Length; i++)
             {
                 var name = genericArgs[i].Name;
-                if (genericParameters.TryGetValue(name, out var type))
+                Type type;
+                if (!genericParameters.TryGetValue(name, out type))
                 {
-                    types[i] = type;
+                    // Try to infer it from the name based on modern graph
+                    type = ModernGraphTypeInformation.GetTypeArguments(method, parameterValues);
                 }
-                //TODO: Try to infer it from the name based on modern schema
-                else
+                if (type == null)
                 {
                     throw new InvalidOperationException(
                         $"Can not build traversal to test as '{method.Name}()' method is generic and type '{name}'" +
                         $" can not be inferred");
                 }
+                types[i] = type;
             }
             return method.MakeGenericMethod(types);
         }
@@ -138,6 +140,10 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
                         // if we have the type of value we have the type of E2. 
                         genericParameterTypes.Add(info.ParameterType.Name, tokenParameter.GetParameterType());
                     }
+                    else if (info.ParameterType == typeof(object[]))
+                    {
+                        value = new [] {value};
+                    }
                 }
                 parameters[i] = value ?? GetDefault(info.ParameterType);
             }


[13/39] tinkerpop git commit: Parse maps, lists and sets

Posted by dk...@apache.org.
Parse maps, lists and sets


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

Branch: refs/heads/TINKERPOP-1447
Commit: 4b86d19d0b6bb644784eb84717e7dc46b8f3f178
Parents: 17d6876
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Tue Nov 7 10:51:25 2017 +0100
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Thu Nov 30 10:00:09 2017 +0100

----------------------------------------------------------------------
 .../Gherkin/CommonSteps.cs                      | 15 ++++++-----
 .../ModernGraphTypeInformation.cs               |  1 +
 .../Gherkin/TraversalEvaluation/Token.cs        |  2 +-
 .../TraversalEvaluationTests.cs                 |  8 ++++--
 .../TraversalEvaluation/TraversalParser.cs      | 27 ++++++++++++--------
 5 files changed, 33 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/4b86d19d/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
index 8b27567..4a4d18e 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
@@ -31,6 +31,8 @@ using Gremlin.Net.IntegrationTest.Gherkin.Attributes;
 using Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation;
 using Gremlin.Net.Process.Traversal;
 using Gremlin.Net.Structure;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
 using Xunit;
 
 namespace Gremlin.Net.IntegrationTest.Gherkin
@@ -162,19 +164,20 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
             return result;
         }
 
-        private static IDictionary ToMap(string arg)
+        private static IDictionary ToMap(string stringMap)
         {
-            throw new NotImplementedException();
+            var jsonMap = JObject.Parse(stringMap);
+            return (IDictionary) jsonMap.ToObject<IDictionary<string, object>>();
         }
 
-        private static ICollection ToSet(string arg)
+        private static ISet<object> ToSet(string stringSet)
         {
-            throw new NotImplementedException();
+            return new HashSet<object>(ToList(stringSet));
         }
 
-        private static IList ToList(string arg)
+        private static IList<object> ToList(string stringList)
         {
-            throw new NotImplementedException();
+            return stringList.Split(',').Select(ParseValue).ToArray();
         }
 
         private static Vertex ToVertex(string name)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/4b86d19d/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ModernGraphTypeInformation.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ModernGraphTypeInformation.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ModernGraphTypeInformation.cs
index 7e2bee1..10d316d 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ModernGraphTypeInformation.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ModernGraphTypeInformation.cs
@@ -57,6 +57,7 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
                     }
                     return typeof(object);
                 case nameof(GraphTraversal<object,object>.ValueMap):
+                case nameof(GraphTraversal<object,object>.Select):
                     // Use IDictionary<string, object> for value maps
                     return typeof(object);
                 case nameof(GraphTraversal<object,object>.Limit):

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/4b86d19d/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/Token.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/Token.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/Token.cs
index e0acf4b..67c2af1 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/Token.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/Token.cs
@@ -68,7 +68,7 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
             
         public Token(string name, IList<ITokenParameter> parameters = null)
         {
-            Name = name;
+            Name = name.Trim();
             Parameters = parameters ?? EmptyParameters;
         }
             

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/4b86d19d/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEvaluationTests.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEvaluationTests.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEvaluationTests.cs
index aaca93f..ade895c 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEvaluationTests.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEvaluationTests.cs
@@ -60,7 +60,10 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
                         new TraversalPredicateParameter(
                             new[] { new Token("P"), new Token("gt", LiteralParameter.Create(27)) }) })}),
                 Tuple.Create("g.V().count(Scope.local)", 
-                    new[] { new Token("count", new TraversalEnumParameter("Scope.local"))})
+                    new[] { new Token("count", new TraversalEnumParameter("Scope.local"))}),
+                Tuple.Create("g.V().\n  count()", new[] { new Token("count")}),
+                Tuple.Create("g.V().\n has ( \"a\" ) \n.  \ncount()",
+                    new[] {new Token("has", new StringParameter("a")), new Token("count")}),
             };
             foreach (var item in items)
             {
@@ -82,7 +85,8 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
                 Tuple.Create("g.V().where(__.in(\"created\").count().is(1)).values(\"name\")", 3),
                 Tuple.Create("g.V().count(Scope.local)", 2),
                 Tuple.Create("g.V().values(\"age\").is(P.lte(30))", 3),
-                Tuple.Create("g.V().optional(__.out().optional(__.out())).path().limit(1)", 4)
+                Tuple.Create("g.V().optional(__.out().optional(__.out())).path().limit(1)", 4),
+                Tuple.Create("g.V(1).as(\"a\").out(\"knows\").as(\"b\").\n  select(\"a\", \"b\").by(\"name\")", 6)
             };
             var g = new Graph().Traversal();
             foreach (var tuple in traversalTexts)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/4b86d19d/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
index b5efb8d..1f17ec8 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
@@ -124,8 +124,14 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
             foreach (var method in ordered)
             {
                 lastMethod = method;
-                var parameters = method.GetParameters();
-                if (tokenParameters.Count < parameters.Length)
+                var methodParameters = method.GetParameters();
+                var requiredParameters = methodParameters.Length;
+                if (requiredParameters > 0 && IsParamsArray(methodParameters.Last()))
+                {
+                    // Params array can be not provided
+                    requiredParameters--;
+                }
+                if (tokenParameters.Count < requiredParameters)
                 {
                     continue;
                 }
@@ -133,13 +139,13 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
                 var exactMatches = 0;
                 for (var i = 0; i < tokenParameters.Count; i++)
                 {
-                    if (parameters.Length <= i)
+                    if (methodParameters.Length <= i)
                     {
                         // The method contains less parameters (and no params array) than provided
                         matched = false;
                         break;
                     }
-                    var methodParameter = parameters[i];
+                    var methodParameter = methodParameters[i];
                     var tokenParameterType = tokenParameters[i].GetParameterType();
                     // Match either the same parameter type
                     matched = methodParameter.ParameterType == tokenParameterType;
@@ -324,14 +330,9 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
                         parameters.Add(param);
                         break;
                     }
-                    case ',' when text[i+1] != ' ':
-                    case ' ' when text[i+1] != ' ' && text[i+1] != ')':
+                    case ',' when text[i+1] != ' ' && parsing == ParsingPart.StartParameters:
+                    case ' ' when text[i+1] != ' ' && text[i+1] != ')' && parsing == ParsingPart.StartParameters:
                     {
-                        if (parsing != ParsingPart.StartParameters)
-                        {
-                            throw new InvalidOperationException(
-                                "Can not parse space or comma chars outside parameters");
-                        }
                         i++;
                         var param = ParseParameter(text, ref i);
                         if (param == null)
@@ -370,6 +371,10 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
         private static ITokenParameter ParseParameter(string text, ref int i)
         {
             var firstChar = text[i];
+            while (char.IsWhiteSpace(firstChar))
+            {
+                firstChar = text[++i];
+            }
             if (firstChar == ')')
             {
                 return null;


[22/39] tinkerpop git commit: Fix Group scenario result

Posted by dk...@apache.org.
Fix Group scenario result


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

Branch: refs/heads/TINKERPOP-1447
Commit: 6cac107512955114a4fe9a7c9df2deef1c7b4b37
Parents: 7e9d527
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Thu Nov 30 10:32:54 2017 +0100
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Thu Nov 30 10:32:54 2017 +0100

----------------------------------------------------------------------
 gremlin-test/features/sideEffect/Group.feature | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6cac1075/gremlin-test/features/sideEffect/Group.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/sideEffect/Group.feature b/gremlin-test/features/sideEffect/Group.feature
index 72cc86b..94d2191 100644
--- a/gremlin-test/features/sideEffect/Group.feature
+++ b/gremlin-test/features/sideEffect/Group.feature
@@ -207,7 +207,7 @@ Feature: Step - group()
     When iterated to list
     Then the result should be unordered
       | result |
-      | m[{"cover":{"followedBy":"d[777982].l", "sungBy":"d[0].l", "writtenBy":"d[0].l"}, "":{"followedBy":"d[179350].l"}, "original":{"followedBy":"d[2185613].l", "sungBy":"d[0].l", "writtenBy":"d[0].l"}}] |
+      | m[{"cover":{"followedBy":"d[777982].l", "sungBy":"d[0].i", "writtenBy":"d[0].i"}, "":{"followedBy":"d[179350].l"}, "original":{"followedBy":"d[2185613].l", "sungBy":"d[0].i", "writtenBy":"d[0].i"}}] |
 
   Scenario: g_V_groupXmX_byXnameX_byXinXknowsX_nameX_capXmX
     Given the modern graph


[38/39] tinkerpop git commit: CTR: Fixed a few links, but more importantly waited for the zip command, used in a code block, to finish before proceeding.

Posted by dk...@apache.org.
CTR: Fixed a few links, but more importantly waited for the zip command, used in a code block, to finish before proceeding.


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

Branch: refs/heads/TINKERPOP-1447
Commit: a86097d0823397f0485566e8fd5def7a82fb32f3
Parents: fb64051
Author: Daniel Kuppitz <da...@hotmail.com>
Authored: Tue Dec 12 14:04:01 2017 -0700
Committer: Daniel Kuppitz <da...@hotmail.com>
Committed: Tue Dec 12 14:04:01 2017 -0700

----------------------------------------------------------------------
 docs/src/recipes/olap-spark-yarn.asciidoc | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a86097d0/docs/src/recipes/olap-spark-yarn.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/recipes/olap-spark-yarn.asciidoc b/docs/src/recipes/olap-spark-yarn.asciidoc
index e2be4f6..634adeb 100644
--- a/docs/src/recipes/olap-spark-yarn.asciidoc
+++ b/docs/src/recipes/olap-spark-yarn.asciidoc
@@ -18,10 +18,10 @@ limitations under the License.
 OLAP traversals with Spark on YARN
 ----------------------------------
 
-TinkerPop's combination of http://tinkerpop.apache.org/docs/x.y.z/reference/#sparkgraphcomputer[SparkGraphComputer]
-and http://tinkerpop.apache.org/docs/x.y.z/reference/#_properties_files[HadoopGraph] allows for running
+TinkerPop's combination of link:http://tinkerpop.apache.org/docs/x.y.z/reference/#sparkgraphcomputer[SparkGraphComputer]
+and link:http://tinkerpop.apache.org/docs/x.y.z/reference/#_properties_files[HadoopGraph] allows for running
 distributed, analytical graph queries (OLAP) on a computer cluster. The
-http://tinkerpop.apache.org/docs/x.y.z/reference/#sparkgraphcomputer[reference documentation] covers the cases
+link:http://tinkerpop.apache.org/docs/x.y.z/reference/#sparkgraphcomputer[reference documentation] covers the cases
 where Spark runs locally or where the cluster is managed by a Spark server. However, many users can only run OLAP jobs
 via the http://hadoop.apache.org/[Hadoop 2.x] Resource Manager (YARN), which requires `SparkGraphComputer` to be
 configured differently. This recipe describes this configuration.
@@ -51,8 +51,8 @@ it is to look at the install script at https://github.com/apache/tinkerpop/blob/
 and the `start hadoop` section of https://github.com/apache/tinkerpop/blob/x.y.z/docker/scripts/build.sh.
 
 This recipe assumes that you installed the Gremlin Console with the
-http://tinkerpop.apache.org/docs/x.y.z/reference/#spark-plugin[Spark plugin] (the
-http://tinkerpop.apache.org/docs/x.y.z/reference/#hadoop-plugin[Hadoop plugin] is optional). Your Hadoop cluster
+link:http://tinkerpop.apache.org/docs/x.y.z/reference/#spark-plugin[Spark plugin] (the
+link:http://tinkerpop.apache.org/docs/x.y.z/reference/#hadoop-plugin[Hadoop plugin] is optional). Your Hadoop cluster
 may have been configured to use file compression, e.g. LZO compression. If so, you need to copy the relevant
 jar (e.g. `hadoop-lzo-*.jar`) to Gremlin Console's `ext/spark-gremlin/lib` folder.
 
@@ -96,7 +96,7 @@ hadoop = System.getenv('HADOOP_HOME')
 hadoopConfDir = System.getenv('HADOOP_CONF_DIR')
 archive = 'spark-gremlin.zip'
 archivePath = "/tmp/$archive"
-['bash', '-c', "rm $archivePath 2>/dev/null; cd ext/spark-gremlin/lib && zip $archivePath *.jar"].execute()
+['bash', '-c', "rm -f $archivePath; cd ext/spark-gremlin/lib && zip $archivePath *.jar"].execute().waitFor()
 conf = new PropertiesConfiguration('conf/hadoop/hadoop-gryo.properties')
 conf.setProperty('spark.master', 'yarn-client')
 conf.setProperty('spark.yarn.dist.archives', "$archivePath")
@@ -121,7 +121,7 @@ Explanation
 ~~~~~~~~~~~
 
 This recipe does not require running the `bin/hadoop/init-tp-spark.sh` script described in the
-http://tinkerpop.apache.org/docs/x.y.z/reference/#sparkgraphcomputer[reference documentation] and thus is also
+link:http://tinkerpop.apache.org/docs/x.y.z/reference/#sparkgraphcomputer[reference documentation] and thus is also
 valid for cluster users without access permissions to do so.
 Rather, it exploits the `spark.yarn.dist.archives` property, which points to an archive with jars on the local file
 system and is loaded into the various YARN containers. As a result the `spark-gremlin.zip` archive becomes available
@@ -134,7 +134,7 @@ Also the `HADOOP_GREMLIN_LIBS` mechanism is not used because it can not work for
 added to the `SparkContext` are not available to the YARN application master).
 
 The `gremlin.spark.persistContext` property is explained in the reference documentation of
-http://tinkerpop.apache.org/docs/x.y.z/reference/#sparkgraphcomputer[SparkGraphComputer]: it helps in getting
+link:http://tinkerpop.apache.org/docs/x.y.z/reference/#sparkgraphcomputer[SparkGraphComputer]: it helps in getting
 follow-up OLAP queries answered faster, because you skip the overhead for getting resources from YARN.
 
 Additional configuration options
@@ -154,4 +154,4 @@ jar.
 You may not like the idea that the Hadoop and Spark jars from the TinkerPop distribution differ from the versions in
 your cluster. If so, just build TinkerPop from source with the corresponding dependencies changed in the various `pom.xml`
 files (e.g. `spark-core_2.10-1.6.1-some-vendor.jar` instead of `spark-core_2.10-1.6.1.jar`). Of course, TinkerPop will
-only build for exactly matching or slightly differing artifact versions.
\ No newline at end of file
+only build for exactly matching or slightly differing artifact versions.


[37/39] tinkerpop git commit: CTR: Added missing `zip` dependency in Docker build file.

Posted by dk...@apache.org.
CTR: Added missing `zip` dependency in Docker build file.


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

Branch: refs/heads/TINKERPOP-1447
Commit: fb640511970724da7a0bd271c7b304d5e97f8a20
Parents: 97e3d1c
Author: Daniel Kuppitz <da...@hotmail.com>
Authored: Mon Dec 11 13:32:38 2017 -0700
Committer: Daniel Kuppitz <da...@hotmail.com>
Committed: Mon Dec 11 13:32:38 2017 -0700

----------------------------------------------------------------------
 docker/Dockerfile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/fb640511/docker/Dockerfile
----------------------------------------------------------------------
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 35dd35e..08b7b3c 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -26,7 +26,7 @@ RUN apt-get update \
     && sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ trusty main" > /etc/apt/sources.list.d/dotnetdev.list' \
     && apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 417A0893 \
     && apt-get update \
-    && apt-get install -y oracle-java8-installer curl gawk git maven openssh-server dotnet-dev-1.0.4 subversion \
+    && apt-get install -y oracle-java8-installer curl gawk git maven openssh-server dotnet-dev-1.0.4 subversion zip \
     && apt-get install -y python python-dev python-pip build-essential \
     && pip install virtualenv virtualenvwrapper \
     && pip install --upgrade pip \


[12/39] tinkerpop git commit: Parser fixes and unordered comparison

Posted by dk...@apache.org.
Parser fixes and unordered comparison


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

Branch: refs/heads/TINKERPOP-1447
Commit: 4fbfb99a5eb0ccbccca9ca8878d2ba9f2ee11c03
Parents: bfb9df3
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Thu Nov 16 18:20:54 2017 +0100
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Thu Nov 30 10:00:09 2017 +0100

----------------------------------------------------------------------
 .../Gherkin/CommonSteps.cs                      | 32 +++++++++++++++++---
 .../Gherkin/GherkinTestRunner.cs                |  6 ++--
 .../ModernGraphTypeInformation.cs               | 18 ++++++-----
 .../TraversalEvaluationTests.cs                 | 14 +++++++--
 .../TraversalEvaluation/TraversalParser.cs      |  1 +
 5 files changed, 54 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/4fbfb99a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
index 1ccf01d..1c2c8fa 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
@@ -151,9 +151,12 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
                     }
                     else
                     {
-                        var expectedArray = expected.OrderBy(x => x).ToArray();
-                        var resultArray = _result.OrderBy(x => x).ToArray();
-                        Assert.Equal(expectedArray, resultArray);
+                        var expectedArray = expected.ToArray();
+                        foreach (var resultItem in _result)
+                        {
+                            Assert.Contains(resultItem, expectedArray);
+                        }
+                        Assert.Equal(expectedArray.Length, _result.Length);
                     }
                     break;
                 default:
@@ -191,8 +194,27 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
 
         private static IDictionary ToMap(string stringMap, string graphName)
         {
-            var jsonMap = JObject.Parse(stringMap);
-            return (IDictionary) jsonMap.ToObject<IDictionary<string, object>>();
+            IDictionary<string, JToken> jsonMap = JObject.Parse(stringMap);
+            return jsonMap.ToDictionary(kv => kv.Key, kv => ParseMapValue(kv.Value, graphName));
+        }
+
+        private static object ParseMapValue(JToken value, string graphName)
+        {
+            if (value.Type == JTokenType.Array)
+            {
+                return value.Select(v => ParseMapValue(v, graphName)).ToArray();
+            }
+            var objValue = value.ToObject<object>();
+            if (objValue is long longValue)
+            {
+                // JSON Numeric values converted to int64 by default
+                return Convert.ToInt32(longValue);
+            }
+            if (objValue is string stringValue)
+            {
+                return ParseValue(stringValue, graphName);
+            }
+            return objValue;
         }
 
         private static ISet<object> ToSet(string stringSet, string graphName)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/4fbfb99a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs
index fdee536..5527705 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs
@@ -22,7 +22,6 @@
 #endregion
 
 using System;
-using System.Collections;
 using System.Collections.Generic;
 using System.IO;
 using System.Linq;
@@ -329,7 +328,10 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
             {
                 "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/Sum.feature",
 //                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/Coalesce.feature",
-                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/AddEdge.feature"
+                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/AddEdge.feature",
+                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/AddVertex.feature",
+                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/ValueMap.feature",
+                "/Users/jorge/workspace/tinkerpop/gremlin-test/features/map/Select.feature",
             };
 //            var files = new [] {"/Users/jorge/workspace/temp/count.feature"};
 //            var files = Directory.GetFiles(path, "*.feature", SearchOption.AllDirectories);

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/4fbfb99a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ModernGraphTypeInformation.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ModernGraphTypeInformation.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ModernGraphTypeInformation.cs
index a467519..f96b9bf 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ModernGraphTypeInformation.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/ModernGraphTypeInformation.cs
@@ -41,12 +41,13 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
         };
         
         /// <summary>
-        /// Gets the type argument information based on the modern graph.
+        /// Gets the type argument information based on the modern graph information.
         /// </summary>s
         public static Type GetTypeArguments(MethodInfo method, object[] parameterValues, int genericTypeIndex)
         {
             switch (method.Name)
             {
+                case nameof(GraphTraversal<object,object>.Properties):
                 case nameof(GraphTraversal<object,object>.Values) when parameterValues.Length == 1:
                     // The parameter contains the element property names
                     var properties = ((IEnumerable) parameterValues[parameterValues.Length - 1]).Cast<string>();
@@ -59,18 +60,21 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
                 case nameof(GraphTraversal<object,object>.Group) when genericTypeIndex == 0:
                     // Use IDictionary<string, object> for Group
                     return typeof(string);
-                case nameof(GraphTraversal<object,object>.ValueMap):
-                case nameof(GraphTraversal<object,object>.Select):
-                case nameof(GraphTraversal<object,object>.Group):
-                case nameof(GraphTraversal<object,object>.Unfold):
-                    // default to object for this methods
-                    return typeof(object);
                 case nameof(GraphTraversal<object,object>.Limit):
                 case nameof(GraphTraversal<object,object>.Optional):
                 case nameof(GraphTraversal<object,object>.Sum):
                 case nameof(GraphTraversal<object,object>.Coalesce):
                     // Maintain the same type
                     return method.DeclaringType.GetGenericArguments()[1];
+                case nameof(GraphTraversal<object,object>.ValueMap):
+                case nameof(GraphTraversal<object,object>.Select):
+                case nameof(GraphTraversal<object,object>.Group):
+                case nameof(GraphTraversal<object,object>.GroupCount):
+                case nameof(GraphTraversal<object,object>.Unfold):
+                case nameof(GraphTraversal<object,object>.Choose):
+                case nameof(GraphTraversal<object,object>.Union):
+                    // default to object for this methods
+                    return typeof(object);
             }
             return null;
         }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/4fbfb99a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEvaluationTests.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEvaluationTests.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEvaluationTests.cs
index a2dd888..3907dd2 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEvaluationTests.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEvaluationTests.cs
@@ -23,10 +23,8 @@
 
 using System;
 using System.Linq;
-using Gremlin.Net.Process.Traversal;
 using Gremlin.Net.Structure;
 using Xunit;
-using Xunit.Abstractions;
 
 namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
 {
@@ -64,6 +62,14 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
                 Tuple.Create("g.V().\n  count()", new[] { new Token("count")}),
                 Tuple.Create("g.V().\n has ( \"a\" ) \n.  \ncount()",
                     new[] {new Token("has", new StringParameter("a")), new Token("count")}),
+                Tuple.Create("g.V().choose(__.outE(),__.as(\"a\"))", new []
+                {
+                    new Token("choose", new ITokenParameter[] { 
+                        new StaticTraversalParameter(new[] {new Token("__"), new Token("outE")}, "__.outE()"),
+                        new StaticTraversalParameter(
+                            new[] {new Token("__"), new Token("as", new StringParameter("a"))}, "__.as(\"a\")")
+                    })
+                })
             };
             foreach (var item in items)
             {
@@ -88,7 +94,9 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
                 Tuple.Create("g.V().optional(__.out().optional(__.out())).path().limit(1)", 4),
                 Tuple.Create("g.V(1).as(\"a\").out(\"knows\").as(\"b\").\n  select(\"a\", \"b\").by(\"name\")", 6),
                 Tuple.Create(
-                    "g.V().hasLabel(\"software\").group().by(\"name\").by(__.bothE().values(\"weight\").sum())", 5)
+                    "g.V().hasLabel(\"software\").group().by(\"name\").by(__.bothE().values(\"weight\").sum())", 5),
+                Tuple.Create("g.V().choose(__.outE().count().is(0L),__.as(\"a\"),__.as(\"b\"))" +
+                                  "\n.choose(__.select(\"a\"),__.select(\"a\"),__.select(\"b\"))", 3)
             };
             var g = new Graph().Traversal();
             foreach (var tuple in traversalTexts)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/4fbfb99a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
index d557c49..66aae70 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
@@ -346,6 +346,7 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
                         parameters.Add(param);
                         break;
                     }
+                    case ',' when parsing != ParsingPart.StartParameters:
                     case ')' when parsing != ParsingPart.StartParameters:
                         // The current nested object already ended
                         if (parsing == ParsingPart.Name)


[09/39] tinkerpop git commit: Invoke predicates and enums

Posted by dk...@apache.org.
Invoke predicates and enums


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

Branch: refs/heads/TINKERPOP-1447
Commit: ee33016266b69b2cf771019997b81782acbb9c4e
Parents: a805845
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Mon Oct 30 15:14:38 2017 +0100
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Thu Nov 30 10:00:08 2017 +0100

----------------------------------------------------------------------
 .../StaticTraversalParameter.cs                 | 15 +--
 .../TraversalEnumParameter.cs                   | 98 ++++++++++++++++++++
 .../TraversalEvaluationTests.cs                 | 16 +++-
 .../TraversalEvaluation/TraversalParser.cs      | 79 ++++++++++------
 .../TraversalPredicateParameter.cs              | 26 ++++--
 .../TraversalTokenParameter.cs                  | 71 --------------
 6 files changed, 188 insertions(+), 117 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ee330162/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/StaticTraversalParameter.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/StaticTraversalParameter.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/StaticTraversalParameter.cs
index 8e0fbf9..dca691b 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/StaticTraversalParameter.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/StaticTraversalParameter.cs
@@ -30,9 +30,11 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
 {
     internal class StaticTraversalParameter : ITokenParameter, IEquatable<StaticTraversalParameter>
     {
+        private readonly string _traversalText;
+
         public bool Equals(StaticTraversalParameter other)
         {
-            return Parts.SequenceEqual(other.Parts);
+            return Tokens.SequenceEqual(other.Tokens);
         }
 
         public override bool Equals(object obj)
@@ -45,12 +47,12 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
 
         public override int GetHashCode()
         {
-            return Parts != null ? Parts.GetHashCode() : 0;
+            return Tokens != null ? Tokens.GetHashCode() : 0;
         }
 
         public object GetValue()
         {
-            throw new NotImplementedException();
+            return TraversalParser.GetTraversalFromTokens(Tokens, null, _traversalText);
         }
 
         public Type GetParameterType()
@@ -58,11 +60,12 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
             return typeof(ITraversal);
         }
 
-        public IList<Token> Parts { get; }
+        public IList<Token> Tokens { get; }
         
-        public StaticTraversalParameter(IList<Token> parts)
+        public StaticTraversalParameter(IList<Token> tokens, string traversalText)
         {
-            Parts = parts;
+            _traversalText = traversalText;
+            Tokens = tokens;
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ee330162/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEnumParameter.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEnumParameter.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEnumParameter.cs
new file mode 100644
index 0000000..663928a
--- /dev/null
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEnumParameter.cs
@@ -0,0 +1,98 @@
+#region License
+
+/*
+ * 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.
+ */
+
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using Gremlin.Net.Process.Traversal;
+using TEnum = Gremlin.Net.Process.Traversal.T;
+
+namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
+{
+    /// <summary>
+    /// Represents a parameter for a traversal token (ie: T.label)
+    /// </summary>
+    internal class TraversalEnumParameter : ITokenParameter, IEquatable<TraversalEnumParameter>
+    {
+        private readonly string _text;
+
+        private static readonly IDictionary<string, Type> EnumTypesByName = typeof(Scope).GetTypeInfo().Assembly
+            .GetTypes().Where(t => t.GetTypeInfo().IsEnum && t.GetTypeInfo().IsPublic)
+            .ToDictionary(e => e.Name, e => e);
+        
+        private readonly object _value;
+        private readonly Type _type;
+        
+        public TraversalEnumParameter(string text)
+        {
+            _text = text;
+            var separatorIndex = text.IndexOf('.');
+            var enumTypeName = text.Substring(0, separatorIndex);
+            if (!EnumTypesByName.TryGetValue(enumTypeName, out var type))
+            {
+                throw new KeyNotFoundException($"Enum with name {enumTypeName} not found");
+            }
+            _type = type;
+            var valueName = text.Substring(separatorIndex + 1);
+            _value = Enum.Parse(type, GetCsharpName(valueName));
+        }
+
+        private string GetCsharpName(string valueText)
+        {
+            if (_type == typeof(Direction))
+            {
+                valueText = valueText.ToLower();
+            }
+            return TraversalParser.GetCsharpName(valueText);
+        }
+
+        public bool Equals(TraversalEnumParameter other)
+        {
+            return _text == other._text;
+        }
+
+        public override bool Equals(object obj)
+        {
+            if (ReferenceEquals(null, obj)) return false;
+            if (ReferenceEquals(this, obj)) return true;
+            if (obj.GetType() != GetType()) return false;
+            return Equals((TraversalEnumParameter) obj);
+        }
+
+        public override int GetHashCode()
+        {
+            return _text.GetHashCode();
+        }
+
+        public object GetValue()
+        {
+            return _value;
+        }
+
+        public Type GetParameterType()
+        {
+            return _type;
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ee330162/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEvaluationTests.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEvaluationTests.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEvaluationTests.cs
index 4e3ec42..9cbceb9 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEvaluationTests.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalEvaluationTests.cs
@@ -54,11 +54,13 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
                     new[] {new Token("has", new[] {new StringParameter("lang"), new StringParameter("java")})}),
                 Tuple.Create("g.V().where(__.in(\"knows\"))",
                     new[] {new Token("where", new[] {new StaticTraversalParameter(
-                        new[] {new Token("__"), new Token("in", new StringParameter("knows"))})})}),
+                        new[] {new Token("__"), new Token("in", new StringParameter("knows"))}, "__.in(\"knows\")")})}),
                 Tuple.Create("g.V().has(\"age\", P.gt(27)", 
                     new[] {new Token("has", new ITokenParameter[] { new StringParameter("age"),
                         new TraversalPredicateParameter(
-                            new[] { new Token("P"), new Token("gt", NumericParameter.Create(27)) }) })})
+                            new[] { new Token("P"), new Token("gt", NumericParameter.Create(27)) }) })}),
+                Tuple.Create("g.V().count(Scope.local)", 
+                    new[] { new Token("count", new TraversalEnumParameter("Scope.local"))})
             };
             foreach (var item in items)
             {
@@ -80,16 +82,20 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
             var traversalTexts = new []
             {
                 "g.V().count()",
-                "g.V().constant(123)",
+                //"g.V().constant(123L)", Can be parsed using the new type-safe API
                 "g.V().has(\"no\").count()",
                 "g.V().values(\"age\")",
                 "g.V().valueMap(\"name\", \"age\")",
-                "g.V().repeat(__.both()).times(5)"
+                "g.V().where(__.in(\"created\").count().is(1)).values(\"name\")",
+                "g.V().count(Scope.local)",
+                "g.V().values(\"age\").is(P.lte(30))"
             };
             var g = new Graph().Traversal();
             foreach (var text in traversalTexts)
             {
-                Assert.NotNull(TraversalParser.GetTraversal(text, g));
+                var traversal = TraversalParser.GetTraversal(text, g);
+                Assert.NotNull(traversal);
+                Assert.True(traversal.Bytecode.StepInstructions.Count > 0);
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ee330162/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
index 11283c1..9880a64 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
@@ -42,49 +42,63 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
         private static readonly Regex RegexFloat =
             new Regex(@"\d+\.\d+f", RegexOptions.Compiled | RegexOptions.IgnoreCase);
         private static readonly Regex RegexLong = new Regex(@"\d+l", RegexOptions.Compiled | RegexOptions.IgnoreCase);
+        private static readonly Regex RegexEnum = new Regex(@"\w+\.\w+", RegexOptions.Compiled);
 
         internal static ITraversal GetTraversal(string traversalText, GraphTraversalSource g)
         {
-            Func<GraphTraversalSource, ITraversal> traversalBuilder;
-            if (!FixedTranslations.TryGetValue(traversalText, out traversalBuilder))
+            if (!FixedTranslations.TryGetValue(traversalText, out var traversalBuilder))
             {
-                return BuildFromMethods(traversalText, g);
+                var tokens = ParseTraversal(traversalText);
+                return GetTraversalFromTokens(tokens, g, traversalText);
             }
             return traversalBuilder(g);
         }
 
-        private static ITraversal BuildFromMethods(string traversalText, GraphTraversalSource g)
+        internal static ITraversal GetTraversalFromTokens(IList<Token> tokens, GraphTraversalSource g,
+                                                         string traversalText)
         {
-            var parts = ParseTraversal(traversalText);
-            if (parts[0].Name != "g")
+            ITraversal traversal;
+            Type traversalType;
+            var initialIndex = 2;
+            if (tokens[0].Name == "g")
             {
-                throw BuildException(traversalText);
+                switch (tokens[1].Name)
+                {
+                    case "V":
+                        //TODO: support V() parameters
+                        traversal = g.V();
+                        break;
+                    case "E":
+                        traversal = g.E();
+                        break;
+                    default:
+                        throw BuildException(traversalText);
+                }
+                traversalType = traversal.GetType();
             }
-            ITraversal traversal;
-            switch (parts[1].Name)
+            else if (tokens[0].Name == "__")
             {
-                case "V":
-                    //TODO: support V() parameters
-                    traversal = g.V();
-                    break;
-                case "E":
-                    traversal = g.E();
-                    break;
-                default:
-                    throw BuildException(traversalText);
+                traversal = null;
+                traversalType = typeof(__);
+                initialIndex = 1;
             }
-            for (var i = 2; i < parts.Count; i++)
+            else
             {
-                var token = parts[i];
+                throw BuildException(traversalText);
+            }
+            for (var i = initialIndex; i < tokens.Count; i++)
+            {
+                var token = tokens[i];
                 var name = GetCsharpName(token.Name);
-                var method = traversal.GetType().GetMethod(name);
+                var method = traversalType.GetMethod(name);
                 if (method == null)
                 {
-                    throw new InvalidOperationException($"Traversal method '{parts[i]}' not found for testing");
+                    throw new InvalidOperationException($"Traversal method '{tokens[i]}' not found for testing");
                 }
                 var parameterValues = BuildParameters(method, token, out var genericParameters);
                 method = BuildGenericMethod(method, genericParameters, parameterValues);
                 traversal = (ITraversal) method.Invoke(traversal, parameterValues);
+                traversalType = traversal.GetType();
             }
             return traversal;
         }
@@ -155,7 +169,7 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
             return type.GetTypeInfo().IsValueType ? Activator.CreateInstance(type) : null;
         }
 
-        private static string GetCsharpName(string part)
+        internal static string GetCsharpName(string part)
         {
             // Transform to PascalCasing and remove the parenthesis
             return char.ToUpper(part[0]) + part.Substring(1);
@@ -268,17 +282,24 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
             }
             if (text.Substring(i, 3).StartsWith("__."))
             {
-                return new StaticTraversalParameter(ParseTokens(text, ref i));
-            }
-            if (text.Substring(i, 2).StartsWith("T."))
-            {
-                return new TraversalTokenParameter(ParseTokens(text, ref i));
+                var startIndex = i;
+                var tokens = ParseTokens(text, ref i);
+                return new StaticTraversalParameter(tokens, text.Substring(startIndex, i - startIndex));
             }
             if (text.Substring(i, 2).StartsWith("P."))
             {
                 return new TraversalPredicateParameter(ParseTokens(text, ref i));
             }
-            return null;
+            var parameterText = text.Substring(i, text.IndexOf(')', i) - i);
+            if (string.IsNullOrWhiteSpace(parameterText))
+            {
+                return null;
+            }
+            if (RegexEnum.IsMatch(parameterText))
+            {
+                return new TraversalEnumParameter(parameterText);
+            }
+            throw new NotSupportedException($"Parameter {parameterText} not supported");
         }
         
         private static ITokenParameter ParseNumber(string text, ref int i)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ee330162/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalPredicateParameter.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalPredicateParameter.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalPredicateParameter.cs
index 8c040b9..0d0dc49 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalPredicateParameter.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalPredicateParameter.cs
@@ -24,6 +24,7 @@
 using System;
 using System.Collections.Generic;
 using System.Linq;
+using System.Reflection;
 using Gremlin.Net.Process.Traversal;
 
 namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
@@ -35,7 +36,7 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
     {
         public bool Equals(TraversalPredicateParameter other)
         {
-            return Parts.SequenceEqual(other.Parts);
+            return Tokens.SequenceEqual(other.Tokens);
         }
 
         public override bool Equals(object obj)
@@ -48,12 +49,25 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
 
         public override int GetHashCode()
         {
-            return Parts != null ? Parts.GetHashCode() : 0;
+            return Tokens != null ? Tokens.GetHashCode() : 0;
         }
 
         public object GetValue()
         {
-            throw new NotImplementedException();
+            var type = typeof(P);
+            object instance = null;
+            for (var i = 1; i < Tokens.Count; i++)
+            {
+                var token = Tokens[i];
+                var method = type.GetMethod(TraversalParser.GetCsharpName(token.Name),
+                    BindingFlags.Static | BindingFlags.Public);
+                if (method == null)
+                {
+                    throw new InvalidOperationException($"Predicate (P) method '{token}' not found for testing");
+                }
+                instance = method.Invoke(instance, new object[] {token.Parameters.Select(p => p.GetValue()).ToArray()});
+            }
+            return instance;
         }
 
         public Type GetParameterType()
@@ -61,11 +75,11 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
             return typeof(TraversalPredicate);
         }
 
-        public IList<Token> Parts { get; }
+        public IList<Token> Tokens { get; }
         
-        public TraversalPredicateParameter(IList<Token> parts)
+        public TraversalPredicateParameter(IList<Token> tokens)
         {
-            Parts = parts;
+            Tokens = tokens;
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ee330162/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalTokenParameter.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalTokenParameter.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalTokenParameter.cs
deleted file mode 100644
index 9291cd6..0000000
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalTokenParameter.cs
+++ /dev/null
@@ -1,71 +0,0 @@
-#region License
-
-/*
- * 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.
- */
-
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using TEnum = Gremlin.Net.Process.Traversal.T;
-
-namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
-{
-    /// <summary>
-    /// Represents a parameter for a traversal token (ie: T.label)
-    /// </summary>
-    internal class TraversalTokenParameter : ITokenParameter, IEquatable<TraversalTokenParameter>
-    {
-        public bool Equals(TraversalTokenParameter other)
-        {
-            return Parts.SequenceEqual(other.Parts);
-        }
-
-        public override bool Equals(object obj)
-        {
-            if (ReferenceEquals(null, obj)) return false;
-            if (ReferenceEquals(this, obj)) return true;
-            if (obj.GetType() != GetType()) return false;
-            return Equals((TraversalTokenParameter) obj);
-        }
-
-        public override int GetHashCode()
-        {
-            return Parts != null ? Parts.GetHashCode() : 0;
-        }
-
-        public object GetValue()
-        {
-            throw new NotImplementedException();
-        }
-
-        public Type GetParameterType()
-        {
-            return typeof(TEnum);
-        }
-
-        public IList<Token> Parts { get; }
-        
-        public TraversalTokenParameter(IList<Token> parts)
-        {
-            Parts = parts;
-        }
-    }
-}
\ No newline at end of file