Search in sources :

Example 6 with WorkbasketSummary

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

the class QueryWorkbasketAccTest method testQueryWorkbasketByNameStartsWithSortedByNameAscending.

@WithAccessId(userName = "teamlead_1", groupNames = { "group_1" })
@Test
public void testQueryWorkbasketByNameStartsWithSortedByNameAscending() throws SQLException, NotAuthorizedException, InvalidArgumentException {
    WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
    List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery().nameLike("%Gruppenpostkorb KSC%").orderByName(asc).list();
    Assert.assertEquals(3L, results.size());
    Assert.assertEquals("GPK_KSC", results.get(0).getKey());
    // check sort order is correct
    WorkbasketSummary previousSummary = null;
    for (WorkbasketSummary wbSummary : results) {
        if (previousSummary != null) {
            Assert.assertTrue(wbSummary.getName().compareToIgnoreCase(previousSummary.getName()) >= 0);
        }
        previousSummary = wbSummary;
    }
}
Also used : WorkbasketService(pro.taskana.WorkbasketService) WorkbasketSummary(pro.taskana.WorkbasketSummary) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 7 with WorkbasketSummary

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

the class QueryWorkbasketsWithPaginationAccTest method testGetFirstPageOfWorkbasketQueryWithOffset.

@WithAccessId(userName = "teamlead_1", groupNames = { "group_1" })
@Test
public void testGetFirstPageOfWorkbasketQueryWithOffset() throws NotAuthorizedException {
    WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
    List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery().domainIn("DOMAIN_A").list(0, 5);
    assertThat(results.size(), equalTo(5));
}
Also used : WorkbasketService(pro.taskana.WorkbasketService) WorkbasketSummary(pro.taskana.WorkbasketSummary) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 8 with WorkbasketSummary

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

the class QueryWorkbasketsWithPaginationAccTest method testPaginationWithPages.

@WithAccessId(userName = "teamlead_1", groupNames = { "group_1" })
@Test
public void testPaginationWithPages() throws NotAuthorizedException {
    WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
    // Getting full page
    int pageNumber = 2;
    int pageSize = 4;
    List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery().domainIn("DOMAIN_A").listPage(pageNumber, pageSize);
    assertThat(results.size(), equalTo(4));
    // Getting full page
    pageNumber = 4;
    pageSize = 1;
    results = workbasketService.createWorkbasketQuery().domainIn("DOMAIN_A").listPage(pageNumber, pageSize);
    assertThat(results.size(), equalTo(1));
    // Getting last results on 1 big page
    pageNumber = 1;
    pageSize = 100;
    results = workbasketService.createWorkbasketQuery().domainIn("DOMAIN_A").listPage(pageNumber, pageSize);
    assertThat(results.size(), equalTo(8));
    // Getting last results on multiple pages
    pageNumber = 2;
    pageSize = 5;
    results = workbasketService.createWorkbasketQuery().domainIn("DOMAIN_A").listPage(pageNumber, pageSize);
    assertThat(results.size(), equalTo(3));
}
Also used : WorkbasketService(pro.taskana.WorkbasketService) WorkbasketSummary(pro.taskana.WorkbasketSummary) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 9 with WorkbasketSummary

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

the class QueryWorkbasketsWithPaginationAccTest method testWorkbasketQueryDomA.

@WithAccessId(userName = "teamlead_1", groupNames = { "group_1" })
@Test
public void testWorkbasketQueryDomA() throws SQLException, NotAuthorizedException, InvalidArgumentException {
    WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
    List<WorkbasketSummary> result = workbasketService.createWorkbasketQuery().domainIn("DOMAIN_A").list();
    assertThat(result.size(), equalTo(8));
}
Also used : WorkbasketService(pro.taskana.WorkbasketService) WorkbasketSummary(pro.taskana.WorkbasketSummary) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 10 with WorkbasketSummary

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

the class QueryWorkbasketsWithPaginationAccTest method testPaginationNullAndNegativeLimitsIgnoring.

@WithAccessId(userName = "teamlead_1", groupNames = { "group_1" })
@Test
public void testPaginationNullAndNegativeLimitsIgnoring() throws NotAuthorizedException {
    WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
    // 0 limit/size = 0 results
    int pageNumber = 2;
    int pageSize = 0;
    List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery().domainIn("DOMAIN_A").listPage(pageNumber, pageSize);
    assertThat(results.size(), equalTo(0));
    // Negative size will be 0 = 0 results
    pageNumber = 2;
    pageSize = -1;
    results = workbasketService.createWorkbasketQuery().domainIn("DOMAIN_A").listPage(pageNumber, pageSize);
    assertThat(results.size(), equalTo(0));
    // Negative page = first page
    pageNumber = -1;
    pageSize = 10;
    results = workbasketService.createWorkbasketQuery().domainIn("DOMAIN_A").listPage(pageNumber, pageSize);
    assertThat(results.size(), equalTo(8));
}
Also used : WorkbasketService(pro.taskana.WorkbasketService) WorkbasketSummary(pro.taskana.WorkbasketSummary) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Aggregations

WorkbasketSummary (pro.taskana.WorkbasketSummary)66 Test (org.junit.Test)56 WorkbasketService (pro.taskana.WorkbasketService)53 AbstractAccTest (acceptance.AbstractAccTest)52 WithAccessId (pro.taskana.security.WithAccessId)51 ArrayList (java.util.ArrayList)15 Workbasket (pro.taskana.Workbasket)9 NotAuthorizedException (pro.taskana.exceptions.NotAuthorizedException)7 WorkbasketQuery (pro.taskana.WorkbasketQuery)5 Classification (pro.taskana.Classification)3 Task (pro.taskana.Task)3 InvalidArgumentException (pro.taskana.exceptions.InvalidArgumentException)3 WorkbasketNotFoundException (pro.taskana.exceptions.WorkbasketNotFoundException)3 Instant (java.time.Instant)2 Arrays (java.util.Arrays)2 HashSet (java.util.HashSet)2 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 PersistenceException (org.apache.ibatis.exceptions.PersistenceException)2 Ignore (org.junit.Ignore)2