use of com.axway.ats.rbv.db.DbMetaData in project ats-framework by Axway.
the class Test_SnapshotExecutor method matchDifferentSizeOfPropertiesCount.
/**
* UnitTest
* @throws RbvException
*/
@Test
public void matchDifferentSizeOfPropertiesCount() throws RbvException {
MetaData meta = new DbMetaData();
meta.putProperty(META_KEY_1, MOD_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);
meta.putProperty(TABLE_NAME + ".columnfive", 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", true);
DbStringFieldRule matchingRule = new DbStringFieldRule(TABLE_NAME, COLUMN_NAME_1, MOD_META_VALUE_1 + 2, 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 || result.isEmpty());
}
use of com.axway.ats.rbv.db.DbMetaData in project ats-framework by Axway.
the class Test_SnapshotExecutor method matchGlobalRuleAndSnapshotRulesPositive.
/**
* UnitTest
* @throws RbvException
*/
@Test
public void matchGlobalRuleAndSnapshotRulesPositive() throws RbvException {
this.newData = new ArrayList<MetaData>();
DbMetaData meta;
meta = new DbMetaData();
meta.putProperty(META_KEY_1, MOD_META_VALUE_1 + 35);
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, MOD_META_VALUE_1 + 33);
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);
meta = new DbMetaData();
meta.putProperty(META_KEY_1, MOD_META_VALUE_1 + 33);
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 globalRule = new DbStringFieldRule(TABLE_NAME, COLUMN_NAME_1, MOD_META_VALUE_1 + 33, DbStringFieldRule.MatchRelation.EQUALS, "global_rule", true);
DbStringFieldRule keyRule = new DbStringFieldRule(TABLE_NAME, COLUMN_NAME_2, META_VALUE_2 + 1, DbStringFieldRule.MatchRelation.EQUALS, "key_rule", true);
DbStringFieldRule matchingRule = new DbStringFieldRule(TABLE_NAME, COLUMN_NAME_1, MOD_META_VALUE_1 + 35, DbStringFieldRule.MatchRelation.EQUALS, "match_metakey_1", true);
SnapshotExecutor executor = new SnapshotExecutor(this.snapshot);
executor.addRule(keyRule, matchingRule);
executor.setRootRule(globalRule);
List<MetaData> result = executor.evaluate(this.newData);
assertTrue(result != null && !result.isEmpty());
}
use of com.axway.ats.rbv.db.DbMetaData in project ats-framework by Axway.
the class Test_SnapshotExecutor method matchGlobalRuleNegativeOneOfTheRecordsIsNotChanged.
/**
* UnitTest
* @throws RbvException
*/
@Test
public void matchGlobalRuleNegativeOneOfTheRecordsIsNotChanged() throws RbvException {
this.newData = new ArrayList<MetaData>();
DbMetaData meta;
meta = new DbMetaData();
meta.putProperty(META_KEY_1, MOD_META_VALUE_1 + 33);
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, MOD_META_VALUE_1 + 33);
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);
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 globalRule = new DbStringFieldRule(TABLE_NAME, COLUMN_NAME_1, MOD_META_VALUE_1 + 33, DbStringFieldRule.MatchRelation.EQUALS, "global_rule", true);
SnapshotExecutor executor = new SnapshotExecutor(this.snapshot);
executor.setRootRule(globalRule);
List<MetaData> result = executor.evaluate(this.newData);
assertTrue(result == null || result.isEmpty());
}
use of com.axway.ats.rbv.db.DbMetaData in project ats-framework by Axway.
the class Test_SnapshotExecutor method matchDifferentSizeOfPropertiesName.
/**
* UnitTest
* @throws RbvException
*/
@Test
public void matchDifferentSizeOfPropertiesName() throws RbvException {
MetaData meta = new DbMetaData();
meta.putProperty(META_KEY_1, MOD_META_VALUE_1 + 2);
meta.putProperty(META_KEY_2, META_VALUE_2 + 2);
meta.putProperty(META_KEY_3, META_VALUE_3 + 2);
meta.putProperty("Some_other_disturbingly_wrong_name", 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", true);
DbStringFieldRule matchingRule = new DbStringFieldRule(TABLE_NAME, COLUMN_NAME_1, MOD_META_VALUE_1 + 2, 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 || result.isEmpty());
}
use of com.axway.ats.rbv.db.DbMetaData 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());
}
Aggregations