use of pro.taskana.WorkbasketService in project taskana by Taskana.
the class QueryWorkbasketsWithPaginationAccTest method testPaginationThrowingExceptionWhenPageOutOfBounds.
/**
* Testcase only for DB2 users, because H2 doesn´t throw a Exception when the offset is set to high.<br>
* Using DB2 should throw a unchecked RuntimeException for a offset which is out of bounds.
*
* @throws NotAuthorizedException
*/
@Ignore
@Test(expected = TaskanaRuntimeException.class)
public void testPaginationThrowingExceptionWhenPageOutOfBounds() throws SQLException, NotAuthorizedException, InvalidArgumentException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
// entrypoint set outside result amount
int pageNumber = 6;
int pageSize = 10;
workbasketService.createWorkbasketQuery().domainIn("DOMAIN_A").listPage(pageNumber, pageSize);
}
use of pro.taskana.WorkbasketService in project taskana by Taskana.
the class QueryWorkbasketsWithPaginationAccTest method testListOffsetAndLimitOutOfBounds.
@WithAccessId(userName = "teamlead_1", groupNames = { "group_1" })
@Test
public void testListOffsetAndLimitOutOfBounds() throws NotAuthorizedException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
// both will be 0, working
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery().domainIn("DOMAIN_A").list(-1, -3);
assertThat(results.size(), equalTo(0));
// limit will be 0
results = workbasketService.createWorkbasketQuery().domainIn("DOMAIN_A").list(1, -3);
assertThat(results.size(), equalTo(0));
// offset will be 0
results = workbasketService.createWorkbasketQuery().domainIn("DOMAIN_A").list(-1, 3);
assertThat(results.size(), equalTo(3));
}
use of pro.taskana.WorkbasketService in project taskana by Taskana.
the class UpdateWorkbasketAuthorizationsAccTest method testDeleteAccessItemsForAccessId.
@WithAccessId(userName = "teamlead_1", groupNames = { "businessadmin" })
@Test
public void testDeleteAccessItemsForAccessId() throws NotAuthorizedException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
final String accessId = "group_1";
final long accessIdCountBefore = workbasketService.createWorkbasketAccessItemQuery().accessIdIn(accessId).count();
workbasketService.deleteWorkbasketAccessItemsForAccessId(accessId);
final long accessIdCountAfter = workbasketService.createWorkbasketAccessItemQuery().accessIdIn(accessId).count();
assertTrue(accessIdCountBefore > accessIdCountAfter);
}
use of pro.taskana.WorkbasketService in project taskana by Taskana.
the class UpdateWorkbasketAuthorizationsAccTest method testUpdateWorkbasketAccessItemSucceeds.
@WithAccessId(userName = "teamlead_1", groupNames = { "group_1", "businessadmin" })
@Test
public void testUpdateWorkbasketAccessItemSucceeds() throws InvalidArgumentException, NotAuthorizedException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
WorkbasketAccessItem accessItem = workbasketService.newWorkbasketAccessItem("key1000000000000000000000000000000000000", "user1");
accessItem.setPermAppend(true);
accessItem.setPermCustom11(true);
accessItem.setPermRead(true);
accessItem = workbasketService.createWorkbasketAccessItem(accessItem);
accessItem.setPermCustom1(true);
accessItem.setPermAppend(false);
WorkbasketAccessItem updatedItem = workbasketService.updateWorkbasketAccessItem(accessItem);
Assert.assertEquals(false, updatedItem.isPermAppend());
Assert.assertEquals(true, updatedItem.isPermRead());
Assert.assertEquals(true, updatedItem.isPermCustom11());
Assert.assertEquals(true, updatedItem.isPermCustom1());
Assert.assertEquals(false, updatedItem.isPermCustom2());
}
use of pro.taskana.WorkbasketService in project taskana by Taskana.
the class UpdateWorkbasketAuthorizationsAccTest method testInsertAccessItemList.
@WithAccessId(userName = "teamlead_1", groupNames = { "group_1", "businessadmin" })
@Test
public void testInsertAccessItemList() throws InvalidArgumentException, NotAuthorizedException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
final String wbId = "WBI:100000000000000000000000000000000004";
List<WorkbasketAccessItem> accessItems = workbasketService.getWorkbasketAccessItems(wbId);
int countBefore = accessItems.size();
// update some values
WorkbasketAccessItem item0 = accessItems.get(0);
item0.setPermAppend(false);
item0.setPermOpen(false);
item0.setPermTransfer(false);
final String updateId0 = item0.getId();
// insert new entry
WorkbasketAccessItem newItem = workbasketService.newWorkbasketAccessItem(wbId, CurrentUserContext.getUserid());
newItem.setPermRead(true);
newItem.setPermOpen(true);
newItem.setPermCustom12(true);
accessItems.add(newItem);
workbasketService.setWorkbasketAccessItems(wbId, accessItems);
List<WorkbasketAccessItem> updatedAccessItems = workbasketService.getWorkbasketAccessItems(wbId);
int countAfter = updatedAccessItems.size();
assertTrue((countBefore + 1) == countAfter);
item0 = updatedAccessItems.stream().filter(i -> i.getId().equals(updateId0)).findFirst().get();
assertFalse(item0.isPermAppend());
assertFalse(item0.isPermOpen());
assertFalse(item0.isPermTransfer());
assertFalse(item0.isPermAppend());
assertFalse(item0.isPermTransfer());
}
Aggregations