@Test
public void testSimple() throws Exception
{
GatewayLocation gw1 = new SimpleGatewayLocation("GWA", "EPR");
GatewayLocation gw2 = new SimpleGatewayLocation("GWB", "EPR");
Graph graph = new Graph();
ProcessingElementNode a = new ProcessingElementNode("A");
a.addAnnotation(AnnotationKeys.GATEWAY, gw1);
ProcessingElementNode b = new ProcessingElementNode("B");
b.addAnnotation(AnnotationKeys.GATEWAY, gw1);
ProcessingElementNode c = new ProcessingElementNode("C");
c.addAnnotation(AnnotationKeys.GATEWAY, gw2);
b.connectInput("in", 0, a.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(2, partitions.size());
Graph g = partitions.get(gw1);
TestCase.assertTrue(g.getNodes().containsAll(Arrays.asList(a, b)));
g = partitions.get(gw2);
TestCase.assertTrue(g.getNodes().contains(c));
}