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());
}
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));
}
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));
}
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));
}
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));
}
Aggregations