Search in sources :

Example 66 with WithAccessId

use of pro.taskana.security.WithAccessId in project taskana by Taskana.

the class QueryWorkbasketsWithPaginationAccTest method testPaginationWithPages.

@WithAccessId(userName = "teamlead_1", groupNames = { "group_1" })
@Test
public void testPaginationWithPages() throws NotAuthorizedException {
    WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
    // Getting full page
    int pageNumber = 2;
    int pageSize = 4;
    List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery().domainIn("DOMAIN_A").listPage(pageNumber, pageSize);
    assertThat(results.size(), equalTo(4));
    // Getting full page
    pageNumber = 4;
    pageSize = 1;
    results = workbasketService.createWorkbasketQuery().domainIn("DOMAIN_A").listPage(pageNumber, pageSize);
    assertThat(results.size(), equalTo(1));
    // Getting last results on 1 big page
    pageNumber = 1;
    pageSize = 100;
    results = workbasketService.createWorkbasketQuery().domainIn("DOMAIN_A").listPage(pageNumber, pageSize);
    assertThat(results.size(), equalTo(8));
    // Getting last results on multiple pages
    pageNumber = 2;
    pageSize = 5;
    results = workbasketService.createWorkbasketQuery().domainIn("DOMAIN_A").listPage(pageNumber, pageSize);
    assertThat(results.size(), equalTo(3));
}
Also used : WorkbasketService(pro.taskana.WorkbasketService) WorkbasketSummary(pro.taskana.WorkbasketSummary) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 67 with WithAccessId

use of pro.taskana.security.WithAccessId in project taskana by Taskana.

the class QueryWorkbasketsWithPaginationAccTest method testWorkbasketQueryDomA.

@WithAccessId(userName = "teamlead_1", groupNames = { "group_1" })
@Test
public void testWorkbasketQueryDomA() throws SQLException, NotAuthorizedException, InvalidArgumentException {
    WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
    List<WorkbasketSummary> result = workbasketService.createWorkbasketQuery().domainIn("DOMAIN_A").list();
    assertThat(result.size(), equalTo(8));
}
Also used : WorkbasketService(pro.taskana.WorkbasketService) WorkbasketSummary(pro.taskana.WorkbasketSummary) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 68 with WithAccessId

use of pro.taskana.security.WithAccessId in project taskana by Taskana.

the class QueryWorkbasketsWithPaginationAccTest method testPaginationNullAndNegativeLimitsIgnoring.

@WithAccessId(userName = "teamlead_1", groupNames = { "group_1" })
@Test
public void testPaginationNullAndNegativeLimitsIgnoring() throws NotAuthorizedException {
    WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
    // 0 limit/size = 0 results
    int pageNumber = 2;
    int pageSize = 0;
    List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery().domainIn("DOMAIN_A").listPage(pageNumber, pageSize);
    assertThat(results.size(), equalTo(0));
    // Negative size will be 0 = 0 results
    pageNumber = 2;
    pageSize = -1;
    results = workbasketService.createWorkbasketQuery().domainIn("DOMAIN_A").listPage(pageNumber, pageSize);
    assertThat(results.size(), equalTo(0));
    // Negative page = first page
    pageNumber = -1;
    pageSize = 10;
    results = workbasketService.createWorkbasketQuery().domainIn("DOMAIN_A").listPage(pageNumber, pageSize);
    assertThat(results.size(), equalTo(8));
}
Also used : WorkbasketService(pro.taskana.WorkbasketService) WorkbasketSummary(pro.taskana.WorkbasketSummary) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 69 with WithAccessId

use of pro.taskana.security.WithAccessId in project taskana by Taskana.

the class QueryWorkbasketsWithPaginationAccTest method testCountOfWorkbasketQuery.

@WithAccessId(userName = "teamlead_1", groupNames = { "group_1" })
@Test
public void testCountOfWorkbasketQuery() throws SQLException, NotAuthorizedException, InvalidArgumentException {
    WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
    long count = workbasketService.createWorkbasketQuery().domainIn("DOMAIN_A").count();
    assertThat(count, equalTo(8L));
}
Also used : WorkbasketService(pro.taskana.WorkbasketService) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 70 with WithAccessId

use of pro.taskana.security.WithAccessId in project taskana by Taskana.

the class UpdateWorkbasketAuthorizationsAccTest method testDeleteAccessItemsForAccessIdWithUnusedValuesThrowingNoException.

@WithAccessId(userName = "teamlead_1", groupNames = { "businessadmin" })
@Test
public void testDeleteAccessItemsForAccessIdWithUnusedValuesThrowingNoException() throws NotAuthorizedException {
    WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
    workbasketService.deleteWorkbasketAccessItemsForAccessId("");
    workbasketService.deleteWorkbasketAccessItemsForAccessId(null);
    workbasketService.deleteWorkbasketAccessItemsForAccessId("123UNUSED456");
}
Also used : WorkbasketService(pro.taskana.WorkbasketService) 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