public Void call() throws Exception
{
List<List<EObject>> result = new ArrayList<List<EObject>>();
result.add(new ArrayList<EObject>());
Concern c1 = URNModelFactory.eINSTANCE.createConcern();
Concern c2 = URNModelFactory.eINSTANCE.createConcern();
accessLayer.addElement(project, c1);
accessLayer.addElement(project, c2);
c1.setId("test");
c2.setId("test");
result.add(new ArrayList<EObject>());
result.get(0).add(c1);
result.add(new ArrayList<EObject>());
result.get(1).add(c2);
Rule rule = RuleModelFactory.eINSTANCE.createRule();
accessLayer.addElement(project, rule);
ElementDefinition e1 = RuleModelFactory.eINSTANCE.createElementDefinition();
accessLayer.addElement(project, e1);
ElementDefinition e2 = RuleModelFactory.eINSTANCE.createElementDefinition();
accessLayer.addElement(project, e2);
rule.getElements().add(e1);
rule.getElements().add(e2);
e1.setAlias("number_1");
e2.setAlias("number_2");
BaseCondition baseCondition = RuleModelFactory.eINSTANCE.createBaseCondition();
LogicCondition logicCondition = RuleModelFactory.eINSTANCE.createLogicCondition();
accessLayer.addElement(project, baseCondition);
accessLayer.addElement(project, logicCondition);
rule.setConditions(logicCondition);
logicCondition.getBaseConditions().add(baseCondition);
logicCondition.setType(LogicConditionType.AND);
baseCondition.setSource("number_1::Id");
baseCondition.setTarget("number_2::Id");
List<EObject[]> tuples = new ArrayList<EObject[]>();
// test "EQUALS":
baseCondition.setType(BaseConditionType.VALUE_EQUALS);
assertTrue(conditionProcessor.executeBaseCondition(rule, result, baseCondition, tuples));
assertEquals(1, result.get(0).size()); // test this once...
assertEquals(1, result.get(1).size());
c1.setId("test_addition");
assertFalse(conditionProcessor.executeBaseCondition(rule, result, baseCondition, tuples));
assertEquals(0, result.get(0).size());
assertEquals(0, result.get(1).size());
result.get(0).clear();
result.get(0).add(c1);
result.get(1).clear();
result.get(1).add(c2);
// test "STARTS_WITH":
c1.setId("test_bla");
baseCondition.setType(BaseConditionType.VALUE_STARTS_WITH);
assertTrue(conditionProcessor.executeBaseCondition(rule, result, baseCondition, tuples));
c1.setId("bla");
assertFalse(conditionProcessor.executeBaseCondition(rule, result, baseCondition, tuples));
result.get(0).clear();
result.get(0).add(c1);
result.get(1).clear();
result.get(1).add(c2);
// test "ENDS_WITH":
c1.setId("test");
baseCondition.setType(BaseConditionType.VALUE_ENDS_WITH);
assertTrue(conditionProcessor.executeBaseCondition(rule, result, baseCondition, tuples));
c1.setId("test_bla");
assertFalse(conditionProcessor.executeBaseCondition(rule, result, baseCondition, tuples));
result.get(0).clear();
result.get(0).add(c1);
result.get(1).clear();
result.get(1).add(c2);
// test "CONTAINS":
c1.setId("test_addition");
baseCondition.setType(BaseConditionType.VALUE_CONTAINS);
assertTrue(conditionProcessor.executeBaseCondition(rule, result, baseCondition, tuples));
c1.setId("tes");
assertFalse(conditionProcessor.executeBaseCondition(rule, result, baseCondition, tuples));
result.get(0).clear();
result.get(0).add(c1);
result.get(1).clear();
result.get(1).add(c2);
// test "SIMILAR_TO"
c1.setId("test");
baseCondition.setType(BaseConditionType.VALUE_SIMILAR_TO);
assertTrue(conditionProcessor.executeBaseCondition(rule, result, baseCondition, tuples));
c1.setId("tast");
assertFalse(conditionProcessor.executeBaseCondition(rule, result, baseCondition, tuples));
result.get(0).clear();
result.get(0).add(c1);
result.get(1).clear();
result.get(1).add(c2);
// test "LESSER_THAN":
c1.setId("1");
c2.setId("2");
baseCondition.setType(BaseConditionType.VALUE_LESSER_THAN);
assertTrue(conditionProcessor.executeBaseCondition(rule, result, baseCondition, tuples));
c1.setId("2");
c2.setId("1");
assertFalse(conditionProcessor.executeBaseCondition(rule, result, baseCondition, tuples));
result.get(0).clear();
result.get(0).add(c1);
result.get(1).clear();
result.get(1).add(c2);
// test "GREATER_THAN":
c1.setId("2");
c2.setId("1");
baseCondition.setType(BaseConditionType.VALUE_GREATER_THAN);
assertTrue(conditionProcessor.executeBaseCondition(rule, result, baseCondition, tuples));
c1.setId("1");
c2.setId("2");
assertFalse(conditionProcessor.executeBaseCondition(rule, result, baseCondition, tuples));
// test "IS_PARENT":
result.get(0).clear();
result.get(0).add(rule);