use of org.camunda.bpm.engine.history.HistoricIncidentQuery in project camunda-bpm-platform by camunda.
the class HistoricIncidentQueryTest method testQueryByProcessDefinitionId.
@Test
@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/oneFailingServiceProcess.bpmn20.xml" })
public void testQueryByProcessDefinitionId() {
startProcessInstance(PROCESS_DEFINITION_KEY);
ProcessInstance pi = runtimeService.createProcessInstanceQuery().singleResult();
HistoricIncidentQuery query = historyService.createHistoricIncidentQuery().processDefinitionId(pi.getProcessDefinitionId());
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 testQueryByInvalidCauseIncidentId.
@Test
public void testQueryByInvalidCauseIncidentId() {
HistoricIncidentQuery query = historyService.createHistoricIncidentQuery();
assertEquals(0, query.causeIncidentId("invalid").list().size());
assertEquals(0, query.causeIncidentId("invalid").count());
try {
query.causeIncidentId(null);
fail("It was possible to set a null value as causeIncidentId.");
} catch (ProcessEngineException e) {
}
}
use of org.camunda.bpm.engine.history.HistoricIncidentQuery 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());
}
use of org.camunda.bpm.engine.history.HistoricIncidentQuery in project camunda-bpm-platform by camunda.
the class HistoricIncidentQueryTest method testQueryPaging.
@Test
@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/oneFailingServiceProcess.bpmn20.xml" })
public void testQueryPaging() {
startProcessInstances(PROCESS_DEFINITION_KEY, 4);
HistoricIncidentQuery query = historyService.createHistoricIncidentQuery();
assertEquals(4, query.listPage(0, 4).size());
assertEquals(1, query.listPage(2, 1).size());
assertEquals(2, query.listPage(1, 2).size());
assertEquals(3, query.listPage(1, 4).size());
}
use of org.camunda.bpm.engine.history.HistoricIncidentQuery in project camunda-bpm-platform by camunda.
the class HistoricIncidentQueryTest method testQueryByInvalidIncidentType.
@Test
public void testQueryByInvalidIncidentType() {
HistoricIncidentQuery query = historyService.createHistoricIncidentQuery();
assertEquals(0, query.incidentType("invalid").list().size());
assertEquals(0, query.incidentType("invalid").count());
try {
query.incidentType(null);
fail("It was possible to set a null value as incidentType.");
} catch (ProcessEngineException e) {
}
}
Aggregations