Search in sources :

Example 6 with WorkbasketService

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

the class QueryWorkbasketAccTest method testQueryWorkbasketByNameContainsCaseInsensitive.

@WithAccessId(userName = "teamlead_1", groupNames = { "group_1" })
@Test
public void testQueryWorkbasketByNameContainsCaseInsensitive() throws SQLException, NotAuthorizedException, InvalidArgumentException {
    WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
    List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery().nameLike("%TEAMLEAD%").list();
    Assert.assertEquals(2L, results.size());
}
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 WorkbasketService

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

the class QueryWorkbasketAccTest method testQueryWorkbasketByKeyContainsIgnoreCase.

@WithAccessId(userName = "teamlead_1", groupNames = { "group_1" })
@Test
public void testQueryWorkbasketByKeyContainsIgnoreCase() throws SQLException, NotAuthorizedException, InvalidArgumentException {
    WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
    List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery().keyLike("%kSc%").list();
    Assert.assertEquals(3L, results.size());
}
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 WorkbasketService

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

the class QueryWorkbasketAccTest method testQueryWorkbasketByNameStartsWithSortedByNameDescending.

@WithAccessId(userName = "max")
@Test
public void testQueryWorkbasketByNameStartsWithSortedByNameDescending() throws SQLException, NotAuthorizedException, InvalidArgumentException {
    WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
    List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery().nameLike("basxet%").orderByName(desc).list();
    Assert.assertEquals(10L, results.size());
    // 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 9 with WorkbasketService

use of pro.taskana.WorkbasketService 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 10 with WorkbasketService

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

the class QueryWorkbasketAccessItemsAccTest method testQueryAccessItemsForAccessIdsAndWorkbasketKey.

@WithAccessId(userName = "dummy", groupNames = { "businessadmin" })
@Test
public void testQueryAccessItemsForAccessIdsAndWorkbasketKey() throws SQLException, NotAuthorizedException, InvalidArgumentException {
    WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
    List<WorkbasketAccessItem> results = workbasketService.createWorkbasketAccessItemQuery().accessIdIn("user_1_1", "group_1").workbasketIdIn("WBI:100000000000000000000000000000000006", "WBI:100000000000000000000000000000000002").list();
    Assert.assertEquals(3L, results.size());
}
Also used : WorkbasketService(pro.taskana.WorkbasketService) WorkbasketAccessItem(pro.taskana.WorkbasketAccessItem) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Aggregations

AbstractAccTest (acceptance.AbstractAccTest)84 Test (org.junit.Test)84 WorkbasketService (pro.taskana.WorkbasketService)84 WithAccessId (pro.taskana.security.WithAccessId)78 WorkbasketSummary (pro.taskana.WorkbasketSummary)52 Workbasket (pro.taskana.Workbasket)12 WorkbasketAccessItem (pro.taskana.WorkbasketAccessItem)11 ArrayList (java.util.ArrayList)8 NotAuthorizedException (pro.taskana.exceptions.NotAuthorizedException)7 InvalidWorkbasketException (pro.taskana.exceptions.InvalidWorkbasketException)5 WorkbasketNotFoundException (pro.taskana.exceptions.WorkbasketNotFoundException)5 SQLException (java.sql.SQLException)4 Task (pro.taskana.Task)4 TaskService (pro.taskana.TaskService)4 InvalidArgumentException (pro.taskana.exceptions.InvalidArgumentException)4 List (java.util.List)3 Assert.assertTrue (org.junit.Assert.assertTrue)3 Assert.fail (org.junit.Assert.fail)3 Ignore (org.junit.Ignore)3 RunWith (org.junit.runner.RunWith)3