use of org.camunda.bpm.engine.task.TaskQuery in project camunda-bpm-platform by camunda.
the class FilterTaskQueryTest method testExtendTaskQuery_ORInBothExtendedAndExtendingQuery.
public void testExtendTaskQuery_ORInBothExtendedAndExtendingQuery() {
// given
createTasksForOrQueries();
// when
TaskQuery extendedQuery = taskService.createTaskQuery().or().taskName("taskForOr").taskDescription("aTaskDescription").endOr();
Filter extendedFilter = filterService.newTaskFilter("extendedOrFilter");
extendedFilter.setQuery(extendedQuery);
filterService.saveFilter(extendedFilter);
TaskQuery extendingQuery = taskService.createTaskQuery().or().tenantIdIn("aTenantId").taskOwner("aTaskOwner").endOr().or().taskPriority(3).taskAssignee("aTaskAssignee").endOr();
// then
assertEquals(6, extendedQuery.list().size());
assertEquals(6, filterService.list(extendedFilter.getId()).size());
assertEquals(4, extendingQuery.list().size());
assertEquals(3, filterService.list(extendedFilter.getId(), extendingQuery).size());
}
use of org.camunda.bpm.engine.task.TaskQuery in project camunda-bpm-platform by camunda.
the class FilterTaskQueryTest method testTaskQueryLookupByNameLikeCaseInsensitive.
/**
* CAM-6165
*
* Verify that search by name like returns case insensitive results
*/
public void testTaskQueryLookupByNameLikeCaseInsensitive() {
TaskQuery query = taskService.createTaskQuery();
query.taskNameLike("%task%");
saveQuery(query);
List<Task> tasks = filterService.list(filter.getId());
assertNotNull(tasks);
assertThat(tasks.size(), is(3));
query = taskService.createTaskQuery();
query.taskNameLike("%Task%");
saveQuery(query);
tasks = filterService.list(filter.getId());
assertNotNull(tasks);
assertThat(tasks.size(), is(3));
}
use of org.camunda.bpm.engine.task.TaskQuery in project camunda-bpm-platform by camunda.
the class FilterTaskQueryTest method testInitializeFormKeysEnabled.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/task/oneTaskWithFormKeyProcess.bpmn20.xml" })
public void testInitializeFormKeysEnabled() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("testProcess");
TaskQuery query = taskService.createTaskQuery().processInstanceId(processInstance.getId());
saveQuery(query);
Task task = (Task) filterService.list(filter.getId()).get(0);
assertEquals("exampleFormKey", task.getFormKey());
task = filterService.singleResult(filter.getId());
assertEquals("exampleFormKey", task.getFormKey());
runtimeService.deleteProcessInstance(processInstance.getId(), "test");
}
use of org.camunda.bpm.engine.task.TaskQuery in project camunda-bpm-platform by camunda.
the class FilterTaskQueryTest method testExtendingTaskQueryList.
public void testExtendingTaskQueryList() {
TaskQuery query = taskService.createTaskQuery();
saveQuery(query);
List<Task> tasks = filterService.list(filter.getId());
assertEquals(3, tasks.size());
tasks = filterService.list(filter.getId(), query);
assertEquals(3, tasks.size());
TaskQuery extendingQuery = taskService.createTaskQuery();
extendingQuery.taskDelegationState(DelegationState.RESOLVED);
tasks = filterService.list(filter.getId(), extendingQuery);
assertEquals(2, tasks.size());
for (Task task : tasks) {
assertEquals(DelegationState.RESOLVED, task.getDelegationState());
}
}
use of org.camunda.bpm.engine.task.TaskQuery in project camunda-bpm-platform by camunda.
the class FilterTaskQueryTest method testTaskQueryByFollowUpBeforeOrNotExistentExtendingQuery.
public void testTaskQueryByFollowUpBeforeOrNotExistentExtendingQuery() {
// create query
TaskQueryImpl query = new TaskQueryImpl();
query.followUpBeforeOrNotExistent(testDate);
// save filter without query
filterService.saveFilter(filter);
// fetch from db
filter = filterService.createTaskFilterQuery().singleResult();
// use query as extending query
List<Task> tasks = filterService.list(filter.getId(), query);
assertEquals(3, tasks.size());
// set as filter query and save filter
filter.setQuery(query);
filterService.saveFilter(filter);
// fetch from db
filter = filterService.createTaskFilterQuery().singleResult();
tasks = filterService.list(filter.getId());
assertEquals(3, tasks.size());
TaskQuery extendingQuery = taskService.createTaskQuery();
extendingQuery.orderByTaskCreateTime().asc();
tasks = filterService.list(filter.getId(), extendingQuery);
assertEquals(3, tasks.size());
}
Aggregations