@Test
public void testOnAdd() throws Exception {

    Process process = new Process();
    process.setName("p1");
    Cluster cluster = new Cluster();
    cluster.setName("c1");
    cluster.setColo("1");
    Feed f1 = addInput(process, "f1", cluster);
    Feed f2 = addInput(process, "f2", cluster);
    Feed f3 = addOutput(process, "f3", cluster);
    Feed f4 = addOutput(process, "f4", cluster);
    org.apache.ivory.entity.v0.process.Cluster processCluster = new org.apache.ivory.entity.v0.process.Cluster();
    processCluster.setName("c1");
    process.setClusters(new org.apache.ivory.entity.v0.process.Clusters());
    process.getClusters().getClusters().add(processCluster);
    store.publish(EntityType.CLUSTER, cluster);
    store.publish(EntityType.FEED, f1);
    store.publish(EntityType.FEED, f2);
    store.publish(EntityType.FEED, f3);
    store.publish(EntityType.FEED, f4);
    store.publish(EntityType.PROCESS, process);
    Set<Entity> entities = graph.getDependents(process);
    Assert.assertEquals(entities.size(), 5);
    Assert.assertTrue(entities.contains(cluster));
    Assert.assertTrue(entities.contains(f1));
    Assert.assertTrue(entities.contains(f2));
    Assert.assertTrue(entities.contains(f3));
    Assert.assertTrue(entities.contains(f4));
    entities = graph.getDependents(f1);
    Assert.assertEquals(entities.size(), 2);
    Assert.assertTrue(entities.contains(process));
    Assert.assertTrue(entities.contains(cluster));
    entities = graph.getDependents(f2);
    Assert.assertEquals(entities.size(), 2);
    Assert.assertTrue(entities.contains(process));
    Assert.assertTrue(entities.contains(cluster));
    entities = graph.getDependents(f3);
    Assert.assertEquals(entities.size(), 2);
    Assert.assertTrue(entities.contains(process));
    Assert.assertTrue(entities.contains(cluster));
    entities = graph.getDependents(f4);
    Assert.assertEquals(entities.size(), 2);
    Assert.assertTrue(entities.contains(process));
    Assert.assertTrue(entities.contains(cluster));
    entities = graph.getDependents(cluster);
    Assert.assertEquals(entities.size(), 5);
    Assert.assertTrue(entities.contains(process));
    Assert.assertTrue(entities.contains(f1));
    Assert.assertTrue(entities.contains(f2));
    Assert.assertTrue(entities.contains(f3));
    Assert.assertTrue(entities.contains(f4));
}