Search in sources :

Example 81 with MetaData

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

the class Test_SimpleMonitorListener method monitorGetAllMachingMetaDataEndOnFirstMatch.

@Test
public void monitorGetAllMachingMetaDataEndOnFirstMatch() throws RbvException {
    DbFieldsRule dbRule = new DbStringFieldRule("", "key1", "value101", MatchRelation.EQUALS, "monitorGetAllMachingMetaDataEndOnFirstMatch", false);
    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();
    listener.evaluateMonitors(TIME_END_POLL);
    long after = System.currentTimeMillis();
    assertTrue("It's not a first match!", after - before < TIME_BEFORE_END_POLL);
    List<MetaData> matchingMetaData = monitor.getAllMatchedMetaData();
    assertEquals(1, matchingMetaData.size());
    String value = (String) matchingMetaData.get(0).getProperty("key1");
    //there is no guarantee for the hash map order so we check for both possible values
    assertTrue(value.equals("value00") || value.equals("value10"));
}
Also used : Monitor(com.axway.ats.rbv.Monitor) SimpleMonitorListener(com.axway.ats.rbv.SimpleMonitorListener) MetaData(com.axway.ats.rbv.MetaData) 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

MetaData (com.axway.ats.rbv.MetaData)81 Test (org.junit.Test)76 BaseTest (com.axway.ats.rbv.BaseTest)71 FileSystemMetaData (com.axway.ats.rbv.filesystem.FileSystemMetaData)49 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)45 DbStringFieldRule (com.axway.ats.rbv.db.rules.DbStringFieldRule)17 DbMetaData (com.axway.ats.rbv.db.DbMetaData)16 SnapshotExecutor (com.axway.ats.rbv.executors.SnapshotExecutor)15 FileMd5Rule (com.axway.ats.rbv.filesystem.rules.FileMd5Rule)10 FilePathRule (com.axway.ats.rbv.filesystem.rules.FilePathRule)10 FileSizeRule (com.axway.ats.rbv.filesystem.rules.FileSizeRule)10 FilePackage (com.axway.ats.action.objects.FilePackage)9 ArrayList (java.util.ArrayList)7 FileModtimeRule (com.axway.ats.rbv.filesystem.rules.FileModtimeRule)6 FilePermRule (com.axway.ats.rbv.filesystem.rules.FilePermRule)6 ImapMetaData (com.axway.ats.rbv.imap.ImapMetaData)5 FileContentRule (com.axway.ats.rbv.filesystem.rules.FileContentRule)4 FileSystemFolder (com.axway.ats.rbv.filesystem.FileSystemFolder)3 RbvException (com.axway.ats.rbv.model.RbvException)3 FileSystemOperations (com.axway.ats.action.filesystem.FileSystemOperations)2