public void testInvalidPoll() throws UnknownHostException { m_network.resetInvalidPollCount(); MonitoredService svc = new MockMonitoredService(99, "InvalidNode", InetAddressUtils.addr("1.1.1.1"), "ICMP"); ServiceMonitor monitor = m_pollerConfig.getServiceMonitor("ICMP"); monitor.poll(svc, Collections.emptyMap()); assertEquals(1, m_network.getInvalidPollCount()); }
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()); }
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()); }
/** * Test for NMS-9112 */ @Test public void testNoInvalidPollsAfterNodeCategoryMembershipChanged() throws InterruptedException { m_pollerConfig.setNodeOutageProcessingEnabled(true); MockNode node = m_network.getNode(1); // Start the poller startDaemons(); // Send a uei.opennms.org/nodes/nodeCategoryMembershipChanged // This will remove, add or reschedule services for the node as necessary EventBuilder eventBuilder = MockEventUtil.createEventBuilder("Test", EventConstants.NODE_CATEGORY_MEMBERSHIP_CHANGED_EVENT_UEI); eventBuilder.setNodeid(node.getNodeId()); Event nodeCatMemChangedEvent = eventBuilder.getEvent(); m_eventMgr.sendEventToListeners(nodeCatMemChangedEvent); // Delete the node and send a nodeDeleted event m_network.removeElement(node); Event deleteEvent = node.createDeleteEvent(); m_eventMgr.sendEventToListeners(deleteEvent); // Wait a little long than a polling cycle sleep(3000); m_network.resetInvalidPollCount(); // Sleep some more and verify that no invalid polls have occurred sleep(3000); assertEquals("Received a poll for an element that doesn't exist", 0, m_network.getInvalidPollCount()); }