use of pro.taskana.security.WithAccessId in project taskana by Taskana.
the class TaskServiceImplIntExplicitTest method testCreateTask.
@WithAccessId(userName = "Elena", groupNames = { "businessadmin" })
@Test
public void testCreateTask() throws FileNotFoundException, SQLException, TaskNotFoundException, NotAuthorizedException, WorkbasketNotFoundException, ClassificationNotFoundException, ClassificationAlreadyExistException, TaskAlreadyExistException, InvalidWorkbasketException, InvalidArgumentException, WorkbasketAlreadyExistException, DomainNotFoundException {
Connection connection = dataSource.getConnection();
taskanaEngineImpl.setConnection(connection);
generateSampleAccessItems();
Task task = this.generateDummyTask();
connection.commit();
WorkbasketAccessItem accessItem = workbasketService.newWorkbasketAccessItem("wb", "Elena");
accessItem.setPermAppend(true);
accessItem.setPermRead(true);
accessItem.setPermOpen(true);
workbasketService.createWorkbasketAccessItem(accessItem);
task.setPrimaryObjRef(JunitHelper.createDefaultObjRef());
task = taskServiceImpl.createTask(task);
// needed so that the change is visible in the other session
connection.commit();
TaskanaEngine te2 = taskanaEngineConfiguration.buildTaskanaEngine();
TaskServiceImpl taskServiceImpl2 = (TaskServiceImpl) te2.getTaskService();
Task resultTask = taskServiceImpl2.getTask(task.getId());
Assert.assertNotNull(resultTask);
connection.commit();
}
use of pro.taskana.security.WithAccessId in project taskana by Taskana.
the class WorkbasketServiceImplIntExplicitTest method testInsertWorkbasketAccessUser.
@WithAccessId(userName = "Elena", groupNames = { "businessadmin" })
@Test
public void testInsertWorkbasketAccessUser() throws NotAuthorizedException, SQLException, InvalidArgumentException {
Connection connection = dataSource.getConnection();
taskanaEngineImpl.setConnection(connection);
workBasketService = taskanaEngine.getWorkbasketService();
WorkbasketAccessItem accessItem = workBasketService.newWorkbasketAccessItem("Key1", "Arthur Dent");
accessItem.setPermOpen(true);
accessItem.setPermRead(true);
workBasketService.createWorkbasketAccessItem(accessItem);
Assert.assertEquals(1, workBasketService.getWorkbasketAccessItems("Key1").size());
connection.commit();
}
use of pro.taskana.security.WithAccessId 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());
}
use of pro.taskana.security.WithAccessId in project taskana by Taskana.
the class QueryWorkbasketAccTest method testQueryWorkbasketByNameContainsCaseInsensitive.
@WithAccessId(userName = "teamlead_1", groupNames = { "group_1" })
@Test
public void testQueryWorkbasketByNameContainsCaseInsensitive() throws SQLException, NotAuthorizedException, InvalidArgumentException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery().nameLike("%TEAMLEAD%").list();
Assert.assertEquals(2L, results.size());
}
use of pro.taskana.security.WithAccessId in project taskana by Taskana.
the class QueryWorkbasketAccTest method testQueryWorkbasketByKeyContainsIgnoreCase.
@WithAccessId(userName = "teamlead_1", groupNames = { "group_1" })
@Test
public void testQueryWorkbasketByKeyContainsIgnoreCase() throws SQLException, NotAuthorizedException, InvalidArgumentException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery().keyLike("%kSc%").list();
Assert.assertEquals(3L, results.size());
}
Aggregations