use of org.camunda.bpm.engine.history.HistoricIncidentQuery in project camunda-bpm-platform by camunda.
the class HistoricIncidentTest method testCreateRecursiveHistoricIncidentsForNestedCallActivities.
@Deployment(resources = { "org/camunda/bpm/engine/test/history/HistoricIncidentTest.testCreateRecursiveHistoricIncidentsForNestedCallActivities.bpmn20.xml", "org/camunda/bpm/engine/test/history/HistoricIncidentQueryTest.testQueryByCauseIncidentId.bpmn20.xml", "org/camunda/bpm/engine/test/api/runtime/oneFailingServiceProcess.bpmn20.xml" })
public void testCreateRecursiveHistoricIncidentsForNestedCallActivities() {
startProcessInstance("process1");
ProcessInstance pi1 = runtimeService.createProcessInstanceQuery().processDefinitionKey("process1").singleResult();
assertNotNull(pi1);
ProcessInstance pi2 = runtimeService.createProcessInstanceQuery().processDefinitionKey("process").singleResult();
assertNotNull(pi2);
ProcessInstance pi3 = runtimeService.createProcessInstanceQuery().processDefinitionKey(PROCESS_DEFINITION_KEY).singleResult();
assertNotNull(pi3);
HistoricIncidentQuery query = historyService.createHistoricIncidentQuery();
HistoricIncident rootCauseHistoricIncident = query.processInstanceId(pi3.getId()).singleResult();
assertNotNull(rootCauseHistoricIncident);
// cause and root cause id is equal to the id of the root incident
assertEquals(rootCauseHistoricIncident.getId(), rootCauseHistoricIncident.getCauseIncidentId());
assertEquals(rootCauseHistoricIncident.getId(), rootCauseHistoricIncident.getRootCauseIncidentId());
HistoricIncident causeHistoricIncident = query.processInstanceId(pi2.getId()).singleResult();
assertNotNull(causeHistoricIncident);
// cause and root cause id is equal to the id of the root incident
assertEquals(rootCauseHistoricIncident.getId(), causeHistoricIncident.getCauseIncidentId());
assertEquals(rootCauseHistoricIncident.getId(), causeHistoricIncident.getRootCauseIncidentId());
HistoricIncident historicIncident = query.processInstanceId(pi1.getId()).singleResult();
assertNotNull(historicIncident);
// cause and root cause id is equal to the id of the root incident
assertEquals(causeHistoricIncident.getId(), historicIncident.getCauseIncidentId());
assertEquals(rootCauseHistoricIncident.getId(), historicIncident.getRootCauseIncidentId());
}
use of org.camunda.bpm.engine.history.HistoricIncidentQuery in project camunda-bpm-platform by camunda.
the class HistoricIncidentQueryTest method testQueryByInvalidIncidentMessage.
@Test
public void testQueryByInvalidIncidentMessage() {
HistoricIncidentQuery query = historyService.createHistoricIncidentQuery();
assertEquals(0, query.incidentMessage("invalid").list().size());
assertEquals(0, query.incidentMessage("invalid").count());
try {
query.incidentMessage(null);
fail("It was possible to set a null value as incidentMessage.");
} catch (ProcessEngineException e) {
}
}
use of org.camunda.bpm.engine.history.HistoricIncidentQuery in project camunda-bpm-platform by camunda.
the class HistoricIncidentQueryTest method testQueryByCauseIncidentId.
@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 testQueryByCauseIncidentId() {
startProcessInstance("process");
String processInstanceId = runtimeService.createProcessInstanceQuery().processDefinitionKey(PROCESS_DEFINITION_KEY).singleResult().getId();
Incident incident = runtimeService.createIncidentQuery().processInstanceId(processInstanceId).singleResult();
HistoricIncidentQuery query = historyService.createHistoricIncidentQuery().causeIncidentId(incident.getId());
assertEquals(2, query.list().size());
assertEquals(2, query.count());
}
use of org.camunda.bpm.engine.history.HistoricIncidentQuery in project camunda-bpm-platform by camunda.
the class HistoricIncidentQueryTest method testQueryByExecutionId.
@Test
@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/oneFailingServiceProcess.bpmn20.xml" })
public void testQueryByExecutionId() {
startProcessInstance(PROCESS_DEFINITION_KEY);
ProcessInstance pi = runtimeService.createProcessInstanceQuery().singleResult();
HistoricIncidentQuery query = historyService.createHistoricIncidentQuery().executionId(pi.getId());
assertEquals(1, query.list().size());
assertEquals(1, query.count());
}
use of org.camunda.bpm.engine.history.HistoricIncidentQuery in project camunda-bpm-platform by camunda.
the class HistoricIncidentQueryTest method testQueryByIncidentMessage.
@Test
@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/oneFailingServiceProcess.bpmn20.xml" })
public void testQueryByIncidentMessage() {
startProcessInstance(PROCESS_DEFINITION_KEY);
HistoricIncidentQuery query = historyService.createHistoricIncidentQuery().incidentMessage(FailingDelegate.EXCEPTION_MESSAGE);
assertEquals(1, query.list().size());
assertEquals(1, query.count());
}
Aggregations