Search in sources :

Example 66 with TaskType

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

the class TestOrgSync method test550ReconcileOpenDJAfterMembershipChange.

@Test
public void test550ReconcileOpenDJAfterMembershipChange() throws Exception {
    final String TEST_NAME = "test550ReconcileOpenDJAfterMembershipChange";
    TestUtil.displayTestTile(this, TEST_NAME);
    // We manually remove Lemonhead from R_canibalism group
    // And check whether reconciliation re-adds him again
    // GIVEN
    Task task = createTask(TestOrgSync.class.getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();
    assumeAssignmentPolicy(AssignmentPolicyEnforcementType.NONE);
    Collection<String> membersBeforeTest = openDJController.getGroupUniqueMembers(RESP_CANIBALISM_DN);
    System.out.println("group members before test = " + membersBeforeTest);
    assertTrue(RESP_CANIBALISM_DN + " does not contain " + ACCOUNT_LEMONHEAD_DN, membersBeforeTest.contains(ACCOUNT_LEMONHEAD_DN));
    openDJController.removeGroupUniqueMember(RESP_CANIBALISM_DN, ACCOUNT_LEMONHEAD_DN);
    System.out.println("group members after removal = " + openDJController.getGroupUniqueMembers(RESP_CANIBALISM_DN));
    openDJController.assertNoUniqueMember(RESP_CANIBALISM_DN, ACCOUNT_LEMONHEAD_DN);
    // WHEN
    TestUtil.displayWhen(TEST_NAME);
    restartTask(TASK_RECON_OPENDJ_DEFAULT_SINGLE_OID);
    // THEN
    TestUtil.displayThen(TEST_NAME);
    waitForTaskFinish(TASK_RECON_OPENDJ_DEFAULT_SINGLE_OID, false);
    waitForTaskCloseOrSuspend(TASK_RECON_OPENDJ_DEFAULT_SINGLE_OID);
    // THEN
    TestUtil.displayThen(TEST_NAME);
    // Task result
    PrismObject<TaskType> reconTaskAfter = getTask(TASK_RECON_OPENDJ_DEFAULT_SINGLE_OID);
    OperationResultType reconTaskResult = reconTaskAfter.asObjectable().getResult();
    display("Recon task result", reconTaskResult);
    TestUtil.assertSuccess(reconTaskResult);
    Collection<String> membersAfterTest = openDJController.getGroupUniqueMembers(RESP_CANIBALISM_DN);
    System.out.println("group members after test = " + membersAfterTest);
    assertTrue(RESP_CANIBALISM_DN + " does not contain " + ACCOUNT_LEMONHEAD_DN, // ...it
    membersAfterTest.contains(ACCOUNT_LEMONHEAD_DN.toLowerCase()));
// seems
// to
// get
// lowercased
// during
// the
// reconciliation
}
Also used : Task(com.evolveum.midpoint.task.api.Task) OperationResultType(com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType) TaskType(com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) Test(org.testng.annotations.Test)

Example 67 with TaskType

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

the class TestOrgSync method test510ReconcileOpenDJLdapGroup.

@Test
public void test510ReconcileOpenDJLdapGroup() throws Exception {
    final String TEST_NAME = "test510ReconcileOpenDJLdapGroup";
    TestUtil.displayTestTile(this, TEST_NAME);
    // GIVEN
    Task task = createTask(TestOrgSync.class.getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();
    assumeAssignmentPolicy(AssignmentPolicyEnforcementType.NONE);
    List<PrismObject<UserType>> users = modelService.searchObjects(UserType.class, null, null, task, result);
    display("Users before recon", users);
    assertUsers(18);
    reconciliationTaskResultListener.clear();
    // WHEN
    TestUtil.displayWhen(TEST_NAME);
    importObjectFromFile(TASK_RECON_OPENDJ_LDAPGROUP_SINGLE_FILE);
    // THEN
    TestUtil.displayThen(TEST_NAME);
    waitForTaskFinish(TASK_RECON_OPENDJ_LDAPGROUP_SINGLE_OID, false);
    waitForTaskCloseOrSuspend(TASK_RECON_OPENDJ_DEFAULT_SINGLE_OID);
    // THEN
    TestUtil.displayThen(TEST_NAME);
    reconciliationTaskResultListener.assertResult(RESOURCE_OPENDJ_OID, 0, 2, 0, 0);
    users = modelService.searchObjects(UserType.class, null, null, task, result);
    display("Users after recon", users);
    assertUsers(18);
    // Task result
    PrismObject<TaskType> reconTaskAfter = getTask(TASK_RECON_OPENDJ_LDAPGROUP_SINGLE_OID);
    OperationResultType reconTaskResult = reconTaskAfter.asObjectable().getResult();
    display("Recon task result", reconTaskResult);
    TestUtil.assertSuccess(reconTaskResult);
}
Also used : PrismObject(com.evolveum.midpoint.prism.PrismObject) Task(com.evolveum.midpoint.task.api.Task) OperationResultType(com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType) TaskType(com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) Test(org.testng.annotations.Test)

Example 68 with TaskType

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

the class TestOrgSync method test502ReconcileOpenDJDefaultAgain.

@Test
public void test502ReconcileOpenDJDefaultAgain() throws Exception {
    final String TEST_NAME = "test502ReconcileOpenDJDefaultAgain";
    TestUtil.displayTestTile(this, TEST_NAME);
    // GIVEN
    Task task = createTask(TestOrgSync.class.getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();
    assumeAssignmentPolicy(AssignmentPolicyEnforcementType.NONE);
    assertUsers(18);
    reconciliationTaskResultListener.clear();
    // WHEN
    TestUtil.displayWhen(TEST_NAME);
    restartTask(TASK_RECON_OPENDJ_DEFAULT_SINGLE_OID);
    // THEN
    TestUtil.displayThen(TEST_NAME);
    waitForTaskFinish(TASK_RECON_OPENDJ_DEFAULT_SINGLE_OID, false);
    waitForTaskCloseOrSuspend(TASK_RECON_OPENDJ_DEFAULT_SINGLE_OID);
    // THEN
    TestUtil.displayThen(TEST_NAME);
    reconciliationTaskResultListener.assertResult(RESOURCE_OPENDJ_OID, 0, 17, 0, 0);
    assertUsers(18);
    // Task result
    PrismObject<TaskType> reconTaskAfter = getTask(TASK_RECON_OPENDJ_DEFAULT_SINGLE_OID);
    OperationResultType reconTaskResult = reconTaskAfter.asObjectable().getResult();
    display("Recon task result", reconTaskResult);
    TestUtil.assertSuccess(reconTaskResult);
}
Also used : Task(com.evolveum.midpoint.task.api.Task) OperationResultType(com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType) TaskType(com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) Test(org.testng.annotations.Test)

Example 69 with TaskType

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

the class RTask method copyFromJAXB.

public static void copyFromJAXB(TaskType jaxb, RTask repo, RepositoryContext repositoryContext, IdGeneratorResult generatorResult) throws DtoTranslationException {
    RObject.copyFromJAXB(jaxb, repo, repositoryContext, generatorResult);
    PrismObjectDefinition<TaskType> taskDefinition = jaxb.asPrismObject().getDefinition();
    repo.setName(RPolyString.copyFromJAXB(jaxb.getName()));
    repo.setTaskIdentifier(jaxb.getTaskIdentifier());
    repo.setExecutionStatus(RUtil.getRepoEnumValue(jaxb.getExecutionStatus(), RTaskExecutionStatus.class));
    repo.setHandlerUri(jaxb.getHandlerUri());
    repo.setLastRunFinishTimestamp(jaxb.getLastRunFinishTimestamp());
    repo.setCompletionTimestamp(jaxb.getCompletionTimestamp());
    repo.setLastRunStartTimestamp(jaxb.getLastRunStartTimestamp());
    repo.setNode(jaxb.getNode());
    repo.setBinding(RUtil.getRepoEnumValue(jaxb.getBinding(), RTaskBinding.class));
    repo.setRecurrence(RUtil.getRepoEnumValue(jaxb.getRecurrence(), RTaskRecurrence.class));
    repo.setCanRunOnNode(jaxb.getCanRunOnNode());
    repo.setThreadStopAction(RUtil.getRepoEnumValue(jaxb.getThreadStopAction(), RThreadStopAction.class));
    repo.setCategory(jaxb.getCategory());
    repo.setParent(jaxb.getParent());
    repo.setObjectRef(RUtil.jaxbRefToEmbeddedRepoRef(jaxb.getObjectRef(), repositoryContext.prismContext));
    repo.setOwnerRefTask(RUtil.jaxbRefToEmbeddedRepoRef(jaxb.getOwnerRef(), repositoryContext.prismContext));
    repo.setWaitingReason(RUtil.getRepoEnumValue(jaxb.getWaitingReason(), RTaskWaitingReason.class));
    repo.setDependent(RUtil.listToSet(jaxb.getDependent()));
    WfContextType wfc = jaxb.getWorkflowContext();
    if (wfc != null) {
        repo.setWfProcessInstanceId(wfc.getProcessInstanceId());
        repo.setWfRequesterRef(RUtil.jaxbRefToEmbeddedRepoRef(wfc.getRequesterRef(), repositoryContext.prismContext));
        repo.setWfObjectRef(RUtil.jaxbRefToEmbeddedRepoRef(wfc.getObjectRef(), repositoryContext.prismContext));
        repo.setWfTargetRef(RUtil.jaxbRefToEmbeddedRepoRef(wfc.getTargetRef(), repositoryContext.prismContext));
        repo.setWfStartTimestamp(wfc.getStartTimestamp());
        repo.setWfEndTimestamp(wfc.getEndTimestamp());
    }
    RUtil.copyResultFromJAXB(taskDefinition, jaxb.F_RESULT, jaxb.getResult(), repo, repositoryContext.prismContext);
}
Also used : TaskType(com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType) WfContextType(com.evolveum.midpoint.xml.ns._public.common.common_3.WfContextType)

Example 70 with TaskType

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

the class RTask method toJAXB.

@Override
public TaskType toJAXB(PrismContext prismContext, Collection<SelectorOptions<GetOperationOptions>> options) throws DtoTranslationException {
    TaskType object = new TaskType();
    RUtil.revive(object, prismContext);
    RTask.copyToJAXB(this, object, prismContext, options);
    return object;
}
Also used : TaskType(com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType)

Aggregations

TaskType (com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType)88 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)63 Test (org.testng.annotations.Test)50 Task (com.evolveum.midpoint.task.api.Task)47 PrismObject (com.evolveum.midpoint.prism.PrismObject)30 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)25 OperationResultType (com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType)23 AbstractModelIntegrationTest (com.evolveum.midpoint.model.test.AbstractModelIntegrationTest)19 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)18 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)17 PrismAsserts.assertEqualsPolyString (com.evolveum.midpoint.prism.util.PrismAsserts.assertEqualsPolyString)16 AbstractInitializedModelIntegrationTest (com.evolveum.midpoint.model.intest.AbstractInitializedModelIntegrationTest)15 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)15 ArrayList (java.util.ArrayList)14 QName (javax.xml.namespace.QName)13 ObjectReferenceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType)11 ObjectDeltaType (com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType)10 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)8 Checker (com.evolveum.midpoint.test.Checker)8 ObjectChecker (com.evolveum.midpoint.test.ObjectChecker)8