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/06/15 18:06:22 UTC

incubator-tinkerpop git commit: added stronger 'copy over' tests for StarGraphTest -- vertices+edges and only edges.

Repository: incubator-tinkerpop
Updated Branches:
  refs/heads/master ddee0dcbb -> f98d0744d


added stronger 'copy over' tests for StarGraphTest -- vertices+edges and only edges.


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

Branch: refs/heads/master
Commit: f98d0744d06ab6c5dc074aca765d4044f3941b03
Parents: ddee0dc
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Mon Jun 15 10:06:15 2015 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Mon Jun 15 10:06:15 2015 -0600

----------------------------------------------------------------------
 .../structure/util/star/StarGraphTest.java      | 21 +++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/f98d0744/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraphTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraphTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraphTest.java
index 46e2f83..2c5d6d2 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraphTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraphTest.java
@@ -115,15 +115,26 @@ public class StarGraphTest extends AbstractGremlinTest {
     @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_PROPERTY)
     @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
     public void shouldCopyFromGraphAToGraphB() throws Exception {
-        final Configuration configuration = graphProvider.newGraphConfiguration("readGraph", this.getClass(), name.getMethodName(), null);
-        final Graph g1 = graphProvider.openTestGraph(configuration);
+        final List<StarGraph> starGraphs = IteratorUtils.stream(graph.vertices()).map(StarGraph::of).collect(Collectors.toList());
 
-        List<StarGraph> starVertices = IteratorUtils.stream(graph.vertices()).map(StarGraph::of).collect(Collectors.toList());
-        starVertices.forEach(starVertex -> starVertex.edges().forEachRemaining(edge -> ((Attachable<Edge>) edge).attach(Attachable.Method.getOrCreate(g1))));
+        // via vertices and then edges
+        final Configuration g1Configuration = graphProvider.newGraphConfiguration("readGraph", this.getClass(), name.getMethodName(), null);
+        Graph g1 = graphProvider.openTestGraph(g1Configuration);
+        starGraphs.stream().map(StarGraph::getStarVertex).forEach(vertex -> vertex.attach(Attachable.Method.getOrCreate(g1)));
+        starGraphs.stream().forEach(starGraph -> starGraph.edges().forEachRemaining(edge -> ((Attachable<Edge>) edge).attach(Attachable.Method.getOrCreate(g1))));
         assertEquals(IteratorUtils.count(graph.vertices()), IteratorUtils.count(g1.vertices()));
         assertEquals(IteratorUtils.count(graph.edges()), IteratorUtils.count(g1.edges()));
+        graph.vertices().forEachRemaining(vertex -> TestHelper.validateVertexEquality(vertex, g1.vertices(vertex.id()).next(), true));
+        graphProvider.clear(g1, g1Configuration);
+
+        // via edges only
+        final Configuration g2Configuration = graphProvider.newGraphConfiguration("readGraph", this.getClass(), name.getMethodName(), null);
+        final Graph g2 = graphProvider.openTestGraph(g2Configuration);
+        starGraphs.stream().forEach(starGraph -> starGraph.edges().forEachRemaining(edge -> ((Attachable<Edge>) edge).attach(Attachable.Method.getOrCreate(g2))));
+        assertEquals(IteratorUtils.count(graph.vertices()), IteratorUtils.count(g2.vertices()));
+        assertEquals(IteratorUtils.count(graph.edges()), IteratorUtils.count(g2.edges()));
         // TODO: you can't get adjacent labels -- graph.vertices().forEachRemaining(vertex -> TestHelper.validateVertexEquality(vertex, g1.vertices(vertex.id()).next(), true));
-        graphProvider.clear(g1, configuration);
+        graphProvider.clear(g2, g2Configuration);
     }
 
     @Test