use of org.camunda.bpm.engine.runtime.Incident in project camunda-bpm-platform by camunda.
the class ProcessInstanceQueryTest method testQueryByIncidentMessageLikeInSubProcess.
@Test
@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/failingSubProcessCreateOneIncident.bpmn20.xml" })
public void testQueryByIncidentMessageLikeInSubProcess() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("failingSubProcess");
testHelper.executeAvailableJobs();
List<Incident> incidentList = runtimeService.createIncidentQuery().list();
assertEquals(1, incidentList.size());
List<ProcessInstance> processInstanceList = runtimeService.createProcessInstanceQuery().incidentMessageLike("%exception%").list();
assertEquals(1, processInstanceList.size());
assertEquals(processInstance.getId(), processInstanceList.get(0).getId());
}
use of org.camunda.bpm.engine.runtime.Incident in project camunda-bpm-platform by camunda.
the class ProcessInstanceQueryTest method testQueryByIncidentType.
@Test
@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/failingProcessCreateOneIncident.bpmn20.xml" })
public void testQueryByIncidentType() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("failingProcess");
testHelper.executeAvailableJobs();
List<Incident> incidentList = runtimeService.createIncidentQuery().list();
assertEquals(1, incidentList.size());
Incident incident = runtimeService.createIncidentQuery().processInstanceId(processInstance.getId()).singleResult();
List<ProcessInstance> processInstanceList = runtimeService.createProcessInstanceQuery().incidentType(incident.getIncidentType()).list();
assertEquals(1, processInstanceList.size());
}
use of org.camunda.bpm.engine.runtime.Incident in project camunda-bpm-platform by camunda.
the class ProcessInstanceQueryTest method testQueryByIncidentTypeInSubProcess.
@Test
@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/failingSubProcessCreateOneIncident.bpmn20.xml" })
public void testQueryByIncidentTypeInSubProcess() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("failingSubProcess");
testHelper.executeAvailableJobs();
List<Incident> incidentList = runtimeService.createIncidentQuery().list();
assertEquals(1, incidentList.size());
Incident incident = runtimeService.createIncidentQuery().processInstanceId(processInstance.getId()).singleResult();
List<ProcessInstance> processInstanceList = runtimeService.createProcessInstanceQuery().incidentType(incident.getIncidentType()).list();
assertEquals(1, processInstanceList.size());
assertEquals(processInstance.getId(), processInstanceList.get(0).getId());
}
use of org.camunda.bpm.engine.runtime.Incident in project camunda-bpm-platform by camunda.
the class ProcessInstanceQueryTest method testQueryByIncidentMessage.
@Test
@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/failingProcessCreateOneIncident.bpmn20.xml" })
public void testQueryByIncidentMessage() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("failingProcess");
testHelper.executeAvailableJobs();
List<Incident> incidentList = runtimeService.createIncidentQuery().list();
assertEquals(1, incidentList.size());
Incident incident = runtimeService.createIncidentQuery().processInstanceId(processInstance.getId()).singleResult();
List<ProcessInstance> processInstanceList = runtimeService.createProcessInstanceQuery().incidentMessage(incident.getIncidentMessage()).list();
assertEquals(1, processInstanceList.size());
}
use of org.camunda.bpm.engine.runtime.Incident in project camunda-bpm-platform by camunda.
the class MigrationExternalTaskTest method testIncidentWithoutMapExternalTask.
@Test
public void testIncidentWithoutMapExternalTask() {
// given
ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(ExternalTaskModels.ONE_EXTERNAL_TASK_PROCESS);
ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(modify(ExternalTaskModels.ONE_EXTERNAL_TASK_PROCESS).changeElementId("externalTask", "newExternalTask"));
// external task is not mapped to new external task
MigrationPlan migrationPlan = rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapEqualActivities().build();
ProcessInstance processInstance = rule.getRuntimeService().startProcessInstanceById(sourceProcessDefinition.getId());
ExternalTask externalTask = rule.getExternalTaskService().createExternalTaskQuery().singleResult();
rule.getExternalTaskService().setRetries(externalTask.getId(), 0);
Incident incidentBeforeMigration = rule.getRuntimeService().createIncidentQuery().singleResult();
assertNotNull(incidentBeforeMigration);
// when migration is executed
try {
testHelper.migrateProcessInstance(migrationPlan, processInstance);
Assert.fail("Exception expected!");
} catch (Exception ex) {
Assert.assertTrue(ex instanceof MigratingProcessInstanceValidationException);
}
}
Aggregations