Search in sources :

Example 56 with WithAccessId

use of pro.taskana.security.WithAccessId 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 57 with WithAccessId

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

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

Example 59 with WithAccessId

use of pro.taskana.security.WithAccessId 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 60 with WithAccessId

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

Aggregations

Test (org.junit.Test)216 WithAccessId (pro.taskana.security.WithAccessId)216 AbstractAccTest (acceptance.AbstractAccTest)201 TaskService (pro.taskana.TaskService)100 WorkbasketService (pro.taskana.WorkbasketService)78 Task (pro.taskana.Task)57 WorkbasketSummary (pro.taskana.WorkbasketSummary)51 TaskSummary (pro.taskana.TaskSummary)47 TaskanaEngineProxyForTest (pro.taskana.impl.TaskanaEngineProxyForTest)34 Workbasket (pro.taskana.Workbasket)23 Classification (pro.taskana.Classification)21 KeyDomain (pro.taskana.KeyDomain)19 InvalidArgumentException (pro.taskana.exceptions.InvalidArgumentException)19 ArrayList (java.util.ArrayList)17 Instant (java.time.Instant)16 WorkbasketAccessItem (pro.taskana.WorkbasketAccessItem)16 TaskanaEngineConfigurationTest (pro.taskana.impl.configuration.TaskanaEngineConfigurationTest)15 Connection (java.sql.Connection)10 NotAuthorizedException (pro.taskana.exceptions.NotAuthorizedException)9 TimeInterval (pro.taskana.TimeInterval)8