Search in sources :

Example 21 with HistoricCaseInstance

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));
}
Also used : HistoricCaseInstance(org.camunda.bpm.engine.history.HistoricCaseInstance) Test(org.junit.Test)

Example 22 with HistoricCaseInstance

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;
}
Also used : HistoricCaseInstance(org.camunda.bpm.engine.history.HistoricCaseInstance) CommandChecker(org.camunda.bpm.engine.impl.cfg.CommandChecker)

Example 23 with HistoricCaseInstance

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);
}
Also used : HistoricCaseInstance(org.camunda.bpm.engine.history.HistoricCaseInstance) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 24 with HistoricCaseInstance

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());
}
Also used : CaseInstance(org.camunda.bpm.engine.runtime.CaseInstance) HistoricCaseInstance(org.camunda.bpm.engine.history.HistoricCaseInstance) HistoricCaseInstance(org.camunda.bpm.engine.history.HistoricCaseInstance) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 25 with HistoricCaseInstance

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