Search in sources :

Example 46 with WorkbasketService

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

the class QueryWorkbasketByPermissionAccTest method testQueryAllTransferTargetsForUserAndGroupSortedByNameDescending.

@WithAccessId(userName = "dummy", groupNames = { "businessadmin" })
@Test
public void testQueryAllTransferTargetsForUserAndGroupSortedByNameDescending() throws SQLException, NotAuthorizedException, InvalidArgumentException, SystemException {
    WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
    List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery().accessIdsHavePermission(WorkbasketPermission.APPEND, "user_1_1", "group_1").orderByName(desc).orderByKey(asc).list();
    Assert.assertEquals(6, results.size());
    Assert.assertEquals("USER_2_2", results.get(0).getKey());
}
Also used : WorkbasketService(pro.taskana.WorkbasketService) WorkbasketSummary(pro.taskana.WorkbasketSummary) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 47 with WorkbasketService

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

the class QueryWorkbasketByPermissionAccTest method testQueryAllTransferSourcesForUserAndGroup.

@WithAccessId(userName = "dummy", groupNames = { "businessadmin" })
@Test
public void testQueryAllTransferSourcesForUserAndGroup() throws SQLException, NotAuthorizedException, InvalidArgumentException, SystemException {
    WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
    List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery().accessIdsHavePermission(WorkbasketPermission.DISTRIBUTE, "user_1_1", "group_1").list();
    Assert.assertEquals(2, results.size());
    List<String> keys = new ArrayList<>(Arrays.asList("GPK_KSC_1", "USER_1_1"));
    for (WorkbasketSummary wb : results) {
        Assert.assertTrue(keys.contains(wb.getKey()));
    }
}
Also used : WorkbasketService(pro.taskana.WorkbasketService) ArrayList(java.util.ArrayList) WorkbasketSummary(pro.taskana.WorkbasketSummary) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 48 with WorkbasketService

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

the class WorkbasketQueryWithOrderedPaginationAccTest method testGetFirstPageOfTaskQueryWithOffset.

@Ignore
@Test
public void testGetFirstPageOfTaskQueryWithOffset() throws NotAuthorizedException {
    WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
    List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery().domainIn("DOMAIN_A").orderByKey(asc).list(0, 5);
    assertThat(results.size(), equalTo(5));
    assertThat(results.get(0).getKey(), equalTo("GPK_KSC"));
    assertThat(results.get(4).getKey(), equalTo("key2"));
    results = workbasketService.createWorkbasketQuery().domainIn("DOMAIN_A").orderByKey(desc).list(0, 5);
    assertThat(results.size(), equalTo(5));
    assertThat(results.get(0).getKey(), equalTo("USER_2_2"));
    assertThat(results.get(4).getKey(), equalTo("TEAMLEAD_2"));
}
Also used : WorkbasketService(pro.taskana.WorkbasketService) WorkbasketSummary(pro.taskana.WorkbasketSummary) Ignore(org.junit.Ignore) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test)

Example 49 with WorkbasketService

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

the class WorkbasketQueryWithOrderedPaginationAccTest method testGetSecondPageOfTaskQueryWithOffset.

@Ignore
@Test
public void testGetSecondPageOfTaskQueryWithOffset() throws NotAuthorizedException {
    WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
    List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery().domainIn("DOMAIN_A").orderByKey(asc).list(5, 5);
    assertThat(results.size(), equalTo(5));
    assertThat(results.get(0).getKey(), equalTo("key3"));
    assertThat(results.get(4).getKey(), equalTo("USER_1_1"));
    results = workbasketService.createWorkbasketQuery().domainIn("DOMAIN_A").orderByKey(desc).list(5, 5);
    assertThat(results.size(), equalTo(5));
    assertThat(results.get(0).getKey(), equalTo("TEAMLEAD_1"));
    assertThat(results.get(4).getKey(), equalTo("key3"));
}
Also used : WorkbasketService(pro.taskana.WorkbasketService) WorkbasketSummary(pro.taskana.WorkbasketSummary) Ignore(org.junit.Ignore) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test)

Example 50 with WorkbasketService

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

the class QueryWorkbasketAccTest method testQueryWorkbasketByName.

@WithAccessId(userName = "teamlead_1", groupNames = { "group_1" })
@Test
public void testQueryWorkbasketByName() throws SQLException, NotAuthorizedException, InvalidArgumentException {
    WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
    List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery().nameIn("Gruppenpostkorb KSC").list();
    Assert.assertEquals(1L, results.size());
    Assert.assertEquals("GPK_KSC", results.get(0).getKey());
}
Also used : WorkbasketService(pro.taskana.WorkbasketService) WorkbasketSummary(pro.taskana.WorkbasketSummary) 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