Search in sources :

Example 31 with WithAccessId

use of pro.taskana.security.WithAccessId in project taskana by Taskana.

the class QueryTasksAccTest method testQueryForName.

@WithAccessId(userName = "teamlead_1", groupNames = { "group_1", "group_2" })
@Test
public void testQueryForName() throws SQLException, NotAuthorizedException, InvalidArgumentException {
    TaskService taskService = taskanaEngine.getTaskService();
    List<TaskSummary> results = taskService.createTaskQuery().nameLike("task%").list();
    assertThat(results.size(), equalTo(6));
    String[] ids = results.stream().map(TaskSummary::getName).collect(Collectors.toList()).toArray(new String[0]);
    List<TaskSummary> result2 = taskService.createTaskQuery().nameIn(ids).list();
    assertThat(result2.size(), equalTo(6));
}
Also used : TaskService(pro.taskana.TaskService) TaskSummary(pro.taskana.TaskSummary) TaskanaEngineProxyForTest(pro.taskana.impl.TaskanaEngineProxyForTest) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 32 with WithAccessId

use of pro.taskana.security.WithAccessId in project taskana by Taskana.

the class QueryTasksAccTest method testQueryForOwnerLike.

@WithAccessId(userName = "teamlead_1", groupNames = { "group_1", "group_2" })
@Test
public void testQueryForOwnerLike() throws SQLException, NotAuthorizedException, InvalidArgumentException {
    TaskService taskService = taskanaEngine.getTaskService();
    List<TaskSummary> results = taskService.createTaskQuery().ownerLike("%a%", "%u%").orderByCreated(asc).list();
    assertThat(results.size(), equalTo(25));
    TaskSummary previousSummary = null;
    for (TaskSummary taskSummary : results) {
        if (previousSummary != null) {
            Assert.assertTrue(!previousSummary.getCreated().isAfter(taskSummary.getCreated()));
        }
        previousSummary = taskSummary;
    }
}
Also used : TaskService(pro.taskana.TaskService) TaskSummary(pro.taskana.TaskSummary) TaskanaEngineProxyForTest(pro.taskana.impl.TaskanaEngineProxyForTest) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 33 with WithAccessId

use of pro.taskana.security.WithAccessId in project taskana by Taskana.

the class QueryTasksAccTest method testQueryForCustom8.

@WithAccessId(userName = "teamlead_1", groupNames = { "group_1" })
@Test
public void testQueryForCustom8() throws SQLException, NotAuthorizedException, InvalidArgumentException {
    TaskService taskService = taskanaEngine.getTaskService();
    List<TaskSummary> results = taskService.createTaskQuery().customAttributeLike("8", "%a%", "%b%", "%c%", "%d%", "%e%", "%f%", "%g%", "%h%", "%i%", "%j%", "%k%", "%l%", "%m%", "%n%", "%o%", "%p%", "%q%", "%r%", "%s%", "%w%").list();
    assertThat(results.size(), equalTo(1));
    String[] ids = results.stream().map(t -> {
        try {
            return t.getCustomAttribute("8");
        } catch (InvalidArgumentException e) {
            e.printStackTrace();
            return "";
        }
    }).collect(Collectors.toList()).toArray(new String[0]);
    List<TaskSummary> result2 = taskService.createTaskQuery().customAttributeIn("8", ids).list();
    assertThat(result2.size(), equalTo(1));
}
Also used : InvalidArgumentException(pro.taskana.exceptions.InvalidArgumentException) TaskService(pro.taskana.TaskService) TaskSummary(pro.taskana.TaskSummary) TaskanaEngineProxyForTest(pro.taskana.impl.TaskanaEngineProxyForTest) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 34 with WithAccessId

use of pro.taskana.security.WithAccessId in project taskana by Taskana.

the class QueryTasksAccTest method testQueryForParentBusinessProcessId.

@WithAccessId(userName = "teamlead_1", groupNames = { "group_1", "group_2" })
@Test
public void testQueryForParentBusinessProcessId() throws SQLException, NotAuthorizedException, InvalidArgumentException {
    TaskService taskService = taskanaEngine.getTaskService();
    List<TaskSummary> results = taskService.createTaskQuery().parentBusinessProcessIdLike("%PBPI%", "doc%3%").list();
    assertThat(results.size(), equalTo(24));
    String[] parentIds = results.stream().map(TaskSummary::getParentBusinessProcessId).collect(Collectors.toList()).toArray(new String[0]);
    List<TaskSummary> result2 = taskService.createTaskQuery().parentBusinessProcessIdIn(parentIds).list();
    assertThat(result2.size(), equalTo(24));
}
Also used : TaskService(pro.taskana.TaskService) TaskSummary(pro.taskana.TaskSummary) TaskanaEngineProxyForTest(pro.taskana.impl.TaskanaEngineProxyForTest) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 35 with WithAccessId

use of pro.taskana.security.WithAccessId in project taskana by Taskana.

the class QueryTasksAccTest method testQueryForCustom4.

@WithAccessId(userName = "teamlead_1", groupNames = { "group_1" })
@Test
public void testQueryForCustom4() throws SQLException, NotAuthorizedException, InvalidArgumentException {
    TaskService taskService = taskanaEngine.getTaskService();
    List<TaskSummary> results = taskService.createTaskQuery().customAttributeLike("4", "%a%", "%b%", "%c%", "%d%", "%e%", "%f%", "%g%", "%h%", "%i%", "%j%", "%k%", "%l%", "%m%", "%n%", "%o%", "%p%", "%q%", "%r%", "%s%", "%w%").list();
    assertThat(results.size(), equalTo(1));
    String[] ids = results.stream().map(t -> {
        try {
            return t.getCustomAttribute("4");
        } catch (InvalidArgumentException e) {
            e.printStackTrace();
            return "";
        }
    }).collect(Collectors.toList()).toArray(new String[0]);
    List<TaskSummary> result2 = taskService.createTaskQuery().customAttributeIn("4", ids).list();
    assertThat(result2.size(), equalTo(1));
}
Also used : InvalidArgumentException(pro.taskana.exceptions.InvalidArgumentException) TaskService(pro.taskana.TaskService) TaskSummary(pro.taskana.TaskSummary) TaskanaEngineProxyForTest(pro.taskana.impl.TaskanaEngineProxyForTest) 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