use of com.evolveum.midpoint.wf.impl.ExpectedTask in project midpoint by Evolveum.
the class TestObjectLifecycleAdvanced method test045ActivateCompleteRole.
@Test
public void test045ActivateCompleteRole() throws Exception {
login(userAdministrator);
ObjectDelta<RoleType> activateRoleDelta = prismContext.deltaFor(RoleType.class).item(RoleType.F_LIFECYCLE_STATE).replace(SchemaConstants.LIFECYCLE_ACTIVE).item(RoleType.F_DESCRIPTION).replace("hi").asObjectDelta(roleEmployeeOid);
executeTest(new TestDetails() {
@Override
protected LensContext createModelContext(OperationResult result) throws Exception {
LensContext<RoleType> lensContext = createLensContext(RoleType.class);
addFocusDeltaToContext(lensContext, activateRoleDelta);
return lensContext;
}
@Override
protected void afterFirstClockworkRun(CaseType rootCase, CaseType case0, List<CaseType> subcases, List<CaseWorkItemType> workItems, Task opTask, OperationResult result) throws Exception {
ExpectedTask expectedTask = new ExpectedTask(null, "Matching state: after operation (\"active lifecycleState\")");
ExpectedWorkItem expectedWorkItem = new ExpectedWorkItem(userEmployeeOwnerOid, null, expectedTask);
assertWfContextAfterClockworkRun(rootCase, subcases, workItems, null, Collections.singletonList(expectedTask), Collections.singletonList(expectedWorkItem));
ApprovalContextType wfc = subcases.get(0).getApprovalContext();
assertEquals("Wrong # of attached policy rules entries", 1, wfc.getPolicyRules().getEntry().size());
SchemaAttachedPolicyRuleType attachedRule = wfc.getPolicyRules().getEntry().get(0);
assertEquals(1, attachedRule.getStageMin().intValue());
assertEquals(1, attachedRule.getStageMax().intValue());
assertEquals("Wrong # of attached triggers", 1, attachedRule.getRule().getTrigger().size());
EvaluatedPolicyRuleTriggerType trigger = attachedRule.getRule().getTrigger().get(0);
assertEquals("Wrong constraintKind in trigger", PolicyConstraintKindType.TRANSITION, trigger.getConstraintKind());
CaseWorkItemType workItem = subcases.get(0).getWorkItem().get(0);
assertEquals("Wrong # of additional information", 0, workItem.getAdditionalInformation().size());
}
@Override
protected void afterCase0Finishes(CaseType rootCase, Task opTask, OperationResult result) {
// assertNoObject(employee);
}
@Override
protected void afterRootCaseFinishes(CaseType rootCase, List<CaseType> subcases, Task opTask, OperationResult result) {
// assertObject(employee);
}
@Override
protected boolean executeImmediately() {
return false;
}
@Override
protected Boolean decideOnApproval(CaseWorkItemType caseWorkItem) throws Exception {
login(getUser(userEmployeeOwnerOid));
return true;
}
}, 1);
}
Aggregations