use of pro.taskana.TaskService in project taskana by Taskana.
the class TransferTaskAccTest method testTransferTaskToWorkbasketId.
@WithAccessId(userName = "teamlead_1", groupNames = { "group_1" })
@Test
public void testTransferTaskToWorkbasketId() throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException, InvalidStateException, InvalidOwnerException {
TaskService taskService = taskanaEngine.getTaskService();
Task task = taskService.getTask("TKI:000000000000000000000000000000000003");
taskService.claim(task.getId());
taskService.setTaskRead(task.getId(), true);
taskService.transfer(task.getId(), "WBI:100000000000000000000000000000000006");
Task transferredTask = taskService.getTask("TKI:000000000000000000000000000000000003");
assertNotNull(transferredTask);
assertTrue(transferredTask.isTransferred());
assertFalse(transferredTask.isRead());
assertEquals(TaskState.READY, transferredTask.getState());
}
use of pro.taskana.TaskService in project taskana by Taskana.
the class DeleteTaskAccTest method testForceDeleteTaskIfNotCompleted.
@WithAccessId(userName = "user_1_2", groupNames = { "group_1", "admin" })
@Test(expected = TaskNotFoundException.class)
public void testForceDeleteTaskIfNotCompleted() throws SQLException, TaskNotFoundException, InvalidStateException, NotAuthorizedException {
TaskService taskService = taskanaEngine.getTaskService();
Task task = taskService.getTask("TKI:000000000000000000000000000000000027");
try {
taskService.deleteTask(task.getId());
fail("Should not be possible to delete claimed task without force flag");
} catch (InvalidStateException ex) {
taskService.deleteTask(task.getId(), true);
}
taskService.getTask("TKI:000000000000000000000000000000000027");
}
use of pro.taskana.TaskService in project taskana by Taskana.
the class QueryTasksByWorkbasketAccTest method testThrowsExceptionIfNoOpenerPermissionOnAtLeastOneQueriedWorkbasket.
// BB
@Ignore
@WithAccessId(userName = "user_1_1", groupNames = { "group_1" })
@Test(expected = NotAuthorizedToQueryWorkbasketException.class)
public void testThrowsExceptionIfNoOpenerPermissionOnAtLeastOneQueriedWorkbasket() throws SQLException, NotAuthorizedException, InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService();
taskService.createTaskQuery().workbasketKeyDomainIn(new KeyDomain("USER_1_1", "DOMAIN_A"), new KeyDomain("USER_2_1", "DOMAIN_A")).list();
}
use of pro.taskana.TaskService in project taskana by Taskana.
the class QueryTasksByWorkbasketAccTest method testThrowsExceptionIfNoOpenerPermissionOnQueriedWorkbasket.
// BB
@Ignore
@WithAccessId(userName = "user_1_1", groupNames = { "group_1" })
@Test(expected = NotAuthorizedToQueryWorkbasketException.class)
public void testThrowsExceptionIfNoOpenerPermissionOnQueriedWorkbasket() throws SQLException, NotAuthorizedException, InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService();
taskService.createTaskQuery().workbasketKeyDomainIn(new KeyDomain("USER_2_1", "DOMAIN_A")).list();
}
use of pro.taskana.TaskService in project taskana by Taskana.
the class QueryTasksWithSortingAccTest method testSortByDomainNameAndCreated.
@WithAccessId(userName = "teamlead_1", groupNames = { "group_1", "group_2" })
@Test
public void testSortByDomainNameAndCreated() throws SQLException, NotAuthorizedException, InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery().workbasketKeyDomainIn(new KeyDomain("USER_3_2", "DOMAIN_B")).orderByDomain(asc).orderByName(asc).orderByCreated(null).list();
assertThat(results.size(), equalTo(25));
TaskSummary previousSummary = null;
for (TaskSummary taskSummary : results) {
// created: " + taskSummary.getCreated());
if (previousSummary != null) {
Assert.assertTrue(taskSummary.getDomain().compareToIgnoreCase(previousSummary.getDomain()) >= 0);
if (taskSummary.getDomain().equals(previousSummary.getDomain())) {
Assert.assertTrue(taskSummary.getName().compareToIgnoreCase(previousSummary.getName()) >= 0);
if (taskSummary.getName().equals(previousSummary.getName())) {
Assert.assertTrue(!taskSummary.getCreated().isBefore(previousSummary.getCreated()));
}
}
}
previousSummary = taskSummary;
}
}
Aggregations