Search in sources :

Example 1 with EmptyEventConfDao

use of org.opennms.netmgt.dao.mock.MockEventIpcManager.EmptyEventConfDao in project opennms by OpenNMS.

the class VacuumdIT method setUp.

@Before
public void setUp() throws Exception {
    m_network.createStandardNetwork();
    InputStream is = ConfigurationTestUtils.getInputStreamForResource(this, "/org/opennms/netmgt/vacuumd/vacuumd-configuration.xml");
    try {
        VacuumdConfigFactory.setInstance(new VacuumdConfigFactory(is));
    } finally {
        IOUtils.closeQuietly(is);
    }
    m_eventdIpcMgr.setEventWriter(m_database);
    EventExpander expander = new EventExpander(new MetricRegistry());
    expander.setEventConfDao(new EmptyEventConfDao());
    m_eventdIpcMgr.setEventExpander(expander);
    Vacuumd.destroySingleton();
    m_vacuumd = Vacuumd.getSingleton();
    m_vacuumd.setEventManager(m_eventdIpcMgr);
    m_vacuumd.init();
    // Insert some empty nodes to avoid foreign-key violations on subsequent events/alarms
    OnmsNode node = new OnmsNode(m_locationDao.getDefaultLocation(), "default-1");
    node.setId(1);
    m_nodeDao.save(node);
    node = new OnmsNode(m_locationDao.getDefaultLocation(), "default-2");
    node.setId(2);
    m_nodeDao.save(node);
    m_nodeDao.flush();
    MockUtil.println("------------ Finished setup for: " + this.getClass().getName() + " --------------------------");
}
Also used : VacuumdConfigFactory(org.opennms.netmgt.config.VacuumdConfigFactory) OnmsNode(org.opennms.netmgt.model.OnmsNode) EventExpander(org.opennms.netmgt.eventd.EventExpander) InputStream(java.io.InputStream) MetricRegistry(com.codahale.metrics.MetricRegistry) EmptyEventConfDao(org.opennms.netmgt.dao.mock.MockEventIpcManager.EmptyEventConfDao) Before(org.junit.Before)

Aggregations

MetricRegistry (com.codahale.metrics.MetricRegistry)1 InputStream (java.io.InputStream)1 Before (org.junit.Before)1 VacuumdConfigFactory (org.opennms.netmgt.config.VacuumdConfigFactory)1 EmptyEventConfDao (org.opennms.netmgt.dao.mock.MockEventIpcManager.EmptyEventConfDao)1 EventExpander (org.opennms.netmgt.eventd.EventExpander)1 OnmsNode (org.opennms.netmgt.model.OnmsNode)1