use of org.activiti.engine.task.TaskQuery in project Activiti by Activiti.
the class TaskQueryTest method testQueryByInvalidDescriptionOr.
public void testQueryByInvalidDescriptionOr() {
TaskQuery query = taskService.createTaskQuery().or().taskId("invalid").taskDescription("invalid");
assertNull(query.singleResult());
assertEquals(0, query.list().size());
assertEquals(0, query.count());
try {
taskService.createTaskQuery().or().taskId("invalid").taskDescription(null).list();
fail();
} catch (ActivitiIllegalArgumentException e) {
}
}
use of org.activiti.engine.task.TaskQuery in project Activiti by Activiti.
the class TaskQueryTest method testQueryByUnassignedOr.
public void testQueryByUnassignedOr() {
TaskQuery query = taskService.createTaskQuery().or().taskId("invalid").taskUnassigned();
assertEquals(11, query.count());
assertEquals(11, query.list().size());
}
use of org.activiti.engine.task.TaskQuery in project Activiti by Activiti.
the class TaskQueryTest method testQueryByInvalidTaskIdOr.
public void testQueryByInvalidTaskIdOr() {
TaskQuery query = taskService.createTaskQuery().or().taskId("invalid").taskName("invalid");
assertNull(query.singleResult());
assertEquals(0, query.list().size());
assertEquals(0, query.count());
try {
taskService.createTaskQuery().taskId(null);
fail("expected exception");
} catch (ActivitiIllegalArgumentException e) {
// OK
}
}
use of org.activiti.engine.task.TaskQuery in project Activiti by Activiti.
the class TaskQueryTest method testQueryByCandidateOrAssignedOr.
public void testQueryByCandidateOrAssignedOr() {
TaskQuery query = taskService.createTaskQuery().or().taskId("invalid").taskCandidateOrAssigned("kermit");
assertEquals(11, query.count());
List<Task> tasks = query.list();
assertEquals(11, tasks.size());
// if dbIdentityUsed set false in process engine configuration of using custom session factory of GroupIdentityManager
ArrayList<String> candidateGroups = new ArrayList<String>();
candidateGroups.add("management");
candidateGroups.add("accountancy");
candidateGroups.add("noexist");
query = taskService.createTaskQuery().or().taskId("invalid").taskCandidateGroupIn(candidateGroups).taskCandidateOrAssigned("kermit");
assertEquals(11, query.count());
tasks = query.list();
assertEquals(11, tasks.size());
query = taskService.createTaskQuery().or().taskId("invalid").taskCandidateOrAssigned("fozzie");
assertEquals(3, query.count());
assertEquals(3, query.list().size());
// create a new task that no identity link and assignee to kermit
Task task = taskService.newTask();
task.setName("assigneeToKermit");
task.setDescription("testTask description");
task.setPriority(3);
task.setAssignee("kermit");
taskService.saveTask(task);
query = taskService.createTaskQuery().or().taskId("invalid").taskCandidateOrAssigned("kermit");
assertEquals(12, query.count());
tasks = query.list();
assertEquals(12, tasks.size());
Task assigneeToKermit = taskService.createTaskQuery().or().taskId("invalid").taskName("assigneeToKermit").singleResult();
taskService.deleteTask(assigneeToKermit.getId());
if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.AUDIT)) {
historyService.deleteHistoricTaskInstance(assigneeToKermit.getId());
}
}
use of org.activiti.engine.task.TaskQuery in project Activiti by Activiti.
the class TaskQueryTest method testQueryByNameIn.
public void testQueryByNameIn() {
final List<String> taskNameList = new ArrayList<String>(2);
taskNameList.add("testTask");
taskNameList.add("gonzoTask");
TaskQuery query = taskService.createTaskQuery().taskNameIn(taskNameList);
assertEquals(7, query.list().size());
assertEquals(7, query.count());
try {
query.singleResult();
fail("expected exception");
} catch (ActivitiException e) {
// OK
}
}
Aggregations