use of org.activiti.engine.task.TaskQuery in project Activiti by Activiti.
the class TaskQueryTest method testQueryByInvalidNameLike.
public void testQueryByInvalidNameLike() {
TaskQuery query = taskService.createTaskQuery().taskNameLike("1");
assertNull(query.singleResult());
assertEquals(0, query.list().size());
assertEquals(0, query.count());
try {
taskService.createTaskQuery().or().taskId("invalid").taskNameLike(null).singleResult();
fail();
} catch (ActivitiIllegalArgumentException e) {
}
}
use of org.activiti.engine.task.TaskQuery in project Activiti by Activiti.
the class TaskQueryTest method testQueryByInvalidNameInOr.
public void testQueryByInvalidNameInOr() {
final List<String> taskNameList = new ArrayList<String>(2);
taskNameList.add("invalid");
TaskQuery query = taskService.createTaskQuery().or().taskNameIn(taskNameList).taskId("invalid");
assertEquals(0, query.list().size());
assertEquals(0, query.count());
try {
taskService.createTaskQuery().or().taskId("invalid").taskNameIn(null).singleResult();
fail("expected exception");
} catch (ActivitiException e) {
// OK
}
}
use of org.activiti.engine.task.TaskQuery in project Activiti by Activiti.
the class TaskQueryTest method testQueryCreatedOn.
public void testQueryCreatedOn() throws Exception {
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss.SSS");
// Exact matching of createTime, should result in 6 tasks
Date createTime = sdf.parse("01/01/2001 01:01:01.000");
TaskQuery query = taskService.createTaskQuery().taskCreatedOn(createTime);
assertEquals(6, query.count());
assertEquals(6, query.list().size());
}
use of org.activiti.engine.task.TaskQuery in project Activiti by Activiti.
the class TaskQueryTest method testQueryNoCriteria.
public void testQueryNoCriteria() {
TaskQuery query = taskService.createTaskQuery();
assertEquals(12, query.count());
assertEquals(12, query.list().size());
try {
query.singleResult();
fail("expected exception");
} catch (ActivitiException e) {
// OK
}
}
use of org.activiti.engine.task.TaskQuery in project Activiti by Activiti.
the class ParallelGatewayTest method testNestedForkJoin.
// ACT-482
@Deployment
public void testNestedForkJoin() {
runtimeService.startProcessInstanceByKey("nestedForkJoin");
// After process startm, only task 0 should be active
TaskQuery query = taskService.createTaskQuery().orderByTaskName().asc();
List<Task> tasks = query.list();
assertEquals(1, tasks.size());
assertEquals("Task 0", tasks.get(0).getName());
// Completing task 0 will create Task A and B
taskService.complete(tasks.get(0).getId());
tasks = query.list();
assertEquals(2, tasks.size());
assertEquals("Task A", tasks.get(0).getName());
assertEquals("Task B", tasks.get(1).getName());
// Completing task A should not trigger any new tasks
taskService.complete(tasks.get(0).getId());
tasks = query.list();
assertEquals(1, tasks.size());
assertEquals("Task B", tasks.get(0).getName());
// Completing task B creates tasks B1 and B2
taskService.complete(tasks.get(0).getId());
tasks = query.list();
assertEquals(2, tasks.size());
assertEquals("Task B1", tasks.get(0).getName());
assertEquals("Task B2", tasks.get(1).getName());
// Completing B1 and B2 will activate both joins, and process reaches task C
taskService.complete(tasks.get(0).getId());
taskService.complete(tasks.get(1).getId());
tasks = query.list();
assertEquals(1, tasks.size());
assertEquals("Task C", tasks.get(0).getName());
}
Aggregations