assertEquals(1, userTO.getMemberships().size());
assertEquals(9, userTO.getMemberships().get(0).getRoleId());
assertEquals("createApproval", userTO.getStatus());
// 2. request if there is any pending task for user just created
WorkflowFormTO form = userWorkflowService.getFormForUser(userTO.getId());
assertNotNull(form);
assertNotNull(form.getUserId());
assertEquals(userTO.getId(), form.getUserId());
assertNotNull(form.getTaskId());
assertNull(form.getOwner());
// 3. claim task from rossini, not in role 7 (designated for approval in workflow definition): fail
UserWorkflowService userService2 =
setupCredentials(userWorkflowService, UserWorkflowService.class, "rossini", ADMIN_PWD);
try {
userService2.claimForm(form.getTaskId());
fail();
} catch (SyncopeClientCompositeErrorException scce) {
assertNotNull(scce.getException(SyncopeClientExceptionType.Workflow));
}
// 4. claim task from bellini, in role 7
UserWorkflowService userService3 =
setupCredentials(userWorkflowService, UserWorkflowService.class, "bellini", ADMIN_PWD);
form = userService3.claimForm(form.getTaskId());
assertNotNull(form);
assertNotNull(form.getTaskId());
assertNotNull(form.getOwner());
// 5. reject user
Map<String, WorkflowFormPropertyTO> props = form.getPropertyMap();
props.get("approve").setValue(Boolean.FALSE.toString());
props.get("rejectReason").setValue("I don't like him.");
form.setProperties(props.values());
userTO = userService3.submitForm(form);
assertNotNull(userTO);
assertEquals("rejected", userTO.getStatus());
// 6. check that rejected user was not propagated to external resource (SYNCOPE-364)