use of com.evolveum.midpoint.model.api.ModelExecuteOptions in project midpoint by Evolveum.
the class TestTracing method test200ClassLessValues.
/**
* Tests class-less PCVs.
*/
@Test
public void test200ClassLessValues() throws Exception {
given();
Task task = getTestTask();
OperationResult result = getTestOperationResult();
deleteReportDataObjects(result);
when();
ModelExecuteOptions options = executeOptions();
options.tracingProfile(createModelAndProvisioningLoggingTracingProfile());
ObjectDelta<UserType> delta = deltaFor(UserType.class).item(UserType.F_ASSIGNMENT).add(new AssignmentType(prismContext).targetRef(ROLE_CLASS_LESS_VALUES.oid, RoleType.COMPLEX_TYPE)).asObjectDelta(USER_JIM.oid);
executeChanges(delta, options, task, result);
then();
assertSuccess(result);
assertUserAfter(USER_JIM.oid).assignments().assertAssignments(1).end().extensionContainer(NAME_MY_CONTAINER).assertSize(1).value(0).assertItemsExactly(NAME_VALUE, NAME_EMBEDDED);
assertTraceCanBeParsed(result);
}
use of com.evolveum.midpoint.model.api.ModelExecuteOptions in project midpoint by Evolveum.
the class TestMapping method test262ModifyUserLocalityRecon.
/**
* MID-3661, MID-3674
*/
@Test
public void test262ModifyUserLocalityRecon() throws Exception {
given();
Task task = getTestTask();
OperationResult result = getTestOperationResult();
getDummyResource(RESOURCE_DUMMY_LIGHT_CRIMSON_NAME).resetBreakMode();
DummyAccount dummyAccountBefore = getDummyAccount(RESOURCE_DUMMY_LIGHT_CRIMSON_NAME, ACCOUNT_GUYBRUSH_DUMMY_USERNAME);
displayDumpable("Dummy account before", dummyAccountBefore);
when();
ObjectDelta<UserType> objectDelta = createModifyUserReplaceDelta(USER_GUYBRUSH_OID, UserType.F_LOCALITY, PrismTestUtil.createPolyString(LOCALITY_SCABB_ISLAND));
Collection<ObjectDelta<? extends ObjectType>> deltas = MiscSchemaUtil.createCollection(objectDelta);
ModelExecuteOptions options = executeOptions().reconcile();
modelService.executeChanges(deltas, options, task, result);
then();
assertSuccess(result);
PrismObject<UserType> userAfter = getUser(USER_GUYBRUSH_OID);
display("User after", userAfter);
assertUser(userAfter, USER_GUYBRUSH_OID, USER_GUYBRUSH_USERNAME, USER_GUYBRUSH_FULL_NAME, USER_GUYBRUSH_GIVEN_NAME, USER_GUYBRUSH_FAMILY_NAME);
String accountOid = getSingleLinkOid(userAfter);
PrismObject<ShadowType> repoShadow = repositoryService.getObject(ShadowType.class, accountOid, null, result);
display("Repo shadow after", repoShadow);
assertNoPostponedOperation(repoShadow);
// Check account in dummy resource
DummyAccount dummyAccountAfter = assertDummyAccount(RESOURCE_DUMMY_LIGHT_CRIMSON_NAME, ACCOUNT_GUYBRUSH_DUMMY_USERNAME, ACCOUNT_GUYBRUSH_DUMMY_FULLNAME, true);
displayDumpable("Dummy account after", dummyAccountAfter);
assertDummyAccountAttribute(RESOURCE_DUMMY_LIGHT_CRIMSON_NAME, ACCOUNT_GUYBRUSH_DUMMY_USERNAME, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_LOCATION_NAME, LOCALITY_SCABB_ISLAND);
assertDummyAccountAttribute(RESOURCE_DUMMY_LIGHT_CRIMSON_NAME, ACCOUNT_GUYBRUSH_DUMMY_USERNAME, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_DRINK_NAME, DRINK_GIN, DRINK_MEZCAL, rumFrom(LOCALITY_SCABB_ISLAND));
}
use of com.evolveum.midpoint.model.api.ModelExecuteOptions in project midpoint by Evolveum.
the class TestMapping method test212ModifyUserLocalityRecon.
/**
* MID-3661
*/
@Test
public void test212ModifyUserLocalityRecon() throws Exception {
given();
Task task = getTestTask();
OperationResult result = getTestOperationResult();
getDummyResource(RESOURCE_DUMMY_CRIMSON_NAME).resetBreakMode();
DummyAccount dummyAccountBefore = getDummyAccount(RESOURCE_DUMMY_CRIMSON_NAME, ACCOUNT_GUYBRUSH_DUMMY_USERNAME);
displayDumpable("Dummy account before", dummyAccountBefore);
when();
ObjectDelta<UserType> objectDelta = createModifyUserReplaceDelta(USER_GUYBRUSH_OID, UserType.F_LOCALITY, PrismTestUtil.createPolyString(LOCALITY_SCABB_ISLAND));
Collection<ObjectDelta<? extends ObjectType>> deltas = MiscSchemaUtil.createCollection(objectDelta);
ModelExecuteOptions options = executeOptions().reconcile();
modelService.executeChanges(deltas, options, task, result);
then();
assertSuccess(result);
PrismObject<UserType> userAfter = getUser(USER_GUYBRUSH_OID);
display("User after", userAfter);
assertUser(userAfter, USER_GUYBRUSH_OID, USER_GUYBRUSH_USERNAME, USER_GUYBRUSH_FULL_NAME, USER_GUYBRUSH_GIVEN_NAME, USER_GUYBRUSH_FAMILY_NAME);
String accountOid = getSingleLinkOid(userAfter);
PrismObject<ShadowType> repoShadow = repositoryService.getObject(ShadowType.class, accountOid, null, result);
display("Repo shadow after", repoShadow);
assertNoPostponedOperation(repoShadow);
// Check account in dummy resource
DummyAccount dummyAccountAfter = assertDummyAccount(RESOURCE_DUMMY_CRIMSON_NAME, ACCOUNT_GUYBRUSH_DUMMY_USERNAME, ACCOUNT_GUYBRUSH_DUMMY_FULLNAME, true);
displayDumpable("Dummy account after", dummyAccountAfter);
assertDummyAccountAttribute(RESOURCE_DUMMY_CRIMSON_NAME, ACCOUNT_GUYBRUSH_DUMMY_USERNAME, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_LOCATION_NAME, LOCALITY_SCABB_ISLAND);
assertDummyAccountAttribute(RESOURCE_DUMMY_CRIMSON_NAME, ACCOUNT_GUYBRUSH_DUMMY_USERNAME, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_DRINK_NAME, DRINK_VODKA, DRINK_WHISKY, "rum from Scabb Island");
}
use of com.evolveum.midpoint.model.api.ModelExecuteOptions in project midpoint by Evolveum.
the class TestMiscellaneous method test110RequestPrunedRole.
@Test
public void test110RequestPrunedRole() throws Exception {
login(userAdministrator);
Task task = getTestTask();
OperationResult result = getTestOperationResult();
given();
ModelExecuteOptions options = executeOptions().partialProcessing(new PartialProcessingOptionsType().approvals(PartialProcessingTypeType.SKIP));
assignRole(userJackOid, ROLE_GOLD.oid, options, task, result);
assertAssignedRole(getUser(userJackOid), ROLE_GOLD.oid);
when();
assignRole(userJackOid, ROLE_SILVER.oid, task, result);
then();
result.computeStatus();
TestUtil.assertInProgress("Operation NOT in progress", result);
assertNotAssignedRole(userJackOid, ROLE_SILVER.oid, result);
// complete the work item related to assigning role silver
CaseWorkItemType workItem = getWorkItem(task, result);
display("Work item", workItem);
caseManager.completeWorkItem(WorkItemId.of(workItem), ApprovalUtils.createApproveOutput(prismContext), null, task, result);
CaseType aCase = CaseWorkItemUtil.getCaseRequired(workItem);
CaseType rootCase = getCase(aCase.getParentRef().getOid());
waitForCaseClose(rootCase);
// should be pruned without approval
assertNotAssignedRole(userJackOid, ROLE_GOLD.oid, result);
}
use of com.evolveum.midpoint.model.api.ModelExecuteOptions in project midpoint by Evolveum.
the class TestPreview method test100PurePreview.
/**
* Use pure "previewChanges" and check the approval schema execution information.
*/
@Test
public void test100PurePreview() throws Exception {
given();
login(userAdministrator);
Task task = getTestTask();
OperationResult result = getTestOperationResult();
ModelExecuteOptions options = executeOptions();
options.getOrCreatePartialProcessing().setApprovals(PartialProcessingTypeType.PROCESS);
when();
ModelContext<UserType> modelContext = modelInteractionService.previewChanges(getAssignmentDeltas(), options, task, result);
then();
ApprovalSchemaExecutionInformationType execInfo = getSingleExecutionInformation(modelContext);
displayExecutionInformation(execInfo);
// Everything is "in the future", so we have to obtain approvers information from the execInfo.stage list
assertThat(getFutureStageApprovers(execInfo, 1)).as("stage 1 approvers").containsExactlyInAnyOrder(USER_JANE.oid);
assertThat(getFutureStageApprovers(execInfo, 2)).as("stage 2 approvers").containsExactlyInAnyOrder(USER_MARTIN.oid);
assertThat(getFutureStageApprovers(execInfo, 3)).as("stage 3 approvers").containsExactlyInAnyOrder(USER_PETER.oid, USER_KATE.oid);
}
Aggregations