use of org.opennms.netmgt.mock.MockService in project opennms by OpenNMS.
the class PollerQueryManagerDaoIT method testInterfaceWithNoCriticalService.
@Test
public void testInterfaceWithNoCriticalService() {
m_pollerConfig.setNodeOutageProcessingEnabled(true);
MockInterface iface = m_network.getInterface(3, "192.168.1.4");
MockService svc = iface.getService("SMTP");
MockService otherService = iface.getService("HTTP");
startDaemons();
anticipateDown(iface);
iface.bringDown();
verifyAnticipated(8000);
anticipateUp(iface);
anticipateDown(otherService, true);
svc.bringUp();
verifyAnticipated(8000);
}
use of org.opennms.netmgt.mock.MockService in project opennms by OpenNMS.
the class PollerQueryManagerDaoIT method testNodeLostServiceWithReason.
@Test
public void testNodeLostServiceWithReason() {
m_pollerConfig.setNodeOutageProcessingEnabled(true);
MockService svc = m_network.getService(1, "192.168.1.1", "ICMP");
Event e = svc.createDownEvent();
String reasonParm = "eventReason";
String val = (String) AbstractEventUtil.getInstance().getNamedParmValue("parm[" + reasonParm + "]", e);
assertEquals("Service Not Responding.", val);
}
use of org.opennms.netmgt.mock.MockService in project opennms by OpenNMS.
the class PollablesIT method anticipateResponsive.
private void anticipateResponsive(MockElement element) {
MockVisitor visitor = new MockVisitorAdapter() {
@Override
public void visitService(MockService svc) {
m_eventMgr.getEventAnticipator().anticipateEvent(svc.createResponsiveEvent());
}
};
element.visit(visitor);
}
use of org.opennms.netmgt.mock.MockService in project opennms by OpenNMS.
the class PollablesIT method testPollService.
@Test
public void testPollService() throws Exception {
PollableService pSvc = pDot1Smtp;
MockService mSvc = mDot1Smtp;
pSvc.doPoll();
assertUp(pSvc);
assertUnchanged(pSvc);
mSvc.bringDown();
pSvc.doPoll();
assertDown(pSvc);
assertChanged(pSvc);
pSvc.resetStatusChanged();
mSvc.bringUp();
pSvc.doPoll();
assertUp(pSvc);
assertChanged(pSvc);
pSvc.recalculateStatus();
}
use of org.opennms.netmgt.mock.MockService in project opennms by OpenNMS.
the class PollablesIT method assertNoPoll.
/**
* @param network
*/
private void assertNoPoll(MockElement elem) {
MockVisitor zeroAsserter = new MockVisitorAdapter() {
@Override
public void visitService(MockService svc) {
assertEquals("Unexpected poll count for " + svc, 0, svc.getPollCount());
}
};
elem.visit(zeroAsserter);
}
Aggregations