You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by jo...@apache.org on 2017/09/11 14:22:50 UTC
tinkerpop git commit: Gremlin .NET Support GraphSON3 [Forced Update!]
Repository: tinkerpop
Updated Branches:
refs/heads/TINKERPOP-1730 2ad017dcb -> abc1dbfd7 (forced update)
Gremlin .NET Support GraphSON3
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/abc1dbfd
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/abc1dbfd
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/abc1dbfd
Branch: refs/heads/TINKERPOP-1730
Commit: abc1dbfd7e0cae7c326b630b4309c24848e1012b
Parents: db24e28
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Fri Sep 8 17:32:29 2017 +0200
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Mon Sep 11 16:21:58 2017 +0200
----------------------------------------------------------------------
.../src/Gremlin.Net/Driver/GremlinClient.cs | 6 +-
.../Driver/Messages/ResponseResult.cs | 3 +-
.../Remote/DriverRemoteTraversalSideEffects.cs | 2 +-
.../Structure/IO/GraphSON/GraphSON3Reader.cs | 3 +-
.../Structure/IO/GraphSON/Path3Deserializer.cs | 45 +++++
.../Structure/IO/GraphSON/PathDeserializer.cs | 5 +-
.../src/Gremlin.Net/Structure/Path.cs | 24 ++-
.../GraphTraversalTests.cs | 4 +-
.../DriverRemoteConnection/SideEffectTests.cs | 24 ++-
.../IO/GraphSON/GraphSONReaderTests.cs | 22 ++-
.../Gremlin.Net.UnitTest/Structure/PathTests.cs | 190 +++++++++----------
gremlin-dotnet/test/pom.xml | 2 -
12 files changed, 205 insertions(+), 125 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/abc1dbfd/gremlin-dotnet/src/Gremlin.Net/Driver/GremlinClient.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Driver/GremlinClient.cs b/gremlin-dotnet/src/Gremlin.Net/Driver/GremlinClient.cs
index 064770f..a251ab7 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Driver/GremlinClient.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Driver/GremlinClient.cs
@@ -37,7 +37,7 @@ namespace Gremlin.Net.Driver
/// <summary>
/// Defines the default mime type to use.
/// </summary>
- public const string DefaultMimeType = "application/vnd.gremlin-v2.0+json";
+ public const string DefaultMimeType = "application/vnd.gremlin-v3.0+json";
private readonly ConnectionPool _connectionPool;
@@ -51,8 +51,8 @@ namespace Gremlin.Net.Driver
public GremlinClient(GremlinServer gremlinServer, GraphSONReader graphSONReader = null,
GraphSONWriter graphSONWriter = null, string mimeType = null)
{
- var reader = graphSONReader ?? new GraphSON2Reader();
- var writer = graphSONWriter ?? new GraphSON2Writer();
+ var reader = graphSONReader ?? new GraphSON3Reader();
+ var writer = graphSONWriter ?? new GraphSON3Writer();
var connectionFactory = new ConnectionFactory(gremlinServer, reader, writer, mimeType ?? DefaultMimeType);
_connectionPool = new ConnectionPool(connectionFactory);
}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/abc1dbfd/gremlin-dotnet/src/Gremlin.Net/Driver/Messages/ResponseResult.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Driver/Messages/ResponseResult.cs b/gremlin-dotnet/src/Gremlin.Net/Driver/Messages/ResponseResult.cs
index 643fbe8..1fc8f7a 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Driver/Messages/ResponseResult.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Driver/Messages/ResponseResult.cs
@@ -23,13 +23,14 @@
using System.Collections.Generic;
using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
namespace Gremlin.Net.Driver.Messages
{
internal class ResponseResult<T>
{
[JsonProperty(PropertyName = "data")]
- public List<T> Data { get; set; }
+ public JToken Data { get; set; }
[JsonProperty(PropertyName = "meta")]
public Dictionary<string, object> Meta { get; set; }
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/abc1dbfd/gremlin-dotnet/src/Gremlin.Net/Driver/Remote/DriverRemoteTraversalSideEffects.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Driver/Remote/DriverRemoteTraversalSideEffects.cs b/gremlin-dotnet/src/Gremlin.Net/Driver/Remote/DriverRemoteTraversalSideEffects.cs
index 8ce495d..34c3cea 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Driver/Remote/DriverRemoteTraversalSideEffects.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Driver/Remote/DriverRemoteTraversalSideEffects.cs
@@ -90,7 +90,7 @@ namespace Gremlin.Net.Driver.Remote
private object RetrieveSideEffectsForKey(string key)
{
- return _gremlinClient.SubmitWithSingleResultAsync<object>(SideEffectGatherMessage(key)).Result;
+ return _gremlinClient.SubmitAsync<object>(SideEffectGatherMessage(key)).Result;
}
private RequestMessage SideEffectGatherMessage(string key)
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/abc1dbfd/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSON3Reader.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSON3Reader.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSON3Reader.cs
index 4bc7878..cc74fe3 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSON3Reader.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSON3Reader.cs
@@ -35,7 +35,8 @@ namespace Gremlin.Net.Structure.IO.GraphSON
{
{ "g:List", new ListSerializer() },
{ "g:Set", new SetSerializer() },
- { "g:Map", new MapSerializer() }
+ { "g:Map", new MapSerializer() },
+ { "g:Path", new Path3Deserializer() }
};
/// <summary>
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/abc1dbfd/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/Path3Deserializer.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/Path3Deserializer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/Path3Deserializer.cs
new file mode 100644
index 0000000..8a0ed5e
--- /dev/null
+++ b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/Path3Deserializer.cs
@@ -0,0 +1,45 @@
+#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.Collections.Generic;
+using System.Linq;
+using Newtonsoft.Json.Linq;
+
+namespace Gremlin.Net.Structure.IO.GraphSON
+{
+ internal class Path3Deserializer : IGraphSONDeserializer
+ {
+ public dynamic Objectify(JToken graphsonObject, GraphSONReader reader)
+ {
+ // "labels" is a object[] where each item is ISet<object>
+ var labelProperty = (object[])reader.ToObject(graphsonObject["labels"]);
+ var labels = labelProperty
+ .Select(x => new HashSet<string>(((ISet<object>)x).Cast<string>()))
+ .ToList<ISet<string>>();
+ // "objects" is an object[]
+ object[] objectsProperty = reader.ToObject(graphsonObject["objects"]);
+ var objects = objectsProperty.ToArray();
+ return new Path(labels, objects);
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/abc1dbfd/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/PathDeserializer.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/PathDeserializer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/PathDeserializer.cs
index afdf07c..b322df8 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/PathDeserializer.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/PathDeserializer.cs
@@ -21,6 +21,7 @@
#endregion
+using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json.Linq;
@@ -32,8 +33,8 @@ namespace Gremlin.Net.Structure.IO.GraphSON
{
var labels =
graphsonObject["labels"]
- .Select(readObjLabels => readObjLabels.Select(l => (string) l).ToList())
- .ToList();
+ .Select(readObjLabels => new HashSet<string>(readObjLabels.Select(l => (string) l)))
+ .ToList<ISet<string>>();
var objects = graphsonObject["objects"].Select(o => reader.ToObject(o)).ToList();
return new Path(labels, objects);
}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/abc1dbfd/gremlin-dotnet/src/Gremlin.Net/Structure/Path.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/Path.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/Path.cs
index 01a436a..a9f2698 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/Path.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Structure/Path.cs
@@ -43,7 +43,7 @@ namespace Gremlin.Net.Structure
/// </summary>
/// <param name="labels">The labels associated with the path</param>
/// <param name="objects">The objects in the <see cref="Path" />.</param>
- public Path(List<List<string>> labels, List<object> objects)
+ public Path(IList<ISet<string>> labels, IList<object> objects)
{
Labels = labels;
Objects = objects;
@@ -52,12 +52,12 @@ namespace Gremlin.Net.Structure
/// <summary>
/// Gets an ordered list of the labels associated with the <see cref="Path" />.
/// </summary>
- public List<List<string>> Labels { get; }
+ public IList<ISet<string>> Labels { get; }
/// <summary>
/// Gets an ordered list of the objects in the <see cref="Path" />.
/// </summary>
- public List<object> Objects { get; }
+ public IList<object> Objects { get; }
/// <summary>
/// Gets the object associated with the particular label of the path.
@@ -147,21 +147,31 @@ namespace Gremlin.Net.Structure
return value != null;
}
- private bool ObjectsEqual(IReadOnlyCollection<object> otherObjects)
+ private bool ObjectsEqual(ICollection<object> otherObjects)
{
if (Objects == null)
return otherObjects == null;
return Objects.SequenceEqual(otherObjects);
}
- private bool LabelsEqual(IReadOnlyList<List<string>> otherLabels)
+ private bool LabelsEqual(ICollection<ISet<string>> otherLabels)
{
if (Labels == null)
return otherLabels == null;
if (Labels.Count != otherLabels.Count)
return false;
- var foundUnequalObjLabels = Labels.Where((objLabels, i) => !objLabels.SequenceEqual(otherLabels[i])).Any();
- return !foundUnequalObjLabels;
+ using (var enumOther = otherLabels.GetEnumerator())
+ using (var enumThis = Labels.GetEnumerator())
+ {
+ while (enumOther.MoveNext() && enumThis.MoveNext())
+ {
+ if (!enumOther.Current.SequenceEqual(enumThis.Current))
+ {
+ return false;
+ }
+ }
+ }
+ return true;
}
/// <inheritdoc />
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/abc1dbfd/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 11190ce..f290894 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
@@ -102,9 +102,9 @@ namespace Gremlin.Net.IntegrationTest.Process.Traversal.DriverRemoteConnection
var connection = _connectionFactory.CreateRemoteConnection();
var g = graph.Traversal().WithRemote(connection);
- var receivedValueMap = g.V().Has("name", "marko").ValueMap<string, object>().Next();
+ var receivedValueMap = g.V().Has("name", "marko").ValueMap<object, object>().Next();
- var expectedValueMap = new Dictionary<string, object>
+ var expectedValueMap = new Dictionary<object, object>
{
{"age", new List<object> {29}},
{"name", new List<object> {"marko"}}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/abc1dbfd/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/DriverRemoteConnection/SideEffectTests.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/DriverRemoteConnection/SideEffectTests.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/DriverRemoteConnection/SideEffectTests.cs
index f100e04..ca1c8d5 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/DriverRemoteConnection/SideEffectTests.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/DriverRemoteConnection/SideEffectTests.cs
@@ -22,9 +22,11 @@
#endregion
using System;
+using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
+using Gremlin.Net.Process.Traversal;
using Gremlin.Net.Structure;
using Xunit;
@@ -81,12 +83,20 @@ namespace Gremlin.Net.IntegrationTest.Process.Traversal.DriverRemoteConnection
var g = graph.Traversal().WithRemote(connection);
var t = g.V().Out("created").GroupCount("m").By("name").Iterate();
t.SideEffects.Keys();
-
- var m = t.SideEffects.Get("m") as Dictionary<string, dynamic>;
+ var m = (IList) t.SideEffects.Get("m");
Assert.Equal(2, m.Count);
- Assert.Equal((long) 3, m["lop"]);
- Assert.Equal((long) 1, m["ripple"]);
+ var result = new Dictionary<object, object>();
+
+ foreach (IDictionary map in m)
+ {
+ foreach (var key in map.Keys)
+ {
+ result.Add(key, map[key]);
+ }
+ }
+ Assert.Equal((long) 3, result["lop"]);
+ Assert.Equal((long) 1, result["ripple"]);
}
[Fact]
@@ -129,10 +139,8 @@ namespace Gremlin.Net.IntegrationTest.Process.Traversal.DriverRemoteConnection
Assert.Equal(2, keys.Count);
Assert.Contains("m", keys);
Assert.Contains("n", keys);
- var n = (Dictionary<object, long>) t.SideEffects.Get("n");
- Assert.Equal(2, n.Count);
- Assert.Equal(3, n["lop"]);
- Assert.Equal(1, n["ripple"]);
+ var n = (IList<object>) t.SideEffects.Get("n");
+ Assert.Equal(n.Select(tr => ((Traverser)tr).Object), new[] {"lop", "ripple"});
}
[Fact]
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/abc1dbfd/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 3fca7f7..e958e06 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
@@ -196,12 +196,12 @@ namespace Gremlin.Net.UnitTest.Structure.IO.GraphSON
Assert.Equal(new List<object> {5, 6}, deserializedValue);
}
- [Theory, MemberData(nameof(Versions))]
- public void ShouldDeserializePath(int version)
+ [Fact]
+ public void ShouldDeserializePathFromGraphSON2()
{
var graphSon =
"{\"@type\":\"g:Path\",\"@value\":{\"labels\":[[\"a\"],[\"b\",\"c\"],[]],\"objects\":[{\"@type\":\"g:Vertex\",\"@value\":{\"id\":{\"@type\":\"g:Int32\",\"@value\":1},\"label\":\"person\",\"properties\":{\"name\":[{\"@type\":\"g:VertexProperty\",\"@value\":{\"id\":{\"@type\":\"g:Int64\",\"@value\":0},\"value\":\"marko\",\"label\":\"name\"}}],\"age\":[{\"@type\":\"g:VertexProperty\",\"@value\":{\"id\":{\"@type\":\"g:Int64\",\"@value\":1},\"value\":{\"@type\":\"g:Int32\",\"@value\":29},\"label\":\"age\"}}]}}},{\"@type\":\"g:Vertex\",\"@value\":{\"id\":{\"@type\":\"g:Int32\",\"@value\":3},\"label\":\"software\",\"properties\":{\"name\":[{\"@type\":\"g:VertexProperty\",\"@value\":{\"id\":{\"@type\":\"g:Int64\",\"@value\":4},\"value\":\"lop\",\"label\":\"name\"}}],\"lang\":[{\"@type\":\"g:VertexProperty\",\"@value\":{\"id\":{\"@type\":\"g:Int64\",\"@value\":5},\"value\":\"java\",\"label\":\"lang\"}}]}}},\"lop\"]}}";
- var reader = CreateStandardGraphSONReader(version);
+ var reader = CreateStandardGraphSONReader(2);
Path readPath = reader.ToObject(JObject.Parse(graphSon));
@@ -212,6 +212,22 @@ namespace Gremlin.Net.UnitTest.Structure.IO.GraphSON
Assert.Equal(3, readPath.Count);
}
+ [Fact]
+ public void ShouldDeserializePathFromGraphSON3()
+ {
+ var graphSon = "{\"@type\":\"g:Path\",\"@value\":{" +
+ "\"labels\":{\"@type\":\"g:List\",\"@value\":[{\"@type\":\"g:Set\",\"@value\":[\"z\"]}]}," +
+ "\"objects\":{\"@type\":\"g:List\",\"@value\":[{\"@type\":\"g:Vertex\",\"@value\":{\"id\":{\"@type\":\"g:Int64\",\"@value\":5},\"label\":\"\"}}]}}}";
+ var reader = CreateStandardGraphSONReader(3);
+
+ Path readPath = reader.ToObject(JObject.Parse(graphSon));
+
+ Assert.Equal("[v[5]]", readPath.ToString());
+ Assert.Equal(new Vertex(5L), readPath[0]);
+ Assert.Equal(new Vertex(5L), readPath["z"]);
+ Assert.Equal(1, readPath.Count);
+ }
+
[Theory, MemberData(nameof(Versions))]
public void ShouldDeserializePropertyWithEdgeElement(int version)
{
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/abc1dbfd/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/PathTests.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/PathTests.cs b/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/PathTests.cs
index e4ffb6e..cbc3f8d 100644
--- a/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/PathTests.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/PathTests.cs
@@ -34,11 +34,11 @@ namespace Gremlin.Net.UnitTest.Structure
[Fact]
public void ShouldAssignPropertiesCorrectly()
{
- var labels = new List<List<string>>
+ var labels = new List<ISet<string>>
{
- new List<string> {"a", "b"},
- new List<string> {"c", "b"},
- new List<string>()
+ new HashSet<string> {"a", "b"},
+ new HashSet<string> {"c", "b"},
+ new HashSet<string>()
};
var objects = new List<object> {1, new Vertex(1), "hello"};
@@ -51,11 +51,11 @@ namespace Gremlin.Net.UnitTest.Structure
[Fact]
public void ShouldReturnTrueForContainsKeyWhenGivenKeyExists()
{
- var labels = new List<List<string>>
+ var labels = new List<ISet<string>>
{
- new List<string> {"a", "b"},
- new List<string> {"c", "b"},
- new List<string>()
+ new HashSet<string> {"a", "b"},
+ new HashSet<string> {"c", "b"},
+ new HashSet<string>()
};
var path = new Path(labels, new List<object>());
@@ -67,11 +67,11 @@ namespace Gremlin.Net.UnitTest.Structure
[Fact]
public void ShouldReturnFalseForContainsKeyWhenGivenKeyDoesNotExist()
{
- var labels = new List<List<string>>
+ var labels = new List<ISet<string>>
{
- new List<string> {"a", "b"},
- new List<string> {"c", "b"},
- new List<string>()
+ new HashSet<string> {"a", "b"},
+ new HashSet<string> {"c", "b"},
+ new HashSet<string>()
};
var path = new Path(labels, new List<object>());
@@ -84,7 +84,7 @@ namespace Gremlin.Net.UnitTest.Structure
public void ShouldReturnCountOfObjectsForCountProperty()
{
var objects = new List<object> {1, new Vertex(1), "hello"};
- var path = new Path(new List<List<string>>(), objects);
+ var path = new Path(new List<ISet<string>>(), objects);
var count = path.Count;
@@ -95,7 +95,7 @@ namespace Gremlin.Net.UnitTest.Structure
public void ShouldEnumeratorObjectsIntoListWhenToListIsCalled()
{
var objects = new List<object> {1, new Vertex(1), "hello"};
- var path = new Path(new List<List<string>>(), objects);
+ var path = new Path(new List<ISet<string>>(), objects);
var enumeratedObj = path.ToList();
@@ -107,19 +107,19 @@ namespace Gremlin.Net.UnitTest.Structure
{
var firstPath =
new Path(
- new List<List<string>>
+ new List<ISet<string>>
{
- new List<string> {"a", "b"},
- new List<string> {"c", "b"},
- new List<string>()
+ new HashSet<string> {"a", "b"},
+ new HashSet<string> {"c", "b"},
+ new HashSet<string>()
}, new List<object> {1, new Vertex(1), "hello"});
var secondPath =
new Path(
- new List<List<string>>
+ new List<ISet<string>>
{
- new List<string> {"a", "b"},
- new List<string> {"c", "b"},
- new List<string>()
+ new HashSet<string> {"a", "b"},
+ new HashSet<string> {"c", "b"},
+ new HashSet<string>()
}, new List<object> {1, new Vertex(1), "hello"});
var equals = firstPath.Equals(secondPath);
@@ -132,19 +132,19 @@ namespace Gremlin.Net.UnitTest.Structure
{
var firstPath =
new Path(
- new List<List<string>>
+ new List<ISet<string>>
{
- new List<string> {"a", "b"},
- new List<string> {"c", "b"},
- new List<string>()
+ new HashSet<string> {"a", "b"},
+ new HashSet<string> {"c", "b"},
+ new HashSet<string>()
}, new List<object> {1, new Vertex(1), "hello"});
var secondPath =
new Path(
- new List<List<string>>
+ new List<ISet<string>>
{
- new List<string> {"a"},
- new List<string> {"c", "b"},
- new List<string>()
+ new HashSet<string> {"a"},
+ new HashSet<string> {"c", "b"},
+ new HashSet<string>()
}, new List<object> {1, new Vertex(1), "hello"});
var equals = firstPath.Equals(secondPath);
@@ -157,19 +157,19 @@ namespace Gremlin.Net.UnitTest.Structure
{
var firstPath =
new Path(
- new List<List<string>>
+ new List<ISet<string>>
{
- new List<string> {"a", "b"},
- new List<string> {"c", "b"},
- new List<string>()
+ new HashSet<string> {"a", "b"},
+ new HashSet<string> {"c", "b"},
+ new HashSet<string>()
}, new List<object> {1, new Vertex(1), "hello"});
var secondPath =
new Path(
- new List<List<string>>
+ new List<ISet<string>>
{
- new List<string> {"a", "b"},
- new List<string> {"c", "b"},
- new List<string>()
+ new HashSet<string> {"a", "b"},
+ new HashSet<string> {"c", "b"},
+ new HashSet<string>()
}, new List<object> {3, new Vertex(1), "hello"});
var equals = firstPath.Equals(secondPath);
@@ -182,19 +182,19 @@ namespace Gremlin.Net.UnitTest.Structure
{
var firstPath =
new Path(
- new List<List<string>>
+ new List<ISet<string>>
{
- new List<string> {"a", "b"},
- new List<string> {"c", "b"},
- new List<string>()
+ new HashSet<string> {"a", "b"},
+ new HashSet<string> {"c", "b"},
+ new HashSet<string>()
}, new List<object> { 1, new Vertex(1), "hello" });
object secondPath =
new Path(
- new List<List<string>>
+ new List<ISet<string>>
{
- new List<string> {"a", "b"},
- new List<string> {"c", "b"},
- new List<string>()
+ new HashSet<string> {"a", "b"},
+ new HashSet<string> {"c", "b"},
+ new HashSet<string>()
}, new List<object> { 1, new Vertex(1), "hello" });
var equals = firstPath.Equals(secondPath);
@@ -207,19 +207,19 @@ namespace Gremlin.Net.UnitTest.Structure
{
var firstPath =
new Path(
- new List<List<string>>
+ new List<ISet<string>>
{
- new List<string> {"a", "b"},
- new List<string> {"c", "b"},
- new List<string>()
+ new HashSet<string> {"a", "b"},
+ new HashSet<string> {"c", "b"},
+ new HashSet<string>()
}, new List<object> { 1, new Vertex(1), "hello" });
object secondPath =
new Path(
- new List<List<string>>
+ new List<ISet<string>>
{
- new List<string> {"a"},
- new List<string> {"c", "b"},
- new List<string>()
+ new HashSet<string> {"a"},
+ new HashSet<string> {"c", "b"},
+ new HashSet<string>()
}, new List<object> { 1, new Vertex(1), "hello" });
var equals = firstPath.Equals(secondPath);
@@ -232,19 +232,19 @@ namespace Gremlin.Net.UnitTest.Structure
{
var firstPath =
new Path(
- new List<List<string>>
+ new List<ISet<string>>
{
- new List<string> {"a", "b"},
- new List<string> {"c", "b"},
- new List<string>()
+ new HashSet<string> {"a", "b"},
+ new HashSet<string> {"c", "b"},
+ new HashSet<string>()
}, new List<object> { 1, new Vertex(1), "hello" });
object secondPath =
new Path(
- new List<List<string>>
+ new List<ISet<string>>
{
- new List<string> {"a", "b"},
- new List<string> {"c", "b"},
- new List<string>()
+ new HashSet<string> {"a", "b"},
+ new HashSet<string> {"c", "b"},
+ new HashSet<string>()
}, new List<object> { 3, new Vertex(1), "hello" });
var equals = firstPath.Equals(secondPath);
@@ -255,7 +255,7 @@ namespace Gremlin.Net.UnitTest.Structure
[Fact]
public void ShouldReturnFalseForEqualsWhereOtherIsNull()
{
- var path = new Path(new List<List<string>> {new List<string> {"a", "b"},}, new List<object> {1});
+ var path = new Path(new List<ISet<string>> {new HashSet<string> {"a", "b"},}, new List<object> {1});
var equals = path.Equals(null);
@@ -267,19 +267,19 @@ namespace Gremlin.Net.UnitTest.Structure
{
var firstPath =
new Path(
- new List<List<string>>
+ new List<ISet<string>>
{
- new List<string> {"a", "b"},
- new List<string> {"c", "b"},
- new List<string>()
+ new HashSet<string> {"a", "b"},
+ new HashSet<string> {"c", "b"},
+ new HashSet<string>()
}, new List<object> { 1, new Vertex(1), "hello" });
var secondPath =
new Path(
- new List<List<string>>
+ new List<ISet<string>>
{
- new List<string> {"a", "b"},
- new List<string> {"c", "b"},
- new List<string>()
+ new HashSet<string> {"a", "b"},
+ new HashSet<string> {"c", "b"},
+ new HashSet<string>()
}, new List<object> { 1, new Vertex(1), "hello" });
var firstHashCode = firstPath.GetHashCode();
@@ -292,7 +292,7 @@ namespace Gremlin.Net.UnitTest.Structure
public void ShouldThrowWhenInvalidIndexIsAccessed()
{
var objects = new List<object> {1, new Vertex(1), "hello"};
- var path = new Path(new List<List<string>>(), objects);
+ var path = new Path(new List<ISet<string>>(), objects);
Assert.Throws<ArgumentOutOfRangeException>(() => path[3]);
}
@@ -301,7 +301,7 @@ namespace Gremlin.Net.UnitTest.Structure
public void ShouldReturnObjectsByTheirIndex()
{
var objects = new List<object> {1, new Vertex(1), "hello"};
- var path = new Path(new List<List<string>>(), objects);
+ var path = new Path(new List<ISet<string>>(), objects);
Assert.Equal(1, path[0]);
Assert.Equal(new Vertex(1), path[1]);
@@ -311,11 +311,11 @@ namespace Gremlin.Net.UnitTest.Structure
[Fact]
public void ShouldReturnAllObjectsWhenTheirKeyIsAccessed()
{
- var labels = new List<List<string>>
+ var labels = new List<ISet<string>>
{
- new List<string> {"a", "b"},
- new List<string> {"c", "b"},
- new List<string>()
+ new HashSet<string> {"a", "b"},
+ new HashSet<string> {"c", "b"},
+ new HashSet<string>()
};
var objects = new List<object> {1, new Vertex(1), "hello"};
var path = new Path(labels, objects);
@@ -328,11 +328,11 @@ namespace Gremlin.Net.UnitTest.Structure
[Fact]
public void ShouldReturnObjectsByTheirKey()
{
- var labels = new List<List<string>>
+ var labels = new List<ISet<string>>
{
- new List<string> {"a"},
- new List<string> {"c", "b"},
- new List<string>()
+ new HashSet<string> {"a"},
+ new HashSet<string> {"c", "b"},
+ new HashSet<string>()
};
var objects = new List<object> {1, new Vertex(1), "hello"};
var path = new Path(labels, objects);
@@ -345,7 +345,7 @@ namespace Gremlin.Net.UnitTest.Structure
[Fact]
public void ShouldThrowWhenUnknownKeyIsAccessed()
{
- var path = new Path(new List<List<string>>(), new List<object>());
+ var path = new Path(new List<ISet<string>>(), new List<object>());
Assert.Throws<KeyNotFoundException>(() => path["unknownKey"]);
}
@@ -353,11 +353,11 @@ namespace Gremlin.Net.UnitTest.Structure
[Fact]
public void ShouldReturnCommonStringRepresentationForToString()
{
- var labels = new List<List<string>>
+ var labels = new List<ISet<string>>
{
- new List<string> {"a", "b"},
- new List<string> {"c", "b"},
- new List<string>()
+ new HashSet<string> {"a", "b"},
+ new HashSet<string> {"c", "b"},
+ new HashSet<string>()
};
var objects = new List<object> {1, new Vertex(1), "hello"};
var path = new Path(labels, objects);
@@ -370,11 +370,11 @@ namespace Gremlin.Net.UnitTest.Structure
[Fact]
public void ShouldReturnTrueAndObjectsForTryGetWhenKeyWithMultipleObjectsIsProvided()
{
- var labels = new List<List<string>>
+ var labels = new List<ISet<string>>
{
- new List<string> {"a", "b"},
- new List<string> {"c", "b"},
- new List<string>()
+ new HashSet<string> {"a", "b"},
+ new HashSet<string> {"c", "b"},
+ new HashSet<string>()
};
var objects = new List<object> {1, new Vertex(1), "hello"};
var path = new Path(labels, objects);
@@ -388,11 +388,11 @@ namespace Gremlin.Net.UnitTest.Structure
[Fact]
public void ShouldReturnTrueAndCorrectObjectForTryGet()
{
- var labels = new List<List<string>>
+ var labels = new List<ISet<string>>
{
- new List<string> {"a"},
- new List<string> {"c", "b"},
- new List<string>()
+ new HashSet<string> {"a"},
+ new HashSet<string> {"c", "b"},
+ new HashSet<string>()
};
var objects = new List<object> {1, new Vertex(1), "hello"};
var path = new Path(labels, objects);
@@ -406,7 +406,7 @@ namespace Gremlin.Net.UnitTest.Structure
[Fact]
public void ShouldReturnFalseForTryGetWhenUnknownKeyIsProvided()
{
- var path = new Path(new List<List<string>>(), new List<object>());
+ var path = new Path(new List<ISet<string>>(), new List<object>());
var success = path.TryGetValue("unknownKey", out object _);
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/abc1dbfd/gremlin-dotnet/test/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/pom.xml b/gremlin-dotnet/test/pom.xml
index 0a747c0..8931902 100644
--- a/gremlin-dotnet/test/pom.xml
+++ b/gremlin-dotnet/test/pom.xml
@@ -143,7 +143,6 @@ log.info("Starting Gremlin Server instances for native testing of gremlin-dotnet
def settings = Settings.read("${gremlin.server.dir}/conf/gremlin-server-modern.yaml")
settings.graphs.graph = "${gremlin.server.dir}/conf/tinkergraph-empty.properties"
settings.scriptEngines["gremlin-groovy"].plugins["org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin"].files = ["${gremlin.server.dir}/scripts/generate-modern.groovy"]
-settings.serializers << new SerializerSettings("org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV2d0", [:])
settings.port = 45950
def server = new GremlinServer(settings)
@@ -164,7 +163,6 @@ if (!securePropsFile.exists()) {
def settingsSecure = Settings.read("${gremlin.server.dir}/conf/gremlin-server-modern.yaml")
settingsSecure.graphs.graph = "${gremlin.server.dir}/conf/tinkergraph-empty.properties"
settingsSecure.scriptEngines["gremlin-groovy"].plugins["org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin"].files = ["${gremlin.server.dir}/scripts/generate-modern.groovy"]
-settingsSecure.serializers << new SerializerSettings("org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV2d0", [:])
settingsSecure.port = 45951
settingsSecure.authentication.authenticator = "org.apache.tinkerpop.gremlin.server.auth.SimpleAuthenticator"
settingsSecure.authentication.config = [credentialsDb: "${project.basedir}/target/tinkergraph-credentials.properties"]