Search in sources :

Example 1 with TaskSummary

use of pro.taskana.TaskSummary in project taskana by Taskana.

the class TaskServiceImplIntAutocommitTest method should_ReturnList_when_BuilderIsUsed.

@Test
public void should_ReturnList_when_BuilderIsUsed() throws SQLException, NotAuthorizedException, WorkbasketNotFoundException, ClassificationNotFoundException, ClassificationAlreadyExistException, TaskAlreadyExistException, InvalidWorkbasketException, InvalidArgumentException, SystemException, WorkbasketAlreadyExistException, DomainNotFoundException {
    Workbasket wb = workbasketService.newWorkbasket("key", "DOMAIN_A");
    wb.setName("workbasket");
    wb.setType(WorkbasketType.GROUP);
    taskanaEngine.getWorkbasketService().createWorkbasket(wb);
    Classification classification = classificationService.newClassification("TEST", "DOMAIN_A", "TASK");
    taskanaEngine.getClassificationService().createClassification(classification);
    Task task = taskServiceImpl.newTask(wb.getKey(), wb.getDomain());
    task.setName("Unit Test Task");
    task.setClassificationKey(classification.getKey());
    task.setPrimaryObjRef(JunitHelper.createDefaultObjRef());
    taskServiceImpl.createTask(task);
    List<TaskSummary> results = taskServiceImpl.createTaskQuery().nameIn("bla", "test").descriptionLike("test").priorityIn(1, 2, 2).stateIn(TaskState.CLAIMED).workbasketKeyDomainIn(new KeyDomain("asd", "novatec"), new KeyDomain("asdasdasd", "DOMAIN_A")).ownerIn("test", "test2", "bla").customAttributeIn("16", "test").classificationKeyIn("pId1", "pId2").primaryObjectReferenceCompanyIn("first comp", "sonstwo gmbh").primaryObjectReferenceSystemIn("sys").primaryObjectReferenceTypeIn("type1", "type2").primaryObjectReferenceSystemInstanceIn("sysInst1", "sysInst2").primaryObjectReferenceValueIn("val1", "val2", "val3").list();
    Assert.assertEquals(0, results.size());
}
Also used : Task(pro.taskana.Task) Classification(pro.taskana.Classification) TaskSummary(pro.taskana.TaskSummary) Workbasket(pro.taskana.Workbasket) KeyDomain(pro.taskana.KeyDomain) TaskanaEngineConfigurationTest(pro.taskana.impl.configuration.TaskanaEngineConfigurationTest) Test(org.junit.Test)

Example 2 with TaskSummary

use of pro.taskana.TaskSummary in project taskana by Taskana.

the class TaskQueryAccTest method testTaskQueryUser_1_1BusinessAdm.

@WithAccessId(userName = "user_1_1", groupNames = { "businessadmin" })
@Test
public void testTaskQueryUser_1_1BusinessAdm() {
    TaskService taskService = taskanaEngine.getTaskService();
    List<TaskSummary> results = taskService.createTaskQuery().ownerLike("%a%", "%u%").list();
    assertThat(results.size(), equalTo(3));
}
Also used : TaskService(pro.taskana.TaskService) TaskSummary(pro.taskana.TaskSummary) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 3 with TaskSummary

use of pro.taskana.TaskSummary in project taskana by Taskana.

the class TaskQueryAccTest method testTaskQueryUser_1_1.

@WithAccessId(// , groupNames = {"businessadmin"})
userName = "user_1_1")
@Test
public void testTaskQueryUser_1_1() {
    TaskService taskService = taskanaEngine.getTaskService();
    List<TaskSummary> results = taskService.createTaskQuery().ownerLike("%a%", "%u%").list();
    assertThat(results.size(), equalTo(3));
}
Also used : TaskService(pro.taskana.TaskService) TaskSummary(pro.taskana.TaskSummary) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 4 with TaskSummary

use of pro.taskana.TaskSummary in project taskana by Taskana.

the class TaskQueryAccTest method testTaskQueryUser_1_1Admin.

@WithAccessId(userName = "user_1_1", groupNames = { "admin" })
@Test
public void testTaskQueryUser_1_1Admin() {
    TaskService taskService = taskanaEngine.getTaskService();
    List<TaskSummary> results = taskService.createTaskQuery().ownerLike("%a%", "%u%").list();
    assertThat(results.size(), equalTo(25));
}
Also used : TaskService(pro.taskana.TaskService) TaskSummary(pro.taskana.TaskSummary) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 5 with TaskSummary

use of pro.taskana.TaskSummary in project taskana by Taskana.

the class QueryTasksAccTest method testQueryForClassificationKey.

@WithAccessId(userName = "teamlead_1", groupNames = { "group_1", "group_2" })
@Test
public void testQueryForClassificationKey() throws SQLException, NotAuthorizedException, InvalidArgumentException {
    TaskService taskService = taskanaEngine.getTaskService();
    List<TaskSummary> results = taskService.createTaskQuery().classificationKeyLike("L10%").list();
    assertThat(results.size(), equalTo(65));
    String[] ids = results.stream().map(t -> t.getClassificationSummary().getKey()).collect(Collectors.toList()).toArray(new String[0]);
    List<TaskSummary> result2 = taskService.createTaskQuery().classificationKeyIn(ids).list();
    assertThat(result2.size(), equalTo(65));
}
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)

Aggregations

TaskSummary (pro.taskana.TaskSummary)58 Test (org.junit.Test)48 TaskService (pro.taskana.TaskService)47 WithAccessId (pro.taskana.security.WithAccessId)45 AbstractAccTest (acceptance.AbstractAccTest)44 TaskanaEngineProxyForTest (pro.taskana.impl.TaskanaEngineProxyForTest)17 KeyDomain (pro.taskana.KeyDomain)14 InvalidArgumentException (pro.taskana.exceptions.InvalidArgumentException)14 Instant (java.time.Instant)9 ArrayList (java.util.ArrayList)8 TimeInterval (pro.taskana.TimeInterval)8 Classification (pro.taskana.Classification)5 Task (pro.taskana.Task)5 NotAuthorizedException (pro.taskana.exceptions.NotAuthorizedException)5 NotAuthorizedToQueryWorkbasketException (pro.taskana.exceptions.NotAuthorizedToQueryWorkbasketException)5 TaskQuery (pro.taskana.TaskQuery)4 Workbasket (pro.taskana.Workbasket)3 Arrays (java.util.Arrays)2 HashSet (java.util.HashSet)2 List (java.util.List)2