use of pro.taskana.security.WithAccessId 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.security.WithAccessId 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.security.WithAccessId 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.security.WithAccessId 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());
}
use of pro.taskana.security.WithAccessId in project taskana by Taskana.
the class DeleteWorkbasketAccTest method testDeleteWorkbasketWhichIsUsed.
@WithAccessId(userName = "user_1_1", groupNames = { "businessadmin" })
@Test(expected = WorkbasketInUseException.class)
public void testDeleteWorkbasketWhichIsUsed() throws WorkbasketNotFoundException, NotAuthorizedException, WorkbasketInUseException, InvalidArgumentException {
// all rights, DOMAIN_A with Tasks
Workbasket wb = workbasketService.getWorkbasket("USER_1_1", "DOMAIN_A");
workbasketService.deleteWorkbasket(wb.getId());
}
Aggregations