use of pro.taskana.TaskService in project taskana by Taskana.
the class WorkOnTaskAccTest method testClaimTask.
@WithAccessId(userName = "user_1_2", groupNames = { "group_1" })
@Test
public void testClaimTask() throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException, InvalidStateException, InvalidOwnerException {
TaskService taskService = taskanaEngine.getTaskService();
Task task = taskService.getTask("TKI:000000000000000000000000000000000025");
taskService.claim(task.getId());
Task claimedTask = taskService.getTask("TKI:000000000000000000000000000000000025");
assertNotNull(claimedTask);
assertEquals(TaskState.CLAIMED, claimedTask.getState());
assertNotNull(claimedTask.getClaimed());
assertNotEquals(claimedTask.getCreated(), claimedTask.getModified());
assertEquals(claimedTask.getClaimed(), claimedTask.getModified());
assertTrue(claimedTask.isRead());
assertEquals("user_1_2", claimedTask.getOwner());
}
use of pro.taskana.TaskService in project taskana by Taskana.
the class WorkOnTaskAccTest method testBulkCompleteTasks.
@WithAccessId(userName = "user_1_2", groupNames = { "group_1" })
@Test
public void testBulkCompleteTasks() throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException, ConcurrencyException, AttachmentPersistenceException {
TaskService taskService = taskanaEngine.getTaskService();
List<String> taskIdList = new ArrayList<>();
taskIdList.add("TKI:000000000000000000000000000000000100");
taskIdList.add("TKI:000000000000000000000000000000000101");
BulkOperationResults<String, TaskanaException> results = taskService.completeTasks(taskIdList);
assertFalse(results.containsErrors());
Task completedTask1 = taskService.getTask("TKI:000000000000000000000000000000000100");
assertEquals(TaskState.COMPLETED, completedTask1.getState());
assertNotNull(completedTask1.getCompleted());
Task completedTask2 = taskService.getTask("TKI:000000000000000000000000000000000101");
assertEquals(TaskState.COMPLETED, completedTask2.getState());
assertNotNull(completedTask2.getCompleted());
}
use of pro.taskana.TaskService in project taskana by Taskana.
the class WorkOnTaskAccTest method testForceClaimTaskWhichIsAlreadyClaimedByAnotherUser.
@WithAccessId(userName = "user_1_2", groupNames = { "group_1" })
@Test(expected = InvalidOwnerException.class)
public void testForceClaimTaskWhichIsAlreadyClaimedByAnotherUser() throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException, InvalidStateException, InvalidOwnerException {
TaskService taskService = taskanaEngine.getTaskService();
Task task = taskService.getTask("TKI:000000000000000000000000000000000028");
taskService.claim(task.getId());
}
use of pro.taskana.TaskService in project taskana by Taskana.
the class WorkOnTaskAccTest method testThrowsExceptionIfCancelClaimOfTaskFromAnotherUser.
@WithAccessId(userName = "user_1_2", groupNames = { "group_1" })
@Test(expected = InvalidOwnerException.class)
public void testThrowsExceptionIfCancelClaimOfTaskFromAnotherUser() throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException, InvalidStateException, InvalidOwnerException {
TaskService taskService = taskanaEngine.getTaskService();
Task claimedTask = taskService.getTask("TKI:000000000000000000000000000000000030");
taskService.cancelClaim(claimedTask.getId());
}
use of pro.taskana.TaskService in project taskana by Taskana.
the class WorkOnTaskAccTest method testThrowsExceptionIfTaskIsAlreadyClaimed.
@WithAccessId(userName = "user_1_2", groupNames = { "group_1" })
@Test(expected = InvalidOwnerException.class)
public void testThrowsExceptionIfTaskIsAlreadyClaimed() throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException, InvalidStateException, InvalidOwnerException {
TaskService taskService = taskanaEngine.getTaskService();
Task task = taskService.getTask("TKI:000000000000000000000000000000000026");
taskService.claim(task.getId());
}
Aggregations