use of com.evolveum.midpoint.model.impl.lens.construction.PersonaConstruction in project midpoint by Evolveum.
the class AbstractTestProjectorPersona method test100AssignRolePersonaAdminToJack.
@Test
public void test100AssignRolePersonaAdminToJack() throws Exception {
// GIVEN
Task task = getTestTask();
OperationResult result = task.getResult();
assumeAssignmentPolicy(AssignmentPolicyEnforcementType.FULL);
LensContext<UserType> context = createUserLensContext();
fillContextWithUser(context, USER_JACK_OID, result);
ObjectDelta<UserType> focusDelta = createAssignmentAssignmentHolderDelta(UserType.class, USER_JACK_OID, getPersonaRoleOid(), RoleType.COMPLEX_TYPE, null, null, null, true);
addFocusDeltaToContext(context, focusDelta);
displayDumpable("Input context", context);
assertFocusModificationSanity(context);
rememberCounter(InternalCounters.SHADOW_FETCH_OPERATION_COUNT);
// WHEN
projector.project(context, "test", task, result);
// THEN
displayDumpable("Output context", context);
assertCounterIncrement(InternalCounters.SHADOW_FETCH_OPERATION_COUNT, 0);
assertSame(context.getFocusContext().getPrimaryDelta().getChangeType(), ChangeType.MODIFY);
assertSideEffectiveDeltasOnly(context.getFocusContext().getSecondaryDelta(), "user secondary delta", ActivationStatusType.ENABLED);
assertTrue("Unexpected projection changes", context.getProjectionContexts().isEmpty());
DeltaSetTriple<EvaluatedAssignmentImpl<?>> evaluatedAssignmentTriple = context.getEvaluatedAssignmentTriple();
assertNotNull("No evaluatedAssignmentTriple", evaluatedAssignmentTriple);
assertTrue("Unexpected evaluatedAssignmentTriple zero set", evaluatedAssignmentTriple.getZeroSet().isEmpty());
assertTrue("Unexpected evaluatedAssignmentTriple minus set", evaluatedAssignmentTriple.getMinusSet().isEmpty());
assertNotNull("No evaluatedAssignmentTriple plus set", evaluatedAssignmentTriple.getPlusSet());
assertEquals("Wrong size of evaluatedAssignmentTriple plus set", 1, evaluatedAssignmentTriple.getPlusSet().size());
EvaluatedAssignmentImpl<UserType> evaluatedAssignment = (EvaluatedAssignmentImpl<UserType>) evaluatedAssignmentTriple.getPlusSet().iterator().next();
displayDumpable("evaluatedAssignment", evaluatedAssignment);
assertNotNull("No evaluatedAssignment", evaluatedAssignment);
DeltaSetTriple<PersonaConstruction<UserType>> personaConstructionTriple = evaluatedAssignment.getPersonaConstructionTriple();
displayDumpable("personaConstructionTriple", personaConstructionTriple);
assertNotNull("No personaConstructionTriple", personaConstructionTriple);
assertFalse("Empty personaConstructionTriple", personaConstructionTriple.isEmpty());
assertTrue("Unexpected personaConstructionTriple plus set", personaConstructionTriple.getPlusSet().isEmpty());
assertTrue("Unexpected personaConstructionTriple minus set", personaConstructionTriple.getMinusSet().isEmpty());
assertNotNull("No personaConstructionTriple zero set", personaConstructionTriple.getZeroSet());
assertEquals("Wrong size of personaConstructionTriple zero set", 1, personaConstructionTriple.getZeroSet().size());
PersonaConstruction<UserType> personaConstruction = personaConstructionTriple.getZeroSet().iterator().next();
assertNotNull("No personaConstruction", personaConstruction);
PersonaConstructionType personaConstructionType = personaConstruction.getConstructionBean();
assertNotNull("No personaConstructionType", personaConstructionType);
assertTrue("Wrong type: " + personaConstructionType.getTargetType(), QNameUtil.match(UserType.COMPLEX_TYPE, personaConstructionType.getTargetType()));
assertPersonaSubtypeOrArchetype(personaConstructionType);
}
Aggregations