Updating message passing tests to use kitchen sink
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/f03c4df4 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/f03c4df4 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/f03c4df4 Branch: refs/heads/TINKERPOP-1862 Commit: f03c4df45473bafcf95d47f34467479f89af73a1 Parents: febe0ac Author: Graff, Philip B <philip.gr...@jhuapl.edu> Authored: Sun Feb 25 12:35:43 2018 -0500 Committer: Graff, Philip B <philip.gr...@jhuapl.edu> Committed: Sun Feb 25 12:35:43 2018 -0500 ---------------------------------------------------------------------- .../process/computer/GraphComputerTest.java | 21 ++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f03c4df4/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/computer/GraphComputerTest.java ---------------------------------------------------------------------- diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/computer/GraphComputerTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/computer/GraphComputerTest.java index da0e53f..4cbe584 100644 --- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/computer/GraphComputerTest.java +++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/computer/GraphComputerTest.java @@ -69,6 +69,7 @@ import java.util.concurrent.Future; import static org.apache.tinkerpop.gremlin.LoadGraphWith.GraphData.GRATEFUL; import static org.apache.tinkerpop.gremlin.LoadGraphWith.GraphData.MODERN; +import static org.apache.tinkerpop.gremlin.LoadGraphWith.GraphData.SINK; import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.outE; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -2688,8 +2689,9 @@ public class GraphComputerTest extends AbstractGremlinProcessTest { /////////////////////////////////// @Test + @LoadGraphWith(SINK) public void testMessagePassingIn() throws Exception { - runTest(Direction.IN).forEachRemaining(v -> { + runMPTest(Direction.IN).forEachRemaining(v -> { vertexPropertyChecks(v); final String in = v.value(VertexProgramR.PROPERTY_IN); if (in.equals("a")) @@ -2703,8 +2705,9 @@ public class GraphComputerTest extends AbstractGremlinProcessTest { } @Test + @LoadGraphWith(SINK) public void testMessagePassingOut() throws Exception { - runTest(Direction.OUT).forEachRemaining(v -> { + runMPTest(Direction.OUT).forEachRemaining(v -> { vertexPropertyChecks(v); final String in = v.value(VertexProgramR.PROPERTY_IN); if (in.equals("a")) @@ -2718,8 +2721,9 @@ public class GraphComputerTest extends AbstractGremlinProcessTest { } @Test + @LoadGraphWith(SINK) public void testMessagePassingBoth() throws Exception { - runTest(Direction.BOTH).forEachRemaining(v -> { + runMPTest(Direction.BOTH).forEachRemaining(v -> { vertexPropertyChecks(v); final String in = v.value(VertexProgramR.PROPERTY_IN); if (in.equals("a")) @@ -2732,14 +2736,10 @@ public class GraphComputerTest extends AbstractGremlinProcessTest { }); } - private GraphTraversal<Vertex, Vertex> runTest(Direction direction) throws Exception { - final Vertex a = graph.addVertex(VertexProgramR.PROPERTY_IN, "a"); - final Vertex b = graph.addVertex(VertexProgramR.PROPERTY_IN, "b"); - a.addEdge("edge", b); - a.addEdge("edge", a); + private GraphTraversal<Vertex, Vertex> runMPTest(Direction direction) throws Exception { final VertexProgramR svp = VertexProgramR.build().direction(direction).create(); - final ComputerResult result = graphProvider.getGraphComputer(graph).program(svp).submit().get(); - return result.graph().traversal().V(); + final ComputerResult result = graphProvider.getGraphComputer(graph).program(svp).vertices(__.hasLabel(VertexProgramR.VERTEX_LABEL)).submit().get(); + return result.graph().traversal().V().hasLabel(VertexProgramR.VERTEX_LABEL); } private static void vertexPropertyChecks(Vertex v) { @@ -2754,6 +2754,7 @@ public class GraphComputerTest extends AbstractGremlinProcessTest { private static final String SIMPLE_VERTEX_PROGRAM_CFG_PREFIX = "gremlin.simpleVertexProgram"; private static final String PROPERTY_OUT = "propertyout"; private static final String PROPERTY_IN = "propertyin"; + private static final String VERTEX_LABEL = "message_passing_test"; private static final String DIRECTION_CFG_KEY = SIMPLE_VERTEX_PROGRAM_CFG_PREFIX + ".direction"; private final MessageScope.Local<String> inMessageScope = MessageScope.Local.of(__::inE);