Search in sources :

Example 61 with DbStringFieldRule

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);
}
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 62 with DbStringFieldRule

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());
}
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 63 with DbStringFieldRule

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);
}
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 64 with DbStringFieldRule

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);
}
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

DbStringFieldRule (com.axway.ats.rbv.db.rules.DbStringFieldRule)64 Test (org.junit.Test)57 ArrayList (java.util.ArrayList)34 Monitor (com.axway.ats.rbv.Monitor)33 DbFieldsRule (com.axway.ats.rbv.db.rules.DbFieldsRule)33 SimpleMonitorListener (com.axway.ats.rbv.SimpleMonitorListener)32 BaseTest (com.axway.ats.rbv.BaseTest)24 MetaData (com.axway.ats.rbv.MetaData)17 DbMetaData (com.axway.ats.rbv.db.DbMetaData)15 SnapshotExecutor (com.axway.ats.rbv.executors.SnapshotExecutor)15 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 PublicAtsApi (com.axway.ats.common.PublicAtsApi)7 PollingParameters (com.axway.ats.rbv.PollingParameters)3 AndRuleOperation (com.axway.ats.rbv.rules.AndRuleOperation)2 Rule (com.axway.ats.rbv.rules.Rule)1