use of pro.taskana.WorkbasketService in project taskana by Taskana.
the class QueryWorkbasketAccTest method testQueryAllForAdminMultipleTimes.
@WithAccessId(userName = "teamlead_1", groupNames = { "admin" })
@Test
public void testQueryAllForAdminMultipleTimes() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
WorkbasketQuery query = workbasketService.createWorkbasketQuery();
long count = query.count();
assertTrue(count == 24);
List<WorkbasketSummary> workbaskets = query.list();
assertNotNull(workbaskets);
assertEquals(count, workbaskets.size());
workbaskets = query.list();
assertNotNull(workbaskets);
assertEquals(count, workbaskets.size());
}
use of pro.taskana.WorkbasketService in project taskana by Taskana.
the class QueryWorkbasketAccTest method testQueryAllForUserMultipleTimes.
@WithAccessId(userName = "teamlead_1", groupNames = { "group_1_1" })
@Test
public void testQueryAllForUserMultipleTimes() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
WorkbasketQuery query = workbasketService.createWorkbasketQuery();
long count = query.count();
assertEquals(3, count);
List<WorkbasketSummary> workbaskets = query.list();
assertNotNull(workbaskets);
assertEquals(count, workbaskets.size());
workbaskets = query.list();
assertNotNull(workbaskets);
assertEquals(count, workbaskets.size());
}
use of pro.taskana.WorkbasketService in project taskana by Taskana.
the class QueryWorkbasketAccTest method testQueryWorkbasketByDomain.
@WithAccessId(userName = "teamlead_1", groupNames = { "group_1" })
@Test
public void testQueryWorkbasketByDomain() throws SQLException, NotAuthorizedException, InvalidArgumentException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery().domainIn("DOMAIN_B").list();
Assert.assertEquals(1L, results.size());
}
use of pro.taskana.WorkbasketService in project taskana by Taskana.
the class QueryWorkbasketAccTest method testQueryWorkbasketByAdmin.
@WithAccessId(userName = "unknown", groupNames = "admin")
@Test
public void testQueryWorkbasketByAdmin() throws SQLException, NotAuthorizedException, InvalidArgumentException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery().nameLike("%").orderByName(desc).list();
Assert.assertEquals(24L, 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;
}
results = workbasketService.createWorkbasketQuery().nameLike("%").accessIdsHavePermission(WorkbasketPermission.TRANSFER, "teamlead_1", "group_1", "group_2").orderByName(desc).list();
Assert.assertEquals(13L, results.size());
}
use of pro.taskana.WorkbasketService in project taskana by Taskana.
the class CreateWorkbasketAccTest method testCreateWorkbasket.
@WithAccessId(userName = "user_1_2", groupNames = { "businessadmin" })
@Test
public void testCreateWorkbasket() throws SQLException, NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException, InvalidWorkbasketException, WorkbasketAlreadyExistException, DomainNotFoundException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
int before = workbasketService.createWorkbasketQuery().domainIn("DOMAIN_A").list().size();
Workbasket workbasket = workbasketService.newWorkbasket("NT1234", "DOMAIN_A");
workbasket.setName("Megabasket");
workbasket.setType(WorkbasketType.GROUP);
workbasket.setOrgLevel1("company");
workbasket = workbasketService.createWorkbasket(workbasket);
WorkbasketAccessItem wbai = workbasketService.newWorkbasketAccessItem(workbasket.getId(), "user_1_2");
wbai.setPermRead(true);
workbasketService.createWorkbasketAccessItem(wbai);
int after = workbasketService.createWorkbasketQuery().domainIn("DOMAIN_A").list().size();
assertEquals(before + 1, after);
Workbasket createdWorkbasket = workbasketService.getWorkbasket("NT1234", "DOMAIN_A");
assertNotNull(createdWorkbasket);
assertNotNull(createdWorkbasket.getId());
Workbasket createdWorkbasket2 = workbasketService.getWorkbasket(createdWorkbasket.getId());
assertNotNull(createdWorkbasket);
assertEquals(createdWorkbasket, createdWorkbasket2);
}
Aggregations