tinkerpop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From florianhockm...@apache.org
Subject [14/15] tinkerpop git commit: Merge branch 'tp32' into tp33
Date Mon, 13 Aug 2018 17:38:20 GMT
Merge branch 'tp32' into tp33


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

Branch: refs/heads/tp33
Commit: 25ae755118cc5d968652d4fd36bccb4d78ce9a7d
Parents: 5676e86 ea18963
Author: Florian Hockmann <fh@florian-hockmann.de>
Authored: Mon Aug 13 19:23:39 2018 +0200
Committer: Florian Hockmann <fh@florian-hockmann.de>
Committed: Mon Aug 13 19:23:39 2018 +0200

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |   1 +
 gremlin-dotnet/glv/Gremlin.Net.csproj.template  |   3 +-
 .../src/Gremlin.Net/Gremlin.Net.csproj          |   3 +-
 .../IO/GraphSON/BigIntegerDeserializer.cs       |  38 +++++++
 .../IO/GraphSON/BigIntegerSerializer.cs         |  37 +++++++
 .../IO/GraphSON/ByteBufferDeserializer.cs       |  36 +++++++
 .../IO/GraphSON/ByteBufferSerializer.cs         |  36 +++++++
 .../Structure/IO/GraphSON/ByteConverter.cs      |  33 ++++++
 .../Structure/IO/GraphSON/CharConverter.cs      |  34 ++++++
 .../Structure/IO/GraphSON/DateDeserializer.cs   |  38 +++++++
 .../Structure/IO/GraphSON/DateSerializer.cs     |   9 +-
 .../IO/GraphSON/DurationDeserializer.cs         |  37 +++++++
 .../Structure/IO/GraphSON/DurationSerializer.cs |  38 +++++++
 .../Structure/IO/GraphSON/GraphSONReader.cs     |  14 ++-
 .../Structure/IO/GraphSON/GraphSONWriter.cs     |  13 ++-
 .../Structure/IO/GraphSON/Int16Converter.cs     |  34 ++++++
 .../Gremlin.Net.UnitTest.csproj                 |   1 +
 .../IO/GraphSON/GraphSONReaderTests.cs          | 108 +++++++++++++++++++
 .../IO/GraphSON/GraphSONWriterTests.cs          |  65 +++++++++++
 19 files changed, 563 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/25ae7551/CHANGELOG.asciidoc
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/25ae7551/gremlin-dotnet/src/Gremlin.Net/Gremlin.Net.csproj
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/25ae7551/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONReader.cs
----------------------------------------------------------------------
diff --cc gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONReader.cs
index 94fcd8d,d11b14c..5ced99a
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONReader.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONReader.cs
@@@ -52,8 -49,15 +52,16 @@@ namespace Gremlin.Net.Structure.IO.Grap
                  {"g:Property", new PropertyDeserializer()},
                  {"g:VertexProperty", new VertexPropertyDeserializer()},
                  {"g:Path", new PathDeserializer()},
 +                {"g:T", new TDeserializer()},
-                 {"gx:BigDecimal", new DecimalConverter()}
+ 
+                 //Extended
+                 {"gx:BigDecimal", new DecimalConverter()},
+                 {"gx:Duration", new DurationDeserializer()},
+                 {"gx:BigInteger", new BigIntegerDeserializer()},
+                 {"gx:Byte", new ByteConverter()},
+                 {"gx:ByteBuffer", new ByteBufferDeserializer()},
+                 {"gx:Char", new CharConverter()},
+                 {"gx:Int16", new Int16Converter() }
              };
  
          /// <summary>

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/25ae7551/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONWriter.cs
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/25ae7551/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONReaderTests.cs
----------------------------------------------------------------------
diff --cc gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONReaderTests.cs
index c93630f,74bf385..00cf853
--- a/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONReaderTests.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONReaderTests.cs
@@@ -34,32 -36,22 +35,43 @@@ namespace Gremlin.Net.UnitTest.Structur
  {
      public class GraphSONReaderTests
      {
 -        private GraphSONReader CreateStandardGraphSONReader()
 -        {
 -            return new GraphSONReader();
 +        /// <summary>
 +        /// Parameters for each test supporting multiple versions of GraphSON
 +        /// </summary>
 +        public static IEnumerable<object[]> Versions => new []
 +        {
 +            new object[] { 2 },
 +            new object[] { 3 }
 +        };
 +        
 +        /// <summary>
 +        /// Parameters for each collections test supporting multiple versions of GraphSON
 +        /// </summary>
 +        public static IEnumerable<object[]> VersionsSupportingCollections => new
[]
 +        {
 +            new object[] { 3 }
 +        };
 +        
 +        private GraphSONReader CreateStandardGraphSONReader(int version)
 +        {
 +            if (version == 3)
 +            {
 +                return new GraphSON3Reader();
 +            }
 +            return new GraphSON2Reader();
          }
  
+         //During CI, we encountered a case where Newtonsoft.Json version 9.0.0
+         //was loaded although there is no obvious direct nor indirect dependency
+         //on that version of the library. An explicit reference to version
+         //11.0.0 from Gremlin.Net.UnitTest fixes that, however, it is
+         //still unclear what causes the downgrade. Until resolution, we keep this test.
+         [Fact]
+         public void NewtonsoftJsonVersionShouldSupportReallyBigIntegers()
+         {
+             Assert.Equal(new Version(11, 0, 0, 0), typeof(JToken).Assembly.GetName().Version);
+         }
+ 
          [Fact]
          public void ShouldDeserializeWithCustomDeserializerForNewType()
          {
@@@ -416,6 -334,102 +428,102 @@@
              Assert.NotNull(d);
              Assert.Equal("g:Traverser", (string)d["@type"]);
          }
+ 
 -        [Fact]
 -        public void ShouldDeserializeDurationToTimeSpan()
++        [Theory, MemberData(nameof(Versions))]
++        public void ShouldDeserializeDurationToTimeSpan(int version)
+         {
+             var serializedValue = "{\"@type\":\"gx:Duration\",\"@value\":\"PT120H\"}";
 -            var reader = CreateStandardGraphSONReader();
++            var reader = CreateStandardGraphSONReader(version);
+ 
+             var jObject = JObject.Parse(serializedValue);
+             TimeSpan deserializedValue = reader.ToObject(jObject);
+ 
+             Assert.Equal(TimeSpan.FromDays(5), deserializedValue);
+         }
+ 
 -        [Fact]
 -        public void ShouldDeserializeBigInteger()
++        [Theory, MemberData(nameof(Versions))]
++        public void ShouldDeserializeBigInteger(int version)
+         {
+             var serializedValue = "{\"@type\":\"gx:BigInteger\",\"@value\":123456789}";
 -            var reader = CreateStandardGraphSONReader();
++            var reader = CreateStandardGraphSONReader(version);
+ 
+             var jObject = JObject.Parse(serializedValue);
+             BigInteger deserializedValue = reader.ToObject(jObject);
+ 
+             Assert.Equal(BigInteger.Parse("123456789"), deserializedValue);
+         }
+ 
 -        [Fact]
 -        public void ShouldDeserializeBigIntegerValueAsString()
++        [Theory, MemberData(nameof(Versions))]
++        public void ShouldDeserializeBigIntegerValueAsString(int version)
+         {
+             var serializedValue = "{\"@type\":\"gx:BigInteger\",\"@value\":\"123456789\"}";
 -            var reader = CreateStandardGraphSONReader();
++            var reader = CreateStandardGraphSONReader(version);
+ 
+             var jObject = JObject.Parse(serializedValue);
+             BigInteger deserializedValue = reader.ToObject(jObject);
+ 
+             Assert.Equal(BigInteger.Parse("123456789"), deserializedValue);
+         }
+ 
 -        [Fact]
 -        public void ShouldDeserializeReallyBigIntegerValue()
++        [Theory, MemberData(nameof(Versions))]
++        public void ShouldDeserializeReallyBigIntegerValue(int version)
+         {
+             var serializedValue = "{\"@type\":\"gx:BigInteger\",\"@value\":123456789987654321123456789987654321}";
 -            var reader = CreateStandardGraphSONReader();
++            var reader = CreateStandardGraphSONReader(version);
+ 
+             var jObject = JObject.Parse(serializedValue);
+             BigInteger deserializedValue = reader.ToObject(jObject);
+ 
+             Assert.Equal(BigInteger.Parse("123456789987654321123456789987654321"), deserializedValue);
+         }
+ 
 -        [Fact]
 -        public void ShouldDeserializeByte()
++        [Theory, MemberData(nameof(Versions))]
++        public void ShouldDeserializeByte(int version)
+         {
+             var serializedValue = "{\"@type\":\"gx:Byte\",\"@value\":1}";
 -            var reader = CreateStandardGraphSONReader();
++            var reader = CreateStandardGraphSONReader(version);
+ 
+             var jObject = JObject.Parse(serializedValue);
+             var deserializedValue = reader.ToObject(jObject);
+ 
+             Assert.Equal(1, deserializedValue);
+         }
+ 
 -        [Fact]
 -        public void ShouldDeserializeByteBuffer()
++        [Theory, MemberData(nameof(Versions))]
++        public void ShouldDeserializeByteBuffer(int version)
+         {
+             var serializedValue = "{\"@type\":\"gx:ByteBuffer\",\"@value\":\"c29tZSBieXRlcyBmb3IgeW91\"}";
 -            var reader = CreateStandardGraphSONReader();
++            var reader = CreateStandardGraphSONReader(version);
+ 
+             var jObject = JObject.Parse(serializedValue);
+             var deserializedValue = reader.ToObject(jObject);
+ 
+             Assert.Equal(Convert.FromBase64String("c29tZSBieXRlcyBmb3IgeW91"), deserializedValue);
+         }
+ 
 -        [Fact]
 -        public void ShouldDeserializeChar()
++        [Theory, MemberData(nameof(Versions))]
++        public void ShouldDeserializeChar(int version)
+         {
+             var serializedValue = "{\"@type\":\"gx:Char\",\"@value\":\"x\"}";
 -            var reader = CreateStandardGraphSONReader();
++            var reader = CreateStandardGraphSONReader(version);
+ 
+             var jObject = JObject.Parse(serializedValue);
+             var deserializedValue = reader.ToObject(jObject);
+ 
+             Assert.Equal('x', deserializedValue);
+         }
+ 
 -        [Fact]
 -        public void ShouldDeserializeInt16()
++        [Theory, MemberData(nameof(Versions))]
++        public void ShouldDeserializeInt16(int version)
+         {
+             var serializedValue = "{\"@type\":\"gx:Int16\",\"@value\":100}";
 -            var reader = CreateStandardGraphSONReader();
++            var reader = CreateStandardGraphSONReader(version);
+ 
+             var jObject = JObject.Parse(serializedValue);
+             var deserializedValue = reader.ToObject(jObject);
+ 
+             Assert.Equal(100, deserializedValue);
+         }
      }
  
      internal class TestGraphSONDeserializer : IGraphSONDeserializer

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/25ae7551/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONWriterTests.cs
----------------------------------------------------------------------
diff --cc gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONWriterTests.cs
index 9f62abe,a544fb3..2d30fa1
--- a/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONWriterTests.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONWriterTests.cs
@@@ -406,6 -347,70 +407,70 @@@ namespace Gremlin.Net.UnitTest.Structur
                  "{\"@type\":\"g:Lambda\",\"@value\":{\"script\":\"{ it.get() }\",\"language\":\"gremlin-groovy\",\"arguments\":-1}}";
              Assert.Equal(expected, graphSon);
          }
+ 
 -        [Fact]
 -        public void ShouldSerializeTimeSpan()
++        [Theory, MemberData(nameof(Versions))]
++        public void ShouldSerializeTimeSpan(int version)
+         {
 -            var writer = CreateStandardGraphSONWriter();
++            var writer = CreateGraphSONWriter(version);
+             var timeSpan = new TimeSpan(5, 4, 3, 2, 1);
+ 
+             var graphSon = writer.WriteObject(timeSpan);
+ 
+             const string expected = "{\"@type\":\"gx:Duration\",\"@value\":\"P5DT4H3M2.001S\"}";
+             Assert.Equal(expected, graphSon);
+         }
+ 
 -        [Fact]
 -        public void ShouldSerializeBigInteger()
++        [Theory, MemberData(nameof(Versions))]
++        public void ShouldSerializeBigInteger(int version)
+         {
 -            var writer = CreateStandardGraphSONWriter();
++            var writer = CreateGraphSONWriter(version);
+             var bigInteger = BigInteger.Parse("123456789987654321123456789987654321");
+ 
+             var graphSon = writer.WriteObject(bigInteger);
+ 
+             const string expected = "{\"@type\":\"gx:BigInteger\",\"@value\":\"123456789987654321123456789987654321\"}";
+             Assert.Equal(expected, graphSon);
+         }
+ 
 -        [Fact]
 -        public void ShouldSerializeByte()
++        [Theory, MemberData(nameof(Versions))]
++        public void ShouldSerializeByte(int version)
+         {
 -            var writer = CreateStandardGraphSONWriter();
++            var writer = CreateGraphSONWriter(version);
+ 
+             var graphSon = writer.WriteObject((byte)1);
+ 
+             Assert.Equal("{\"@type\":\"gx:Byte\",\"@value\":1}", graphSon);
+         }
+ 
 -        [Fact]
 -        public void ShouldSerializeByteBuffer()
++        [Theory, MemberData(nameof(Versions))]
++        public void ShouldSerializeByteBuffer(int version)
+         {
 -            var writer = CreateStandardGraphSONWriter();
++            var writer = CreateGraphSONWriter(version);
+ 
+             var graphSon = writer.WriteObject(Convert.FromBase64String("c29tZSBieXRlcyBmb3IgeW91"));
+ 
+             Assert.Equal("{\"@type\":\"gx:ByteBuffer\",\"@value\":\"c29tZSBieXRlcyBmb3IgeW91\"}",
graphSon);
+         }
+ 
 -        [Fact]
 -        public void ShouldSerializeChar()
++        [Theory, MemberData(nameof(Versions))]
++        public void ShouldSerializeChar(int version)
+         {
 -            var writer = CreateStandardGraphSONWriter();
++            var writer = CreateGraphSONWriter(version);
+ 
+             var graphSon = writer.WriteObject('x');
+ 
+             Assert.Equal("{\"@type\":\"gx:Char\",\"@value\":\"x\"}", graphSon);
+         }
+ 
 -        [Fact]
 -        public void ShouldSerializeInt16()
++        [Theory, MemberData(nameof(Versions))]
++        public void ShouldSerializeInt16(int version)
+         {
 -            var writer = CreateStandardGraphSONWriter();
++            var writer = CreateGraphSONWriter(version);
+ 
+             var graphSon = writer.WriteObject((short)100);
+ 
+             Assert.Equal("{\"@type\":\"gx:Int16\",\"@value\":100}", graphSon);
+         }
      }
  
      internal class TestGraphSONSerializer : IGraphSONSerializer


Mime
View raw message