use of org.activiti.engine.task.TaskQuery in project Activiti by Activiti.
the class HistoryServiceTest method testOrderProcessWithCallActivity.
@Deployment(resources = { "org/activiti/examples/bpmn/callactivity/orderProcess.bpmn20.xml", "org/activiti/examples/bpmn/callactivity/checkCreditProcess.bpmn20.xml" })
public void testOrderProcessWithCallActivity() {
// After the process has started, the 'verify credit history' task should be
// active
ProcessInstance pi = runtimeService.startProcessInstanceByKey("orderProcess");
TaskQuery taskQuery = taskService.createTaskQuery();
Task verifyCreditTask = taskQuery.singleResult();
// Completing the task with approval, will end the subprocess and continue
// the original process
taskService.complete(verifyCreditTask.getId(), CollectionUtil.singletonMap("creditApproved", true));
Task prepareAndShipTask = taskQuery.singleResult();
assertEquals("Prepare and Ship", prepareAndShipTask.getName());
// verify
HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().superProcessInstanceId(pi.getId()).singleResult();
assertNotNull(historicProcessInstance);
assertTrue(historicProcessInstance.getProcessDefinitionId().contains("checkCreditProcess"));
}
use of org.activiti.engine.task.TaskQuery in project Activiti by Activiti.
the class TaskQueryTest method testQueryByUnassigned.
public void testQueryByUnassigned() {
TaskQuery query = taskService.createTaskQuery().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 testQueryByCandidateUser.
public void testQueryByCandidateUser() {
TaskQuery query = taskService.createTaskQuery().taskCandidateUser("kermit");
assertEquals(11, query.count());
assertEquals(11, query.list().size());
try {
query.singleResult();
fail("expected exception");
} catch (ActivitiException e) {
// OK
}
query = taskService.createTaskQuery().taskCandidateUser("fozzie");
assertEquals(3, query.count());
assertEquals(3, 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 TaskQueryTest method testQueryByDescriptionOr.
public void testQueryByDescriptionOr() {
TaskQuery query = taskService.createTaskQuery().or().taskId("invalid").taskDescription("testTask description");
assertEquals(6, query.list().size());
assertEquals(6, query.count());
try {
query.singleResult();
fail();
} catch (ActivitiException e) {
}
}
use of org.activiti.engine.task.TaskQuery in project Activiti by Activiti.
the class TaskQueryTest method testQueryByAssignee.
public void testQueryByAssignee() {
TaskQuery query = taskService.createTaskQuery().taskAssignee("gonzo");
assertEquals(1, query.count());
assertEquals(1, query.list().size());
assertNotNull(query.singleResult());
query = taskService.createTaskQuery().taskAssignee("kermit");
assertEquals(0, query.count());
assertEquals(0, query.list().size());
assertNull(query.singleResult());
}
Aggregations