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));
result.get(0).clear();
result.get(0).add(c1);
result.get(1).clear();
result.get(1).add(c2);
// test "NOT":
c1.setId("creator__");
logicCondition.setType(LogicConditionType.NOT);
logicCondition.getBaseConditions().remove(baseCondition2);
assertEquals(2, result.size());
assertTrue(conditionProcessor.executeLogicCondition(rule, result, rule.getConditions(), tuples));
result.get(0).clear();
result.get(0).add(c1);
result.get(1).clear();