use of org.opennms.netmgt.passive.PassiveStatusKeeper in project opennms by OpenNMS.
the class PassiveStatusd method onInit.
/**
* <p>onInit</p>
*/
@Override
protected void onInit() {
EventIpcManagerFactory.init();
EventIpcManager mgr = EventIpcManagerFactory.getIpcManager();
PassiveStatusKeeper keeper = getPassiveStatusKeeper();
keeper.setEventManager(mgr);
keeper.setDataSource(DataSourceFactory.getInstance());
keeper.init();
}
use of org.opennms.netmgt.passive.PassiveStatusKeeper in project opennms by OpenNMS.
the class PassiveServiceMonitorIT method testPoll.
// inherit from PassiveStatusKeeperTest so we can inherit all the proper initialization
public void testPoll() throws UnknownHostException {
PassiveStatusKeeper psk = PassiveStatusKeeper.getInstance();
psk.setStatus("localhost", "127.0.0.1", "my-passive-service", PollStatus.get(PollStatus.SERVICE_UNAVAILABLE, "testing failure"));
ServiceMonitor sm = new PassiveServiceMonitor();
MonitoredService ms = createMonitoredService(1, "localhost", null, "127.0.0.1", "my-passive-service");
PollStatus ps = sm.poll(ms, new HashMap<String, Object>());
assertEquals(PollStatus.down("fail."), ps);
psk.setStatus("localhost", "127.0.0.1", "my-passive-service", PollStatus.get(PollStatus.SERVICE_AVAILABLE, "testing failure"));
ps = sm.poll(ms, new HashMap<String, Object>());
assertEquals(PollStatus.up(), ps);
}
Aggregations