use of org.jbpm.services.api.model.UserTaskInstanceDesc in project jbpm by kiegroup.
the class UserTaskServiceImplTest method testStartAndStop.
@Test
public void testStartAndStop() {
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.stop(taskId, "salaboy");
task = runtimeDataService.getTaskById(taskId);
assertNotNull(task);
assertEquals(Status.Reserved.toString(), task.getStatus());
}
use of org.jbpm.services.api.model.UserTaskInstanceDesc in project jbpm by kiegroup.
the class UserTaskServiceImplTest method testReleaseAndClaim.
@Test
public void testReleaseAndClaim() {
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.release(taskId, "salaboy");
UserTaskInstanceDesc task = runtimeDataService.getTaskById(taskId);
assertNotNull(task);
assertEquals(Status.Ready.toString(), task.getStatus());
userTaskService.claim(taskId, "salaboy");
task = runtimeDataService.getTaskById(taskId);
assertNotNull(task);
assertEquals(Status.Reserved.toString(), task.getStatus());
}
use of org.jbpm.services.api.model.UserTaskInstanceDesc in project jbpm by kiegroup.
the class UserTaskServiceImplTest method testUpdateTask.
@Test
public void testUpdateTask() {
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("Write a Document", task.getDescription());
assertEquals(9, task.getPriority().intValue());
assertNull(task.getDueDate());
((org.jbpm.kie.services.impl.model.UserTaskInstanceDesc) task).setName("updated");
((org.jbpm.kie.services.impl.model.UserTaskInstanceDesc) task).setPriority(5);
((org.jbpm.kie.services.impl.model.UserTaskInstanceDesc) task).setDescription("my description");
((org.jbpm.kie.services.impl.model.UserTaskInstanceDesc) task).setFormName("BasicForm");
((org.jbpm.kie.services.impl.model.UserTaskInstanceDesc) task).setDueDate(new Date());
userTaskService.updateTask(taskId, "salaboy", task, null, null);
task = runtimeDataService.getTaskById(taskId);
assertNotNull(task);
assertEquals(Status.Reserved.toString(), task.getStatus());
assertEquals("updated", task.getName());
assertEquals("my description", task.getDescription());
assertEquals(5, task.getPriority().intValue());
assertNotNull(task.getDueDate());
Task updatedTask = userTaskService.getTask(taskId);
assertEquals("BasicForm", updatedTask.getFormName());
}
use of org.jbpm.services.api.model.UserTaskInstanceDesc in project jbpm by kiegroup.
the class UserTaskServiceImplTest method testDelegate.
@Test
public void testDelegate() {
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.delegate(taskId, "Administrator", "john");
UserTaskInstanceDesc task = runtimeDataService.getTaskById(taskId);
assertNotNull(task);
assertEquals(Status.Reserved.toString(), task.getStatus());
assertEquals("john", task.getActualOwner());
}
use of org.jbpm.services.api.model.UserTaskInstanceDesc in project jbpm by kiegroup.
the class UserTaskServiceImplTest method testStartAndForward.
@Test
public void testStartAndForward() {
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.forward(taskId, "salaboy", "john");
task = runtimeDataService.getTaskById(taskId);
assertNotNull(task);
assertEquals(Status.Ready.toString(), task.getStatus());
assertEquals("", task.getActualOwner());
}
Aggregations