use of pro.taskana.TaskService in project taskana by Taskana.
the class WorkOnTaskAccTest method testClaimAlreadyClaimedByCallerTask.
@WithAccessId(userName = "user_1_2", groupNames = { "group_1" })
@Test
public void testClaimAlreadyClaimedByCallerTask() throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException, InvalidStateException, InvalidOwnerException {
TaskService taskService = taskanaEngine.getTaskService();
Task task = taskService.getTask("TKI:000000000000000000000000000000000027");
taskService.claim(task.getId());
}
use of pro.taskana.TaskService in project taskana by Taskana.
the class WorkOnTaskAccTest method testForceCancelClaimOfTaskFromAnotherUser.
@WithAccessId(userName = "user_1_2", groupNames = { "group_1" })
@Test
public void testForceCancelClaimOfTaskFromAnotherUser() throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException, InvalidStateException, InvalidOwnerException {
TaskService taskService = taskanaEngine.getTaskService();
Task claimedTask = taskService.getTask("TKI:000000000000000000000000000000000031");
taskService.cancelClaim(claimedTask.getId(), true);
Task unclaimedTask = taskService.getTask("TKI:000000000000000000000000000000000031");
assertNotNull(unclaimedTask);
assertEquals(TaskState.READY, unclaimedTask.getState());
assertNull(unclaimedTask.getClaimed());
assertTrue(unclaimedTask.isRead());
assertNull(unclaimedTask.getOwner());
}
use of pro.taskana.TaskService in project taskana by Taskana.
the class WorkOnTaskAccTest method testThrowsExceptionIfCompletingClaimedTaskOfAnotherUser.
@WithAccessId(userName = "user_1_2", groupNames = { "group_1" })
@Test(expected = InvalidOwnerException.class)
public void testThrowsExceptionIfCompletingClaimedTaskOfAnotherUser() throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException, InvalidStateException, InvalidOwnerException {
TaskService taskService = taskanaEngine.getTaskService();
Task claimedTask = taskService.getTask("TKI:000000000000000000000000000000000034");
taskService.completeTask(claimedTask.getId());
}
use of pro.taskana.TaskService in project taskana by Taskana.
the class WorkOnTaskAccTest method testCancelClaimTask.
@WithAccessId(userName = "user_1_2", groupNames = { "group_1" })
@Test
public void testCancelClaimTask() throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException, InvalidStateException, InvalidOwnerException {
TaskService taskService = taskanaEngine.getTaskService();
Task claimedTask = taskService.getTask("TKI:000000000000000000000000000000000029");
taskService.cancelClaim(claimedTask.getId());
Task unclaimedTask = taskService.getTask("TKI:000000000000000000000000000000000029");
assertNotNull(unclaimedTask);
assertEquals(TaskState.READY, unclaimedTask.getState());
assertNull(unclaimedTask.getClaimed());
assertTrue(unclaimedTask.isRead());
assertNull(unclaimedTask.getOwner());
}
use of pro.taskana.TaskService in project taskana by Taskana.
the class WorkOnTaskAccTest method testCompleteTask.
@WithAccessId(userName = "user_1_2", groupNames = { "group_1" })
@Test
public void testCompleteTask() throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException, InvalidStateException, InvalidOwnerException {
Instant before = Instant.now().minus(Duration.ofSeconds(3L));
TaskService taskService = taskanaEngine.getTaskService();
Task claimedTask = taskService.getTask("TKI:000000000000000000000000000000000032");
taskService.completeTask(claimedTask.getId());
Task completedTask = taskService.getTask("TKI:000000000000000000000000000000000032");
assertNotNull(completedTask);
assertEquals(TaskState.COMPLETED, completedTask.getState());
assertNotNull(completedTask.getCompleted());
assertEquals(completedTask.getCompleted(), completedTask.getModified());
assertTrue(completedTask.getCompleted().isAfter(before));
assertTrue(completedTask.getModified().isAfter(before));
assertTrue(completedTask.isRead());
assertEquals("user_1_2", completedTask.getOwner());
}
Aggregations