use of org.camunda.bpm.engine.runtime.ProcessInstanceQuery in project camunda-bpm-platform by camunda.
the class ProcessInstanceQueryTest method testQueryByUnknownActivityId.
@Test
public void testQueryByUnknownActivityId() {
ProcessInstanceQuery query = runtimeService.createProcessInstanceQuery().activityIdIn("unknown");
assertNoProcessInstancesReturned(query);
}
use of org.camunda.bpm.engine.runtime.ProcessInstanceQuery in project camunda-bpm-platform by camunda.
the class ProcessInstanceQueryTest method testQueryBySubCaseInstanceIdNested.
@Test
@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/superProcessWithCaseCallActivityInsideSubProcess.bpmn20.xml", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testQueryBySubCaseInstanceIdNested() {
String superProcessInstanceId = runtimeService.startProcessInstanceByKey("subProcessQueryTest").getId();
String subCaseInstanceId = caseService.createCaseInstanceQuery().superProcessInstanceId(superProcessInstanceId).singleResult().getId();
ProcessInstanceQuery query = runtimeService.createProcessInstanceQuery().subCaseInstanceId(subCaseInstanceId);
assertEquals(1, query.list().size());
assertEquals(1, query.count());
ProcessInstance superProcessInstance = query.singleResult();
assertNotNull(superProcessInstance);
assertEquals(superProcessInstanceId, superProcessInstance.getId());
}
use of org.camunda.bpm.engine.runtime.ProcessInstanceQuery in project camunda-bpm-platform by camunda.
the class ProcessInstanceQueryTest method testQueryByInvalidCaseInstanceId.
@Test
public void testQueryByInvalidCaseInstanceId() {
ProcessInstanceQuery query = runtimeService.createProcessInstanceQuery();
query.caseInstanceId("invalid");
assertEquals(0, query.count());
try {
query.caseInstanceId(null);
fail("The passed case instance should not be null.");
} catch (Exception ignored) {
}
}
use of org.camunda.bpm.engine.runtime.ProcessInstanceQuery in project camunda-bpm-platform by camunda.
the class RuntimeServiceAsyncOperationsTest method testDeleteProcessInstancesAsyncWithInvalidQueryParameter.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml" })
@Test
public void testDeleteProcessInstancesAsyncWithInvalidQueryParameter() throws Exception {
// given
startTestProcesses(2);
ProcessInstanceQuery query = runtimeService.createProcessInstanceQuery().processInstanceBusinessKey("invalid");
thrown.expect(ProcessEngineException.class);
thrown.expectMessage("processInstanceIds is empty");
// when
runtimeService.deleteProcessInstancesAsync(null, query, TESTING_INSTANCE_DELETE);
}
use of org.camunda.bpm.engine.runtime.ProcessInstanceQuery in project camunda-bpm-platform by camunda.
the class RuntimeServiceAsyncOperationsTest method testDeleteProcessInstancesAsyncWithQuery.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml" })
@Test
public void testDeleteProcessInstancesAsyncWithQuery() throws Exception {
// given
List<String> processIds = startTestProcesses(2);
ProcessInstanceQuery processInstanceQuery = runtimeService.createProcessInstanceQuery().processInstanceIds(new HashSet<String>(processIds));
// when
Batch batch = runtimeService.deleteProcessInstancesAsync(null, processInstanceQuery, TESTING_INSTANCE_DELETE);
executeSeedJob(batch);
executeBatchJobs(batch);
// then
assertHistoricTaskDeletionPresent(processIds, TESTING_INSTANCE_DELETE, testRule);
assertHistoricBatchExists(testRule);
assertProcessInstancesAreDeleted();
}
Aggregations