Search in sources :

Example 16 with KeyDomain

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

the class QueryTasksWithPaginationAccTest method testPaginationNullAndNegativeLimitsIgnoring.

@WithAccessId(userName = "teamlead_1", groupNames = { "group_1" })
@Test
public void testPaginationNullAndNegativeLimitsIgnoring() throws SQLException, NotAuthorizedException, InvalidArgumentException {
    TaskService taskService = taskanaEngine.getTaskService();
    // 0 limit/size = 0 results
    int pageNumber = 2;
    int pageSize = 0;
    List<TaskSummary> results = taskService.createTaskQuery().workbasketKeyDomainIn(new KeyDomain("GPK_KSC", "DOMAIN_A")).listPage(pageNumber, pageSize);
    assertThat(results.size(), equalTo(0));
    // Negative size will be 0 = 0 results
    pageNumber = 2;
    pageSize = -1;
    results = taskService.createTaskQuery().workbasketKeyDomainIn(new KeyDomain("GPK_KSC", "DOMAIN_A")).listPage(pageNumber, pageSize);
    assertThat(results.size(), equalTo(0));
    // Negative page = first page
    pageNumber = -1;
    pageSize = 10;
    results = taskService.createTaskQuery().workbasketKeyDomainIn(new KeyDomain("GPK_KSC", "DOMAIN_A")).listPage(pageNumber, pageSize);
    assertThat(results.size(), equalTo(10));
}
Also used : TaskService(pro.taskana.TaskService) TaskSummary(pro.taskana.TaskSummary) KeyDomain(pro.taskana.KeyDomain) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 17 with KeyDomain

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

the class QueryTasksWithPaginationAccTest method testGetFirstPageOfTaskQueryWithOffset.

@WithAccessId(userName = "teamlead_1", groupNames = { "group_1" })
@Test
public void testGetFirstPageOfTaskQueryWithOffset() throws SQLException, NotAuthorizedException, InvalidArgumentException {
    TaskService taskService = taskanaEngine.getTaskService();
    List<TaskSummary> results = taskService.createTaskQuery().workbasketKeyDomainIn(new KeyDomain("GPK_KSC", "DOMAIN_A")).list(0, 10);
    assertThat(results.size(), equalTo(10));
}
Also used : TaskService(pro.taskana.TaskService) TaskSummary(pro.taskana.TaskSummary) KeyDomain(pro.taskana.KeyDomain) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 18 with KeyDomain

use of pro.taskana.KeyDomain 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)

Aggregations

Test (org.junit.Test)18 KeyDomain (pro.taskana.KeyDomain)18 WithAccessId (pro.taskana.security.WithAccessId)17 AbstractAccTest (acceptance.AbstractAccTest)16 TaskService (pro.taskana.TaskService)16 TaskSummary (pro.taskana.TaskSummary)14 Ignore (org.junit.Ignore)3 Task (pro.taskana.Task)3 Classification (pro.taskana.Classification)2 TaskanaEngineConfigurationTest (pro.taskana.impl.configuration.TaskanaEngineConfigurationTest)2 Connection (java.sql.Connection)1 Workbasket (pro.taskana.Workbasket)1 WorkbasketAccessItem (pro.taskana.WorkbasketAccessItem)1 WorkbasketService (pro.taskana.WorkbasketService)1 NotAuthorizedToQueryWorkbasketException (pro.taskana.exceptions.NotAuthorizedToQueryWorkbasketException)1 TaskanaEngineProxyForTest (pro.taskana.impl.TaskanaEngineProxyForTest)1 WorkbasketImpl (pro.taskana.impl.WorkbasketImpl)1