use of com.evolveum.midpoint.repo.common.expression.ObjectDeltaObject in project midpoint by Evolveum.
the class TestAbstractAssignmentEvaluator method test142RoleVisitorDisabledAssignment.
@Test
public void test142RoleVisitorDisabledAssignment() throws Exception {
final String TEST_NAME = "test142RoleVisitorDisabledAssignment";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(TestAssignmentEvaluator.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
AssignmentEvaluator<UserType> assignmentEvaluator = createAssignmentEvaluator();
PrismAsserts.assertParentConsistency(userTypeJack.asPrismObject());
AssignmentType assignmentType = getAssignmentType(ASSIGNMENT_ROLE_VISITOR_FILE);
assignmentType.setActivation(ActivationUtil.createDisabled());
ObjectDeltaObject<UserType> userOdo = new ObjectDeltaObject<>(userTypeJack.asPrismObject(), null, null);
userOdo.recompute();
ItemDeltaItem<PrismContainerValue<AssignmentType>, PrismContainerDefinition<AssignmentType>> assignmentIdi = new ItemDeltaItem<>();
assignmentIdi.setItemOld(LensUtil.createAssignmentSingleValueContainerClone(assignmentType));
assignmentIdi.recompute();
// WHEN
TestUtil.displayWhen(TEST_NAME);
EvaluatedAssignmentImpl<UserType> evaluatedAssignment = assignmentEvaluator.evaluate(assignmentIdi, PlusMinusZero.ZERO, false, userTypeJack, TEST_NAME, task, result);
evaluatedAssignment.evaluateConstructions(userOdo, task, result);
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertSuccess(result);
assertNotNull(evaluatedAssignment);
display("Evaluated assignment", evaluatedAssignment.debugDump());
assertEquals(1, evaluatedAssignment.getConstructionTriple().size());
PrismAsserts.assertParentConsistency(userTypeJack.asPrismObject());
assertConstruction(evaluatedAssignment, ZERO, "title", ZERO);
assertConstruction(evaluatedAssignment, ZERO, "title", PLUS);
assertConstruction(evaluatedAssignment, ZERO, "title", MINUS);
assertNoConstruction(evaluatedAssignment, PLUS, "title");
assertNoConstruction(evaluatedAssignment, MINUS, "title");
assertConstruction(evaluatedAssignment, ZERO, "location", ZERO, "Caribbean");
assertConstruction(evaluatedAssignment, ZERO, "location", PLUS);
assertConstruction(evaluatedAssignment, ZERO, "location", MINUS);
assertNoConstruction(evaluatedAssignment, PLUS, "location");
assertNoConstruction(evaluatedAssignment, MINUS, "location");
assertEquals("Wrong number of admin GUI configs", 0, evaluatedAssignment.getAdminGuiConfigurations().size());
}
Aggregations