Search in sources :

Example 11 with WorkbasketService

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

the class QueryWorkbasketAccessItemsAccTest method testQueryAccessItemsForAccessIdsNotAuthorized.

@WithAccessId(userName = "dummy")
@Test(expected = NotAuthorizedException.class)
public void testQueryAccessItemsForAccessIdsNotAuthorized() throws SQLException, NotAuthorizedException, InvalidArgumentException {
    WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
    workbasketService.createWorkbasketAccessItemQuery().accessIdIn("user_1_1", "group_1").list();
    fail("NotAuthorizedException was expected.");
}
Also used : WorkbasketService(pro.taskana.WorkbasketService) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 12 with WorkbasketService

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

the class QueryWorkbasketAccessItemsAccTest method testQueryAccessItemsForAccessIdsOrderedAscending.

@WithAccessId(userName = "dummy", groupNames = { "businessadmin" })
@Test
public void testQueryAccessItemsForAccessIdsOrderedAscending() throws SQLException, NotAuthorizedException, InvalidArgumentException {
    WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
    WorkbasketAccessItemQuery query = workbasketService.createWorkbasketAccessItemQuery().accessIdIn("user_1_1", "group_1").orderByAccessId(desc).orderByWorkbasketId(desc);
    List<WorkbasketAccessItem> results = query.list();
    long count = query.count();
    Assert.assertEquals(8L, results.size());
    Assert.assertEquals(results.size(), count);
    Assert.assertEquals("WAI:100000000000000000000000000000000003", results.get(0).getId());
}
Also used : WorkbasketService(pro.taskana.WorkbasketService) WorkbasketAccessItem(pro.taskana.WorkbasketAccessItem) WorkbasketAccessItemQuery(pro.taskana.WorkbasketAccessItemQuery) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 13 with WorkbasketService

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

the class QueryWorkbasketAccessItemsAccTest method testQueryAccessItemsByWorkbasketKey.

@WithAccessId(userName = "dummy", groupNames = { "businessadmin" })
@Test
public void testQueryAccessItemsByWorkbasketKey() throws SQLException, NotAuthorizedException, InvalidArgumentException {
    WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
    List<WorkbasketAccessItem> results = workbasketService.createWorkbasketAccessItemQuery().workbasketIdIn("WBI:100000000000000000000000000000000006").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)

Example 14 with WorkbasketService

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

the class QueryWorkbasketAccessItemsAccTest method testQueryAccessItemsForAccessIds.

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

Example 15 with WorkbasketService

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

the class QueryWorkbasketAccessItemsAccTest method testQueryAccessItemsByWorkbasketKeyOrderedDescending.

@WithAccessId(userName = "dummy", groupNames = { "businessadmin" })
@Test
public void testQueryAccessItemsByWorkbasketKeyOrderedDescending() throws SQLException, NotAuthorizedException, InvalidArgumentException {
    WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
    List<WorkbasketAccessItem> results = workbasketService.createWorkbasketAccessItemQuery().workbasketIdIn("WBI:100000000000000000000000000000000006").orderByWorkbasketId(desc).orderByAccessId(asc).list();
    Assert.assertEquals(3L, results.size());
    Assert.assertEquals("WAI:100000000000000000000000000000000009", results.get(0).getId());
}
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