@Test
public void testFromGraphTransactions() throws Exception {
FlinkAsciiGraphLoader loader = getSocialNetworkLoader();
GraphTransaction g0 = new GraphTransaction(loader.getGraphHeadByVariable("g0"),
Sets.newHashSet(loader.getVerticesByGraphVariables("g0")),
Sets.newHashSet(loader.getEdgesByGraphVariables("g0")));
GraphTransaction g1 = new GraphTransaction(loader.getGraphHeadByVariable("g1"),
Sets.newHashSet(loader.getVerticesByGraphVariables("g1")),
Sets.newHashSet(loader.getEdgesByGraphVariables("g1")));
GraphTransaction g2 = new GraphTransaction(loader.getGraphHeadByVariable("g2"),
Sets.newHashSet(loader.getVerticesByGraphVariables("g2")),
Sets.newHashSet(loader.getEdgesByGraphVariables("g2")));
DataSet<GraphTransaction> transactions = getExecutionEnvironment().fromElements(g0, g1, g2);
GraphCollectionLayout<GraphHead, Vertex, Edge> collectionLayout = getFactory().fromTransactions(transactions);
Collection<GraphHead> loadedGraphHeads = Lists.newArrayList();
Collection<Vertex> loadedVertices = Lists.newArrayList();
Collection<Edge> loadedEdges = Lists.newArrayList();
collectionLayout.getGraphHeads().output(new LocalCollectionOutputFormat<>(loadedGraphHeads));
collectionLayout.getVertices().output(new LocalCollectionOutputFormat<>(loadedVertices));
collectionLayout.getEdges().output(new LocalCollectionOutputFormat<>(loadedEdges));
getExecutionEnvironment().execute();
validateEPGMElementCollections(loader.getGraphHeadsByVariables("g0", "g1", "g2"), loadedGraphHeads);
validateEPGMElementCollections(loader.getVerticesByGraphVariables("g0", "g1", "g2"), loadedVertices);
validateEPGMElementCollections(loader.getEdgesByGraphVariables("g0", "g1", "g2"), loadedEdges);
validateEPGMGraphElementCollections(loader.getVerticesByGraphVariables("g0", "g1", "g2"), loadedVertices);
validateEPGMGraphElementCollections(loader.getEdgesByGraphVariables("g0", "g1", "g2"), loadedEdges);
}