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
}
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);
}
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);
}
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);
}
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;
}
Aggregations