### Question:
EntityGraph implements ConfigurationChangeListener { @Override public void onAdd(Entity entity) throws FalconException { Map<Node, Set<Node>> nodeEdges = null; switch (entity.getEntityType()) { case PROCESS: nodeEdges = getEdgesFor((Process) entity); break; case FEED: nodeEdges = getEdgesFor((Feed) entity); break; default: } if (nodeEdges == null) { return; } LOG.debug("Adding edges for {}: {}", entity.getName(), nodeEdges); for (Map.Entry<Node, Set<Node>> entry : nodeEdges.entrySet()) { LOG.debug("Adding edges : {} for {}", entry.getValue(), entry.getKey()); if (graph.containsKey(entry.getKey())) { graph.get(entry.getKey()).addAll(entry.getValue()); } else { graph.put(entry.getKey(), entry.getValue()); } } LOG.debug("Merged edges to graph {}", entity.getName()); } private  EntityGraph(); static EntityGraph get(); Set<Entity> getDependents(Entity entity); @Override void onAdd(Entity entity); @Override void onRemove(Entity entity); @Override void onChange(Entity oldEntity, Entity newEntity); @Override void onReload(Entity entity);  }### Answer:
@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.falcon.entity.v0.process.Cluster processCluster = new org.apache.falcon.entity.v0.process.Cluster(); processCluster.setName("c1"); process.setClusters(new org.apache.falcon.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)); }