Search in sources :

Example 1 with Trigger

use of org.opennms.netmgt.config.vacuumd.Trigger in project opennms by OpenNMS.

the class VacuumdIT method testRunTrigger.

/**
     * Simple test running a trigger.
     */
@Test
@JUnitTemporaryDatabase(tempDbClass = MockDatabase.class)
public final void testRunTrigger() throws InterruptedException {
    Trigger trigger = VacuumdConfigFactory.getInstance().getTrigger("selectAll");
    String triggerSql = trigger.getStatement().getContent();
    MockUtil.println("Running trigger query: " + triggerSql);
    int count = m_jdbcTemplate.queryForList(triggerSql).size();
    AutomationProcessor ap = new AutomationProcessor(VacuumdConfigFactory.getInstance().getAutomation("cosmicClear"));
    assertFalse("Testing the result rows:" + count + " with the trigger operator " + trigger.getOperator() + " against the required rows:" + trigger.getRowCount(), ap.getTrigger().triggerRowCheck(trigger.getRowCount(), trigger.getOperator(), count));
    assertEquals(0, count);
}
Also used : Trigger(org.opennms.netmgt.config.vacuumd.Trigger) Test(org.junit.Test) JUnitTemporaryDatabase(org.opennms.core.test.db.annotations.JUnitTemporaryDatabase)

Aggregations

Test (org.junit.Test)1 JUnitTemporaryDatabase (org.opennms.core.test.db.annotations.JUnitTemporaryDatabase)1 Trigger (org.opennms.netmgt.config.vacuumd.Trigger)1