test_class.declarator: store = ConfigurationStore.get()
test_class.modifier: private
test_class.original_string: private ConfigurationStore store = ConfigurationStore.get();
test_class.type: ConfigurationStore
test_class.var_name: store
test_class.declarator: graph = EntityGraph.get()
test_class.modifier: private
test_class.original_string: private EntityGraph graph = EntityGraph.get();
test_class.type: EntityGraph
test_class.var_name: graph
test_class.file: common/src/test/java/org/apache/ivory/entity/v0/EntityGraphTest.java
test_class.identifier: EntityGraphTest
test_class.superclass: extends AbstractTestBase
test_case.body: @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.ivory.entity.v0.process.Cluster processCluster = new org.apache.ivory.entity.v0.process.Cluster();
          processCluster.setName("rc1");
          process.setClusters(new org.apache.ivory.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 == null);
  
          entities = graph.getDependents(process);
          Assert.assertTrue(entities == null);
      }
test_case.class_method_signature: EntityGraphTest.testOnRemove()
test_case.full_signature: @Test public void testOnRemove()
test_case.identifier: testOnRemove
test_case.invocations: setName setName setColo setName setClusters add getClusters getClusters publish publish getDependents assertEquals size assertTrue contains getDependents assertEquals size assertTrue contains remove getName getDependents assertTrue getDependents assertTrue
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testOnRemove()
focal_class.declarator: LOG = Logger.getLogger(EntityGraph.class)
focal_class.modifier: private static
focal_class.original_string: private static Logger LOG = Logger.getLogger(EntityGraph.class);
focal_class.type: Logger
focal_class.var_name: LOG
focal_class.declarator: instance = new EntityGraph()
focal_class.modifier: private static
focal_class.original_string: private static EntityGraph instance = new EntityGraph();
focal_class.type: EntityGraph
focal_class.var_name: instance
focal_class.declarator: graph = new ConcurrentHashMap<Node, Set<Node>>()
focal_class.modifier: private
focal_class.original_string: private Map<Node, Set<Node>> graph = new ConcurrentHashMap<Node, Set<Node>>();
focal_class.type: Map<Node, Set<Node>>
focal_class.var_name: graph
focal_class.file: common/src/main/java/org/apache/ivory/entity/v0/EntityGraph.java
focal_class.identifier: EntityGraph
focal_class.interfaces: implements ConfigurationChangeListener
focal_class.class_method_signature: EntityGraph.EntityGraph()
focal_class.full_signature: private  EntityGraph()
focal_class.identifier: EntityGraph
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.signature:  EntityGraph()
focal_class.class_method_signature: EntityGraph.get()
focal_class.full_signature: public static EntityGraph get()
focal_class.identifier: get
focal_class.modifiers: public static
focal_class.parameters: ()
focal_class.return: EntityGraph
focal_class.signature: EntityGraph get()
focal_class.class_method_signature: EntityGraph.getDependents(Entity entity)
focal_class.full_signature: public Set<Entity> getDependents(Entity entity)
focal_class.identifier: getDependents
focal_class.modifiers: public
focal_class.parameters: (Entity entity)
focal_class.return: Set<Entity>
focal_class.signature: Set<Entity> getDependents(Entity entity)
focal_class.class_method_signature: EntityGraph.onAdd(Entity entity)
focal_class.full_signature: @Override public void onAdd(Entity entity)
focal_class.identifier: onAdd
focal_class.modifiers: @Override public
focal_class.parameters: (Entity entity)
focal_class.return: void
focal_class.signature: void onAdd(Entity entity)
focal_class.class_method_signature: EntityGraph.onRemove(Entity entity)
focal_class.full_signature: @Override public void onRemove(Entity entity)
focal_class.identifier: onRemove
focal_class.modifiers: @Override public
focal_class.parameters: (Entity entity)
focal_class.return: void
focal_class.signature: void onRemove(Entity entity)
focal_class.class_method_signature: EntityGraph.onChange(Entity oldEntity, Entity newEntity)
focal_class.full_signature: @Override public void onChange(Entity oldEntity, Entity newEntity)
focal_class.identifier: onChange
focal_class.modifiers: @Override public
focal_class.parameters: (Entity oldEntity, Entity newEntity)
focal_class.return: void
focal_class.signature: void onChange(Entity oldEntity, Entity newEntity)
focal_class.class_method_signature: EntityGraph.getEdgesFor(Process process)
focal_class.full_signature: private Map<Node, Set<Node>> getEdgesFor(Process process)
focal_class.identifier: getEdgesFor
focal_class.modifiers: private
focal_class.parameters: (Process process)
focal_class.return: Map<Node, Set<Node>>
focal_class.signature: Map<Node, Set<Node>> getEdgesFor(Process process)
focal_class.class_method_signature: EntityGraph.getEdgesFor(Feed feed)
focal_class.full_signature: private Map<Node, Set<Node>> getEdgesFor(Feed feed)
focal_class.identifier: getEdgesFor
focal_class.modifiers: private
focal_class.parameters: (Feed feed)
focal_class.return: Map<Node, Set<Node>>
focal_class.signature: Map<Node, Set<Node>> getEdgesFor(Feed feed)
focal_method.body: @Override
      public void onRemove(Entity entity) throws IvoryException {
          Map<Node, Set<Node>> nodeEdges = null;
          switch (entity.getEntityType()) {
              case PROCESS:
                  nodeEdges = getEdgesFor((Process) entity);
                  break;
              case FEED:
                  nodeEdges = getEdgesFor((Feed) entity);
                  break;
          }
          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());
                  }
              }
          }
      }
focal_method.class_method_signature: EntityGraph.onRemove(Entity entity)
focal_method.full_signature: @Override public void onRemove(Entity entity)
focal_method.identifier: onRemove
focal_method.invocations: getEntityType getEdgesFor getEdgesFor entrySet containsKey getKey removeAll get getKey getValue isEmpty get getKey remove getKey
focal_method.modifiers: @Override public
focal_method.parameters: (Entity entity)
focal_method.return: void
focal_method.signature: void onRemove(Entity entity)