Search in sources :

Example 6 with KeyDomain

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

the class QueryTasksWithPaginationAccTest method testPaginationWithPages.

@WithAccessId(userName = "teamlead_1", groupNames = { "group_1" })
@Test
public void testPaginationWithPages() throws SQLException, NotAuthorizedException, InvalidArgumentException {
    TaskService taskService = taskanaEngine.getTaskService();
    // Getting full page
    int pageNumber = 2;
    int pageSize = 4;
    List<TaskSummary> results = taskService.createTaskQuery().workbasketKeyDomainIn(new KeyDomain("GPK_KSC", "DOMAIN_A")).listPage(pageNumber, pageSize);
    assertThat(results.size(), equalTo(4));
    // Getting full page
    pageNumber = 4;
    pageSize = 1;
    results = taskService.createTaskQuery().workbasketKeyDomainIn(new KeyDomain("GPK_KSC", "DOMAIN_A")).listPage(pageNumber, pageSize);
    assertThat(results.size(), equalTo(1));
    // Getting last results on 1 big page
    pageNumber = 1;
    pageSize = 100;
    results = taskService.createTaskQuery().workbasketKeyDomainIn(new KeyDomain("GPK_KSC", "DOMAIN_A")).listPage(pageNumber, pageSize);
    assertThat(results.size(), equalTo(22));
    // Getting last results on multiple pages
    pageNumber = 3;
    pageSize = 10;
    results = taskService.createTaskQuery().workbasketKeyDomainIn(new KeyDomain("GPK_KSC", "DOMAIN_A")).listPage(pageNumber, pageSize);
    assertThat(results.size(), equalTo(2));
}
Also used : TaskService(pro.taskana.TaskService) TaskSummary(pro.taskana.TaskSummary) KeyDomain(pro.taskana.KeyDomain) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 7 with KeyDomain

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

the class QueryTasksByWorkbasketAccTest method testThrowsExceptionIfNoOpenerPermissionOnAtLeastOneQueriedWorkbasket.

// BB
@Ignore
@WithAccessId(userName = "user_1_1", groupNames = { "group_1" })
@Test(expected = NotAuthorizedToQueryWorkbasketException.class)
public void testThrowsExceptionIfNoOpenerPermissionOnAtLeastOneQueriedWorkbasket() throws SQLException, NotAuthorizedException, InvalidArgumentException {
    TaskService taskService = taskanaEngine.getTaskService();
    taskService.createTaskQuery().workbasketKeyDomainIn(new KeyDomain("USER_1_1", "DOMAIN_A"), new KeyDomain("USER_2_1", "DOMAIN_A")).list();
}
Also used : TaskService(pro.taskana.TaskService) KeyDomain(pro.taskana.KeyDomain) Ignore(org.junit.Ignore) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 8 with KeyDomain

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

the class QueryTasksByWorkbasketAccTest method testThrowsExceptionIfNoOpenerPermissionOnQueriedWorkbasket.

// BB
@Ignore
@WithAccessId(userName = "user_1_1", groupNames = { "group_1" })
@Test(expected = NotAuthorizedToQueryWorkbasketException.class)
public void testThrowsExceptionIfNoOpenerPermissionOnQueriedWorkbasket() throws SQLException, NotAuthorizedException, InvalidArgumentException {
    TaskService taskService = taskanaEngine.getTaskService();
    taskService.createTaskQuery().workbasketKeyDomainIn(new KeyDomain("USER_2_1", "DOMAIN_A")).list();
}
Also used : TaskService(pro.taskana.TaskService) KeyDomain(pro.taskana.KeyDomain) Ignore(org.junit.Ignore) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 9 with KeyDomain

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

the class QueryTasksWithSortingAccTest method testSortByDomainNameAndCreated.

@WithAccessId(userName = "teamlead_1", groupNames = { "group_1", "group_2" })
@Test
public void testSortByDomainNameAndCreated() throws SQLException, NotAuthorizedException, InvalidArgumentException {
    TaskService taskService = taskanaEngine.getTaskService();
    List<TaskSummary> results = taskService.createTaskQuery().workbasketKeyDomainIn(new KeyDomain("USER_3_2", "DOMAIN_B")).orderByDomain(asc).orderByName(asc).orderByCreated(null).list();
    assertThat(results.size(), equalTo(25));
    TaskSummary previousSummary = null;
    for (TaskSummary taskSummary : results) {
        // created: " + taskSummary.getCreated());
        if (previousSummary != null) {
            Assert.assertTrue(taskSummary.getDomain().compareToIgnoreCase(previousSummary.getDomain()) >= 0);
            if (taskSummary.getDomain().equals(previousSummary.getDomain())) {
                Assert.assertTrue(taskSummary.getName().compareToIgnoreCase(previousSummary.getName()) >= 0);
                if (taskSummary.getName().equals(previousSummary.getName())) {
                    Assert.assertTrue(!taskSummary.getCreated().isBefore(previousSummary.getCreated()));
                }
            }
        }
        previousSummary = taskSummary;
    }
}
Also used : TaskService(pro.taskana.TaskService) TaskSummary(pro.taskana.TaskSummary) KeyDomain(pro.taskana.KeyDomain) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 10 with KeyDomain

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

the class QueryTasksWithSortingAccTest method testSortByModifiedAndDomain.

@WithAccessId(userName = "teamlead_1", groupNames = { "group_1", "group_2" })
@Test
public void testSortByModifiedAndDomain() throws SQLException, NotAuthorizedException, InvalidArgumentException {
    TaskService taskService = taskanaEngine.getTaskService();
    List<TaskSummary> results = taskService.createTaskQuery().workbasketKeyDomainIn(new KeyDomain("USER_3_2", "DOMAIN_B")).orderByModified(desc).orderByDomain(null).list();
    assertThat(results.size(), equalTo(25));
    TaskSummary previousSummary = null;
    for (TaskSummary taskSummary : results) {
        if (previousSummary != null) {
            Assert.assertTrue(!previousSummary.getModified().isBefore(taskSummary.getModified()));
        }
        previousSummary = taskSummary;
    }
}
Also used : TaskService(pro.taskana.TaskService) TaskSummary(pro.taskana.TaskSummary) KeyDomain(pro.taskana.KeyDomain) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Aggregations

Test (org.junit.Test)18 KeyDomain (pro.taskana.KeyDomain)18 WithAccessId (pro.taskana.security.WithAccessId)17 AbstractAccTest (acceptance.AbstractAccTest)16 TaskService (pro.taskana.TaskService)16 TaskSummary (pro.taskana.TaskSummary)14 Ignore (org.junit.Ignore)3 Task (pro.taskana.Task)3 Classification (pro.taskana.Classification)2 TaskanaEngineConfigurationTest (pro.taskana.impl.configuration.TaskanaEngineConfigurationTest)2 Connection (java.sql.Connection)1 Workbasket (pro.taskana.Workbasket)1 WorkbasketAccessItem (pro.taskana.WorkbasketAccessItem)1 WorkbasketService (pro.taskana.WorkbasketService)1 NotAuthorizedToQueryWorkbasketException (pro.taskana.exceptions.NotAuthorizedToQueryWorkbasketException)1 TaskanaEngineProxyForTest (pro.taskana.impl.TaskanaEngineProxyForTest)1 WorkbasketImpl (pro.taskana.impl.WorkbasketImpl)1