Search in sources :

Example 11 with HistoricCaseActivityInstanceQuery

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

the class HistoricCaseActivityInstanceTest method testAutoCompleteStageWithRepeatableTaskWithoutEntryCriteria.

@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/repetition/RepetitionRuleTest.testAutoCompleteStageWithoutEntryCriteria.cmmn" })
public void testAutoCompleteStageWithRepeatableTaskWithoutEntryCriteria() {
    // given
    createCaseInstanceByKey("case", Variables.createVariables().putValue("manualActivation", false));
    queryCaseExecutionByActivityId("PI_Stage_1");
    // when
    String humanTask = queryCaseExecutionByActivityId("PI_HumanTask_1").getId();
    complete(humanTask);
    // then
    HistoricCaseActivityInstanceQuery query = historicQuery().caseActivityId("PI_HumanTask_1");
    assertEquals(2, query.count());
    query = historicQuery().caseActivityId("PI_Stage_1");
    assertEquals(1, query.count());
}
Also used : HistoricCaseActivityInstanceQuery(org.camunda.bpm.engine.history.HistoricCaseActivityInstanceQuery) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 12 with HistoricCaseActivityInstanceQuery

use of org.camunda.bpm.engine.history.HistoricCaseActivityInstanceQuery 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 13 with HistoricCaseActivityInstanceQuery

use of org.camunda.bpm.engine.history.HistoricCaseActivityInstanceQuery 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)

Example 14 with HistoricCaseActivityInstanceQuery

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

the class HistoricCaseActivityInstanceTest method testAutoCompleteStage.

@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/repetition/RepetitionRuleTest.testAutoCompleteStage.cmmn" })
public void testAutoCompleteStage() {
    // given
    createCaseInstance();
    String humanTask1 = queryCaseExecutionByActivityId("PI_HumanTask_1").getId();
    // when
    complete(humanTask1);
    // then
    HistoricCaseActivityInstanceQuery query = historicQuery().caseActivityId("PI_Stage_1");
    assertEquals(1, query.count());
    query = historicQuery().caseActivityId("PI_HumanTask_1");
    assertEquals(1, query.count());
    query = historicQuery().caseActivityId("PI_HumanTask_2");
    assertEquals(2, query.count());
}
Also used : HistoricCaseActivityInstanceQuery(org.camunda.bpm.engine.history.HistoricCaseActivityInstanceQuery) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 15 with HistoricCaseActivityInstanceQuery

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

the class MultiTenancyHistoricCaseActivityInstanceQueryTest method testQueryDisabledTenantCheck.

public void testQueryDisabledTenantCheck() {
    processEngineConfiguration.setTenantCheckEnabled(false);
    identityService.setAuthentication("user", null, null);
    HistoricCaseActivityInstanceQuery query = historyService.createHistoricCaseActivityInstanceQuery();
    assertThat(query.count(), is(2L));
}
Also used : HistoricCaseActivityInstanceQuery(org.camunda.bpm.engine.history.HistoricCaseActivityInstanceQuery)

Aggregations

HistoricCaseActivityInstanceQuery (org.camunda.bpm.engine.history.HistoricCaseActivityInstanceQuery)25 Deployment (org.camunda.bpm.engine.test.Deployment)11 HistoricCaseActivityInstance (org.camunda.bpm.engine.history.HistoricCaseActivityInstance)5 NotValidException (org.camunda.bpm.engine.exception.NotValidException)2 HistoricCaseInstance (org.camunda.bpm.engine.history.HistoricCaseInstance)2 Response (com.jayway.restassured.response.Response)1 ArrayList (java.util.ArrayList)1 AbstractRestServiceTest (org.camunda.bpm.engine.rest.AbstractRestServiceTest)1 CountResultDto (org.camunda.bpm.engine.rest.dto.CountResultDto)1 HistoricCaseActivityInstanceDto (org.camunda.bpm.engine.rest.dto.history.HistoricCaseActivityInstanceDto)1 CaseExecution (org.camunda.bpm.engine.runtime.CaseExecution)1 CaseInstance (org.camunda.bpm.engine.runtime.CaseInstance)1 Task (org.camunda.bpm.engine.task.Task)1 Matchers.containsString (org.hamcrest.Matchers.containsString)1 Test (org.junit.Test)1 InOrder (org.mockito.InOrder)1