use of org.camunda.bpm.engine.runtime.Incident in project camunda-bpm-platform by camunda.
the class CreateAndResolveIncidentTest method createIncident.
@Test
public void createIncident() {
// given
testRule.deploy(ProcessModels.TWO_TASKS_PROCESS);
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("Process");
// when
Incident incident = runtimeService.createIncident("foo", processInstance.getId(), "aa", "bar");
// then
Incident incident2 = runtimeService.createIncidentQuery().executionId(processInstance.getId()).singleResult();
assertEquals(incident2.getId(), incident.getId());
assertEquals("foo", incident2.getIncidentType());
assertEquals("aa", incident2.getConfiguration());
assertEquals("bar", incident2.getIncidentMessage());
assertEquals(processInstance.getId(), incident2.getExecutionId());
}
use of org.camunda.bpm.engine.runtime.Incident in project camunda-bpm-platform by camunda.
the class IncidentQueryTest method testQueryByInvalidExecutionId.
@Test
public void testQueryByInvalidExecutionId() {
IncidentQuery query = runtimeService.createIncidentQuery().executionId("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 IncidentQueryTest method testQueryByProcessDefinitionId.
public void testQueryByProcessDefinitionId() {
String processDefinitionId = engineRule.getRepositoryService().createProcessDefinitionQuery().singleResult().getId();
IncidentQuery query = runtimeService.createIncidentQuery().processDefinitionId(processDefinitionId);
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 testQueryByActivityId.
public void testQueryByActivityId() {
IncidentQuery query = runtimeService.createIncidentQuery().activityId("theServiceTask");
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 testQueryByInvalidProcessDefinitionId.
@Test
public void testQueryByInvalidProcessDefinitionId() {
IncidentQuery query = runtimeService.createIncidentQuery().processDefinitionId("invalid");
assertEquals(0, query.count());
List<Incident> incidents = query.list();
assertTrue(incidents.isEmpty());
Incident incident = query.singleResult();
assertNull(incident);
}
Aggregations