use of org.camunda.bpm.engine.runtime.Incident 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);
}
use of org.camunda.bpm.engine.runtime.Incident in project camunda-bpm-platform by camunda.
the class ExecutionQueryTest method testQueryByIncidentType.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/failingProcessCreateOneIncident.bpmn20.xml" })
public void testQueryByIncidentType() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("failingProcess");
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());
}
use of org.camunda.bpm.engine.runtime.Incident in project camunda-bpm-platform by camunda.
the class SLSBExceptionInDelegateTest method testOriginalExceptionFromEjbReachesCaller.
@Test
public void testOriginalExceptionFromEjbReachesCaller() {
runtimeService.startProcessInstanceByKey("callProcessWithExceptionFromEjb");
Job job = managementService.createJobQuery().singleResult();
managementService.setJobRetries(job.getId(), 1);
waitForJobExecutorToProcessAllJobs();
Incident incident = runtimeService.createIncidentQuery().activityId("servicetask1").singleResult();
assertThat(incident.getIncidentMessage(), is("error"));
}
use of org.camunda.bpm.engine.runtime.Incident in project camunda-bpm-platform by camunda.
the class HistoricIncidentTest method testPropertiesOfHistoricIncident.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/oneFailingServiceProcess.bpmn20.xml" })
public void testPropertiesOfHistoricIncident() {
startProcessInstance(PROCESS_DEFINITION_KEY);
Incident incident = runtimeService.createIncidentQuery().singleResult();
assertNotNull(incident);
HistoricIncident historicIncident = historyService.createHistoricIncidentQuery().singleResult();
assertNotNull(historicIncident);
assertEquals(incident.getId(), historicIncident.getId());
assertEquals(incident.getIncidentTimestamp(), historicIncident.getCreateTime());
assertNull(historicIncident.getEndTime());
assertEquals(incident.getIncidentType(), historicIncident.getIncidentType());
assertEquals(incident.getIncidentMessage(), historicIncident.getIncidentMessage());
assertEquals(incident.getExecutionId(), historicIncident.getExecutionId());
assertEquals(incident.getActivityId(), historicIncident.getActivityId());
assertEquals(incident.getProcessInstanceId(), historicIncident.getProcessInstanceId());
assertEquals(incident.getProcessDefinitionId(), historicIncident.getProcessDefinitionId());
assertEquals(PROCESS_DEFINITION_KEY, historicIncident.getProcessDefinitionKey());
assertEquals(incident.getCauseIncidentId(), historicIncident.getCauseIncidentId());
assertEquals(incident.getRootCauseIncidentId(), historicIncident.getRootCauseIncidentId());
assertEquals(incident.getConfiguration(), historicIncident.getConfiguration());
assertEquals(incident.getJobDefinitionId(), historicIncident.getJobDefinitionId());
assertTrue(historicIncident.isOpen());
assertFalse(historicIncident.isDeleted());
assertFalse(historicIncident.isResolved());
}
use of org.camunda.bpm.engine.runtime.Incident in project camunda-bpm-platform by camunda.
the class HistoricIncidentQueryTest method testQueryByRootCauseIncidentId.
@Test
@Deployment(resources = { "org/camunda/bpm/engine/test/history/HistoricIncidentQueryTest.testQueryByCauseIncidentId.bpmn20.xml", "org/camunda/bpm/engine/test/api/runtime/oneFailingServiceProcess.bpmn20.xml" })
public void testQueryByRootCauseIncidentId() {
startProcessInstance("process");
String processInstanceId = runtimeService.createProcessInstanceQuery().processDefinitionKey(PROCESS_DEFINITION_KEY).singleResult().getId();
Incident incident = runtimeService.createIncidentQuery().processInstanceId(processInstanceId).singleResult();
HistoricIncidentQuery query = historyService.createHistoricIncidentQuery().rootCauseIncidentId(incident.getId());
assertEquals(2, query.list().size());
assertEquals(2, query.count());
}
Aggregations