Search in sources :

Example 51 with MetaData

use of com.axway.ats.rbv.MetaData 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 52 with MetaData

use of com.axway.ats.rbv.MetaData 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 53 with MetaData

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

the class Test_SnapshotExecutor method matchAfterDifferentUpdatePositive.

/**
     * UnitTest
     * @throws RbvException
     */
@Test
public void matchAfterDifferentUpdatePositive() throws RbvException {
    // remove first piece of default MetaData
    this.newData = new ArrayList<MetaData>();
    MetaData meta = new DbMetaData();
    meta.putProperty(META_KEY_1, MOD_META_VALUE_1 + 1);
    meta.putProperty(META_KEY_2, META_VALUE_2 + 1);
    meta.putProperty(META_KEY_3, META_VALUE_3 + 1);
    meta.putProperty(META_KEY_4, META_VALUE_4 + 1);
    this.newData.add(meta);
    meta = new DbMetaData();
    meta.putProperty(META_KEY_1, META_VALUE_1 + 2);
    meta.putProperty(META_KEY_2, MOD_META_VALUE_2 + 2);
    meta.putProperty(META_KEY_3, META_VALUE_3 + 2);
    meta.putProperty(META_KEY_4, META_VALUE_4 + 2);
    this.newData.add(meta);
    meta = new DbMetaData();
    meta.putProperty(META_KEY_1, META_VALUE_1 + 3);
    meta.putProperty(META_KEY_2, META_VALUE_2 + 3);
    meta.putProperty(META_KEY_3, META_VALUE_3 + 3);
    meta.putProperty(META_KEY_4, META_VALUE_4 + 3);
    this.newData.add(meta);
    DbStringFieldRule keyRule1 = new DbStringFieldRule(TABLE_NAME, COLUMN_NAME_2, META_VALUE_2 + 1, DbStringFieldRule.MatchRelation.EQUALS, "key_rule_1", true);
    DbStringFieldRule matchingRule1 = new DbStringFieldRule(TABLE_NAME, COLUMN_NAME_1, MOD_META_VALUE_1 + 1, DbStringFieldRule.MatchRelation.EQUALS, "match_metakey_1", true);
    DbStringFieldRule keyRule2 = new DbStringFieldRule(TABLE_NAME, COLUMN_NAME_1, META_VALUE_1 + 2, DbStringFieldRule.MatchRelation.EQUALS, "key_rule_2", true);
    DbStringFieldRule matchingRule2 = new DbStringFieldRule(TABLE_NAME, COLUMN_NAME_2, MOD_META_VALUE_2 + 2, DbStringFieldRule.MatchRelation.EQUALS, "match_metakey_2", true);
    SnapshotExecutor executor = new SnapshotExecutor(this.snapshot);
    executor.addRule(keyRule1, matchingRule1);
    executor.addRule(keyRule2, matchingRule2);
    List<MetaData> result = executor.evaluate(this.newData);
    assertTrue(result != null && !result.isEmpty());
}
Also used : DbMetaData(com.axway.ats.rbv.db.DbMetaData) DbMetaData(com.axway.ats.rbv.db.DbMetaData) MetaData(com.axway.ats.rbv.MetaData) SnapshotExecutor(com.axway.ats.rbv.executors.SnapshotExecutor) DbStringFieldRule(com.axway.ats.rbv.db.rules.DbStringFieldRule) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test)

Example 54 with MetaData

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

the class Test_SnapshotExecutor method matchAfterNoUpdateHasBeenMade.

/**
    * UnitTest
    * @throws RbvException
    */
@Test
public void matchAfterNoUpdateHasBeenMade() throws RbvException {
    MetaData meta = new DbMetaData();
    meta.putProperty(META_KEY_1, META_VALUE_1 + 2);
    meta.putProperty(META_KEY_2, META_VALUE_2 + 2);
    meta.putProperty(META_KEY_3, META_VALUE_3 + 2);
    meta.putProperty(META_KEY_4, META_VALUE_4 + 2);
    this.newData.add(meta);
    DbStringFieldRule keyRule = new DbStringFieldRule(TABLE_NAME, COLUMN_NAME_2, META_VALUE_2 + 2, DbStringFieldRule.MatchRelation.EQUALS, "key_rule_1", true);
    DbStringFieldRule matchingRule = new DbStringFieldRule(TABLE_NAME, COLUMN_NAME_1, META_VALUE_1 + 33, DbStringFieldRule.MatchRelation.EQUALS, "match_metakey_1", true);
    SnapshotExecutor executor = new SnapshotExecutor(this.snapshot);
    executor.addRule(keyRule, matchingRule);
    List<MetaData> result = executor.evaluate(this.newData);
    assertTrue(result == null);
}
Also used : DbMetaData(com.axway.ats.rbv.db.DbMetaData) DbMetaData(com.axway.ats.rbv.db.DbMetaData) MetaData(com.axway.ats.rbv.MetaData) SnapshotExecutor(com.axway.ats.rbv.executors.SnapshotExecutor) DbStringFieldRule(com.axway.ats.rbv.db.rules.DbStringFieldRule) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test)

Example 55 with MetaData

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

the class Test_SubjectRule method isMatchWrongMetaData.

@Test(expected = MetaDataIncorrectException.class)
public void isMatchWrongMetaData() throws RbvException {
    SubjectRule rule = new SubjectRule("infos1.mercatoloterie@gmail.com", SubjectMatchMode.FIND, "isMatchEmptyMetaData", true);
    metaData = new MetaData();
    assertFalse(rule.isMatch(metaData));
}
Also used : ImapMetaData(com.axway.ats.rbv.imap.ImapMetaData) MetaData(com.axway.ats.rbv.MetaData) SubjectRule(com.axway.ats.rbv.imap.rules.SubjectRule) BaseTest(com.axway.ats.rbv.BaseTest) 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