use of com.axway.ats.rbv.db.rules.DbStringFieldRule 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());
}
use of com.axway.ats.rbv.db.rules.DbStringFieldRule 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());
}
use of com.axway.ats.rbv.db.rules.DbStringFieldRule in project ats-framework by Axway.
the class Test_DbStringFieldRule method isMatchNullActualValuePositive.
@Test
public void isMatchNullActualValuePositive() throws RbvException {
testMetaData.putProperty("test", null);
DbStringFieldRule rule = new DbStringFieldRule("test", null, MatchRelation.CONTAINS, "isMatchNullActualValue", true);
assertTrue(rule.isMatch(testMetaData));
}
use of com.axway.ats.rbv.db.rules.DbStringFieldRule in project ats-framework by Axway.
the class Test_SimpleMonitorListener method evaluateMonitorsMultipleMonitorsEndOnFirstMatchPositive.
@Test
public void evaluateMonitorsMultipleMonitorsEndOnFirstMatchPositive() throws RbvException {
DbStorage storage = new DbStorage(new MockDbProvider());
Matchable matchable1 = storage.getFolder(new DbSearchTerm(""));
Matchable matchable2 = storage.getFolder(new DbSearchTerm(""));
Matchable matchable3 = storage.getFolder(new DbSearchTerm(""));
DbFieldsRule dbRule = new DbStringFieldRule("", "key1", "value10", MatchRelation.EQUALS, "evaluateMonitorsMultipleMonitorsEndOnFirstMatchPositive", true);
Monitor monitor1 = new Monitor("monitor1", matchable1, dbRule, pollingParams, true, true, false);
Monitor monitor2 = new Monitor("monitor2", matchable2, dbRule, pollingParams, true, true, false);
Monitor monitor3 = new Monitor("monitor3", matchable3, dbRule, pollingParams, true, true, false);
List<Monitor> monitors = new ArrayList<Monitor>();
monitors.add(monitor1);
monitors.add(monitor2);
monitors.add(monitor3);
SimpleMonitorListener listener = new SimpleMonitorListener(monitors);
assertTrue(listener.evaluateMonitors(TIME_END_POLL));
}
use of com.axway.ats.rbv.db.rules.DbStringFieldRule in project ats-framework by Axway.
the class Test_SimpleMonitorListener method monitorGetFirstMachingMetaData.
@Test
public void monitorGetFirstMachingMetaData() throws RbvException {
DbFieldsRule dbRule = new DbStringFieldRule("", "key1", "value10", MatchRelation.EQUALS, "monitorGetFirstMachingMetaData", true);
Monitor monitor = new Monitor("monitor1", matchable, dbRule, pollingParams, true, true, false);
List<Monitor> monitors = new ArrayList<Monitor>();
monitors.add(monitor);
SimpleMonitorListener listener = new SimpleMonitorListener(monitors);
listener.evaluateMonitors(TIME_END_POLL);
assertEquals("value10", monitor.getFirstMatchedMetaData().getProperty("key1"));
}
Aggregations