assertEquals(0, runtimeService.createProcessInstanceQuery().count());
}
@Deployment(resources = {"org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml"})
public void testTaskQueryAfterProcessInstanceSuspendByProcessDefinitionKey() {
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult();
runtimeService.startProcessInstanceById(processDefinition.getId());
Task task = taskService.createTaskQuery().singleResult();
assertNotNull(task);
task = taskService.createTaskQuery().active().singleResult();
assertNotNull(task);
// Suspend
runtimeService.suspendProcessInstanceByProcessDefinitionKey(processDefinition.getKey());
assertEquals(1, taskService.createTaskQuery().count());
assertEquals(1, taskService.createTaskQuery().suspended().count());
assertEquals(0, taskService.createTaskQuery().active().count());
// Activate
runtimeService.activateProcessInstanceByProcessDefinitionKey(processDefinition.getKey());
assertEquals(1, taskService.createTaskQuery().count());
assertEquals(0, taskService.createTaskQuery().suspended().count());
assertEquals(1, taskService.createTaskQuery().active().count());
// Completing should end the process instance