use of org.camunda.bpm.engine.history.HistoricCaseInstance in project camunda-bpm-platform by camunda.
the class MultiTenancyCaseInstanceCmdsTenantCheckTest method terminateCaseExecutionDisabledTenantCheck.
@Test
public void terminateCaseExecutionDisabledTenantCheck() {
identityService.setAuthentication("user", null, null);
processEngineConfiguration.setTenantCheckEnabled(false);
caseService.terminateCaseExecution(caseInstanceId);
HistoricCaseInstance historicCaseInstance = getHistoricCaseInstance();
assertThat(historicCaseInstance, notNullValue());
assertThat(historicCaseInstance.isTerminated(), is(true));
}
use of org.camunda.bpm.engine.history.HistoricCaseInstance in project camunda-bpm-platform by camunda.
the class DeleteHistoricCaseInstanceCmd method execute.
public Object execute(CommandContext commandContext) {
ensureNotNull("caseInstanceId", caseInstanceId);
// Check if case instance is still running
HistoricCaseInstance instance = commandContext.getHistoricCaseInstanceManager().findHistoricCaseInstance(caseInstanceId);
ensureNotNull("No historic case instance found with id: " + caseInstanceId, "instance", instance);
for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
checker.checkDeleteHistoricCaseInstance(instance);
}
ensureNotNull("Case instance is still running, cannot delete historic case instance: " + caseInstanceId, "instance.getCloseTime()", instance.getCloseTime());
commandContext.getHistoricCaseInstanceManager().deleteHistoricCaseInstancesByIds(Arrays.asList(caseInstanceId));
return null;
}
use of org.camunda.bpm.engine.history.HistoricCaseInstance in project camunda-bpm-platform by camunda.
the class HistoricCaseInstanceTest method testSuperCaseInstance.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/cmmn/oneCaseTaskCase.cmmn", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testSuperCaseInstance() {
String caseInstanceId = createCaseInstanceByKey("oneCaseTaskCase").getId();
queryCaseExecutionByActivityId("PI_CaseTask_1").getId();
HistoricCaseInstance historicCaseInstance = historicQuery().superCaseInstanceId(caseInstanceId).singleResult();
assertNotNull(historicCaseInstance);
assertEquals(caseInstanceId, historicCaseInstance.getSuperCaseInstanceId());
String superCaseInstanceId = historicQuery().subCaseInstanceId(historicCaseInstance.getId()).singleResult().getId();
assertEquals(caseInstanceId, superCaseInstanceId);
}
use of org.camunda.bpm.engine.history.HistoricCaseInstance in project camunda-bpm-platform by camunda.
the class HistoricCaseInstanceTest method testCaseInstanceProperties.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/cmmn/emptyStageCase.cmmn" })
public void testCaseInstanceProperties() {
CaseInstance caseInstance = createCaseInstance();
HistoricCaseInstance historicInstance = queryHistoricCaseInstance(caseInstance.getId());
// assert case instance properties are set correctly
assertEquals(caseInstance.getId(), historicInstance.getId());
assertEquals(caseInstance.getBusinessKey(), historicInstance.getBusinessKey());
assertEquals(caseInstance.getCaseDefinitionId(), historicInstance.getCaseDefinitionId());
}
use of org.camunda.bpm.engine.history.HistoricCaseInstance 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());
}
Aggregations