Skip to content

Commit

Permalink
[dbs-leipzig#1011] Fix VertexToEdge graph assignment and test
Browse files Browse the repository at this point in the history
  • Loading branch information
p-f committed Dec 4, 2018
1 parent 75a8362 commit 27362eb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
Expand Up @@ -90,7 +90,7 @@ public LogicalGraph execute(LogicalGraph graph) {
graph.getConfig().getEdgeFactory()));

return graph.getConfig().getLogicalGraphFactory()
.fromDataSets(graph.getGraphHead(), graph.getVertices(),
.fromDataSets(graph.getVertices(),
graph.getEdges().union(newEdges));
}
return null;
Expand Down
Expand Up @@ -25,34 +25,36 @@
*/
public class VertexToEdgeTest extends GradoopFlinkTestBase {

/**
* Test the {@link VertexToEdge} transformation where one one edge is added.
*
* @throws Exception when the execution in Flink fails.
*/
@Test
public void EdgeCreationTest() throws Exception {
public void testWithEdgeCreation() throws Exception {
FlinkAsciiGraphLoader loader = getLoaderFromString("input[" +
"(v0:Blue {a : 3})" +
"(v1:Green {a : 2})" +
"(v2:Blue {a : 4})" +
"(v0)-[{b : 2}]->(v1)" +
"(v1)-[{b : 4}]->(v2)" +
"]");

LogicalGraph input = loader.getLogicalGraphByVariable("input");

loader.appendToDatabaseFromString("expected[" +
"]" +
"expected[" +
"(v00:Blue {a : 3})" +
"(v01:Green {a : 2})" +
"(v02:Blue {a : 4})" +
"(v00)-[{b : 2}]->(v01)" +
"(v01)-[{b : 4}]->(v02)" +
"(v00)-[:foo {a : 2}]->(v02)" +
"(v00)-[:foo {a : 2, originalVertexLabel: \"Green\"," +
"firstEdgeLabel: \"\", secondEdgeLabel: \"\"}]->(v02)" +
"]");
LogicalGraph input = loader.getLogicalGraphByVariable("input");
LogicalGraph expected = loader.getLogicalGraphByVariable("expected");

VertexToEdge vte = new VertexToEdge("Green", "foo");

LogicalGraph transformed = input.callForGraph(vte);
VertexToEdge transformation = new VertexToEdge("Green", "foo");
LogicalGraph transformed = input.callForGraph(transformation);

collectAndAssertTrue(
transformed.equalsByElementData(loader.getLogicalGraphByVariable("expected")));

// transformed.getConfig().getExecutionEnvironment().execute();
transformed.equalsByElementData(expected));
}
}

0 comments on commit 27362eb

Please sign in to comment.