@Override
public Void call() throws Exception
{
List<List<EObject>> result = new ArrayList<List<EObject>>();
Concern c1 = URNModelFactory.eINSTANCE.createConcern();
Concern c2 = URNModelFactory.eINSTANCE.createConcern();
accessLayer.addElement(project, c1);
accessLayer.addElement(project, c2);
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 baseCondition1 = RuleModelFactory.eINSTANCE.createBaseCondition();
BaseCondition baseCondition2 = RuleModelFactory.eINSTANCE.createBaseCondition();
LogicCondition logicCondition = RuleModelFactory.eINSTANCE.createLogicCondition();
accessLayer.addElement(project, baseCondition1);
accessLayer.addElement(project, baseCondition2);
accessLayer.addElement(project, logicCondition);
rule.setConditions(logicCondition);
logicCondition.getBaseConditions().add(baseCondition1);
logicCondition.getBaseConditions().add(baseCondition2);
baseCondition1.setSource("number_1::Id");
baseCondition1.setTarget("number_2::Id");
baseCondition1.setType(BaseConditionType.VALUE_EQUALS);
baseCondition2.setSource("number_1::name");
baseCondition2.setTarget("number_2::name");
baseCondition2.setType(BaseConditionType.VALUE_EQUALS);
List<List<EObject[]>> tuples = new ArrayList<List<EObject[]>>();
tuples.add(new ArrayList<EObject[]>());
tuples.add(new ArrayList<EObject[]>());
// test "AND":
c1.setId("creator");
c2.setId("creator");
c1.setName("name");
c2.setName("name");
logicCondition.setType(LogicConditionType.AND);
assertTrue(conditionProcessor.executeLogicCondition(rule, result, rule.getConditions(), tuples));
c1.setId("creator__");
assertFalse(conditionProcessor.executeLogicCondition(rule, result, rule.getConditions(), tuples));
result.get(0).clear();
result.get(0).add(c1);
result.get(1).clear();
result.get(1).add(c2);
// test "OR":
logicCondition.setType(LogicConditionType.OR);
assertTrue(conditionProcessor.executeLogicCondition(rule, result, rule.getConditions(), tuples));
c2.setName("name___");
assertFalse(conditionProcessor.executeLogicCondition(rule, result, rule.getConditions(), tuples));
result.get(0).clear();
result.get(0).add(c1);
result.get(1).clear();
result.get(1).add(c2);
// test "XOR":
c1.setId("creator");
logicCondition.setType(LogicConditionType.XOR);
assertTrue(conditionProcessor.executeLogicCondition(rule, result, rule.getConditions(), tuples));
c1.setId("creator");
c2.setId("creator");
c1.setName("name");
c2.setName("name");
result.get(0).clear();
result.get(0).add(c1);
result.get(1).clear();
result.get(1).add(c2);
assertFalse(conditionProcessor.executeLogicCondition(rule, result, rule.getConditions(), tuples));