Search in sources :

Example 46 with IncidentQuery

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

the class IncidentQueryTest method testQueryByCauseIncidentIdEqualsNull.

@Test
public void testQueryByCauseIncidentIdEqualsNull() {
    IncidentQuery query = runtimeService.createIncidentQuery().causeIncidentId(null);
    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) Test(org.junit.Test)

Example 47 with IncidentQuery

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

the class IncidentQueryTest method testQueryByProcessInstanceId.

public void testQueryByProcessInstanceId() {
    IncidentQuery query = runtimeService.createIncidentQuery().processInstanceId(processInstanceIds.get(0));
    assertEquals(1, query.count());
    List<Incident> incidents = query.list();
    assertFalse(incidents.isEmpty());
    assertEquals(1, incidents.size());
    Incident incident = query.singleResult();
    assertNotNull(incident);
}
Also used : IncidentQuery(org.camunda.bpm.engine.runtime.IncidentQuery) Incident(org.camunda.bpm.engine.runtime.Incident)

Example 48 with IncidentQuery

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

Example 49 with IncidentQuery

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

the class IncidentQueryTest method testQueryByJobDefinitionId.

@Test
public void testQueryByJobDefinitionId() {
    String processDefinitionId1 = testHelper.deployAndGetDefinition(FAILING_SERVICE_TASK_MODEL).getId();
    String processDefinitionId2 = testHelper.deployAndGetDefinition(FAILING_SERVICE_TASK_MODEL).getId();
    runtimeService.startProcessInstanceById(processDefinitionId1);
    runtimeService.startProcessInstanceById(processDefinitionId2);
    testHelper.executeAvailableJobs();
    String jobDefinitionId1 = managementService.createJobQuery().processDefinitionId(processDefinitionId1).singleResult().getJobDefinitionId();
    String jobDefinitionId2 = managementService.createJobQuery().processDefinitionId(processDefinitionId2).singleResult().getJobDefinitionId();
    IncidentQuery query = runtimeService.createIncidentQuery().jobDefinitionIdIn(jobDefinitionId1, jobDefinitionId2);
    assertEquals(2, query.list().size());
    assertEquals(2, query.count());
    query = runtimeService.createIncidentQuery().jobDefinitionIdIn(jobDefinitionId1);
    assertEquals(1, query.list().size());
    assertEquals(1, query.count());
    query = runtimeService.createIncidentQuery().jobDefinitionIdIn(jobDefinitionId2);
    assertEquals(1, query.list().size());
    assertEquals(1, query.count());
}
Also used : IncidentQuery(org.camunda.bpm.engine.runtime.IncidentQuery) Test(org.junit.Test)

Example 50 with IncidentQuery

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

Aggregations

IncidentQuery (org.camunda.bpm.engine.runtime.IncidentQuery)55 Incident (org.camunda.bpm.engine.runtime.Incident)34 Test (org.junit.Test)21 HistoricIncident (org.camunda.bpm.engine.history.HistoricIncident)7 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)3 Deployment (org.camunda.bpm.engine.test.Deployment)3 IncidentQueryDto (org.camunda.bpm.engine.rest.dto.runtime.IncidentQueryDto)2 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)1 HistoricIncidentQuery (org.camunda.bpm.engine.history.HistoricIncidentQuery)1 RuntimeServiceImpl (org.camunda.bpm.engine.impl.RuntimeServiceImpl)1 JobDefinition (org.camunda.bpm.engine.management.JobDefinition)1 CountResultDto (org.camunda.bpm.engine.rest.dto.CountResultDto)1 IncidentDto (org.camunda.bpm.engine.rest.dto.runtime.IncidentDto)1 Execution (org.camunda.bpm.engine.runtime.Execution)1 Job (org.camunda.bpm.engine.runtime.Job)1