Search in sources :

Example 16 with ObjectDeltaObject

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());
}
Also used : Task(com.evolveum.midpoint.task.api.Task) PrismContainerValue(com.evolveum.midpoint.prism.PrismContainerValue) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ObjectDeltaObject(com.evolveum.midpoint.repo.common.expression.ObjectDeltaObject) ItemDeltaItem(com.evolveum.midpoint.repo.common.expression.ItemDeltaItem) AssignmentType(com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType) PrismContainerDefinition(com.evolveum.midpoint.prism.PrismContainerDefinition) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) Test(org.testng.annotations.Test)

Aggregations

ObjectDeltaObject (com.evolveum.midpoint.repo.common.expression.ObjectDeltaObject)16 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)15 ItemDeltaItem (com.evolveum.midpoint.repo.common.expression.ItemDeltaItem)14 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)14 PrismContainerDefinition (com.evolveum.midpoint.prism.PrismContainerDefinition)13 PrismContainerValue (com.evolveum.midpoint.prism.PrismContainerValue)13 Task (com.evolveum.midpoint.task.api.Task)13 AssignmentType (com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType)13 Test (org.testng.annotations.Test)13 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)5 ItemDefinition (com.evolveum.midpoint.prism.ItemDefinition)3 PrismPropertyDefinition (com.evolveum.midpoint.prism.PrismPropertyDefinition)3 PrismPropertyValue (com.evolveum.midpoint.prism.PrismPropertyValue)3 ObjectDelta (com.evolveum.midpoint.prism.delta.ObjectDelta)3 StringPolicyResolver (com.evolveum.midpoint.repo.common.expression.StringPolicyResolver)3 RoleType (com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType)3 Mapping (com.evolveum.midpoint.model.common.mapping.Mapping)2 IdItemPathSegment (com.evolveum.midpoint.prism.path.IdItemPathSegment)2 NameItemPathSegment (com.evolveum.midpoint.prism.path.NameItemPathSegment)2 GenerateExpressionEvaluatorType (com.evolveum.midpoint.xml.ns._public.common.common_3.GenerateExpressionEvaluatorType)2