use of com.axway.ats.rbv.rules.AndRuleOperation in project ats-framework by Axway.
the class Test_DbBinaryFieldRule method isMatchExpectedFalseMultipleRulesNegative.
@Test
public void isMatchExpectedFalseMultipleRulesNegative() throws RbvException {
DbMetaData metaData = new DbMetaData();
metaData.putProperty("table.column", new byte[] { 0, 2 });
metaData.putProperty("table.column2", new byte[] { 0, 5 });
AndRuleOperation andRule = new AndRuleOperation();
andRule.addRule(ruleTest1ExpectFalse);
andRule.addRule(ruleTest2ExpectFalse);
assertFalse(andRule.isMatch(metaData));
}
use of com.axway.ats.rbv.rules.AndRuleOperation in project ats-framework by Axway.
the class Test_DbBinaryFieldRule method isMatchExpectedTrueMultipleRulesNegativeDontMatch.
@Test
public void isMatchExpectedTrueMultipleRulesNegativeDontMatch() throws RbvException {
DbMetaData metaData = new DbMetaData();
metaData.putProperty("table.column", new byte[] { 0, 2 });
metaData.putProperty("table.column2", new byte[] { 0, 6 });
AndRuleOperation andRule = new AndRuleOperation();
andRule.addRule(ruleTest1ExpectTrue);
andRule.addRule(ruleTest2ExpectTrue);
assertFalse(andRule.isMatch(metaData));
}
use of com.axway.ats.rbv.rules.AndRuleOperation in project ats-framework by Axway.
the class Test_AndRuleOperation method isMatchPriority.
@Test
public void isMatchPriority() throws RbvException, PackageException {
FileSystemMetaData meta = createMock(FileSystemMetaData.class);
FilePackage pack = createMock(FilePackage.class);
expect(meta.getFilePackage()).andReturn(pack);
expect(pack.isFile()).andReturn(true);
// at this point the evaluation should stop since this is the first rule to
// evaluate and it fails thus the second should not be evaluated at all
// if the priority does not work then the second rule would fail the unit test
// because we are not expecting any calls it would do to the mock objects
replayAll();
FilePathRule rule = new FilePathRule("some/path/some.file", "pathRule1", true, 2);
FileFolderRule anotherRule = new FileFolderRule(false, "folderRule", true, 1);
AndRuleOperation andRule = new AndRuleOperation();
andRule.addRule(rule);
andRule.addRule(anotherRule);
assertFalse(andRule.isMatch(meta));
verifyAll();
}
use of com.axway.ats.rbv.rules.AndRuleOperation in project ats-framework by Axway.
the class Test_SnapshotExecutor method matchAfterMultipleUpdateNegative.
/**
* UnitTest
* @throws RbvException
*/
@Test
public void matchAfterMultipleUpdateNegative() 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, MOD_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());
}
use of com.axway.ats.rbv.rules.AndRuleOperation in project ats-framework by Axway.
the class Test_DbNumericFieldRule method isMatchExpectedFalseMultipleRulesNegative.
@Test
public void isMatchExpectedFalseMultipleRulesNegative() throws RbvException {
DbMetaData metaData = new DbMetaData();
metaData.putProperty("table.column", 2);
metaData.putProperty("table.column2", 5);
AndRuleOperation andRule = new AndRuleOperation();
andRule.addRule(ruleTest1ExpectFalse);
andRule.addRule(ruleTest2ExpectFalse);
assertFalse(andRule.isMatch(metaData));
}
Aggregations