Search in sources :

Example 51 with HistoricIncidentQuery

use of org.camunda.bpm.engine.history.HistoricIncidentQuery in project camunda-bpm-platform by camunda.

the class HistoricIncidentQueryTest method testQueryByInvalidIncidentId.

@Test
@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/oneFailingServiceProcess.bpmn20.xml" })
public void testQueryByInvalidIncidentId() {
    startProcessInstance(PROCESS_DEFINITION_KEY);
    HistoricIncidentQuery query = historyService.createHistoricIncidentQuery();
    assertEquals(0, query.incidentId("invalid").list().size());
    assertEquals(0, query.incidentId("invalid").count());
    try {
        query.incidentId(null);
        fail("It was possible to set a null value as incidentId.");
    } catch (ProcessEngineException e) {
    }
}
Also used : HistoricIncidentQuery(org.camunda.bpm.engine.history.HistoricIncidentQuery) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException) Test(org.junit.Test) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 52 with HistoricIncidentQuery

use of org.camunda.bpm.engine.history.HistoricIncidentQuery in project camunda-bpm-platform by camunda.

the class HistoricIncidentQueryTest method testQueryByConfiguration.

@Test
@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/oneFailingServiceProcess.bpmn20.xml" })
public void testQueryByConfiguration() {
    startProcessInstance(PROCESS_DEFINITION_KEY);
    String configuration = managementService.createJobQuery().singleResult().getId();
    HistoricIncidentQuery query = historyService.createHistoricIncidentQuery().configuration(configuration);
    assertEquals(1, query.list().size());
    assertEquals(1, query.count());
}
Also used : HistoricIncidentQuery(org.camunda.bpm.engine.history.HistoricIncidentQuery) Test(org.junit.Test) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 53 with HistoricIncidentQuery

use of org.camunda.bpm.engine.history.HistoricIncidentQuery in project camunda-bpm-platform by camunda.

the class HistoricIncidentQueryTest method testQueryByInvalidProcessDefinitionId.

@Test
public void testQueryByInvalidProcessDefinitionId() {
    HistoricIncidentQuery query = historyService.createHistoricIncidentQuery();
    assertEquals(0, query.processDefinitionId("invalid").list().size());
    assertEquals(0, query.processDefinitionId("invalid").count());
    try {
        query.processDefinitionId(null);
        fail("It was possible to set a null value as processDefinitionId.");
    } catch (ProcessEngineException e) {
    }
}
Also used : HistoricIncidentQuery(org.camunda.bpm.engine.history.HistoricIncidentQuery) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException) Test(org.junit.Test)

Example 54 with HistoricIncidentQuery

use of org.camunda.bpm.engine.history.HistoricIncidentQuery in project camunda-bpm-platform by camunda.

the class HistoricIncidentQueryTest 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();
    HistoricIncidentQuery query = historyService.createHistoricIncidentQuery().jobDefinitionIdIn(jobDefinitionId1, jobDefinitionId2);
    assertEquals(2, query.list().size());
    assertEquals(2, query.count());
    query = historyService.createHistoricIncidentQuery().jobDefinitionIdIn(jobDefinitionId1);
    assertEquals(1, query.list().size());
    assertEquals(1, query.count());
    query = historyService.createHistoricIncidentQuery().jobDefinitionIdIn(jobDefinitionId2);
    assertEquals(1, query.list().size());
    assertEquals(1, query.count());
}
Also used : HistoricIncidentQuery(org.camunda.bpm.engine.history.HistoricIncidentQuery) Test(org.junit.Test)

Example 55 with HistoricIncidentQuery

use of org.camunda.bpm.engine.history.HistoricIncidentQuery in project camunda-bpm-platform by camunda.

the class HistoricIncidentQueryTest method testQueryByUnknownJobDefinitionId.

@Test
public void testQueryByUnknownJobDefinitionId() {
    String processDefinitionId = testHelper.deployAndGetDefinition(FAILING_SERVICE_TASK_MODEL).getId();
    runtimeService.startProcessInstanceById(processDefinitionId);
    testHelper.executeAvailableJobs();
    HistoricIncidentQuery query = historyService.createHistoricIncidentQuery().jobDefinitionIdIn("unknown");
    assertEquals(0, query.list().size());
    assertEquals(0, query.count());
}
Also used : HistoricIncidentQuery(org.camunda.bpm.engine.history.HistoricIncidentQuery) Test(org.junit.Test)

Aggregations

HistoricIncidentQuery (org.camunda.bpm.engine.history.HistoricIncidentQuery)61 Test (org.junit.Test)29 Deployment (org.camunda.bpm.engine.test.Deployment)20 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)13 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)7 HistoricIncident (org.camunda.bpm.engine.history.HistoricIncident)6 Date (java.util.Date)4 Job (org.camunda.bpm.engine.runtime.Job)4 JobDefinition (org.camunda.bpm.engine.management.JobDefinition)2 HistoricIncidentQueryDto (org.camunda.bpm.engine.rest.dto.history.HistoricIncidentQueryDto)2 Incident (org.camunda.bpm.engine.runtime.Incident)2 ArrayList (java.util.ArrayList)1 CountResultDto (org.camunda.bpm.engine.rest.dto.CountResultDto)1 HistoricIncidentDto (org.camunda.bpm.engine.rest.dto.history.HistoricIncidentDto)1