use of org.camunda.bpm.engine.runtime.IncidentQuery in project camunda-bpm-platform by camunda.
the class IncidentQueryTest method testQueryByConfiguration.
@Test
public void testQueryByConfiguration() {
String jobId = managementService.createJobQuery().processInstanceId(processInstanceIds.get(0)).singleResult().getId();
IncidentQuery query = runtimeService.createIncidentQuery().configuration(jobId);
assertEquals(1, query.count());
List<Incident> incidents = query.list();
assertFalse(incidents.isEmpty());
assertEquals(1, incidents.size());
}
use of org.camunda.bpm.engine.runtime.IncidentQuery in project camunda-bpm-platform by camunda.
the class IncidentQueryTest method testQueryByCauseIncidentId.
@Test
@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/IncidentQueryTest.testQueryByCauseIncidentId.bpmn" })
public void testQueryByCauseIncidentId() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("callFailingProcess");
testHelper.executeAvailableJobs();
ProcessInstance subProcessInstance = runtimeService.createProcessInstanceQuery().superProcessInstanceId(processInstance.getId()).singleResult();
assertNotNull(subProcessInstance);
Incident causeIncident = runtimeService.createIncidentQuery().processInstanceId(subProcessInstance.getId()).singleResult();
assertNotNull(causeIncident);
IncidentQuery query = runtimeService.createIncidentQuery().causeIncidentId(causeIncident.getId());
assertEquals(2, query.count());
List<Incident> incidents = query.list();
assertFalse(incidents.isEmpty());
assertEquals(2, incidents.size());
}
use of org.camunda.bpm.engine.runtime.IncidentQuery in project camunda-bpm-platform by camunda.
the class IncidentQueryTest method testQueryByRootCauseIncidentIdEqualsNull.
@Test
public void testQueryByRootCauseIncidentIdEqualsNull() {
IncidentQuery query = runtimeService.createIncidentQuery().rootCauseIncidentId(null);
assertEquals(4, query.count());
List<Incident> incidents = query.list();
assertFalse(incidents.isEmpty());
assertEquals(4, incidents.size());
}
use of org.camunda.bpm.engine.runtime.IncidentQuery in project camunda-bpm-platform by camunda.
the class IncidentQueryTest method testQueryByUnknownJobDefinitionId.
@Test
public void testQueryByUnknownJobDefinitionId() {
IncidentQuery query = runtimeService.createIncidentQuery().jobDefinitionIdIn("unknown");
assertEquals(0, query.count());
List<Incident> incidents = query.list();
assertEquals(0, incidents.size());
}
use of org.camunda.bpm.engine.runtime.IncidentQuery in project camunda-bpm-platform by camunda.
the class IncidentQueryTest method testQueryByInvalidIncidentType.
@Test
public void testQueryByInvalidIncidentType() {
IncidentQuery query = runtimeService.createIncidentQuery().incidentType("invalid");
assertEquals(0, query.count());
List<Incident> incidents = query.list();
assertTrue(incidents.isEmpty());
Incident incident = query.singleResult();
assertNull(incident);
}
Aggregations