### Question:
EntityGraph implements ConfigurationChangeListener { @Override public void onRemove(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; } for (Map.Entry<Node, Set<Node>> entry : nodeEdges.entrySet()) { if (graph.containsKey(entry.getKey())) { graph.get(entry.getKey()).removeAll(entry.getValue()); if (graph.get(entry.getKey()).isEmpty()) { graph.remove(entry.getKey()); } } } } 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 testOnRemove() throws Exception { Process process = new Process(); process.setName("rp1"); Cluster cluster = new Cluster(); cluster.setName("rc1"); cluster.setColo("2"); org.apache.falcon.entity.v0.process.Cluster processCluster = new org.apache.falcon.entity.v0.process.Cluster(); processCluster.setName("rc1"); process.setClusters(new org.apache.falcon.entity.v0.process.Clusters()); process.getClusters().getClusters().add(processCluster); store.publish(EntityType.CLUSTER, cluster); store.publish(EntityType.PROCESS, process); Set<Entity> entities = graph.getDependents(process); Assert.assertEquals(entities.size(), 1); Assert.assertTrue(entities.contains(cluster)); entities = graph.getDependents(cluster); Assert.assertEquals(entities.size(), 1); Assert.assertTrue(entities.contains(process)); store.remove(EntityType.PROCESS, process.getName()); entities = graph.getDependents(cluster); Assert.assertTrue(entities.isEmpty()); entities = graph.getDependents(process); Assert.assertTrue(entities.isEmpty()); }