use of pro.taskana.WorkbasketSummary in project taskana by Taskana.
the class DistributionTargetsAccTest method testSetDistributionTargets.
@WithAccessId(userName = "user_2_2", groupNames = { "group_1", "group_2", "businessadmin" })
@Test
public void testSetDistributionTargets() throws NotAuthorizedException, WorkbasketNotFoundException, InvalidWorkbasketException, SQLException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
Workbasket sourceWorkbasket = workbasketService.getWorkbasket("GPK_KSC_1", "DOMAIN_A");
List<WorkbasketSummary> initialDistributionTargets = workbasketService.getDistributionTargets(sourceWorkbasket.getId());
assertEquals(4, initialDistributionTargets.size());
List<WorkbasketSummary> newDistributionTargets = workbasketService.createWorkbasketQuery().keyIn("USER_1_1", "GPK_B_KSC_1").list();
assertEquals(2, newDistributionTargets.size());
List<String> newDistributionTargetIds = newDistributionTargets.stream().map(t -> t.getId()).collect(Collectors.toList());
workbasketService.setDistributionTargets(sourceWorkbasket.getId(), newDistributionTargetIds);
List<WorkbasketSummary> changedTargets = workbasketService.getDistributionTargets(sourceWorkbasket.getId());
assertEquals(2, changedTargets.size());
// reset DB to original state
resetDb(false);
}
use of pro.taskana.WorkbasketSummary in project taskana by Taskana.
the class DistributionTargetsAccTest method testGetDistributionTargetsSucceedsById.
@WithAccessId(userName = "user_1_1", groupNames = { "teamlead_1" })
@Test
public void testGetDistributionTargetsSucceedsById() throws NotAuthorizedException, WorkbasketNotFoundException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
WorkbasketSummary workbasketSummary = workbasketService.createWorkbasketQuery().keyIn("GPK_KSC").single();
List<WorkbasketSummary> retrievedDistributionTargets = workbasketService.getDistributionTargets(workbasketSummary.getId());
assertEquals(4, retrievedDistributionTargets.size());
List<String> expectedTargetIds = new ArrayList<>(Arrays.asList("WBI:100000000000000000000000000000000002", "WBI:100000000000000000000000000000000003", "WBI:100000000000000000000000000000000004", "WBI:100000000000000000000000000000000005"));
for (WorkbasketSummary wbSummary : retrievedDistributionTargets) {
assertTrue(expectedTargetIds.contains(wbSummary.getId()));
}
}
use of pro.taskana.WorkbasketSummary 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.WorkbasketSummary 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.WorkbasketSummary 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());
}
Aggregations