Search in sources :

Example 26 with HistoricCaseInstance

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

the class HistoricCaseInstanceTest method testQueryBySubCaseInstanceId.

@Deployment(resources = { "org/camunda/bpm/engine/test/api/cmmn/oneCaseTaskCase.cmmn", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testQueryBySubCaseInstanceId() {
    String superCaseInstanceId = caseService.createCaseInstanceByKey("oneCaseTaskCase").getId();
    String subCaseInstanceId = caseService.createCaseInstanceQuery().superCaseInstanceId(superCaseInstanceId).singleResult().getId();
    HistoricCaseInstanceQuery query = historyService.createHistoricCaseInstanceQuery().subCaseInstanceId(subCaseInstanceId);
    assertEquals(1, query.list().size());
    assertEquals(1, query.count());
    HistoricCaseInstance caseInstance = query.singleResult();
    assertEquals(superCaseInstanceId, caseInstance.getId());
    assertNull(caseInstance.getSuperProcessInstanceId());
    assertNull(caseInstance.getSuperCaseInstanceId());
}
Also used : HistoricCaseInstance(org.camunda.bpm.engine.history.HistoricCaseInstance) HistoricCaseInstanceQuery(org.camunda.bpm.engine.history.HistoricCaseInstanceQuery) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 27 with HistoricCaseInstance

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

the class HistoricCaseInstanceTest method testRetrieveCaseDefinitionKey.

@Deployment(resources = "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn")
public void testRetrieveCaseDefinitionKey() {
    // given
    String id = createCaseInstance("oneTaskCase").getId();
    // when
    HistoricCaseInstance caseInstance = historyService.createHistoricCaseInstanceQuery().caseInstanceId(id).singleResult();
    // then
    assertEquals("oneTaskCase", caseInstance.getCaseDefinitionKey());
}
Also used : HistoricCaseInstance(org.camunda.bpm.engine.history.HistoricCaseInstance) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 28 with HistoricCaseInstance

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

the class HistoricCaseInstanceTest method testDeleteHistoricCaseInstance.

@Deployment(resources = { "org/camunda/bpm/engine/test/api/cmmn/emptyStageWithManualActivationCase.cmmn" })
public void testDeleteHistoricCaseInstance() {
    CaseInstance caseInstance = createCaseInstance();
    HistoricCaseInstance historicInstance = queryHistoricCaseInstance(caseInstance.getId());
    assertNotNull(historicInstance);
    try {
        // should not be able to delete historic case instance cause the case instance is still running
        historyService.deleteHistoricCaseInstance(historicInstance.getId());
        fail("Exception expected");
    } catch (NullValueException e) {
    // expected
    }
    terminate(caseInstance.getId());
    close(caseInstance.getId());
    historyService.deleteHistoricCaseInstance(historicInstance.getId());
    assertCount(0, historicQuery());
}
Also used : CaseInstance(org.camunda.bpm.engine.runtime.CaseInstance) HistoricCaseInstance(org.camunda.bpm.engine.history.HistoricCaseInstance) HistoricCaseInstance(org.camunda.bpm.engine.history.HistoricCaseInstance) NullValueException(org.camunda.bpm.engine.exception.NullValueException) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 29 with HistoricCaseInstance

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

the class HistoricCaseInstanceTest method testQueryBySuperCaseInstanceId.

@Deployment(resources = { "org/camunda/bpm/engine/test/api/cmmn/oneCaseTaskCase.cmmn", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testQueryBySuperCaseInstanceId() {
    String superCaseInstanceId = caseService.createCaseInstanceByKey("oneCaseTaskCase").getId();
    HistoricCaseInstanceQuery query = historyService.createHistoricCaseInstanceQuery().superCaseInstanceId(superCaseInstanceId);
    assertEquals(1, query.list().size());
    assertEquals(1, query.count());
    HistoricCaseInstance caseInstance = query.singleResult();
    assertEquals(superCaseInstanceId, caseInstance.getSuperCaseInstanceId());
    assertNull(caseInstance.getSuperProcessInstanceId());
}
Also used : HistoricCaseInstance(org.camunda.bpm.engine.history.HistoricCaseInstance) HistoricCaseInstanceQuery(org.camunda.bpm.engine.history.HistoricCaseInstanceQuery) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 30 with HistoricCaseInstance

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

the class HistoricCaseInstanceTest method testQueryBySuperProcessInstanceId.

@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/superProcessWithCaseCallActivity.bpmn20.xml", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testQueryBySuperProcessInstanceId() {
    String superProcessInstanceId = runtimeService.startProcessInstanceByKey("subProcessQueryTest").getId();
    HistoricCaseInstanceQuery query = historyService.createHistoricCaseInstanceQuery().superProcessInstanceId(superProcessInstanceId);
    assertEquals(1, query.list().size());
    assertEquals(1, query.count());
    HistoricCaseInstance subCaseInstance = query.singleResult();
    assertNotNull(subCaseInstance);
    assertEquals(superProcessInstanceId, subCaseInstance.getSuperProcessInstanceId());
    assertNull(subCaseInstance.getSuperCaseInstanceId());
}
Also used : HistoricCaseInstance(org.camunda.bpm.engine.history.HistoricCaseInstance) HistoricCaseInstanceQuery(org.camunda.bpm.engine.history.HistoricCaseInstanceQuery) Deployment(org.camunda.bpm.engine.test.Deployment)

Aggregations

HistoricCaseInstance (org.camunda.bpm.engine.history.HistoricCaseInstance)30 Deployment (org.camunda.bpm.engine.test.Deployment)14 HistoricCaseInstanceQuery (org.camunda.bpm.engine.history.HistoricCaseInstanceQuery)7 Test (org.junit.Test)6 ArrayList (java.util.ArrayList)3 List (java.util.List)3 HistoricDecisionInstance (org.camunda.bpm.engine.history.HistoricDecisionInstance)3 HistoricIncident (org.camunda.bpm.engine.history.HistoricIncident)3 HistoricProcessInstance (org.camunda.bpm.engine.history.HistoricProcessInstance)3 CommandContext (org.camunda.bpm.engine.impl.interceptor.CommandContext)3 HistoricIncidentEntity (org.camunda.bpm.engine.impl.persistence.entity.HistoricIncidentEntity)3 JobEntity (org.camunda.bpm.engine.impl.persistence.entity.JobEntity)3 After (org.junit.After)3 Response (com.jayway.restassured.response.Response)2 AbstractRestServiceTest (org.camunda.bpm.engine.rest.AbstractRestServiceTest)2 CaseInstance (org.camunda.bpm.engine.runtime.CaseInstance)2 Matchers.containsString (org.hamcrest.Matchers.containsString)2 InOrder (org.mockito.InOrder)2 HashMap (java.util.HashMap)1 HistoryService (org.camunda.bpm.engine.HistoryService)1