Search in sources :

Example 41 with Incident

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());
}
Also used : ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) Incident(org.camunda.bpm.engine.runtime.Incident) Test(org.junit.Test)

Example 42 with Incident

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);
}
Also used : IncidentQuery(org.camunda.bpm.engine.runtime.IncidentQuery) Incident(org.camunda.bpm.engine.runtime.Incident) Test(org.junit.Test)

Example 43 with 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());
}
Also used : IncidentQuery(org.camunda.bpm.engine.runtime.IncidentQuery) Incident(org.camunda.bpm.engine.runtime.Incident)

Example 44 with Incident

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());
}
Also used : IncidentQuery(org.camunda.bpm.engine.runtime.IncidentQuery) Incident(org.camunda.bpm.engine.runtime.Incident)

Example 45 with Incident

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);
}
Also used : IncidentQuery(org.camunda.bpm.engine.runtime.IncidentQuery) Incident(org.camunda.bpm.engine.runtime.Incident) Test(org.junit.Test)

Aggregations

Incident (org.camunda.bpm.engine.runtime.Incident)100 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)50 Test (org.junit.Test)50 Deployment (org.camunda.bpm.engine.test.Deployment)40 IncidentQuery (org.camunda.bpm.engine.runtime.IncidentQuery)34 HistoricIncident (org.camunda.bpm.engine.history.HistoricIncident)19 Job (org.camunda.bpm.engine.runtime.Job)17 MigrationPlan (org.camunda.bpm.engine.migration.MigrationPlan)14 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)13 Execution (org.camunda.bpm.engine.runtime.Execution)10 LockedExternalTask (org.camunda.bpm.engine.externaltask.LockedExternalTask)9 HistoricProcessInstance (org.camunda.bpm.engine.history.HistoricProcessInstance)8 ProcessDefinitionQuery (org.camunda.bpm.engine.repository.ProcessDefinitionQuery)4 BpmnModelInstance (org.camunda.bpm.model.bpmn.BpmnModelInstance)4 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)3 HistoricIncidentQuery (org.camunda.bpm.engine.history.HistoricIncidentQuery)3 ExecutionEntity (org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity)3 BadUserRequestException (org.camunda.bpm.engine.BadUserRequestException)2 RuntimeService (org.camunda.bpm.engine.RuntimeService)2 ExternalTask (org.camunda.bpm.engine.externaltask.ExternalTask)2