Search in sources :

Example 96 with FocusType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.FocusType in project midpoint by Evolveum.

the class ProjectionCredentialsProcessor method processProjectionCredentialsFocus.

public <F extends FocusType> void processProjectionCredentialsFocus(LensContext<F> context, LensProjectionContext projectionContext, XMLGregorianCalendar now, Task task, OperationResult result) throws ExpressionEvaluationException, ObjectNotFoundException, SchemaException, PolicyViolationException, CommunicationException, ConfigurationException, SecurityViolationException {
    ValuePolicyType passwordPolicy = determinePasswordPolicy(context, projectionContext, now, task, result);
    processProjectionPasswordMapping(context, projectionContext, passwordPolicy, now, task, result);
    validateProjectionPassword(context, projectionContext, passwordPolicy, now, task, result);
    applyMetadata(context, projectionContext, now, task, result);
}
Also used : ValuePolicyType(com.evolveum.midpoint.xml.ns._public.common.common_3.ValuePolicyType)

Example 97 with FocusType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.FocusType in project midpoint by Evolveum.

the class TestReconScript method test003testReconcileScriptsAddUserAction.

@Test
public void test003testReconcileScriptsAddUserAction() throws Exception {
    final String TEST_NAME = "test003testReconcileScriptsAddUserAction";
    TestUtil.displayTestTile(this, TEST_NAME);
    Task task = taskManager.createTaskInstance(TEST_NAME);
    OperationResult parentResult = new OperationResult(TEST_NAME);
    ShadowType shadow = parseObjectType(new File(ACCOUNT_BEFORE_SCRIPT_FILENAME), ShadowType.class);
    provisioningService.addObject(shadow.asPrismObject(), null, null, task, parentResult);
    getDummyResource().getScriptHistory().clear();
    waitForTaskStart(TASK_RECON_DUMMY_OID, false, DEFAULT_TASK_WAIT_TIMEOUT);
    waitForTaskNextRunAssertSuccess(TASK_RECON_DUMMY_OID, false, DEFAULT_TASK_WAIT_TIMEOUT);
    waitForTaskFinish(TASK_RECON_DUMMY_OID, true);
    PrismObject<ShadowType> afterRecon = repositoryService.getObject(ShadowType.class, ACCOUNT_BEFORE_SCRIPT_OID, null, parentResult);
    AssertJUnit.assertNotNull(afterRecon);
    ShadowType afterReconShadow = afterRecon.asObjectable();
    if (afterReconShadow.getResult() != null) {
        OperationResult beforeScriptResult = OperationResult.createOperationResult(afterReconShadow.getResult());
        display("result in shadow: " + beforeScriptResult);
        AssertJUnit.fail("Operation in shadow not null, recocniliation failed. ");
    }
    PrismObject<FocusType> user = repositoryService.searchShadowOwner(ACCOUNT_BEFORE_SCRIPT_OID, null, parentResult);
    AssertJUnit.assertNotNull("Owner for account " + shadow.asPrismObject() + " not found. Some probelm in recon occured.", user);
    for (ScriptHistoryEntry script : getDummyResource().getScriptHistory()) {
        String userName = (String) script.getParams().get("midpoint_usercn");
        String idPath = (String) script.getParams().get("midpoint_idpath");
        String tempPath = (String) script.getParams().get("midpoint_temppath");
        LOGGER.trace("userName {} idPath {} tempPath {}", new Object[] { userName, idPath, tempPath });
        if (!idPath.contains(userName)) {
            AssertJUnit.fail("Expected that idPath will contain userName [idPath: " + idPath + ", userName " + userName + "]");
        }
        if (!tempPath.contains(userName)) {
            AssertJUnit.fail("Expected that tempPath will contain userName [idPath: " + idPath + ", userName " + userName + "]");
        }
    }
}
Also used : Task(com.evolveum.midpoint.task.api.Task) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) FocusType(com.evolveum.midpoint.xml.ns._public.common.common_3.FocusType) ScriptHistoryEntry(com.evolveum.icf.dummy.resource.ScriptHistoryEntry) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) File(java.io.File) Test(org.testng.annotations.Test) AbstractInternalModelIntegrationTest(com.evolveum.midpoint.model.impl.AbstractInternalModelIntegrationTest)

Example 98 with FocusType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.FocusType in project midpoint by Evolveum.

the class TestReconScript method test005TestDryRunDelete.

@Test
public void test005TestDryRunDelete() throws Exception {
    final String TEST_NAME = "test005TestDryRunDelete";
    TestUtil.displayTestTile(this, TEST_NAME);
    PrismObject<TaskType> task = getTask(TASK_RECON_DUMMY_OID);
    OperationResult parentResult = new OperationResult(TEST_NAME);
    PropertyDelta dryRunDelta = PropertyDelta.createModificationReplaceProperty(new ItemPath(TaskType.F_EXTENSION, SchemaConstants.MODEL_EXTENSION_DRY_RUN), task.getDefinition(), true);
    Collection<PropertyDelta> modifications = new ArrayList<>();
    modifications.add(dryRunDelta);
    repositoryService.modifyObject(TaskType.class, TASK_RECON_DUMMY_OID, modifications, parentResult);
    getDummyResource().deleteAccountByName("beforeScript");
    waitForTaskStart(TASK_RECON_DUMMY_OID, false);
    waitForTaskNextRunAssertSuccess(TASK_RECON_DUMMY_OID, false);
    waitForTaskFinish(TASK_RECON_DUMMY_OID, false);
    PrismObject<ShadowType> shadow = repositoryService.getObject(ShadowType.class, ACCOUNT_BEFORE_SCRIPT_OID, null, parentResult);
    AssertJUnit.assertNotNull(shadow);
    PrismObject<FocusType> user = repositoryService.searchShadowOwner(ACCOUNT_BEFORE_SCRIPT_OID, null, parentResult);
    AssertJUnit.assertNotNull("Owner for account " + shadow + " not found. Some probelm in dry run occured.", user);
}
Also used : ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) TaskType(com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType) FocusType(com.evolveum.midpoint.xml.ns._public.common.common_3.FocusType) ArrayList(java.util.ArrayList) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) PropertyDelta(com.evolveum.midpoint.prism.delta.PropertyDelta) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) ItemPath(com.evolveum.midpoint.prism.path.ItemPath) Test(org.testng.annotations.Test) AbstractInternalModelIntegrationTest(com.evolveum.midpoint.model.impl.AbstractInternalModelIntegrationTest)

Aggregations

ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)27 ObjectReferenceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType)25 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)23 FocusType (com.evolveum.midpoint.xml.ns._public.common.common_3.FocusType)22 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)21 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)18 PrismObject (com.evolveum.midpoint.prism.PrismObject)16 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)15 ArrayList (java.util.ArrayList)15 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)14 AssignmentType (com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType)12 ItemDelta (com.evolveum.midpoint.prism.delta.ItemDelta)10 ExpressionEvaluationException (com.evolveum.midpoint.util.exception.ExpressionEvaluationException)9 LensProjectionContext (com.evolveum.midpoint.model.impl.lens.LensProjectionContext)8 XMLGregorianCalendar (javax.xml.datatype.XMLGregorianCalendar)8 QName (javax.xml.namespace.QName)8 PropertyDelta (com.evolveum.midpoint.prism.delta.PropertyDelta)7 ConfigurationException (com.evolveum.midpoint.util.exception.ConfigurationException)7 PolicyViolationException (com.evolveum.midpoint.util.exception.PolicyViolationException)7 ActivationStatusType (com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationStatusType)7