use of org.camunda.bpm.engine.runtime.Incident in project camunda-bpm-platform by camunda.
the class IncidentTest method testDoNotCreateNewIncident.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/mgmt/IncidentTest.testShouldCreateOneIncident.bpmn" })
public void testDoNotCreateNewIncident() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("failingProcess");
executeAvailableJobs();
IncidentQuery query = runtimeService.createIncidentQuery().processInstanceId(processInstance.getId());
Incident incident = query.singleResult();
assertNotNull(incident);
JobDefinition jobDefinition = managementService.createJobDefinitionQuery().singleResult();
// set retries to 1 by job definition id
managementService.setJobRetriesByJobDefinitionId(jobDefinition.getId(), 1);
// the incident still exists
Incident tmp = query.singleResult();
assertEquals(incident.getId(), tmp.getId());
// execute the available job (should fail again)
executeAvailableJobs();
// the incident still exists and there
// should be not a new incident
assertEquals(1, query.count());
tmp = query.singleResult();
assertEquals(incident.getId(), tmp.getId());
}
use of org.camunda.bpm.engine.runtime.Incident in project camunda-bpm-platform by camunda.
the class IncidentTest method testShouldDeleteIncidentAfterJobHasBeenDeleted.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/mgmt/IncidentTest.testShouldCreateOneIncident.bpmn" })
public void testShouldDeleteIncidentAfterJobHasBeenDeleted() {
// start failing process
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("failingProcess");
executeAvailableJobs();
// get the job
Job job = managementService.createJobQuery().processInstanceId(processInstance.getId()).singleResult();
assertNotNull(job);
// there exists one incident to failed
Incident incident = runtimeService.createIncidentQuery().processInstanceId(processInstance.getId()).singleResult();
assertNotNull(incident);
// delete the job
managementService.deleteJob(job.getId());
// the incident has been deleted too.
incident = runtimeService.createIncidentQuery().incidentId(incident.getId()).singleResult();
assertNull(incident);
}
use of org.camunda.bpm.engine.runtime.Incident in project camunda-bpm-platform by camunda.
the class IncidentQueryTest method testQueryByRootInvalidCauseIncidentId.
@Test
public void testQueryByRootInvalidCauseIncidentId() {
IncidentQuery query = runtimeService.createIncidentQuery().rootCauseIncidentId("invalid");
assertEquals(0, query.count());
List<Incident> incidents = query.list();
assertTrue(incidents.isEmpty());
assertEquals(0, incidents.size());
}
use of org.camunda.bpm.engine.runtime.Incident in project camunda-bpm-platform by camunda.
the class IncidentQueryTest method testQueryByInvalidIncidentMessage.
@Test
public void testQueryByInvalidIncidentMessage() {
IncidentQuery query = runtimeService.createIncidentQuery().incidentMessage("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 testQueryByInvalidProcessInstanceId.
@Test
public void testQueryByInvalidProcessInstanceId() {
IncidentQuery query = runtimeService.createIncidentQuery().processInstanceId("invalid");
assertEquals(0, query.count());
List<Incident> incidents = query.list();
assertTrue(incidents.isEmpty());
Incident incident = query.singleResult();
assertNull(incident);
}
Aggregations