You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by ok...@apache.org on 2015/03/09 21:10:36 UTC

[2/2] incubator-tinkerpop git commit: more tests converted.

more tests converted.


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

Branch: refs/heads/newapi
Commit: e8e12d1b53baee476b4a89479d18600136372d5b
Parents: 303fce4
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Mon Mar 9 14:10:33 2015 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Mon Mar 9 14:10:33 2015 -0600

----------------------------------------------------------------------
 .../process/TraversalPerformanceTest.java       |   2 +-
 .../traversal/step/sideEffect/AddEdgeTest.java  |  27 +-
 .../tinkerpop/gremlin/structure/IoTest.java     | 463 ++++++++++---------
 .../strategy/ReadOnlyStrategyTest.java          |   2 +-
 .../util/detached/DetachedPropertyTest.java     |   6 +-
 5 files changed, 251 insertions(+), 249 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/e8e12d1b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/TraversalPerformanceTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/TraversalPerformanceTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/TraversalPerformanceTest.java
index 2f6d457..346428d 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/TraversalPerformanceTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/TraversalPerformanceTest.java
@@ -101,7 +101,7 @@ public class TraversalPerformanceTest extends AbstractGremlinTest {
     @LoadGraphWith(LoadGraphWith.GraphData.GRATEFUL)
     @Test
     public void g_V_out_mapXout_out_valuesXnameX_toListX() throws Exception {
-        g.V().out().map(v -> v.get().out().out().values("name").toList()).iterate();
+        g.V().out().map(v -> g.V(v).out().out().values("name").toList()).iterate();
     }
 
     @BenchmarkOptions(benchmarkRounds = DEFAULT_BENCHMARK_ROUNDS, warmupRounds = DEFAULT_WARMUP_ROUNDS, concurrency = BenchmarkOptions.CONCURRENCY_SEQUENTIAL)

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/e8e12d1b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/sideEffect/AddEdgeTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/sideEffect/AddEdgeTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/sideEffect/AddEdgeTest.java
index 1a84921..523f181 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/sideEffect/AddEdgeTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/sideEffect/AddEdgeTest.java
@@ -24,16 +24,17 @@ import org.apache.tinkerpop.gremlin.LoadGraphWith;
 import org.apache.tinkerpop.gremlin.process.Traversal;
 import org.apache.tinkerpop.gremlin.process.TraversalEngine;
 import org.apache.tinkerpop.gremlin.process.UseEngine;
+import org.apache.tinkerpop.gremlin.structure.Direction;
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
 import org.junit.Test;
 
 import java.util.ArrayList;
 import java.util.List;
 
 import static org.apache.tinkerpop.gremlin.LoadGraphWith.GraphData.MODERN;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.*;
 
 /**
  * @author Marko A. Rodriguez (http://markorodriguez.com)
@@ -66,11 +67,11 @@ public abstract class AddEdgeTest extends AbstractGremlinTest {
 
         for (Vertex vertex : cocreators) {
             if (vertex.id().equals(convertToVertexId("marko"))) {
-                assertEquals(vertex.outE("cocreator").count().next(), new Long(4));
-                assertEquals(vertex.inE("cocreator").count().next(), new Long(4));
+                assertEquals(4, IteratorUtils.count(vertex.edges(Direction.OUT, "cocreator")));
+                assertEquals(4, IteratorUtils.count(vertex.edges(Direction.IN, "cocreator")));
             } else {
-                assertEquals(vertex.outE("cocreator").count().next(), new Long(1));
-                assertEquals(vertex.inE("cocreator").count().next(), new Long(1));
+                assertEquals(1, IteratorUtils.count(vertex.edges(Direction.OUT, "cocreator")));
+                assertEquals(1, IteratorUtils.count(vertex.edges(Direction.IN, "cocreator")));
             }
         }
     }
@@ -85,9 +86,9 @@ public abstract class AddEdgeTest extends AbstractGremlinTest {
         while (traversal.hasNext()) {
             final Vertex vertex = traversal.next();
             assertEquals(convertToVertexId("lop"), vertex.id());
-            assertEquals(1, vertex.out("createdBy").count().next().longValue());
-            assertEquals(convertToVertexId("marko"), vertex.out("createdBy").id().next());
-            assertEquals(0, vertex.outE("createdBy").valueMap().next().size());
+            assertEquals(1, IteratorUtils.count(vertex.vertices(Direction.OUT, "createdBy")));
+            assertEquals(convertToVertexId("marko"), vertex.vertices(Direction.OUT, "createdBy").next().id());
+            assertFalse(vertex.edges(Direction.OUT, "createdBy").next().properties().hasNext());
             count++;
 
         }
@@ -104,10 +105,10 @@ public abstract class AddEdgeTest extends AbstractGremlinTest {
         while (traversal.hasNext()) {
             final Vertex vertex = traversal.next();
             assertEquals(convertToVertexId("lop"), vertex.id());
-            assertEquals(Long.valueOf(1l), vertex.out("createdBy").count().next());
-            assertEquals(convertToVertexId("marko"), vertex.out("createdBy").id().next());
-            assertEquals(2, vertex.outE("createdBy").values("weight").next());
-            assertEquals(1, vertex.outE("createdBy").valueMap().next().size());
+            assertEquals(1, IteratorUtils.count(vertex.vertices(Direction.OUT, "createdBy")));
+            assertEquals(convertToVertexId("marko"), vertex.vertices(Direction.OUT, "createdBy").next().id());
+            assertEquals(2, vertex.edges(Direction.OUT, "createdBy").next().values("weight").next());
+            assertEquals(1, IteratorUtils.count(vertex.edges(Direction.OUT, "createdBy").next().properties()));
             count++;