Search in sources :

Example 16 with Matchable

use of com.axway.ats.rbv.storage.Matchable in project ats-framework by Axway.

the class Test_DbFolder method getMetaDataCountsBeforePolling.

@Test(expected = RbvStorageException.class)
public void getMetaDataCountsBeforePolling() throws Exception {
    DbStorage storage = new DbStorage(new MockDbProvider());
    Matchable folder = storage.getFolder(new DbSearchTerm(""));
    folder.open();
    folder.getMetaDataCounts();
}
Also used : DbStorage(com.axway.ats.rbv.db.DbStorage) DbSearchTerm(com.axway.ats.rbv.db.DbSearchTerm) Matchable(com.axway.ats.rbv.storage.Matchable) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test)

Example 17 with Matchable

use of com.axway.ats.rbv.storage.Matchable in project ats-framework by Axway.

the class Test_DbFolder method getAllMetaData.

@Test
public void getAllMetaData() throws Exception {
    DbStorage storage = new DbStorage(new MockDbProvider());
    Matchable folder = storage.getFolder(new DbSearchTerm(""));
    folder.open();
    List<MetaData> metaData = folder.getAllMetaData();
    assertEquals(2, metaData.size());
    folder.close();
}
Also used : DbStorage(com.axway.ats.rbv.db.DbStorage) MetaData(com.axway.ats.rbv.MetaData) DbSearchTerm(com.axway.ats.rbv.db.DbSearchTerm) Matchable(com.axway.ats.rbv.storage.Matchable) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test)

Example 18 with Matchable

use of com.axway.ats.rbv.storage.Matchable in project ats-framework by Axway.

the class Test_DbFolder method getNewMetaData.

@Test
public void getNewMetaData() throws Exception {
    DbStorage storage = new DbStorage(new MockDbProvider());
    Matchable folder = storage.getFolder(new DbSearchTerm(""));
    folder.open();
    List<MetaData> metaData = folder.getNewMetaData();
    assertEquals(2, metaData.size());
    folder.close();
}
Also used : DbStorage(com.axway.ats.rbv.db.DbStorage) MetaData(com.axway.ats.rbv.MetaData) DbSearchTerm(com.axway.ats.rbv.db.DbSearchTerm) Matchable(com.axway.ats.rbv.storage.Matchable) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test)

Example 19 with Matchable

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

Example 20 with Matchable

use of com.axway.ats.rbv.storage.Matchable in project ats-framework by Axway.

the class Test_SimpleMonitorListener method evaluateMonitorsMultipleMonitorsEndOnFirstMatchExpectedFalsePositive.

@Test
public void evaluateMonitorsMultipleMonitorsEndOnFirstMatchExpectedFalsePositive() throws RbvException {
    PollingParameters longPollingParams = new PollingParameters(0, 5000, 10);
    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", "value2345", MatchRelation.EQUALS, "evaluateMonitorsMultipleMonitorsEndOnFirstMatchPositive", true);
    Monitor monitor1 = new Monitor("monitor1", matchable1, dbRule, longPollingParams, false, true, false);
    Monitor monitor2 = new Monitor("monitor2", matchable2, dbRule, longPollingParams, false, true, false);
    Monitor monitor3 = new Monitor("monitor3", matchable3, dbRule, longPollingParams, false, true, false);
    List<Monitor> monitors = new ArrayList<Monitor>();
    monitors.add(monitor1);
    monitors.add(monitor2);
    monitors.add(monitor3);
    long timeBefore = Calendar.getInstance().getTimeInMillis();
    SimpleMonitorListener listener = new SimpleMonitorListener(monitors);
    listener.evaluateMonitors(TIME_END_POLL);
    long timeAfter = Calendar.getInstance().getTimeInMillis();
    //make sure less than (3 * poling interval) seconds have passed
    //this means that only one iteration was made
    assertTrue(timeAfter - timeBefore < 3 * POLLING_INTERVAL - 500);
}
Also used : Monitor(com.axway.ats.rbv.Monitor) DbStorage(com.axway.ats.rbv.db.DbStorage) SimpleMonitorListener(com.axway.ats.rbv.SimpleMonitorListener) DbSearchTerm(com.axway.ats.rbv.db.DbSearchTerm) ArrayList(java.util.ArrayList) DbFieldsRule(com.axway.ats.rbv.db.rules.DbFieldsRule) PollingParameters(com.axway.ats.rbv.PollingParameters) MockDbProvider(com.axway.ats.rbv.db.MockDbProvider) DbStringFieldRule(com.axway.ats.rbv.db.rules.DbStringFieldRule) Matchable(com.axway.ats.rbv.storage.Matchable) Test(org.junit.Test)

Aggregations

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