Search in sources :

Example 16 with HistoricCaseInstanceQuery

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

the class HistoricCaseInstanceTest method testQueryByCaseActivityIds.

@Deployment(resources = { "org/camunda/bpm/engine/test/api/cmmn/oneCaseTaskCase.cmmn", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testQueryByCaseActivityIds() {
    // given
    createCaseInstanceByKey("oneCaseTaskCase");
    // when
    HistoricCaseInstanceQuery query = historyService.createHistoricCaseInstanceQuery().caseActivityIdIn("PI_HumanTask_1", "PI_CaseTask_1");
    // then
    assertEquals(2, query.list().size());
    assertEquals(2, query.count());
}
Also used : HistoricCaseInstanceQuery(org.camunda.bpm.engine.history.HistoricCaseInstanceQuery) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 17 with HistoricCaseInstanceQuery

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

the class HistoricCaseInstanceTest method testQueryBySubProcessInstanceId.

@Deployment(resources = { "org/camunda/bpm/engine/test/api/cmmn/oneProcessTaskCase.cmmn", "org/camunda/bpm/engine/test/api/runtime/oneTaskProcess.bpmn20.xml" })
public void testQueryBySubProcessInstanceId() {
    String superCaseInstanceId = caseService.createCaseInstanceByKey("oneProcessTaskCase").getId();
    String subProcessInstanceId = runtimeService.createProcessInstanceQuery().superCaseInstanceId(superCaseInstanceId).singleResult().getId();
    HistoricCaseInstanceQuery query = historyService.createHistoricCaseInstanceQuery().subProcessInstanceId(subProcessInstanceId);
    assertEquals(1, query.list().size());
    assertEquals(1, query.count());
    HistoricCaseInstance caseInstance = query.singleResult();
    assertEquals(superCaseInstanceId, caseInstance.getId());
    assertNull(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 18 with HistoricCaseInstanceQuery

use of org.camunda.bpm.engine.history.HistoricCaseInstanceQuery 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 19 with HistoricCaseInstanceQuery

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

the class HistoricCaseInstanceTest method testDistinctQueryByCaseActivityIds.

@Deployment(resources = { "org/camunda/bpm/engine/test/api/cmmn/twoTaskCase.cmmn" })
public void testDistinctQueryByCaseActivityIds() {
    // given
    createCaseInstanceByKey("twoTaskCase");
    // when
    HistoricCaseInstanceQuery query = historyService.createHistoricCaseInstanceQuery().caseActivityIdIn("PI_HumanTask_1", "PI_HumanTask_2");
    // then
    assertEquals(1, query.list().size());
    assertEquals(1, query.count());
}
Also used : HistoricCaseInstanceQuery(org.camunda.bpm.engine.history.HistoricCaseInstanceQuery) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 20 with HistoricCaseInstanceQuery

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

the class HistoricCaseInstanceTest method testQueryByInvalidSubProcessInstanceId.

public void testQueryByInvalidSubProcessInstanceId() {
    HistoricCaseInstanceQuery query = historyService.createHistoricCaseInstanceQuery();
    query.subProcessInstanceId("invalid");
    assertEquals(0, query.count());
    assertEquals(0, query.list().size());
    query.caseInstanceId(null);
    assertEquals(0, query.count());
    assertEquals(0, query.list().size());
}
Also used : HistoricCaseInstanceQuery(org.camunda.bpm.engine.history.HistoricCaseInstanceQuery)

Aggregations

HistoricCaseInstanceQuery (org.camunda.bpm.engine.history.HistoricCaseInstanceQuery)26 HistoricCaseInstance (org.camunda.bpm.engine.history.HistoricCaseInstance)7 Deployment (org.camunda.bpm.engine.test.Deployment)7 Response (com.jayway.restassured.response.Response)2 AbstractRestServiceTest (org.camunda.bpm.engine.rest.AbstractRestServiceTest)2 Matchers.containsString (org.hamcrest.Matchers.containsString)2 Test (org.junit.Test)2 InOrder (org.mockito.InOrder)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 CountResultDto (org.camunda.bpm.engine.rest.dto.CountResultDto)1 HistoricCaseInstanceDto (org.camunda.bpm.engine.rest.dto.history.HistoricCaseInstanceDto)1