use of pro.taskana.WorkbasketService in project taskana by Taskana.
the class CreateWorkbasketAccTest method testCreateWorkbasketNotAuthorized.
@WithAccessId(userName = "dummy")
@Test(expected = NotAuthorizedException.class)
public void testCreateWorkbasketNotAuthorized() throws SQLException, NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException, InvalidWorkbasketException, WorkbasketAlreadyExistException, DomainNotFoundException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
Workbasket workbasket = workbasketService.newWorkbasket("key3", "DOMAIN_A");
workbasket.setName("Megabasket");
workbasket.setType(WorkbasketType.GROUP);
workbasket.setOrgLevel1("company");
workbasketService.createWorkbasket(workbasket);
fail("NotAuthorizedException should have been thrown");
}
use of pro.taskana.WorkbasketService in project taskana by Taskana.
the class CreateWorkbasketAccTest method testCreateWorkbasketWithInvalidDomain.
@WithAccessId(userName = "user_1_2", groupNames = { "businessadmin" })
@Test(expected = DomainNotFoundException.class)
public void testCreateWorkbasketWithInvalidDomain() throws SQLException, NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException, InvalidWorkbasketException, WorkbasketAlreadyExistException, DomainNotFoundException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
Workbasket workbasket = workbasketService.newWorkbasket("key3", "UNKNOWN_DOMAIN");
workbasket.setName("Megabasket");
workbasket.setType(WorkbasketType.GROUP);
workbasket.setOrgLevel1("company");
workbasketService.createWorkbasket(workbasket);
fail("DomainNotFoundException should have been thrown");
}
use of pro.taskana.WorkbasketService in project taskana by Taskana.
the class WorkbasketQueryAccTest method testQueryWorkbasketByUnauthenticated.
@Test
public void testQueryWorkbasketByUnauthenticated() 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 CreateTaskAccTest method testSetDomainFromWorkbasket.
@WithAccessId(userName = "user_1_1", groupNames = { "group_1" })
@Test
public void testSetDomainFromWorkbasket() throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException {
TaskService taskService = taskanaEngine.getTaskService();
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
Workbasket workbasket = workbasketService.getWorkbasket("USER_1_1", "DOMAIN_A");
Task newTask = taskService.newTask("WBI:100000000000000000000000000000000006");
newTask.setClassificationKey("T2100");
newTask.setPrimaryObjRef(createObjectReference("COMPANY_A", "SYSTEM_A", "INSTANCE_A", "VNR", "1234567"));
Task createdTask = taskService.createTask(newTask);
assertNotNull(createdTask);
assertThat(createdTask.getCreator(), equalTo(CurrentUserContext.getUserid()));
assertNotNull(createdTask.getDomain());
assertEquals(workbasket.getDomain(), createdTask.getDomain());
}
use of pro.taskana.WorkbasketService in project taskana by Taskana.
the class QueryWorkbasketAccTest method testQueryWorkbasketByOwnerLike.
@WithAccessId(userName = "teamlead_1", groupNames = { "group_1" })
@Test
public void testQueryWorkbasketByOwnerLike() throws SQLException, NotAuthorizedException, InvalidArgumentException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery().ownerLike("%an%", "%te%").orderByOwner(asc).list();
Assert.assertEquals(1L, results.size());
}
Aggregations