@Test
public void testOneGraph() throws Exception
{
GatewayLocation gw = new SimpleGatewayLocation("GWA", "EPR");
Graph graph = new Graph();
ProcessingElementNode a = new ProcessingElementNode("A");
a.addAnnotation(AnnotationKeys.GATEWAY, gw);
ProcessingElementNode b = new ProcessingElementNode("B");
b.addAnnotation(AnnotationKeys.GATEWAY, gw);
ProcessingElementNode c = new ProcessingElementNode("C");
c.addAnnotation(AnnotationKeys.GATEWAY, gw);
b.connectInput("in", 0, a.getOutput("out", 0));
c.connectInput("in", 0, b.getOutput("out", 0));
graph.add(a); graph.add(b); graph.add(c);
SimplePartitioner partitioner = new SimplePartitioner();
Map<GatewayLocation, Graph> partitions = partitioner.partition(graph);
TestCase.assertEquals(1, partitions.size());
Graph g = partitions.get(gw);
TestCase.assertEquals(3, g.getNodes().size());
TestCase.assertTrue(g.getNodes().containsAll(Arrays.asList(a, b, c)));
}