Search in sources :

Example 31 with Incident

use of org.camunda.bpm.engine.runtime.Incident in project camunda-bpm-platform by camunda.

the class IncidentQueryTest method testQueryByInvalidCauseIncidentId.

@Test
public void testQueryByInvalidCauseIncidentId() {
    IncidentQuery query = runtimeService.createIncidentQuery().causeIncidentId("invalid");
    assertEquals(0, query.count());
    List<Incident> incidents = query.list();
    assertTrue(incidents.isEmpty());
    assertEquals(0, incidents.size());
}
Also used : IncidentQuery(org.camunda.bpm.engine.runtime.IncidentQuery) Incident(org.camunda.bpm.engine.runtime.Incident) Test(org.junit.Test)

Example 32 with Incident

use of org.camunda.bpm.engine.runtime.Incident in project camunda-bpm-platform by camunda.

the class IncidentQueryTest method testQueryByInvalidConfiguration.

@Test
public void testQueryByInvalidConfiguration() {
    IncidentQuery query = runtimeService.createIncidentQuery().configuration("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 33 with Incident

use of org.camunda.bpm.engine.runtime.Incident in project camunda-bpm-platform by camunda.

the class ProcessDefinitionQueryTest method testQueryByIncidentMessage.

@org.camunda.bpm.engine.test.Deployment(resources = { "org/camunda/bpm/engine/test/api/repository/failingProcessCreateOneIncident.bpmn20.xml" })
public void testQueryByIncidentMessage() {
    assertEquals(1, repositoryService.createProcessDefinitionQuery().processDefinitionKey("failingProcess").count());
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("failingProcess");
    executeAvailableJobs();
    List<Incident> incidentList = runtimeService.createIncidentQuery().list();
    assertEquals(1, incidentList.size());
    Incident incident = runtimeService.createIncidentQuery().processInstanceId(processInstance.getId()).singleResult();
    ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery().incidentMessage(incident.getIncidentMessage());
    verifyQueryResults(query, 1);
}
Also used : ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) ProcessDefinitionQuery(org.camunda.bpm.engine.repository.ProcessDefinitionQuery) Incident(org.camunda.bpm.engine.runtime.Incident)

Example 34 with Incident

use of org.camunda.bpm.engine.runtime.Incident in project camunda-bpm-platform by camunda.

the class ProcessDefinitionQueryTest method testQueryByIncidentMessageLike.

@org.camunda.bpm.engine.test.Deployment(resources = { "org/camunda/bpm/engine/test/api/repository/failingProcessCreateOneIncident.bpmn20.xml" })
public void testQueryByIncidentMessageLike() {
    assertEquals(1, repositoryService.createProcessDefinitionQuery().processDefinitionKey("failingProcess").count());
    runtimeService.startProcessInstanceByKey("failingProcess");
    executeAvailableJobs();
    List<Incident> incidentList = runtimeService.createIncidentQuery().list();
    assertEquals(1, incidentList.size());
    ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery().incidentMessageLike("%expected%");
    verifyQueryResults(query, 1);
    query = repositoryService.createProcessDefinitionQuery().incidentMessageLike("%\\_expected%");
    verifyQueryResults(query, 1);
}
Also used : ProcessDefinitionQuery(org.camunda.bpm.engine.repository.ProcessDefinitionQuery) Incident(org.camunda.bpm.engine.runtime.Incident)

Example 35 with Incident

use of org.camunda.bpm.engine.runtime.Incident in project camunda-bpm-platform by camunda.

the class ProcessDefinitionQueryTest method testQueryByIncidentId.

@org.camunda.bpm.engine.test.Deployment(resources = { "org/camunda/bpm/engine/test/api/repository/failingProcessCreateOneIncident.bpmn20.xml" })
public void testQueryByIncidentId() {
    assertEquals(1, repositoryService.createProcessDefinitionQuery().processDefinitionKey("failingProcess").count());
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("failingProcess");
    executeAvailableJobs();
    List<Incident> incidentList = runtimeService.createIncidentQuery().list();
    assertEquals(1, incidentList.size());
    Incident incident = runtimeService.createIncidentQuery().processInstanceId(processInstance.getId()).singleResult();
    ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery().incidentId(incident.getId());
    verifyQueryResults(query, 1);
}
Also used : ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) ProcessDefinitionQuery(org.camunda.bpm.engine.repository.ProcessDefinitionQuery) Incident(org.camunda.bpm.engine.runtime.Incident)

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