use of org.camunda.bpm.engine.runtime.Incident in project camunda-bpm-platform by camunda.
the class ExecutionQueryTest method testQueryByIncidentMessageLikeSubProcess.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/failingSubProcessCreateOneIncident.bpmn20.xml" })
public void testQueryByIncidentMessageLikeSubProcess() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("failingSubProcess");
executeAvailableJobs();
List<Incident> incidentList = runtimeService.createIncidentQuery().list();
assertEquals(1, incidentList.size());
runtimeService.createIncidentQuery().processInstanceId(processInstance.getId()).singleResult();
List<Execution> executionList = runtimeService.createExecutionQuery().incidentMessageLike("%exception%").list();
assertEquals(1, executionList.size());
// execution id of subprocess != process instance id
assertNotSame(processInstance.getId(), executionList.get(0).getId());
}
use of org.camunda.bpm.engine.runtime.Incident in project camunda-bpm-platform by camunda.
the class ExecutionQueryTest method testQueryByIncidentTypeInSubprocess.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/failingSubProcessCreateOneIncident.bpmn20.xml" })
public void testQueryByIncidentTypeInSubprocess() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("failingSubProcess");
executeAvailableJobs();
List<Incident> incidentList = runtimeService.createIncidentQuery().list();
assertEquals(1, incidentList.size());
Incident incident = runtimeService.createIncidentQuery().processInstanceId(processInstance.getId()).singleResult();
List<Execution> executionList = runtimeService.createExecutionQuery().incidentType(incident.getIncidentType()).list();
assertEquals(1, executionList.size());
// execution id of subprocess != process instance id
assertNotSame(processInstance.getId(), executionList.get(0).getId());
}
use of org.camunda.bpm.engine.runtime.Incident in project camunda-bpm-platform by camunda.
the class ExecutionQueryTest method testQueryByIncidentIdSubProcess.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/failingSubProcessCreateOneIncident.bpmn20.xml" })
public void testQueryByIncidentIdSubProcess() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("failingSubProcess");
executeAvailableJobs();
List<Incident> incidentList = runtimeService.createIncidentQuery().list();
assertEquals(1, incidentList.size());
Incident incident = runtimeService.createIncidentQuery().processInstanceId(processInstance.getId()).singleResult();
List<Execution> executionList = runtimeService.createExecutionQuery().incidentId(incident.getId()).list();
assertEquals(1, executionList.size());
// execution id of subprocess != process instance id
assertNotSame(processInstance.getId(), executionList.get(0).getId());
}
use of org.camunda.bpm.engine.runtime.Incident in project camunda-bpm-platform by camunda.
the class CreateAndResolveIncidentTest method resolveIncidentWithIncidentHandler.
@Test
public void resolveIncidentWithIncidentHandler() {
// given
testRule.deploy(ProcessModels.TWO_TASKS_PROCESS);
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("Process");
runtimeService.createIncident("custom", processInstance.getId(), "configuration");
Incident incident = runtimeService.createIncidentQuery().singleResult();
// when
runtimeService.resolveIncident(incident.getId());
// then
incident = runtimeService.createIncidentQuery().singleResult();
assertNull(incident);
}
use of org.camunda.bpm.engine.runtime.Incident in project camunda-bpm-platform by camunda.
the class IncidentQueryTest method testQueryByInvalidIncidentId.
@Test
public void testQueryByInvalidIncidentId() {
IncidentQuery query = runtimeService.createIncidentQuery().incidentId("invalid");
assertEquals(0, query.count());
List<Incident> incidents = query.list();
assertTrue(incidents.isEmpty());
Incident incident = query.singleResult();
assertNull(incident);
}
Aggregations