Search in sources :

Example 21 with HistoricCaseInstanceQuery

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

the class HistoricCaseInstanceTest method testQueryByInvalidSuperCaseInstanceId.

public void testQueryByInvalidSuperCaseInstanceId() {
    HistoricCaseInstanceQuery query = historyService.createHistoricCaseInstanceQuery();
    query.superCaseInstanceId("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)

Example 22 with HistoricCaseInstanceQuery

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

the class HistoricCaseInstanceTest method testQueryByNonExistingCaseActivityId.

public void testQueryByNonExistingCaseActivityId() {
    HistoricCaseInstanceQuery query = historyService.createHistoricCaseInstanceQuery().caseActivityIdIn("nonExisting");
    assertEquals(0, query.count());
}
Also used : HistoricCaseInstanceQuery(org.camunda.bpm.engine.history.HistoricCaseInstanceQuery)

Example 23 with HistoricCaseInstanceQuery

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

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

Example 25 with HistoricCaseInstanceQuery

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

the class HistoricCaseInstanceTest method testQueryByCaseActivityId.

@Deployment(resources = { "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testQueryByCaseActivityId() {
    // given
    createCaseInstanceByKey("oneTaskCase");
    // when
    HistoricCaseInstanceQuery query = historyService.createHistoricCaseInstanceQuery().caseActivityIdIn("PI_HumanTask_1");
    // 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)

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