use of org.opennms.netmgt.correlation.CorrelationEngine in project opennms by OpenNMS.
the class ReloadConfigurationIT method testAddAndRemoveEngine.
/**
* Test add and remove engine.
*
* @throws Exception the exception
*/
@Test
public void testAddAndRemoveEngine() throws Exception {
Collection<CorrelationEngine> engines = m_correlator.getEngines();
Assert.assertNotNull(engines);
Assert.assertEquals(1, engines.size());
FileUtils.copyDirectory(new File(DROOLS_SRC, "persistState"), new File(DROOLS_HOME, "persistState"));
sendReloadDaemonConfig();
engines = m_correlator.getEngines();
Assert.assertEquals(2, engines.size());
FileUtils.deleteDirectory(new File(DROOLS_HOME, "simpleRules"));
sendReloadDaemonConfig();
engines = m_correlator.getEngines();
Assert.assertEquals(1, engines.size());
}
use of org.opennms.netmgt.correlation.CorrelationEngine in project opennms by OpenNMS.
the class ReloadConfigurationIT method testEditExistingEngineWithValidContent.
/**
* Test edit existing engine with valid content.
*
* @throws Exception the exception
*/
@Test
public void testEditExistingEngineWithValidContent() throws Exception {
Collection<CorrelationEngine> engines = m_correlator.getEngines();
Assert.assertNotNull(engines);
Assert.assertEquals(1, engines.size());
FileUtils.copyDirectory(new File(DROOLS_SRC2, "simpleRules"), new File(DROOLS_HOME, "simpleRules"));
sendReloadDaemonConfig();
EventBuilder eb = new EventBuilder("uei.opennms.org/junit/myTestEvent", "Junit");
m_eventIpcMgr.send(eb.getEvent());
Thread.sleep(1000);
File file = new File("target/sample-file.txt");
Assert.assertTrue(file.exists());
file.delete();
}
use of org.opennms.netmgt.correlation.CorrelationEngine in project opennms by OpenNMS.
the class ReloadConfigurationIT method testEditExistingEngineWithInvalidContent.
/**
* Test edit existing engine with invalid content.
*
* @throws Exception the exception
*/
@Test
public void testEditExistingEngineWithInvalidContent() throws Exception {
Collection<CorrelationEngine> engines = m_correlator.getEngines();
Assert.assertNotNull(engines);
Assert.assertEquals(1, engines.size());
FileUtils.copyDirectory(new File(DROOLS_SRC2, "brokenRules"), new File(DROOLS_HOME, "brokenRules"));
sendReloadDaemonConfig();
engines = m_correlator.getEngines();
Assert.assertEquals(1, engines.size());
}
use of org.opennms.netmgt.correlation.CorrelationEngine in project opennms by OpenNMS.
the class ReloadConfigurationIT method testAddingEngineWithInvalidContent.
/**
* Test adding engine with invalid content.
*
* @throws Exception the exception
*/
@Test
public void testAddingEngineWithInvalidContent() throws Exception {
Collection<CorrelationEngine> engines = m_correlator.getEngines();
Assert.assertNotNull(engines);
Assert.assertEquals(1, engines.size());
FileUtils.copyDirectory(new File(DROOLS_SRC2, "brokenRules"), new File(DROOLS_HOME, "brokenRules"));
sendReloadDaemonConfig();
engines = m_correlator.getEngines();
// Instead of 2
Assert.assertEquals(1, engines.size());
}
Aggregations