Search in sources :

Example 51 with WithAccessId

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();
}
Also used : Task(pro.taskana.Task) TaskanaEngine(pro.taskana.TaskanaEngine) WorkbasketAccessItem(pro.taskana.WorkbasketAccessItem) Connection(java.sql.Connection) TaskServiceImpl(pro.taskana.impl.TaskServiceImpl) TaskanaEngineConfigurationTest(pro.taskana.impl.configuration.TaskanaEngineConfigurationTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 52 with WithAccessId

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();
}
Also used : WorkbasketAccessItem(pro.taskana.WorkbasketAccessItem) Connection(java.sql.Connection) TaskanaEngineConfigurationTest(pro.taskana.impl.configuration.TaskanaEngineConfigurationTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 53 with WithAccessId

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());
}
Also used : WorkbasketService(pro.taskana.WorkbasketService) WorkbasketSummary(pro.taskana.WorkbasketSummary) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 54 with WithAccessId

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());
}
Also used : WorkbasketService(pro.taskana.WorkbasketService) WorkbasketSummary(pro.taskana.WorkbasketSummary) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 55 with WithAccessId

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());
}
Also used : WorkbasketService(pro.taskana.WorkbasketService) WorkbasketSummary(pro.taskana.WorkbasketSummary) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Aggregations

Test (org.junit.Test)216 WithAccessId (pro.taskana.security.WithAccessId)216 AbstractAccTest (acceptance.AbstractAccTest)201 TaskService (pro.taskana.TaskService)100 WorkbasketService (pro.taskana.WorkbasketService)78 Task (pro.taskana.Task)57 WorkbasketSummary (pro.taskana.WorkbasketSummary)51 TaskSummary (pro.taskana.TaskSummary)47 TaskanaEngineProxyForTest (pro.taskana.impl.TaskanaEngineProxyForTest)34 Workbasket (pro.taskana.Workbasket)23 Classification (pro.taskana.Classification)21 KeyDomain (pro.taskana.KeyDomain)19 InvalidArgumentException (pro.taskana.exceptions.InvalidArgumentException)19 ArrayList (java.util.ArrayList)17 Instant (java.time.Instant)16 WorkbasketAccessItem (pro.taskana.WorkbasketAccessItem)16 TaskanaEngineConfigurationTest (pro.taskana.impl.configuration.TaskanaEngineConfigurationTest)15 Connection (java.sql.Connection)10 NotAuthorizedException (pro.taskana.exceptions.NotAuthorizedException)9 TimeInterval (pro.taskana.TimeInterval)8