Search in sources :

Example 56 with TaskSummary

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

the class QueryTasksByTimeIntervalsAccTest method testDueWithin.

@WithAccessId(userName = "teamlead_1", groupNames = { "group_1", "group_2" })
@Test
public void testDueWithin() throws SQLException, NotAuthorizedException, InvalidArgumentException {
    TaskService taskService = taskanaEngine.getTaskService();
    TimeInterval interval = new TimeInterval(getInstant("2018-01-29T15:55:00"), getInstant("2018-01-30T15:55:22"));
    List<TaskSummary> results = taskService.createTaskQuery().dueWithin(interval).orderByPlanned(asc).list();
    assertThat(results.size(), equalTo(70));
    TaskSummary previousSummary = null;
    for (TaskSummary taskSummary : results) {
        Instant cr = taskSummary.getDue();
        Assert.assertTrue(interval.contains(cr));
        if (previousSummary != null) {
            Assert.assertTrue(!previousSummary.getPlanned().isAfter(taskSummary.getPlanned()));
        }
        previousSummary = taskSummary;
    }
}
Also used : TimeInterval(pro.taskana.TimeInterval) TaskService(pro.taskana.TaskService) Instant(java.time.Instant) TaskSummary(pro.taskana.TaskSummary) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 57 with TaskSummary

use of pro.taskana.TaskSummary 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 58 with TaskSummary

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

Aggregations

TaskSummary (pro.taskana.TaskSummary)58 Test (org.junit.Test)48 TaskService (pro.taskana.TaskService)47 WithAccessId (pro.taskana.security.WithAccessId)45 AbstractAccTest (acceptance.AbstractAccTest)44 TaskanaEngineProxyForTest (pro.taskana.impl.TaskanaEngineProxyForTest)17 KeyDomain (pro.taskana.KeyDomain)14 InvalidArgumentException (pro.taskana.exceptions.InvalidArgumentException)14 Instant (java.time.Instant)9 ArrayList (java.util.ArrayList)8 TimeInterval (pro.taskana.TimeInterval)8 Classification (pro.taskana.Classification)5 Task (pro.taskana.Task)5 NotAuthorizedException (pro.taskana.exceptions.NotAuthorizedException)5 NotAuthorizedToQueryWorkbasketException (pro.taskana.exceptions.NotAuthorizedToQueryWorkbasketException)5 TaskQuery (pro.taskana.TaskQuery)4 Workbasket (pro.taskana.Workbasket)3 Arrays (java.util.Arrays)2 HashSet (java.util.HashSet)2 List (java.util.List)2