use of org.opennms.netmgt.events.api.EventIpcManager in project opennms by OpenNMS.
the class EventIpcManagerFactoryTest method testSetIpcManager.
public void testSetIpcManager() {
EventIpcManager manager = createMock(EventIpcManager.class);
EventIpcManagerFactory.setIpcManager(manager);
assertNotNull("manager should not be null", EventIpcManagerFactory.getIpcManager());
assertEquals("manager", manager, EventIpcManagerFactory.getIpcManager());
}
use of org.opennms.netmgt.events.api.EventIpcManager 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.events.api.EventIpcManager in project opennms by OpenNMS.
the class EventTranslator method onInit.
/**
* <p>onInit</p>
*/
@Override
protected void onInit() {
try {
EventTranslatorConfigFactory.init();
} catch (IOException e) {
LOG.error("IOException: ", e);
throw new UndeclaredThrowableException(e);
} catch (ClassNotFoundException e) {
LOG.error("Unable to initialize database", e);
throw new UndeclaredThrowableException(e);
} catch (SQLException e) {
LOG.error("SQLException: ", e);
throw new UndeclaredThrowableException(e);
} catch (PropertyVetoException e) {
LOG.error("PropertyVetoException: ", e);
throw new UndeclaredThrowableException(e);
}
EventIpcManagerFactory.init();
EventIpcManager mgr = EventIpcManagerFactory.getIpcManager();
org.opennms.netmgt.translator.EventTranslator keeper = getEventTranslator();
keeper.setConfig(EventTranslatorConfigFactory.getInstance());
keeper.setEventManager(mgr);
keeper.setDataSource(DataSourceFactory.getInstance());
keeper.init();
}
use of org.opennms.netmgt.events.api.EventIpcManager in project opennms by OpenNMS.
the class Vacuumd method init.
/*
* (non-Javadoc)
*
* @see org.opennms.netmgt.vacuumd.jmx.VacuumdMBean#init()
*/
/**
* <p>init</p>
*/
@Override
public void init() {
EventIpcManagerFactory.init();
EventIpcManager mgr = EventIpcManagerFactory.getIpcManager();
getVacuumd().setEventManager(mgr);
getVacuumd().init();
}
use of org.opennms.netmgt.events.api.EventIpcManager in project opennms by OpenNMS.
the class CollectdTest method setUp.
@Before
public void setUp() throws Exception {
EventIpcManager m_eventIpcManager;
NodeDao m_nodeDao;
MockLogAppender.setupLogging();
Resource threshdResource = new ClassPathResource("/etc/thresholds.xml");
File homeDir = threshdResource.getFile().getParentFile().getParentFile();
System.setProperty("opennms.home", homeDir.getAbsolutePath());
// Test setup
m_eventIpcManager = m_easyMockUtils.createMock(EventIpcManager.class);
EventIpcManagerFactory.setIpcManager(m_eventIpcManager);
m_nodeDao = m_easyMockUtils.createMock(NodeDao.class);
m_ipIfDao = m_easyMockUtils.createMock(IpInterfaceDao.class);
m_scheduler = new MockScheduler();
m_eventIpcManager.addEventListener(isA(EventListener.class));
expectLastCall().anyTimes();
m_eventIpcManager.addEventListener(isA(EventListener.class), isACollection(String.class));
expectLastCall().anyTimes();
m_eventIpcManager.addEventListener(isA(EventListener.class), isA(String.class));
expectLastCall().anyTimes();
m_eventIpcManager.removeEventListener(isA(EventListener.class));
expectLastCall().anyTimes();
// Mock the FilterDao without using EasyMockUtils so that it can be verified separately
m_filterDao = EasyMock.createMock(FilterDao.class);
List<InetAddress> allIps = new ArrayList<>();
allIps.add(addr("192.168.1.1"));
allIps.add(addr("192.168.1.2"));
allIps.add(addr("192.168.1.3"));
allIps.add(addr("192.168.1.4"));
allIps.add(addr("192.168.1.5"));
expect(m_filterDao.getActiveIPAddressList("IPADDR IPLIKE *.*.*.*")).andReturn(allIps).anyTimes();
expect(m_filterDao.getActiveIPAddressList("IPADDR IPLIKE 1.1.1.1")).andReturn(new ArrayList<InetAddress>(0)).anyTimes();
EasyMock.replay(m_filterDao);
FilterDaoFactory.setInstance(m_filterDao);
// This call will also ensure that the poll-outages.xml file can parse IPv4
// and IPv6 addresses.
Resource resource = new ClassPathResource("etc/poll-outages.xml");
PollOutagesConfigFactory factory = new PollOutagesConfigFactory(resource);
factory.afterPropertiesSet();
PollOutagesConfigFactory.setInstance(factory);
final MockTransactionTemplate transTemplate = new MockTransactionTemplate();
transTemplate.afterPropertiesSet();
m_collectd = new Collectd();
m_collectd.setEventIpcManager(m_eventIpcManager);
m_collectd.setNodeDao(m_nodeDao);
m_collectd.setIpInterfaceDao(m_ipIfDao);
m_collectd.setFilterDao(m_filterDao);
m_collectd.setScheduler(m_scheduler);
m_collectd.setTransactionTemplate(transTemplate);
m_collectd.setPersisterFactory(new MockPersisterFactory());
m_collectd.setServiceCollectorRegistry(new DefaultServiceCollectorRegistry());
m_collectd.setLocationAwareCollectorClient(CollectorTestUtils.createLocationAwareCollectorClient());
ThresholdingConfigFactory.setInstance(new ThresholdingConfigFactory(ConfigurationTestUtils.getInputStreamForConfigFile("thresholds.xml")));
}
Aggregations