Search in sources :

Example 21 with AndRuleOperation

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

the class Test_AndRuleOperation method isMatchBothRulesExpectedTrueNegative.

@Test
public void isMatchBothRulesExpectedTrueNegative() throws RbvException {
    HeaderRule firstRule = new HeaderRule("Sender", "gmail.com", HeaderMatchMode.FIND, "isMatchBothRulesExpectedTrueNegative", true);
    HeaderRule secondRule = new HeaderRule("Sender", "gmail123.com", HeaderMatchMode.FIND, "isMatchBothRulesExpectedTrueNegative", true);
    firstRule.equals(secondRule);
    AndRuleOperation andRule = new AndRuleOperation();
    andRule.addRule(firstRule);
    andRule.addRule(secondRule);
    assertFalse(andRule.isMatch(metaData));
}
Also used : HeaderRule(com.axway.ats.rbv.imap.rules.HeaderRule) AndRuleOperation(com.axway.ats.rbv.rules.AndRuleOperation) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test)

Example 22 with AndRuleOperation

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

the class Test_AndRuleOperation method isMatchOneOfThRulesExpectedFalseNegative.

@Test
public void isMatchOneOfThRulesExpectedFalseNegative() throws RbvException {
    HeaderRule firstRule = new HeaderRule("Sender", "gmail.com", HeaderMatchMode.FIND, "isMatchOneOfThRulesExpectedFalseNegative", true);
    HeaderRule secondRule = new HeaderRule("Sender", "gmail.com", HeaderMatchMode.FIND, "isMatchOneOfThRulesExpectedFalseNegative", false);
    AndRuleOperation andRule = new AndRuleOperation();
    andRule.addRule(firstRule);
    andRule.addRule(secondRule);
    assertFalse(andRule.isMatch(metaData));
}
Also used : HeaderRule(com.axway.ats.rbv.imap.rules.HeaderRule) AndRuleOperation(com.axway.ats.rbv.rules.AndRuleOperation) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test)

Example 23 with AndRuleOperation

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

the class Test_AndRuleOperation method isMatchBothRulesExpectedTruePositive.

@Test
public void isMatchBothRulesExpectedTruePositive() throws RbvException {
    HeaderRule firstRule = new HeaderRule("Sender", "gmail.com", HeaderMatchMode.FIND, "isMatchBothRulesExpectedTruePositive", true);
    HeaderRule secondRule = new HeaderRule("Sender", "gmail.com", HeaderMatchMode.FIND, "isMatchBothRulesExpectedTruePositive", true);
    AndRuleOperation andRule = new AndRuleOperation();
    andRule.addRule(firstRule);
    andRule.addRule(secondRule);
    assertTrue(andRule.isMatch(metaData));
}
Also used : HeaderRule(com.axway.ats.rbv.imap.rules.HeaderRule) AndRuleOperation(com.axway.ats.rbv.rules.AndRuleOperation) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test)

Example 24 with AndRuleOperation

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

the class Test_AndRuleOperation method isMatchOneOfThRulesExpectedFalsePositive.

@Test
public void isMatchOneOfThRulesExpectedFalsePositive() throws RbvException {
    HeaderRule firstRule = new HeaderRule("Sender", "gmail.com", HeaderMatchMode.FIND, "isMatchOneOfThRulesExpectedFalsePositive", true);
    HeaderRule secondRule = new HeaderRule("Sender", "gmail123.com", HeaderMatchMode.FIND, "isMatchOneOfThRulesExpectedFalsePositive", false);
    AndRuleOperation andRule = new AndRuleOperation();
    andRule.addRule(firstRule);
    andRule.addRule(secondRule);
    assertTrue(andRule.isMatch(metaData));
}
Also used : HeaderRule(com.axway.ats.rbv.imap.rules.HeaderRule) AndRuleOperation(com.axway.ats.rbv.rules.AndRuleOperation) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test)

Example 25 with AndRuleOperation

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

the class Test_SnapshotExecutor method matchAfterMultipleUpdatePositive.

/**
 * UnitTest
 * @throws RbvException
 */
@Test
public void matchAfterMultipleUpdatePositive() throws RbvException {
    MetaData meta = new DbMetaData();
    meta.putProperty(META_KEY_1, MOD_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);
    DbStringFieldRule keyRule = new DbStringFieldRule(TABLE_NAME, COLUMN_NAME_2, MOD_META_VALUE_2 + 2, DbStringFieldRule.MatchRelation.EQUALS, "key_rule_1", true);
    DbStringFieldRule matchingRule1 = new DbStringFieldRule(TABLE_NAME, COLUMN_NAME_1, MOD_META_VALUE_1 + 2, DbStringFieldRule.MatchRelation.EQUALS, "match_metakey_1", true);
    DbStringFieldRule matchingRule2 = new DbStringFieldRule(TABLE_NAME, COLUMN_NAME_2, MOD_META_VALUE_2 + 2, DbStringFieldRule.MatchRelation.EQUALS, "match_metakey_2", true);
    AndRuleOperation rule = new AndRuleOperation();
    rule.addRule(matchingRule1);
    rule.addRule(matchingRule2);
    SnapshotExecutor executor = new SnapshotExecutor(this.snapshot);
    executor.addRule(keyRule, rule);
    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) AndRuleOperation(com.axway.ats.rbv.rules.AndRuleOperation) DbStringFieldRule(com.axway.ats.rbv.db.rules.DbStringFieldRule) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test)

Aggregations

BaseTest (com.axway.ats.rbv.BaseTest)25 AndRuleOperation (com.axway.ats.rbv.rules.AndRuleOperation)25 Test (org.junit.Test)25 DbMetaData (com.axway.ats.rbv.db.DbMetaData)20 HeaderRule (com.axway.ats.rbv.imap.rules.HeaderRule)4 MetaData (com.axway.ats.rbv.MetaData)2 DbStringFieldRule (com.axway.ats.rbv.db.rules.DbStringFieldRule)2 SnapshotExecutor (com.axway.ats.rbv.executors.SnapshotExecutor)2 FilePackage (com.axway.ats.action.objects.FilePackage)1 FileSystemMetaData (com.axway.ats.rbv.filesystem.FileSystemMetaData)1 FileFolderRule (com.axway.ats.rbv.filesystem.rules.FileFolderRule)1 FilePathRule (com.axway.ats.rbv.filesystem.rules.FilePathRule)1