userTO = createUser(userTO);
assertNotNull(userTO);
assertEquals("createApproval", userTO.getStatus());
// 2. try to authenticate: fail
EntitlementService myEntitlementService =
setupCredentials(entitlementService, EntitlementService.class, userTO.getUsername(), "password123");
try {
myEntitlementService.getMyEntitlements();
fail();
} catch (AccessControlException e) {
assertNotNull(e);
}
// 3. approve user
super.resetRestTemplate();
WorkflowFormTO form = userWorkflowService.getFormForUser(userTO.getId());
form = userWorkflowService.claimForm(form.getTaskId());
Map<String, WorkflowFormPropertyTO> props = form.getPropertyMap();
props.get("approve").setValue(Boolean.TRUE.toString());
form.setProperties(props.values());
userTO = userWorkflowService.submitForm(form);
assertNotNull(userTO);
assertEquals("active", userTO.getStatus());
// 4. try to authenticate again: success
myEntitlementService =
setupCredentials(entitlementService, EntitlementService.class, userTO.getUsername(), "password123");
assertNotNull(myEntitlementService.getMyEntitlements());
super.resetRestTemplate();
}