// 2. request if there is any pending form for user just created
forms = userWorkflowService.getForms();
assertEquals(preForms + 1, forms.size());
WorkflowFormTO form = userWorkflowService.getFormForUser(userTO.getId());
assertNotNull(form);
// 3. first claim ny bellini ....
UserWorkflowService userService3 = clientFactory.create(
"bellini", ADMIN_PWD).getService(UserWorkflowService.class);
form = userService3.claimForm(form.getTaskId());
assertNotNull(form);
assertNotNull(form.getTaskId());
assertNotNull(form.getOwner());
// 4. second claim task by admin
form = userWorkflowService.claimForm(form.getTaskId());
assertNotNull(form);
// 5. approve user
final Map<String, WorkflowFormPropertyTO> props = form.getPropertyMap();
props.get("approve").setValue(Boolean.TRUE.toString());
form.setProperties(props.values());
// 6. submit approve
userTO = userWorkflowService.submitForm(form);
assertNotNull(userTO);
assertEquals(preForms, userWorkflowService.getForms().size());
assertNull(userWorkflowService.getFormForUser(userTO.getId()));
// 7. search approval into the history as well
forms = userWorkflowService.getFormsByName(userTO.getId(), "Create approval");
assertFalse(forms.isEmpty());
int count = 0;
for (WorkflowFormTO hform : forms) {
if (form.getTaskId().equals(hform.getTaskId())) {
count++;
assertEquals("createApproval", hform.getKey());
assertNotNull(hform.getCreateTime());
assertNotNull(hform.getDueDate());