Search in sources :

Example 46 with HistoricIncidentQuery

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

the class HistoricIncidentTest method testCreateRecursiveHistoricIncidentsForNestedCallActivities.

@Deployment(resources = { "org/camunda/bpm/engine/test/history/HistoricIncidentTest.testCreateRecursiveHistoricIncidentsForNestedCallActivities.bpmn20.xml", "org/camunda/bpm/engine/test/history/HistoricIncidentQueryTest.testQueryByCauseIncidentId.bpmn20.xml", "org/camunda/bpm/engine/test/api/runtime/oneFailingServiceProcess.bpmn20.xml" })
public void testCreateRecursiveHistoricIncidentsForNestedCallActivities() {
    startProcessInstance("process1");
    ProcessInstance pi1 = runtimeService.createProcessInstanceQuery().processDefinitionKey("process1").singleResult();
    assertNotNull(pi1);
    ProcessInstance pi2 = runtimeService.createProcessInstanceQuery().processDefinitionKey("process").singleResult();
    assertNotNull(pi2);
    ProcessInstance pi3 = runtimeService.createProcessInstanceQuery().processDefinitionKey(PROCESS_DEFINITION_KEY).singleResult();
    assertNotNull(pi3);
    HistoricIncidentQuery query = historyService.createHistoricIncidentQuery();
    HistoricIncident rootCauseHistoricIncident = query.processInstanceId(pi3.getId()).singleResult();
    assertNotNull(rootCauseHistoricIncident);
    // cause and root cause id is equal to the id of the root incident
    assertEquals(rootCauseHistoricIncident.getId(), rootCauseHistoricIncident.getCauseIncidentId());
    assertEquals(rootCauseHistoricIncident.getId(), rootCauseHistoricIncident.getRootCauseIncidentId());
    HistoricIncident causeHistoricIncident = query.processInstanceId(pi2.getId()).singleResult();
    assertNotNull(causeHistoricIncident);
    // cause and root cause id is equal to the id of the root incident
    assertEquals(rootCauseHistoricIncident.getId(), causeHistoricIncident.getCauseIncidentId());
    assertEquals(rootCauseHistoricIncident.getId(), causeHistoricIncident.getRootCauseIncidentId());
    HistoricIncident historicIncident = query.processInstanceId(pi1.getId()).singleResult();
    assertNotNull(historicIncident);
    // cause and root cause id is equal to the id of the root incident
    assertEquals(causeHistoricIncident.getId(), historicIncident.getCauseIncidentId());
    assertEquals(rootCauseHistoricIncident.getId(), historicIncident.getRootCauseIncidentId());
}
Also used : HistoricIncident(org.camunda.bpm.engine.history.HistoricIncident) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) HistoricIncidentQuery(org.camunda.bpm.engine.history.HistoricIncidentQuery) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 47 with HistoricIncidentQuery

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

the class HistoricIncidentQueryTest method testQueryByInvalidIncidentMessage.

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

Example 48 with HistoricIncidentQuery

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

the class HistoricIncidentQueryTest method testQueryByCauseIncidentId.

@Test
@Deployment(resources = { "org/camunda/bpm/engine/test/history/HistoricIncidentQueryTest.testQueryByCauseIncidentId.bpmn20.xml", "org/camunda/bpm/engine/test/api/runtime/oneFailingServiceProcess.bpmn20.xml" })
public void testQueryByCauseIncidentId() {
    startProcessInstance("process");
    String processInstanceId = runtimeService.createProcessInstanceQuery().processDefinitionKey(PROCESS_DEFINITION_KEY).singleResult().getId();
    Incident incident = runtimeService.createIncidentQuery().processInstanceId(processInstanceId).singleResult();
    HistoricIncidentQuery query = historyService.createHistoricIncidentQuery().causeIncidentId(incident.getId());
    assertEquals(2, query.list().size());
    assertEquals(2, query.count());
}
Also used : Incident(org.camunda.bpm.engine.runtime.Incident) HistoricIncidentQuery(org.camunda.bpm.engine.history.HistoricIncidentQuery) Test(org.junit.Test) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 49 with HistoricIncidentQuery

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

the class HistoricIncidentQueryTest method testQueryByExecutionId.

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

Example 50 with HistoricIncidentQuery

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

the class HistoricIncidentQueryTest method testQueryByIncidentMessage.

@Test
@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/oneFailingServiceProcess.bpmn20.xml" })
public void testQueryByIncidentMessage() {
    startProcessInstance(PROCESS_DEFINITION_KEY);
    HistoricIncidentQuery query = historyService.createHistoricIncidentQuery().incidentMessage(FailingDelegate.EXCEPTION_MESSAGE);
    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)

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