use of org.opennms.netmgt.mock.MockNode in project opennms by OpenNMS.
the class VacuumdIT method bringNodeUpCreatingEvent.
private void bringNodeUpCreatingEvent(int nodeid) {
MockNode node = m_network.getNode(nodeid);
m_eventdIpcMgr.sendNow(node.createUpEvent());
}
use of org.opennms.netmgt.mock.MockNode in project opennms by OpenNMS.
the class VacuumdIT method bringNodeDownCreatingEventWithReason.
private void bringNodeDownCreatingEventWithReason(int nodeid, String reason) {
MockNode node = m_network.getNode(nodeid);
m_eventdIpcMgr.sendNow(node.createDownEventWithReason(reason));
}
use of org.opennms.netmgt.mock.MockNode in project opennms by OpenNMS.
the class MockDatabaseIT method testNodeQuery.
public void testNodeQuery() {
Querier querier = new Querier(m_db, "select * from node") {
@Override
public void processRow(ResultSet rs) throws SQLException {
int nodeId = rs.getInt("nodeId");
String label = rs.getString("nodeLabel");
MockNode node = m_network.getNode(nodeId);
assertNotNull(node);
assertEquals(nodeId, node.getNodeId());
assertEquals(label, node.getLabel());
}
};
querier.execute();
assertEquals(m_network.getNodeCount(), querier.getCount());
}
use of org.opennms.netmgt.mock.MockNode in project opennms by OpenNMS.
the class PollerIT method testNodeOutageProcessingDisabled.
// test to see that node lost/regained service events come in
@Test
public void testNodeOutageProcessingDisabled() throws Exception {
m_pollerConfig.setNodeOutageProcessingEnabled(false);
MockNode node = m_network.getNode(1);
startDaemons();
resetAnticipated();
anticipateServicesDown(node);
node.bringDown();
verifyAnticipated(10000);
resetAnticipated();
anticipateServicesUp(node);
node.bringUp();
verifyAnticipated(10000);
}
use of org.opennms.netmgt.mock.MockNode in project opennms by OpenNMS.
the class PollerIT method testNodeLabelChanged.
// nodeLabelChanged: EventConstants.NODE_LABEL_CHANGED_EVENT_UEI
@Test
public void testNodeLabelChanged() {
MockNode element = m_network.getNode(1);
String newLabel = "NEW LABEL";
Event event = element.createNodeLabelChangedEvent(newLabel);
m_pollerConfig.setNodeOutageProcessingEnabled(false);
PollAnticipator poll = new PollAnticipator();
element.addAnticipator(poll);
poll.anticipateAllServices(element);
startDaemons();
// wait until after the first poll of the services
poll.waitForAnticipated(1000L);
assertEquals("Router", m_poller.getNetwork().getNode(1).getNodeLabel());
// now delete the node and send a nodeDeleted event
element.setLabel(newLabel);
m_eventMgr.sendEventToListeners(event);
assertEquals(newLabel, m_poller.getNetwork().getNode(1).getNodeLabel());
}
Aggregations