use of org.opennms.netmgt.mock.MockVisitorAdapter in project opennms by OpenNMS.
the class MockDatabase method populate.
public void populate(MockNetwork network) {
MockVisitor dbCreater = new MockVisitorAdapter() {
@Override
public void visitNode(MockNode node) {
writeNode(node);
}
@Override
public void visitInterface(MockInterface iface) {
writeInterface(iface);
}
@Override
public void visitService(MockService svc) {
writeService(svc);
}
@Override
public void visitPathOutage(MockPathOutage out) {
writePathOutage(out);
}
};
network.visit(dbCreater);
getJdbcTemplate().queryForObject("SELECT setval('nodeNxtId', max(nodeid)) FROM node", Integer.class);
}
use of org.opennms.netmgt.mock.MockVisitorAdapter 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.MockVisitorAdapter 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);
}
use of org.opennms.netmgt.mock.MockVisitorAdapter in project opennms by OpenNMS.
the class PollerIT method anticipateServicesDown.
private void anticipateServicesDown(MockElement node) {
MockVisitor eventCreator = new MockVisitorAdapter() {
@Override
public void visitService(MockService svc) {
anticipateDown(svc);
}
};
node.visit(eventCreator);
}
use of org.opennms.netmgt.mock.MockVisitorAdapter in project opennms by OpenNMS.
the class PollerIT method bringDownCritSvcs.
private void bringDownCritSvcs(MockElement element) {
MockVisitor markCritSvcDown = new MockVisitorAdapter() {
@Override
public void visitService(MockService svc) {
if ("ICMP".equals(svc.getSvcName())) {
svc.bringDown();
}
}
};
element.visit(markCritSvcDown);
}
Aggregations