Search in sources :

Example 11 with SnapshotExecutor

use of com.axway.ats.rbv.executors.SnapshotExecutor 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 12 with SnapshotExecutor

use of com.axway.ats.rbv.executors.SnapshotExecutor 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)

Example 13 with SnapshotExecutor

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

the class Test_SnapshotExecutor method matchAfterUpdateNegative.

/**
    * UnitTest
    * @throws RbvException
    */
@Test
public void matchAfterUpdateNegative() 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 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());
}
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 14 with SnapshotExecutor

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

the class Test_SnapshotExecutor method matchAfterUpdatePositive.

/**
     * UnitTest
     * @throws RbvException
     */
@Test
public void matchAfterUpdatePositive() throws RbvException {
    DbMetaData newMeta = new DbMetaData();
    newMeta.putProperty(META_KEY_1, MOD_META_VALUE_1 + 2);
    newMeta.putProperty(META_KEY_2, META_VALUE_2 + 2);
    newMeta.putProperty(META_KEY_3, META_VALUE_3 + 2);
    newMeta.putProperty(META_KEY_4, META_VALUE_4 + 2);
    this.newData.add(newMeta);
    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, 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());
}
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 15 with SnapshotExecutor

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

the class Test_SnapshotExecutor method matchGlobalRulePositive.

/**
     * UnitTest
     * @throws RbvException
     */
@Test
public void matchGlobalRulePositive() 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, 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);
    SnapshotExecutor executor = new SnapshotExecutor(this.snapshot);
    executor.setRootRule(globalRule);
    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)

Aggregations

BaseTest (com.axway.ats.rbv.BaseTest)15 MetaData (com.axway.ats.rbv.MetaData)15 DbMetaData (com.axway.ats.rbv.db.DbMetaData)15 DbStringFieldRule (com.axway.ats.rbv.db.rules.DbStringFieldRule)15 SnapshotExecutor (com.axway.ats.rbv.executors.SnapshotExecutor)15 Test (org.junit.Test)15 AndRuleOperation (com.axway.ats.rbv.rules.AndRuleOperation)2 ArrayList (java.util.ArrayList)2 Rule (com.axway.ats.rbv.rules.Rule)1