Package org.camunda.bpm.engine.history

Examples of org.camunda.bpm.engine.history.HistoricIncidentQuery


    ProcessInstance pi2 = runtimeService.createProcessInstanceQuery()
        .processDefinitionKey(PROCESS_DEFINITION_KEY)
        .singleResult();
    assertNotNull(pi2);

    HistoricIncidentQuery query = historyService.createHistoricIncidentQuery();

    HistoricIncident rootCauseHistoricIncident = query.processInstanceId(pi2.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 historicIncident = query.processInstanceId(pi1.getId()).singleResult();
    assertNotNull(historicIncident);

    // cause and root cause id is equal to the id of the root incident
    assertEquals(rootCauseHistoricIncident.getId(), historicIncident.getCauseIncidentId());
    assertEquals(rootCauseHistoricIncident.getId(), historicIncident.getRootCauseIncidentId());
View Full Code Here


    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());
View Full Code Here

  public void testDoNotCreateNewIncident() {
    startProcessInstance(PROCESS_DEFINITION_KEY);

    ProcessInstance pi = runtimeService.createProcessInstanceQuery().singleResult();

    HistoricIncidentQuery query = historyService.createHistoricIncidentQuery().processInstanceId(pi.getId());
    HistoricIncident incident = query.singleResult();
    assertNotNull(incident);

    JobDefinition jobDefinition = managementService.createJobDefinitionQuery().singleResult();

    // set retries to 1 by job definition id
    managementService.setJobRetriesByJobDefinitionId(jobDefinition.getId(), 1);

    // the incident still exists
    HistoricIncident tmp = query.singleResult();
    assertEquals(incident.getId(), tmp.getId());
    assertNull(tmp.getEndTime());
    assertTrue(tmp.isOpen());

    // execute the available job (should fail again)
    executeAvailableJobs();

    // the incident still exists and there
    // should be not a new incident
    assertEquals(1, query.count());
    tmp = query.singleResult();
    assertEquals(incident.getId(), tmp.getId());
    assertNull(tmp.getEndTime());
    assertTrue(tmp.isOpen());
  }
View Full Code Here

  public void testSetRetriesByJobDefinitionIdResolveIncident() {
    startProcessInstance(PROCESS_DEFINITION_KEY);

    ProcessInstance pi = runtimeService.createProcessInstanceQuery().singleResult();

    HistoricIncidentQuery query = historyService.createHistoricIncidentQuery().processInstanceId(pi.getId());
    HistoricIncident incident = query.singleResult();
    assertNotNull(incident);

    runtimeService.setVariable(pi.getId(), "fail", false);

    JobDefinition jobDefinition = managementService.createJobDefinitionQuery().singleResult();

    // set retries to 1 by job definition id
    managementService.setJobRetriesByJobDefinitionId(jobDefinition.getId(), 1);

    // the incident still exists
    HistoricIncident tmp = query.singleResult();
    assertEquals(incident.getId(), tmp.getId());
    assertNull(tmp.getEndTime());
    assertTrue(tmp.isOpen());

    // execute the available job (should fail again)
    executeAvailableJobs();

    // the incident still exists and there
    // should be not a new incident
    assertEquals(1, query.count());
    tmp = query.singleResult();
    assertEquals(incident.getId(), tmp.getId());
    assertNotNull(tmp.getEndTime());
    assertTrue(tmp.isResolved());

    assertProcessEnded(pi.getId());
View Full Code Here

  public void testQueryByIncidentId() {
    startProcessInstance(PROCESS_DEFINITION_KEY);

    String incidentId = historyService.createHistoricIncidentQuery().singleResult().getId();

    HistoricIncidentQuery query = historyService.createHistoricIncidentQuery()
        .incidentId(incidentId);

    assertEquals(1, query.list().size());
    assertEquals(1, query.count());
  }
View Full Code Here

TOP

Related Classes of org.camunda.bpm.engine.history.HistoricIncidentQuery

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.