Search in sources :

Example 11 with HistoricCaseActivityInstance

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

the class HistoricCaseActivityInstanceTest method queryHistoricActivityCaseInstance.

protected HistoricCaseActivityInstance queryHistoricActivityCaseInstance(String activityId) {
    HistoricCaseActivityInstance historicActivityInstance = historicQuery().caseActivityId(activityId).singleResult();
    assertNotNull("No historic activity instance found for activity id: " + activityId, historicActivityInstance);
    return historicActivityInstance;
}
Also used : HistoricCaseActivityInstance(org.camunda.bpm.engine.history.HistoricCaseActivityInstance)

Example 12 with HistoricCaseActivityInstance

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

the class HistoricCaseActivityInstanceTest method testDecisionTask.

@Deployment
public void testDecisionTask() {
    createCaseInstance();
    HistoricCaseActivityInstance decisionTask = historyService.createHistoricCaseActivityInstanceQuery().caseActivityId("PI_DecisionTask_1").singleResult();
    assertNotNull(decisionTask);
    assertEquals("decisionTask", decisionTask.getCaseActivityType());
}
Also used : HistoricCaseActivityInstance(org.camunda.bpm.engine.history.HistoricCaseActivityInstance) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 13 with HistoricCaseActivityInstance

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

the class HistoricCaseActivityInstanceTest method testDisabledHistoricActivityInstancesStayDisabledOnComplete.

@Deployment(resources = { "org/camunda/bpm/engine/test/history/HistoricCaseActivityInstanceTest.oneStageAndOneTaskCaseWithManualActivation.cmmn" })
public void testDisabledHistoricActivityInstancesStayDisabledOnComplete() {
    // given
    createCaseInstance();
    CaseExecution humanTask = queryCaseExecutionByActivityId("PI_HumanTask_3");
    assertTrue(humanTask.isEnabled());
    CaseExecution stageExecution = queryCaseExecutionByActivityId("PI_Stage_1");
    disable(stageExecution.getId());
    stageExecution = queryCaseExecutionByActivityId("PI_Stage_1");
    assertTrue(stageExecution.isDisabled());
    // when
    CaseExecution casePlanExecution = queryCaseExecutionByActivityId("CasePlanModel_1");
    complete(casePlanExecution.getId());
    // then make sure disabled executions stay disabled
    HistoricCaseActivityInstance stageInstance = historyService.createHistoricCaseActivityInstanceQuery().caseActivityId("PI_Stage_1").singleResult();
    HistoricCaseActivityInstance taskInstance = historyService.createHistoricCaseActivityInstanceQuery().caseActivityId("PI_HumanTask_3").singleResult();
    assertTrue(stageInstance.isDisabled());
    assertTrue(taskInstance.isTerminated());
}
Also used : CaseExecution(org.camunda.bpm.engine.runtime.CaseExecution) HistoricCaseActivityInstance(org.camunda.bpm.engine.history.HistoricCaseActivityInstance) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 14 with HistoricCaseActivityInstance

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

the class HistoricCaseActivityInstanceTest method testAutoCompleteEnabled.

@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/stage/AutoCompleteTest.testCasePlanModel.cmmn" })
public void testAutoCompleteEnabled() {
    String caseInstanceId = createCaseInstanceByKey("case").getId();
    HistoricCaseInstance caseInstance = historyService.createHistoricCaseInstanceQuery().caseInstanceId(caseInstanceId).singleResult();
    assertNotNull(caseInstance);
    assertTrue(caseInstance.isCompleted());
    HistoricCaseActivityInstanceQuery query = historyService.createHistoricCaseActivityInstanceQuery();
    HistoricCaseActivityInstance humanTask1 = query.caseActivityId("PI_HumanTask_1").singleResult();
    assertNotNull(humanTask1);
    assertTrue(humanTask1.isTerminated());
    assertNotNull(humanTask1.getEndTime());
    assertNotNull(humanTask1.getDurationInMillis());
    HistoricCaseActivityInstance humanTask2 = query.caseActivityId("PI_HumanTask_2").singleResult();
    assertNotNull(humanTask2);
    assertTrue(humanTask2.isTerminated());
    assertNotNull(humanTask2.getEndTime());
    assertNotNull(humanTask2.getDurationInMillis());
}
Also used : HistoricCaseInstance(org.camunda.bpm.engine.history.HistoricCaseInstance) HistoricCaseActivityInstance(org.camunda.bpm.engine.history.HistoricCaseActivityInstance) HistoricCaseActivityInstanceQuery(org.camunda.bpm.engine.history.HistoricCaseActivityInstanceQuery) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 15 with HistoricCaseActivityInstance

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

the class HistoricCaseActivityInstanceTest method testQueryByRequired.

@Deployment(resources = "org/camunda/bpm/engine/test/cmmn/required/RequiredRuleTest.testVariableBasedRule.cmmn")
public void testQueryByRequired() {
    caseService.createCaseInstanceByKey("case", Collections.<String, Object>singletonMap("required", true));
    HistoricCaseActivityInstanceQuery query = historyService.createHistoricCaseActivityInstanceQuery().required();
    assertEquals(1, query.count());
    assertEquals(1, query.list().size());
    HistoricCaseActivityInstance activityInstance = query.singleResult();
    assertNotNull(activityInstance);
    assertTrue(activityInstance.isRequired());
}
Also used : HistoricCaseActivityInstance(org.camunda.bpm.engine.history.HistoricCaseActivityInstance) HistoricCaseActivityInstanceQuery(org.camunda.bpm.engine.history.HistoricCaseActivityInstanceQuery) Deployment(org.camunda.bpm.engine.test.Deployment)

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