use of com.axway.ats.rbv.db.rules.DbStringFieldRule in project ats-framework by Axway.
the class Test_SimpleMonitorListener method verifyAlwaysHasAMatch_MatchesAllTheTime.
@Test
public void verifyAlwaysHasAMatch_MatchesAllTheTime() throws RbvException {
DbFieldsRule dbRule = new DbStringFieldRule("", "test_key", "test_value", MatchRelation.EQUALS, "MatchesAllTheTime", true);
Monitor monitor = new Monitor("monitor1", matchable, dbRule, pollingParams, true, false, true);
List<Monitor> monitors = new ArrayList<Monitor>();
monitors.add(monitor);
SimpleMonitorListener listener = new SimpleMonitorListener(monitors);
long before = System.currentTimeMillis();
assertTrue(listener.evaluateMonitors(TIME_END_POLL));
long after = System.currentTimeMillis();
assertTrue(after - before >= TIME_BEFORE_END_POLL);
}
use of com.axway.ats.rbv.db.rules.DbStringFieldRule in project ats-framework by Axway.
the class Test_SimpleMonitorListener method monitorGetAllMachingMetaDataEmpty.
@Test
public void monitorGetAllMachingMetaDataEmpty() throws RbvException {
DbFieldsRule dbRule = new DbStringFieldRule("", "table1", "value10", MatchRelation.EQUALS, "monitorGetAllMachingMetaDataEmpty", true);
Monitor monitor = new Monitor("monitor1", matchable, dbRule, pollingParams, true, false, false);
List<Monitor> monitors = new ArrayList<Monitor>();
monitors.add(monitor);
SimpleMonitorListener listener = new SimpleMonitorListener(monitors);
listener.evaluateMonitors(TIME_END_POLL);
assertEquals(0, monitor.getAllMatchedMetaData().size());
}
use of com.axway.ats.rbv.db.rules.DbStringFieldRule in project ats-framework by Axway.
the class Test_SimpleMonitorListener method verifyMatch_HasAMatch.
/*
*
*
*
* Verifications
*
*
*
*
*/
@Test
public void verifyMatch_HasAMatch() throws RbvException {
DbFieldsRule dbRule = new DbStringFieldRule("", "key1", "value00", MatchRelation.EQUALS, "verifyMatch_HasAMatch", true);
Monitor monitor = new Monitor("monitor1", matchable, dbRule, pollingParams, true, true, false);
List<Monitor> monitors = new ArrayList<Monitor>();
monitors.add(monitor);
SimpleMonitorListener listener = new SimpleMonitorListener(monitors);
long before = System.currentTimeMillis();
assertTrue(listener.evaluateMonitors(TIME_END_POLL));
long after = System.currentTimeMillis();
assertTrue(after - before <= POLLING_INTERVAL);
}
use of com.axway.ats.rbv.db.rules.DbStringFieldRule in project ats-framework by Axway.
the class Test_SimpleMonitorListener method verifyMatch_ButNoMatch.
@Test
public void verifyMatch_ButNoMatch() throws RbvException {
DbFieldsRule dbRule = new DbStringFieldRule("", "key1", "value00_00", MatchRelation.EQUALS, "verifyMatch_ButNoMatch", true);
Monitor monitor = new Monitor("monitor1", matchable, dbRule, pollingParams, true, true, false);
List<Monitor> monitors = new ArrayList<Monitor>();
monitors.add(monitor);
SimpleMonitorListener listener = new SimpleMonitorListener(monitors);
long before = System.currentTimeMillis();
assertFalse(listener.evaluateMonitors(TIME_END_POLL));
long after = System.currentTimeMillis();
assertTrue(after - before >= TIME_BEFORE_END_POLL);
}
Aggregations