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());
}
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());
}
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());
}
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());
}
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());
}
Aggregations