use of org.jbpm.services.api.model.UserTaskInstanceDesc in project jbpm by kiegroup.
the class UserTaskServiceImplTest method testSkip.
@Test
public void testSkip() {
processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "org.jbpm.writedocument");
assertNotNull(processInstanceId);
List<Long> taskIds = runtimeDataService.getTasksByProcessInstanceId(processInstanceId);
assertNotNull(taskIds);
assertEquals(1, taskIds.size());
Long taskId = taskIds.get(0);
userTaskService.skip(taskId, "Administrator");
UserTaskInstanceDesc task = runtimeDataService.getTaskById(taskId);
assertNotNull(task);
assertEquals(Status.Obsolete.toString(), task.getStatus());
}
use of org.jbpm.services.api.model.UserTaskInstanceDesc in project jbpm by kiegroup.
the class UserTaskServiceImplTest method testSetExpirationDate.
@Test
public void testSetExpirationDate() throws Exception {
processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "org.jbpm.writedocument");
assertNotNull(processInstanceId);
List<Long> taskIds = runtimeDataService.getTasksByProcessInstanceId(processInstanceId);
assertNotNull(taskIds);
assertEquals(1, taskIds.size());
Long taskId = taskIds.get(0);
UserTaskInstanceDesc task = runtimeDataService.getTaskById(taskId);
assertNotNull(task);
assertEquals(Status.Reserved.toString(), task.getStatus());
Date origDueDate = task.getDueDate();
assertNull(origDueDate);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
userTaskService.setExpirationDate(taskId, sdf.parse("2013-12-31"));
task = runtimeDataService.getTaskById(taskId);
assertNotNull(task);
assertEquals(Status.Reserved.toString(), task.getStatus());
assertEquals("2013-12-31", sdf.format(task.getDueDate()));
}
use of org.jbpm.services.api.model.UserTaskInstanceDesc in project jbpm by kiegroup.
the class UserTaskServiceImplTest method testStartAndComplete.
@Test
public void testStartAndComplete() {
processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "org.jbpm.writedocument");
assertNotNull(processInstanceId);
List<Long> taskIds = runtimeDataService.getTasksByProcessInstanceId(processInstanceId);
assertNotNull(taskIds);
assertEquals(1, taskIds.size());
Long taskId = taskIds.get(0);
userTaskService.start(taskId, "salaboy");
UserTaskInstanceDesc task = runtimeDataService.getTaskById(taskId);
assertNotNull(task);
assertEquals(Status.InProgress.toString(), task.getStatus());
Map<String, Object> results = new HashMap<String, Object>();
results.put("Result", "some document data");
userTaskService.complete(taskId, "salaboy", results);
task = runtimeDataService.getTaskById(taskId);
assertNotNull(task);
assertEquals(Status.Completed.toString(), task.getStatus());
}
use of org.jbpm.services.api.model.UserTaskInstanceDesc in project jbpm by kiegroup.
the class UserTaskServiceImplTest method testUpdateTaskWithData.
@Test
public void testUpdateTaskWithData() {
processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "org.jbpm.writedocument");
assertNotNull(processInstanceId);
List<Long> taskIds = runtimeDataService.getTasksByProcessInstanceId(processInstanceId);
assertNotNull(taskIds);
assertEquals(1, taskIds.size());
Long taskId = taskIds.get(0);
UserTaskInstanceDesc task = runtimeDataService.getTaskById(taskId);
assertNotNull(task);
assertEquals(Status.Reserved.toString(), task.getStatus());
assertEquals("Write a Document", task.getName());
assertEquals(9, task.getPriority().intValue());
Map<String, Object> inputs = userTaskService.getTaskInputContentByTaskId(taskId);
assertEquals(6, inputs.size());
Map<String, Object> outputs = userTaskService.getTaskOutputContentByTaskId(taskId);
assertEquals(0, outputs.size());
((org.jbpm.kie.services.impl.model.UserTaskInstanceDesc) task).setName("updated");
((org.jbpm.kie.services.impl.model.UserTaskInstanceDesc) task).setPriority(5);
Map<String, Object> updatedInputs = new HashMap<>();
updatedInputs.put("new task input", "test");
Map<String, Object> updatedOutputs = new HashMap<>();
updatedOutputs.put("new task output", "reviewed");
userTaskService.updateTask(taskId, "salaboy", task, updatedInputs, updatedOutputs);
task = runtimeDataService.getTaskById(taskId);
assertNotNull(task);
assertEquals(Status.Reserved.toString(), task.getStatus());
assertEquals("updated", task.getName());
assertEquals(5, task.getPriority().intValue());
inputs = userTaskService.getTaskInputContentByTaskId(taskId);
assertEquals("test", inputs.get("new task input"));
outputs = userTaskService.getTaskOutputContentByTaskId(taskId);
assertEquals("reviewed", outputs.get("new task output"));
}
use of org.jbpm.services.api.model.UserTaskInstanceDesc in project jbpm by kiegroup.
the class UserTaskServiceImplTest method testStartAndFail.
@Test
public void testStartAndFail() {
processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "org.jbpm.writedocument");
assertNotNull(processInstanceId);
List<Long> taskIds = runtimeDataService.getTasksByProcessInstanceId(processInstanceId);
assertNotNull(taskIds);
assertEquals(1, taskIds.size());
Long taskId = taskIds.get(0);
userTaskService.start(taskId, "salaboy");
UserTaskInstanceDesc task = runtimeDataService.getTaskById(taskId);
assertNotNull(task);
assertEquals(Status.InProgress.toString(), task.getStatus());
userTaskService.fail(taskId, "Administrator", new HashMap<String, Object>());
task = runtimeDataService.getTaskById(taskId);
assertNotNull(task);
assertEquals(Status.Failed.toString(), task.getStatus());
}
Aggregations