use of pro.taskana.WorkbasketService in project taskana by Taskana.
the class CreateWorkbasketAccTest method testCreateWorkbasketWithMissingRequiredField.
@WithAccessId(userName = "dummy", groupNames = { "businessadmin" })
@Test
public void testCreateWorkbasketWithMissingRequiredField() throws WorkbasketNotFoundException, NotAuthorizedException, WorkbasketAlreadyExistException, DomainNotFoundException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
Workbasket workbasket = workbasketService.newWorkbasket(null, "novatec");
workbasket.setName("Megabasket");
workbasket.setType(WorkbasketType.GROUP);
workbasket.setOrgLevel1("company");
try {
// missing key
workbasketService.createWorkbasket(workbasket);
fail("InvalidWorkbasketException was expected");
} catch (InvalidWorkbasketException e) {
}
workbasket = workbasketService.newWorkbasket("key", "novatec");
workbasket.setType(WorkbasketType.GROUP);
workbasket.setOrgLevel1("company");
try {
// missing name
workbasketService.createWorkbasket(workbasket);
fail("InvalidWorkbasketException was expected");
} catch (InvalidWorkbasketException e) {
}
workbasket = workbasketService.newWorkbasket("key", "novatec");
workbasket.setName("Megabasket");
workbasket.setOrgLevel1("company");
try {
// missing type
workbasketService.createWorkbasket(workbasket);
fail("InvalidWorkbasketException was expected");
} catch (InvalidWorkbasketException e) {
}
workbasket = workbasketService.newWorkbasket("key", null);
workbasket.setName("Megabasket");
workbasket.setType(WorkbasketType.GROUP);
workbasket.setOrgLevel1("company");
try {
// missing domain
workbasketService.createWorkbasket(workbasket);
fail("InvalidWorkbasketException was expected");
} catch (InvalidWorkbasketException e) {
}
}
use of pro.taskana.WorkbasketService in project taskana by Taskana.
the class WorkbasketQueryAccTest method testQueryWorkbasketByBusinessAdmin.
@WithAccessId(userName = "unknown", groupNames = "businessadmin")
@Test
public void testQueryWorkbasketByBusinessAdmin() throws SQLException, NotAuthorizedException, InvalidArgumentException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery().nameLike("%").list();
Assert.assertEquals(24L, results.size());
results = workbasketService.createWorkbasketQuery().nameLike("%").accessIdsHavePermission(WorkbasketPermission.TRANSFER, "teamlead_1", "group_1", "group_2").list();
Assert.assertEquals(13L, results.size());
}
use of pro.taskana.WorkbasketService in project taskana by Taskana.
the class WorkbasketQueryAccTest method testQueryWorkbasketByUnknownUser.
@WithAccessId(userName = "unknown")
@Test
public void testQueryWorkbasketByUnknownUser() throws SQLException, NotAuthorizedException, InvalidArgumentException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery().nameLike("%").list();
Assert.assertEquals(0L, results.size());
try {
results = workbasketService.createWorkbasketQuery().nameLike("%").accessIdsHavePermission(WorkbasketPermission.TRANSFER, "teamlead_1", "group_1", "group_2").list();
Assert.fail("NotAuthrorizedException was expected");
} catch (NotAuthorizedException ex) {
}
}
use of pro.taskana.WorkbasketService in project taskana by Taskana.
the class WorkbasketQueryAccTest 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("%").list();
Assert.assertEquals(24L, results.size());
results = workbasketService.createWorkbasketQuery().nameLike("%").accessIdsHavePermission(WorkbasketPermission.TRANSFER, "teamlead_1", "group_1", "group_2").list();
Assert.assertEquals(13L, results.size());
}
Aggregations