use of org.camunda.bpm.engine.runtime.Incident in project camunda-bpm-platform by camunda.
the class ProcessInstanceQueryTest method testQueryByIncidentMessageInSubProcess.
@Test
@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/failingSubProcessCreateOneIncident.bpmn20.xml" })
public void testQueryByIncidentMessageInSubProcess() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("failingSubProcess");
testHelper.executeAvailableJobs();
List<Incident> incidentList = runtimeService.createIncidentQuery().list();
assertEquals(1, incidentList.size());
Incident incident = runtimeService.createIncidentQuery().processInstanceId(processInstance.getId()).singleResult();
List<ProcessInstance> processInstanceList = runtimeService.createProcessInstanceQuery().incidentMessage(incident.getIncidentMessage()).list();
assertEquals(1, processInstanceList.size());
assertEquals(processInstance.getId(), processInstanceList.get(0).getId());
}
use of org.camunda.bpm.engine.runtime.Incident in project camunda-bpm-platform by camunda.
the class ProcessInstanceModificationAsyncTest method testRestartAFailedServiceTask.
@Deployment(resources = ASYNC_BEFORE_FAILING_TASK_PROCESS)
public void testRestartAFailedServiceTask() {
// given a failed job
ProcessInstance instance = runtimeService.createProcessInstanceByKey("failingAfterBeforeTask").startBeforeActivity("task2").execute();
executeAvailableJobs();
Incident incident = runtimeService.createIncidentQuery().singleResult();
assertNotNull(incident);
// when the service task is restarted
ActivityInstance tree = runtimeService.getActivityInstance(instance.getId());
runtimeService.createProcessInstanceModification(instance.getId()).startBeforeActivity("task2").cancelTransitionInstance(tree.getTransitionInstances("task2")[0].getId()).execute();
executeAvailableJobs();
// then executing the task has failed again and there is a new incident
Incident newIncident = runtimeService.createIncidentQuery().singleResult();
assertNotNull(newIncident);
assertNotSame(incident.getId(), newIncident.getId());
}
use of org.camunda.bpm.engine.runtime.Incident in project camunda-bpm-platform by camunda.
the class IncidentQueryTest method testQueryByIncidentMessage.
@Test
public void testQueryByIncidentMessage() {
IncidentQuery query = runtimeService.createIncidentQuery().incidentMessage("Expected_exception.");
assertEquals(4, query.count());
List<Incident> incidents = query.list();
assertFalse(incidents.isEmpty());
assertEquals(4, incidents.size());
}
use of org.camunda.bpm.engine.runtime.Incident in project camunda-bpm-platform by camunda.
the class IncidentQueryTest method testQueryByCauseIncidentIdEqualsNull.
@Test
public void testQueryByCauseIncidentIdEqualsNull() {
IncidentQuery query = runtimeService.createIncidentQuery().causeIncidentId(null);
assertEquals(4, query.count());
List<Incident> incidents = query.list();
assertFalse(incidents.isEmpty());
assertEquals(4, incidents.size());
}
use of org.camunda.bpm.engine.runtime.Incident in project camunda-bpm-platform by camunda.
the class IncidentQueryTest method testQueryByProcessInstanceId.
public void testQueryByProcessInstanceId() {
IncidentQuery query = runtimeService.createIncidentQuery().processInstanceId(processInstanceIds.get(0));
assertEquals(1, query.count());
List<Incident> incidents = query.list();
assertFalse(incidents.isEmpty());
assertEquals(1, incidents.size());
Incident incident = query.singleResult();
assertNotNull(incident);
}
Aggregations