Search in sources :

Example 26 with DbStringFieldRule

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

the class Test_DbStringFieldRule method isMatchRelationEqualsPositive.

@Test
public void isMatchRelationEqualsPositive() throws RbvException {
    testMetaData.putProperty("test", "test*(&%^$A&^%$");
    DbStringFieldRule rule = new DbStringFieldRule("test", "test*(&%^$A&^%$", MatchRelation.EQUALS, "isMatchRelationEqualsPositive", true);
    assertTrue(rule.isMatch(testMetaData));
}
Also used : DbStringFieldRule(com.axway.ats.rbv.db.rules.DbStringFieldRule) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test)

Example 27 with DbStringFieldRule

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

the class Test_DbStringFieldRule method isMatchRelationContainsNegative.

@Test
public void isMatchRelationContainsNegative() throws RbvException {
    testMetaData.putProperty("test", "test*(&%^$A&^");
    DbStringFieldRule rule = new DbStringFieldRule("test", "test*(&%^$A&^%$", MatchRelation.CONTAINS, "isMatchRelationContainsNegative", true);
    assertFalse(rule.isMatch(testMetaData));
}
Also used : DbStringFieldRule(com.axway.ats.rbv.db.rules.DbStringFieldRule) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test)

Example 28 with DbStringFieldRule

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

the class Test_SnapshotExecutor method matchDifferentSizeOfList.

/**
     * UnitTest
     * @throws RbvException
     */
@Test
public void matchDifferentSizeOfList() throws RbvException {
    this.newData = new ArrayList<MetaData>();
    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);
    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());
}
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 29 with DbStringFieldRule

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

the class Test_SnapshotExecutor method matchGlobalRuleAndSnapshotRulesNegative.

/**
     * UnitTest
     * @throws RbvException
     */
@Test
public void matchGlobalRuleAndSnapshotRulesNegative() 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);
    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());
}
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 30 with DbStringFieldRule

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

the class Test_SnapshotExecutor method matchAfterDifferentUpdateNegative.

/**
     * @throws RbvException
     */
@Test
public void matchAfterDifferentUpdateNegative() 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, MOD_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);
    List<Rule> rules = new ArrayList<Rule>();
    rules.add(matchingRule1);
    rules.add(matchingRule2);
    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) ArrayList(java.util.ArrayList) SnapshotExecutor(com.axway.ats.rbv.executors.SnapshotExecutor) DbStringFieldRule(com.axway.ats.rbv.db.rules.DbStringFieldRule) Rule(com.axway.ats.rbv.rules.Rule) DbStringFieldRule(com.axway.ats.rbv.db.rules.DbStringFieldRule) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test)

Aggregations

DbStringFieldRule (com.axway.ats.rbv.db.rules.DbStringFieldRule)64 Test (org.junit.Test)57 ArrayList (java.util.ArrayList)34 Monitor (com.axway.ats.rbv.Monitor)33 DbFieldsRule (com.axway.ats.rbv.db.rules.DbFieldsRule)33 SimpleMonitorListener (com.axway.ats.rbv.SimpleMonitorListener)32 BaseTest (com.axway.ats.rbv.BaseTest)24 MetaData (com.axway.ats.rbv.MetaData)17 DbMetaData (com.axway.ats.rbv.db.DbMetaData)15 SnapshotExecutor (com.axway.ats.rbv.executors.SnapshotExecutor)15 DbSearchTerm (com.axway.ats.rbv.db.DbSearchTerm)8 DbStorage (com.axway.ats.rbv.db.DbStorage)8 MockDbProvider (com.axway.ats.rbv.db.MockDbProvider)8 Matchable (com.axway.ats.rbv.storage.Matchable)8 PublicAtsApi (com.axway.ats.common.PublicAtsApi)7 PollingParameters (com.axway.ats.rbv.PollingParameters)3 AndRuleOperation (com.axway.ats.rbv.rules.AndRuleOperation)2 Rule (com.axway.ats.rbv.rules.Rule)1