Search in sources :

Example 21 with HistoricCaseActivityInstance

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

the class HistoricCaseActivityInstanceTest method testRequiredRuleEvaluatesToTrue.

@Deployment(resources = "org/camunda/bpm/engine/test/cmmn/required/RequiredRuleTest.testVariableBasedRule.cmmn")
public void testRequiredRuleEvaluatesToTrue() {
    caseService.createCaseInstanceByKey("case", Collections.<String, Object>singletonMap("required", true));
    HistoricCaseActivityInstance task = historyService.createHistoricCaseActivityInstanceQuery().caseActivityId("PI_HumanTask_1").singleResult();
    assertNotNull(task);
    assertTrue(task.isRequired());
}
Also used : HistoricCaseActivityInstance(org.camunda.bpm.engine.history.HistoricCaseActivityInstance) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 22 with HistoricCaseActivityInstance

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

the class HistoricCaseActivityInstanceTest method testDeleteHistoricCaseActivityInstance.

@Deployment(resources = { "org/camunda/bpm/engine/test/api/cmmn/oneTaskCaseWithManualActivation.cmmn" })
public void testDeleteHistoricCaseActivityInstance() {
    CaseInstance caseInstance = createCaseInstance();
    HistoricCaseActivityInstance historicInstance = historicQuery().singleResult();
    assertNotNull(historicInstance);
    // disable human task to complete case
    disable(historicInstance.getId());
    // close case to be able to delete historic case instance
    close(caseInstance.getId());
    // delete historic case instance
    historyService.deleteHistoricCaseInstance(caseInstance.getId());
    assertCount(0, historicQuery());
}
Also used : CaseInstance(org.camunda.bpm.engine.runtime.CaseInstance) HistoricCaseInstance(org.camunda.bpm.engine.history.HistoricCaseInstance) HistoricCaseActivityInstance(org.camunda.bpm.engine.history.HistoricCaseActivityInstance) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 23 with HistoricCaseActivityInstance

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

the class HistoricCaseActivityInstanceTest method testRequiredRuleEvaluatesToFalse.

@Deployment(resources = "org/camunda/bpm/engine/test/cmmn/required/RequiredRuleTest.testVariableBasedRule.cmmn")
public void testRequiredRuleEvaluatesToFalse() {
    caseService.createCaseInstanceByKey("case", Collections.<String, Object>singletonMap("required", false));
    HistoricCaseActivityInstance task = historyService.createHistoricCaseActivityInstanceQuery().caseActivityId("PI_HumanTask_1").singleResult();
    assertNotNull(task);
    assertFalse(task.isRequired());
}
Also used : HistoricCaseActivityInstance(org.camunda.bpm.engine.history.HistoricCaseActivityInstance) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 24 with HistoricCaseActivityInstance

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

the class HistoricCaseActivityInstanceTest method testHistoricCalledProcessInstanceId.

@Deployment(resources = { "org/camunda/bpm/engine/test/api/cmmn/oneProcessTaskCaseWithManualActivation.cmmn", "org/camunda/bpm/engine/test/history/HistoricCaseActivityInstanceTest.oneTaskProcess.bpmn20.xml" })
public void testHistoricCalledProcessInstanceId() {
    String taskId = "PI_ProcessTask_1";
    createCaseInstanceByKey("oneProcessTaskCase").getId();
    // as long as the process task is not activated there should be no process instance
    assertCount(0, historyService.createHistoricProcessInstanceQuery());
    HistoricCaseActivityInstance historicInstance = queryHistoricActivityCaseInstance(taskId);
    assertNull(historicInstance.getCalledProcessInstanceId());
    // start process task manually to create case instance
    CaseExecution processTask = queryCaseExecutionByActivityId(taskId);
    manualStart(processTask.getId());
    // there should exist a new process instance
    HistoricProcessInstance calledProcessInstance = historyService.createHistoricProcessInstanceQuery().singleResult();
    assertNotNull(calledProcessInstance);
    assertNotNull(calledProcessInstance.getEndTime());
    // check that the called process instance id was correctly set
    historicInstance = queryHistoricActivityCaseInstance(taskId);
    assertEquals(calledProcessInstance.getId(), historicInstance.getCalledProcessInstanceId());
}
Also used : CaseExecution(org.camunda.bpm.engine.runtime.CaseExecution) HistoricProcessInstance(org.camunda.bpm.engine.history.HistoricProcessInstance) HistoricCaseActivityInstance(org.camunda.bpm.engine.history.HistoricCaseActivityInstance) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 25 with HistoricCaseActivityInstance

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

the class HistoricCaseActivityInstanceTest method assertHistoricCreateTime.

protected void assertHistoricCreateTime(String activityId, Date expectedCreateTime) {
    HistoricCaseActivityInstance historicActivityInstance = queryHistoricActivityCaseInstance(activityId);
    Date actualCreateTime = historicActivityInstance.getCreateTime();
    assertSimilarDate(expectedCreateTime, actualCreateTime);
}
Also used : HistoricCaseActivityInstance(org.camunda.bpm.engine.history.HistoricCaseActivityInstance) Date(java.util.Date)

Aggregations

HistoricCaseActivityInstance (org.camunda.bpm.engine.history.HistoricCaseActivityInstance)29 Deployment (org.camunda.bpm.engine.test.Deployment)17 CaseExecution (org.camunda.bpm.engine.runtime.CaseExecution)11 HistoricCaseActivityInstanceQuery (org.camunda.bpm.engine.history.HistoricCaseActivityInstanceQuery)5 Test (org.junit.Test)5 HistoricCaseInstance (org.camunda.bpm.engine.history.HistoricCaseInstance)3 Task (org.camunda.bpm.engine.task.Task)3 Date (java.util.Date)2 HistoricProcessInstance (org.camunda.bpm.engine.history.HistoricProcessInstance)2 CaseInstance (org.camunda.bpm.engine.runtime.CaseInstance)2 Response (com.jayway.restassured.response.Response)1 ArrayList (java.util.ArrayList)1 HistoryService (org.camunda.bpm.engine.HistoryService)1 AbstractRestServiceTest (org.camunda.bpm.engine.rest.AbstractRestServiceTest)1 HistoricCaseActivityInstanceDto (org.camunda.bpm.engine.rest.dto.history.HistoricCaseActivityInstanceDto)1 InvalidRequestException (org.camunda.bpm.engine.rest.exception.InvalidRequestException)1 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)1 Matchers.containsString (org.hamcrest.Matchers.containsString)1 InOrder (org.mockito.InOrder)1