Search in sources :

Example 1 with KeyDomain

use of pro.taskana.KeyDomain 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 KeyDomain

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

the class QueryTasksAccTest method testQueryForWorkbasketKeyDomain.

@WithAccessId(userName = "teamlead_1", groupNames = { "group_1" })
@Test
public void testQueryForWorkbasketKeyDomain() throws SQLException, NotAuthorizedException, InvalidArgumentException {
    TaskService taskService = taskanaEngine.getTaskService();
    List<KeyDomain> workbasketIdentifiers = Arrays.asList(new KeyDomain("GPK_KSC", "DOMAIN_A"), new KeyDomain("USER_1_2", "DOMAIN_A"));
    List<TaskSummary> results = taskService.createTaskQuery().workbasketKeyDomainIn(workbasketIdentifiers.toArray(new KeyDomain[0])).list();
    assertThat(results.size(), equalTo(42));
    String[] ids = results.stream().map(t -> t.getWorkbasketSummary().getId()).collect(Collectors.toList()).toArray(new String[0]);
    List<TaskSummary> result2 = taskService.createTaskQuery().workbasketIdIn(ids).list();
    assertThat(result2.size(), equalTo(42));
}
Also used : TaskService(pro.taskana.TaskService) TaskSummary(pro.taskana.TaskSummary) KeyDomain(pro.taskana.KeyDomain) TaskanaEngineProxyForTest(pro.taskana.impl.TaskanaEngineProxyForTest) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 3 with KeyDomain

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

the class QueryTasksWithPaginationAccTest method testListOffsetAndLimitOutOfBounds.

@WithAccessId(userName = "teamlead_1", groupNames = { "group_1" })
@Test
public void testListOffsetAndLimitOutOfBounds() throws SQLException, NotAuthorizedException, InvalidArgumentException {
    TaskService taskService = taskanaEngine.getTaskService();
    // both will be 0, working
    List<TaskSummary> results = taskService.createTaskQuery().workbasketKeyDomainIn(new KeyDomain("GPK_KSC", "DOMAIN_A")).list(-1, -3);
    assertThat(results.size(), equalTo(0));
    // limit will be 0
    results = taskService.createTaskQuery().workbasketKeyDomainIn(new KeyDomain("GPK_KSC", "DOMAIN_A")).list(1, -3);
    assertThat(results.size(), equalTo(0));
    // offset will be 0
    results = taskService.createTaskQuery().workbasketKeyDomainIn(new KeyDomain("GPK_KSC", "DOMAIN_A")).list(-1, 3);
    assertThat(results.size(), equalTo(3));
}
Also used : TaskService(pro.taskana.TaskService) TaskSummary(pro.taskana.TaskSummary) KeyDomain(pro.taskana.KeyDomain) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 4 with KeyDomain

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

the class QueryTasksWithPaginationAccTest method testCountOfTaskQuery.

@WithAccessId(userName = "teamlead_1", groupNames = { "group_1" })
@Test
public void testCountOfTaskQuery() throws SQLException, NotAuthorizedException, InvalidArgumentException {
    TaskService taskService = taskanaEngine.getTaskService();
    long count = taskService.createTaskQuery().workbasketKeyDomainIn(new KeyDomain("GPK_KSC", "DOMAIN_A")).count();
    assertThat(count, equalTo(22L));
}
Also used : TaskService(pro.taskana.TaskService) KeyDomain(pro.taskana.KeyDomain) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 5 with KeyDomain

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

the class QueryTasksWithPaginationAccTest method testSecondPageOfTaskQueryWithOffset.

@WithAccessId(userName = "teamlead_1", groupNames = { "group_1" })
@Test
public void testSecondPageOfTaskQueryWithOffset() throws SQLException, NotAuthorizedException, InvalidArgumentException {
    TaskService taskService = taskanaEngine.getTaskService();
    List<TaskSummary> results = taskService.createTaskQuery().workbasketKeyDomainIn(new KeyDomain("GPK_KSC", "DOMAIN_A")).list(10, 10);
    assertThat(results.size(), equalTo(10));
}
Also used : TaskService(pro.taskana.TaskService) TaskSummary(pro.taskana.TaskSummary) KeyDomain(pro.taskana.KeyDomain) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Aggregations

Test (org.junit.Test)18 KeyDomain (pro.taskana.KeyDomain)18 WithAccessId (pro.taskana.security.WithAccessId)17 AbstractAccTest (acceptance.AbstractAccTest)16 TaskService (pro.taskana.TaskService)16 TaskSummary (pro.taskana.TaskSummary)14 Ignore (org.junit.Ignore)3 Task (pro.taskana.Task)3 Classification (pro.taskana.Classification)2 TaskanaEngineConfigurationTest (pro.taskana.impl.configuration.TaskanaEngineConfigurationTest)2 Connection (java.sql.Connection)1 Workbasket (pro.taskana.Workbasket)1 WorkbasketAccessItem (pro.taskana.WorkbasketAccessItem)1 WorkbasketService (pro.taskana.WorkbasketService)1 NotAuthorizedToQueryWorkbasketException (pro.taskana.exceptions.NotAuthorizedToQueryWorkbasketException)1 TaskanaEngineProxyForTest (pro.taskana.impl.TaskanaEngineProxyForTest)1 WorkbasketImpl (pro.taskana.impl.WorkbasketImpl)1