use of org.camunda.bpm.engine.runtime.Incident in project camunda-bpm-platform by camunda.
the class IncidentQueryTest method testQueryByIncidentId.
@Test
public void testQueryByIncidentId() {
Incident incident = runtimeService.createIncidentQuery().processInstanceId(processInstanceIds.get(0)).singleResult();
assertNotNull(incident);
IncidentQuery query = runtimeService.createIncidentQuery().incidentId(incident.getId());
assertEquals(1, query.count());
List<Incident> incidents = query.list();
assertFalse(incidents.isEmpty());
assertEquals(1, incidents.size());
}
use of org.camunda.bpm.engine.runtime.Incident in project camunda-bpm-platform by camunda.
the class IncidentQueryTest method testQueryByExecutionId.
public void testQueryByExecutionId() {
Execution execution = runtimeService.createExecutionQuery().processInstanceId(processInstanceIds.get(0)).singleResult();
assertNotNull(execution);
IncidentQuery query = runtimeService.createIncidentQuery().executionId(execution.getId());
assertEquals(1, query.count());
List<Incident> incidents = query.list();
assertFalse(incidents.isEmpty());
assertEquals(1, incidents.size());
}
use of org.camunda.bpm.engine.runtime.Incident in project camunda-bpm-platform by camunda.
the class CreateAndResolveIncidentAuthorizationTest method resolveIncident.
@Test
public void resolveIncident() {
testRule.deployAndGetDefinition(ProcessModels.TWO_TASKS_PROCESS);
ProcessInstance processInstance = engineRule.getRuntimeService().startProcessInstanceByKey("Process");
ExecutionEntity execution = (ExecutionEntity) engineRule.getRuntimeService().createExecutionQuery().active().singleResult();
authRule.disableAuthorization();
Incident incident = engineRule.getRuntimeService().createIncident("foo", execution.getId(), execution.getActivityId(), "bar");
authRule.init(scenario).withUser("userId").bindResource("processInstance", processInstance.getId()).bindResource("processDefinition", "Process").start();
// when
engineRule.getRuntimeService().resolveIncident(incident.getId());
// then
authRule.assertScenario(scenario);
}
use of org.camunda.bpm.engine.runtime.Incident in project camunda-bpm-platform by camunda.
the class ExecutionQueryTest method testQueryByIncidentMessageInSubProcess.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/failingSubProcessCreateOneIncident.bpmn20.xml" })
public void testQueryByIncidentMessageInSubProcess() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("failingSubProcess");
executeAvailableJobs();
List<Incident> incidentList = runtimeService.createIncidentQuery().list();
assertEquals(1, incidentList.size());
Incident incident = runtimeService.createIncidentQuery().processInstanceId(processInstance.getId()).singleResult();
List<Execution> executionList = runtimeService.createExecutionQuery().incidentMessage(incident.getIncidentMessage()).list();
assertEquals(1, executionList.size());
// execution id of subprocess != process instance id
assertNotSame(processInstance.getId(), executionList.get(0).getId());
}
use of org.camunda.bpm.engine.runtime.Incident in project camunda-bpm-platform by camunda.
the class ExecutionQueryTest method testQueryByIncidentId.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/failingProcessCreateOneIncident.bpmn20.xml" })
public void testQueryByIncidentId() {
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().incidentId(incident.getId()).list();
assertEquals(1, executionList.size());
}
Aggregations