Search in sources :

Example 31 with DbFieldsRule

use of com.axway.ats.rbv.db.rules.DbFieldsRule 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());
}
Also used : Monitor(com.axway.ats.rbv.Monitor) SimpleMonitorListener(com.axway.ats.rbv.SimpleMonitorListener) ArrayList(java.util.ArrayList) DbFieldsRule(com.axway.ats.rbv.db.rules.DbFieldsRule) DbStringFieldRule(com.axway.ats.rbv.db.rules.DbStringFieldRule) Test(org.junit.Test)

Example 32 with DbFieldsRule

use of com.axway.ats.rbv.db.rules.DbFieldsRule 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);
}
Also used : Monitor(com.axway.ats.rbv.Monitor) SimpleMonitorListener(com.axway.ats.rbv.SimpleMonitorListener) ArrayList(java.util.ArrayList) DbFieldsRule(com.axway.ats.rbv.db.rules.DbFieldsRule) DbStringFieldRule(com.axway.ats.rbv.db.rules.DbStringFieldRule) Test(org.junit.Test)

Example 33 with DbFieldsRule

use of com.axway.ats.rbv.db.rules.DbFieldsRule 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);
}
Also used : Monitor(com.axway.ats.rbv.Monitor) SimpleMonitorListener(com.axway.ats.rbv.SimpleMonitorListener) ArrayList(java.util.ArrayList) DbFieldsRule(com.axway.ats.rbv.db.rules.DbFieldsRule) DbStringFieldRule(com.axway.ats.rbv.db.rules.DbStringFieldRule) Test(org.junit.Test)

Aggregations

Monitor (com.axway.ats.rbv.Monitor)33 DbFieldsRule (com.axway.ats.rbv.db.rules.DbFieldsRule)33 DbStringFieldRule (com.axway.ats.rbv.db.rules.DbStringFieldRule)33 Test (org.junit.Test)33 SimpleMonitorListener (com.axway.ats.rbv.SimpleMonitorListener)32 ArrayList (java.util.ArrayList)32 DbSearchTerm (com.axway.ats.rbv.db.DbSearchTerm)8 DbStorage (com.axway.ats.rbv.db.DbStorage)8 MockDbProvider (com.axway.ats.rbv.db.MockDbProvider)8 Matchable (com.axway.ats.rbv.storage.Matchable)8 PollingParameters (com.axway.ats.rbv.PollingParameters)3 MetaData (com.axway.ats.rbv.MetaData)2