use of com.axway.ats.rbv.db.rules.DbFieldsRule in project ats-framework by Axway.
the class Test_SimpleMonitorListener method evaluateMonitorsMultipleMonitorsNegative.
@Test
public void evaluateMonitorsMultipleMonitorsNegative() throws RbvException {
DbStorage storage = new DbStorage(new MockDbProvider());
Matchable matchable1 = storage.getFolder(new DbSearchTerm(""));
Matchable matchable2 = storage.getFolder(new DbSearchTerm(""));
Matchable matchable3 = storage.getFolder(new DbSearchTerm(""));
DbFieldsRule dbRuleRight = new DbStringFieldRule("", "key1", "value10", MatchRelation.EQUALS, "evaluateMonitorsMultipleMonitorsNegative1", true);
DbFieldsRule dbRuleWrong = new DbStringFieldRule("", "table1", "value10", MatchRelation.EQUALS, "evaluateMonitorsMultipleMonitorsNegative2", true);
Monitor monitor1 = new Monitor("monitor1", matchable1, dbRuleRight, pollingParams, true, false, false);
Monitor monitor2 = new Monitor("monitor2", matchable2, dbRuleRight, pollingParams, true, false, false);
Monitor monitor3 = new Monitor("monitor3", matchable3, dbRuleWrong, pollingParams, true, false, false);
List<Monitor> monitors = new ArrayList<Monitor>();
monitors.add(monitor1);
monitors.add(monitor2);
monitors.add(monitor3);
SimpleMonitorListener listener = new SimpleMonitorListener(monitors);
assertFalse(listener.evaluateMonitors(TIME_END_POLL));
}
use of com.axway.ats.rbv.db.rules.DbFieldsRule in project ats-framework by Axway.
the class Test_SimpleMonitorListener method verifyNeverMatches_IntiallyNoMatch_ButThenFoundAMatch.
@Test
public void verifyNeverMatches_IntiallyNoMatch_ButThenFoundAMatch() throws RbvException {
DbFieldsRule dbRule = new DbStringFieldRule("", "test_key", "test_value_changed", MatchRelation.EQUALS, "IntiallyNoMatch_ButThenFoundAMatch", true);
Monitor monitor = new Monitor("monitor1", matchable, dbRule, pollingParams, false, false, true);
List<Monitor> monitors = new ArrayList<Monitor>();
monitors.add(monitor);
changeDBValues(3 * POLLING_INTERVAL);
SimpleMonitorListener listener = new SimpleMonitorListener(monitors);
long before = System.currentTimeMillis();
assertFalse(listener.evaluateMonitors(TIME_END_POLL));
long after = System.currentTimeMillis();
assertTrue(after - before > TIME_AFTER_START_POLL && after - before < TIME_END_POLL);
}
use of com.axway.ats.rbv.db.rules.DbFieldsRule in project ats-framework by Axway.
the class Test_SimpleMonitorListener method verifyAlwaysHasAMatch_ButNoMatch.
@Test
public void verifyAlwaysHasAMatch_ButNoMatch() throws RbvException {
DbFieldsRule dbRule = new DbStringFieldRule("", "test_key", "test_value_000", MatchRelation.EQUALS, "verifyAlwaysHasAMatch_ButNoMatch", 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();
assertFalse(listener.evaluateMonitors(TIME_END_POLL));
long after = System.currentTimeMillis();
assertTrue(after - before <= TIME_AFTER_START_POLL);
}
use of com.axway.ats.rbv.db.rules.DbFieldsRule in project ats-framework by Axway.
the class Test_SimpleMonitorListener method evaluateMonitorsOneMonitorExpectedFalseNegative.
@Test
public void evaluateMonitorsOneMonitorExpectedFalseNegative() throws RbvException {
DbFieldsRule dbRule = new DbStringFieldRule("", "key1", "value10", MatchRelation.EQUALS, "evaluateMonitorsOneMonitorExpectedFalseNegative", true);
Monitor monitor = new Monitor("monitor1", matchable, dbRule, pollingParams, false, false, false);
List<Monitor> monitors = new ArrayList<Monitor>();
monitors.add(monitor);
SimpleMonitorListener listener = new SimpleMonitorListener(monitors);
assertFalse(listener.evaluateMonitors(TIME_END_POLL));
}
use of com.axway.ats.rbv.db.rules.DbFieldsRule in project ats-framework by Axway.
the class Test_SimpleMonitorListener method evaluateMonitorsOneMonitorPositive.
@Test
public void evaluateMonitorsOneMonitorPositive() throws RbvException {
DbFieldsRule dbRule = new DbStringFieldRule("", "key1", "value10", MatchRelation.EQUALS, "evaluateMonitorsOneMonitorPositive", 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);
assertTrue(listener.evaluateMonitors(TIME_END_POLL));
}
Aggregations