Search in sources :

Example 96 with TaskService

use of pro.taskana.TaskService in project taskana by Taskana.

the class QueryTasksWithPaginationAccTest method testPaginationThrowingExceptionWhenPageOutOfBounds.

/**
 * Testcase only for DB2 users, because H2 doesn´t throw a Exception when the offset is set to high.<br>
 * Using DB2 should throw a unchecked RuntimeException for a offset which is out of bounds.
 *
 * @throws SQLException
 * @throws NotAuthorizedException
 * @throws InvalidArgumentException
 */
@Ignore
@WithAccessId(userName = "teamlead_1", groupNames = { "group_1" })
@Test(expected = TaskanaRuntimeException.class)
public void testPaginationThrowingExceptionWhenPageOutOfBounds() throws SQLException, NotAuthorizedException, InvalidArgumentException {
    TaskService taskService = taskanaEngine.getTaskService();
    // entrypoint set outside result amount
    int pageNumber = 6;
    int pageSize = 10;
    taskService.createTaskQuery().workbasketKeyDomainIn(new KeyDomain("GPK_KSC", "DOMAIN_A")).listPage(pageNumber, pageSize);
}
Also used : TaskService(pro.taskana.TaskService) KeyDomain(pro.taskana.KeyDomain) Ignore(org.junit.Ignore) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 97 with TaskService

use of pro.taskana.TaskService in project taskana by Taskana.

the class TransferTaskAccTest method testTransferTaskToWorkbasketKeyDomain.

@WithAccessId(userName = "teamlead_1", groupNames = { "group_1" })
@Test
public void testTransferTaskToWorkbasketKeyDomain() 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(), "USER_1_1", "DOMAIN_A");
    Task transferredTask = taskService.getTask("TKI:000000000000000000000000000000000003");
    assertNotNull(transferredTask);
    assertTrue(transferredTask.isTransferred());
    assertFalse(transferredTask.isRead());
    assertEquals(TaskState.READY, transferredTask.getState());
}
Also used : Task(pro.taskana.Task) TaskService(pro.taskana.TaskService) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 98 with TaskService

use of pro.taskana.TaskService in project taskana by Taskana.

the class TransferTaskAccTest method testThrowsExceptionIfTransferWithNoTransferAuthorization.

@WithAccessId(userName = "user_1_1", groupNames = { "group_1" })
@Test(expected = NotAuthorizedException.class)
public void testThrowsExceptionIfTransferWithNoTransferAuthorization() throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException {
    TaskService taskService = taskanaEngine.getTaskService();
    Task task = taskService.getTask("TKI:000000000000000000000000000000000001");
    taskService.transfer(task.getId(), "WBI:100000000000000000000000000000000005");
}
Also used : Task(pro.taskana.Task) TaskService(pro.taskana.TaskService) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 99 with TaskService

use of pro.taskana.TaskService in project taskana by Taskana.

the class DeleteTaskAccTest method testThrowsExceptionIfTaskIsNotCompleted.

@WithAccessId(userName = "user_1_2", groupNames = { "group_1", "admin" })
@Test(expected = InvalidStateException.class)
public void testThrowsExceptionIfTaskIsNotCompleted() throws TaskNotFoundException, InvalidStateException, SQLException, NotAuthorizedException {
    TaskService taskService = taskanaEngine.getTaskService();
    Task task = taskService.getTask("TKI:000000000000000000000000000000000029");
    taskService.deleteTask(task.getId());
}
Also used : Task(pro.taskana.Task) TaskService(pro.taskana.TaskService) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 100 with TaskService

use of pro.taskana.TaskService in project taskana by Taskana.

the class DeleteTaskAccTest method testDeleteSingleTask.

@WithAccessId(userName = "user_1_2", groupNames = { "group_1", "admin" })
@Test(expected = TaskNotFoundException.class)
public void testDeleteSingleTask() throws TaskNotFoundException, InvalidStateException, NotAuthorizedException {
    TaskService taskService = taskanaEngine.getTaskService();
    Task task = taskService.getTask("TKI:000000000000000000000000000000000036");
    taskService.deleteTask(task.getId());
    taskService.getTask("TKI:000000000000000000000000000000000036");
}
Also used : Task(pro.taskana.Task) TaskService(pro.taskana.TaskService) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Aggregations

TaskService (pro.taskana.TaskService)102 Test (org.junit.Test)101 AbstractAccTest (acceptance.AbstractAccTest)99 WithAccessId (pro.taskana.security.WithAccessId)98 Task (pro.taskana.Task)48 TaskSummary (pro.taskana.TaskSummary)45 TaskanaEngineProxyForTest (pro.taskana.impl.TaskanaEngineProxyForTest)32 KeyDomain (pro.taskana.KeyDomain)16 InvalidArgumentException (pro.taskana.exceptions.InvalidArgumentException)16 Instant (java.time.Instant)13 TimeInterval (pro.taskana.TimeInterval)8 ArrayList (java.util.ArrayList)7 TaskanaException (pro.taskana.exceptions.TaskanaException)6 InvalidStateException (pro.taskana.exceptions.InvalidStateException)5 TaskNotFoundException (pro.taskana.exceptions.TaskNotFoundException)4 SqlSession (org.apache.ibatis.session.SqlSession)3 Ignore (org.junit.Ignore)3 Workbasket (pro.taskana.Workbasket)3 ConcurrencyException (pro.taskana.exceptions.ConcurrencyException)3 NotAuthorizedException (pro.taskana.exceptions.NotAuthorizedException)3