use of com.axway.ats.rbv.db.rules.DbFieldsRule in project ats-framework by Axway.
the class Test_SimpleMonitorListener method verifyNoMatch_ButHasAMatch.
@Test
public void verifyNoMatch_ButHasAMatch() throws RbvException {
DbFieldsRule dbRule = new DbStringFieldRule("", "key1", "value00", MatchRelation.EQUALS, "verifyNoMatch_ButHasAMatch", true);
Monitor monitor = new Monitor("monitor1", matchable, dbRule, pollingParams, false, 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);
}
use of com.axway.ats.rbv.db.rules.DbFieldsRule in project ats-framework by Axway.
the class Test_SimpleMonitorListener method evaluateMonitorsOneMonitorPositiveRunTwice.
@Test
public void evaluateMonitorsOneMonitorPositiveRunTwice() throws RbvException {
DbFieldsRule dbRule = new DbStringFieldRule("", "key1", "value10", MatchRelation.EQUALS, "evaluateMonitorsOneMonitorPositiveRunTwice", 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));
assertTrue(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 evaluateMonitorsMultipleMonitorsEndOnFirstMatchPositive.
@Test
public void evaluateMonitorsMultipleMonitorsEndOnFirstMatchPositive() 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 dbRule = new DbStringFieldRule("", "key1", "value10", MatchRelation.EQUALS, "evaluateMonitorsMultipleMonitorsEndOnFirstMatchPositive", true);
Monitor monitor1 = new Monitor("monitor1", matchable1, dbRule, pollingParams, true, true, false);
Monitor monitor2 = new Monitor("monitor2", matchable2, dbRule, pollingParams, true, true, false);
Monitor monitor3 = new Monitor("monitor3", matchable3, dbRule, pollingParams, true, true, false);
List<Monitor> monitors = new ArrayList<Monitor>();
monitors.add(monitor1);
monitors.add(monitor2);
monitors.add(monitor3);
SimpleMonitorListener listener = new SimpleMonitorListener(monitors);
assertTrue(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 monitorGetFirstMachingMetaData.
@Test
public void monitorGetFirstMachingMetaData() throws RbvException {
DbFieldsRule dbRule = new DbStringFieldRule("", "key1", "value10", MatchRelation.EQUALS, "monitorGetFirstMachingMetaData", 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);
listener.evaluateMonitors(TIME_END_POLL);
assertEquals("value10", monitor.getFirstMatchedMetaData().getProperty("key1"));
}
use of com.axway.ats.rbv.db.rules.DbFieldsRule in project ats-framework by Axway.
the class Test_SimpleMonitorListener method verifyAlwaysHasAMatch_IntiallyFoundAMatch_ButThenNoMatch.
@Test
public void verifyAlwaysHasAMatch_IntiallyFoundAMatch_ButThenNoMatch() throws RbvException {
DbFieldsRule dbRule = new DbStringFieldRule("", "test_key", "test_value", MatchRelation.EQUALS, "IntiallyFoundAMatch_ButThenNoMatch", true);
Monitor monitor = new Monitor("monitor1", matchable, dbRule, pollingParams, true, 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);
}
Aggregations