// Test harness that tests any type of node, interface or element. private void testElementDeleted(MockElement element) { Event deleteEvent = element.createDeleteEvent(); m_pollerConfig.setNodeOutageProcessingEnabled(false); PollAnticipator poll = new PollAnticipator(); element.addAnticipator(poll); poll.anticipateAllServices(element); startDaemons(); // wait til after the first poll of the services poll.waitForAnticipated(1000L); // now delete the node and send a nodeDeleted event m_network.removeElement(element); m_eventMgr.sendEventToListeners(deleteEvent); // reset the poll count and wait to see if any polls on the removed // element happened m_network.resetInvalidPollCount(); // now ensure that no invalid polls have occurred sleep(3000); assertEquals( "Received a poll for an element that doesn't exist", 0, m_network.getInvalidPollCount()); }
public void testOutagesClosedOnDelete(MockElement element) { startDaemons(); Event deleteEvent = element.createDeleteEvent(); // bring down so we create an outage in the outages table anticipateDown(element); element.bringDown(); verifyAnticipated(5000, false); m_outageAnticipator.anticipateOutageClosed(element, deleteEvent); // now delete the service m_eventMgr.sendEventToListeners(deleteEvent); m_network.removeElement(element); verifyAnticipated(5000); }