tinkerpop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From spmalle...@apache.org
Subject [2/9] tinkerpop git commit: TINKERPOP-1734 Test for DSLs with .NET
Date Fri, 01 Dec 2017 12:14:40 GMT
TINKERPOP-1734 Test for DSLs with .NET


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

Branch: refs/heads/TINKERPOP-1846
Commit: 2f345ca16dc056b8ecff383d1d29d5e22149bbdd
Parents: fe7b175
Author: Stephen Mallette <spmva@genoprime.com>
Authored: Wed Nov 29 15:17:26 2017 -0500
Committer: Stephen Mallette <spmva@genoprime.com>
Committed: Thu Nov 30 07:05:40 2017 -0500

----------------------------------------------------------------------
 .../Process/Traversal/Dsl/DslTest.cs            | 62 ++++++++++++++++++++
 1 file changed, 62 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2f345ca1/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/Dsl/DslTest.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/Dsl/DslTest.cs
b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/Dsl/DslTest.cs
new file mode 100644
index 0000000..d1541ef
--- /dev/null
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/Dsl/DslTest.cs
@@ -0,0 +1,62 @@
+#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 Gremlin.Net.Process.Traversal;
+using Gremlin.Net.Structure;
+using Gremlin.Net.IntegrationTest.Process.Traversal.DriverRemoteConnection;
+using Xunit;
+
+namespace Gremlin.Net.IntegrationTest.Process.Traversal.Dsl {
+
+    public static class SocialTraversal {
+        public static GraphTraversal<Vertex,Vertex> knows(this GraphTraversal<Vertex,Vertex>
t, string personName) {
+            return t.Out("knows").HasLabel("person").Has("name", personName);
+        }
+    }
+
+    public static class SocialTraversalSource {
+        public static GraphTraversal<Vertex,Vertex> persons(this GraphTraversalSource
g, params string[] personNames) {
+            GraphTraversal<Vertex,Vertex> t = g.V().HasLabel("person");
+
+            if (personNames.Length > 0) {    
+                t = t.Has("name", P.Within(personNames));
+            }
+
+            return t;
+        }
+    }
+
+    public class DslTest {
+        private readonly RemoteConnectionFactory _connectionFactory = new RemoteConnectionFactory();
+        
+        [Fact]
+        public void ShouldUseDsl() {
+            var graph = new Graph();
+            var connection = _connectionFactory.CreateRemoteConnection();
+            var social = graph.Traversal().WithRemote(connection);
+
+            Assert.NotNull(social.persons("marko").knows("josh").Next());
+        }
+    }
+}
\ No newline at end of file


Mime
View raw message