Search in sources :

Example 6 with HistoricVariableInstanceEntity

use of org.camunda.bpm.engine.impl.persistence.entity.HistoricVariableInstanceEntity in project camunda-bpm-platform by camunda.

the class HistoricVariableInstanceTest method testParallel.

@Deployment
public void testParallel() {
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("myProc");
    TaskQuery taskQuery = taskService.createTaskQuery();
    Task userTask = taskQuery.singleResult();
    assertEquals("userTask1", userTask.getName());
    taskService.complete(userTask.getId(), CollectionUtil.singletonMap("myVar", "test789"));
    assertProcessEnded(processInstance.getId());
    List<HistoricVariableInstance> variables = historyService.createHistoricVariableInstanceQuery().orderByVariableName().asc().list();
    assertEquals(2, variables.size());
    HistoricVariableInstanceEntity historicVariable = (HistoricVariableInstanceEntity) variables.get(0);
    assertEquals("myVar", historicVariable.getName());
    assertEquals("test789", historicVariable.getTextValue());
    HistoricVariableInstanceEntity historicVariable1 = (HistoricVariableInstanceEntity) variables.get(1);
    assertEquals("myVar1", historicVariable1.getName());
    assertEquals("test456", historicVariable1.getTextValue());
    assertEquals(8, historyService.createHistoricActivityInstanceQuery().count());
    if (isFullHistoryEnabled()) {
        assertEquals(5, historyService.createHistoricDetailQuery().count());
    }
}
Also used : Task(org.camunda.bpm.engine.task.Task) TaskQuery(org.camunda.bpm.engine.task.TaskQuery) HistoricVariableInstanceEntity(org.camunda.bpm.engine.impl.persistence.entity.HistoricVariableInstanceEntity) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 7 with HistoricVariableInstanceEntity

use of org.camunda.bpm.engine.impl.persistence.entity.HistoricVariableInstanceEntity in project camunda-bpm-platform by camunda.

the class HistoricVariableInstanceTest method testHistoricVariableInstanceRevisionAsync.

@Deployment
public void testHistoricVariableInstanceRevisionAsync() {
    // given:
    // a finished process instance
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process");
    // when
    executeAvailableJobs();
    // then
    assertProcessEnded(processInstance.getId());
    HistoricVariableInstance variable = historyService.createHistoricVariableInstanceQuery().singleResult();
    assertNotNull(variable);
    HistoricVariableInstanceEntity variableEntity = (HistoricVariableInstanceEntity) variable;
    // the revision has to be 2
    assertEquals(2, variableEntity.getRevision());
    if (isFullHistoryEnabled()) {
        List<HistoricDetail> details = historyService.createHistoricDetailQuery().orderByVariableRevision().asc().list();
        int i = 0;
        for (HistoricDetail detail : details) {
            HistoricVariableUpdate variableDetail = (HistoricVariableUpdate) detail;
            assertEquals(i, variableDetail.getRevision());
            i++;
        }
    }
}
Also used : HistoricVariableInstanceEntity(org.camunda.bpm.engine.impl.persistence.entity.HistoricVariableInstanceEntity) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 8 with HistoricVariableInstanceEntity

use of org.camunda.bpm.engine.impl.persistence.entity.HistoricVariableInstanceEntity in project camunda-bpm-platform by camunda.

the class HistoricVariableInstanceTest method testSimple.

@Deployment
public void testSimple() {
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("myProc");
    TaskQuery taskQuery = taskService.createTaskQuery();
    Task userTask = taskQuery.singleResult();
    assertEquals("userTask1", userTask.getName());
    taskService.complete(userTask.getId(), CollectionUtil.singletonMap("myVar", "test789"));
    assertProcessEnded(processInstance.getId());
    List<HistoricVariableInstance> variables = historyService.createHistoricVariableInstanceQuery().list();
    assertEquals(1, variables.size());
    HistoricVariableInstanceEntity historicVariable = (HistoricVariableInstanceEntity) variables.get(0);
    assertEquals("test456", historicVariable.getTextValue());
    assertEquals(5, historyService.createHistoricActivityInstanceQuery().count());
    if (isFullHistoryEnabled()) {
        assertEquals(3, historyService.createHistoricDetailQuery().count());
    }
}
Also used : Task(org.camunda.bpm.engine.task.Task) TaskQuery(org.camunda.bpm.engine.task.TaskQuery) HistoricVariableInstanceEntity(org.camunda.bpm.engine.impl.persistence.entity.HistoricVariableInstanceEntity) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 9 with HistoricVariableInstanceEntity

use of org.camunda.bpm.engine.impl.persistence.entity.HistoricVariableInstanceEntity in project camunda-bpm-platform by camunda.

the class HistoricVariableInstanceTest method testSimpleNoWaitState.

@Deployment
public void testSimpleNoWaitState() {
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("myProc");
    assertProcessEnded(processInstance.getId());
    List<HistoricVariableInstance> variables = historyService.createHistoricVariableInstanceQuery().list();
    assertEquals(1, variables.size());
    HistoricVariableInstanceEntity historicVariable = (HistoricVariableInstanceEntity) variables.get(0);
    assertEquals("test456", historicVariable.getTextValue());
    assertEquals(4, historyService.createHistoricActivityInstanceQuery().count());
    if (isFullHistoryEnabled()) {
        assertEquals(2, historyService.createHistoricDetailQuery().count());
    }
}
Also used : HistoricVariableInstanceEntity(org.camunda.bpm.engine.impl.persistence.entity.HistoricVariableInstanceEntity) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 10 with HistoricVariableInstanceEntity

use of org.camunda.bpm.engine.impl.persistence.entity.HistoricVariableInstanceEntity in project camunda-bpm-platform by camunda.

the class HistoricVariableInstanceTest method testTwoSubProcessInParallelWithinSubProcess.

@Deployment
public void testTwoSubProcessInParallelWithinSubProcess() {
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("twoSubProcessInParallelWithinSubProcess");
    assertProcessEnded(processInstance.getId());
    List<HistoricVariableInstance> variables = historyService.createHistoricVariableInstanceQuery().orderByVariableName().asc().list();
    assertEquals(2, variables.size());
    HistoricVariableInstanceEntity historicVariable = (HistoricVariableInstanceEntity) variables.get(0);
    assertEquals("myVar", historicVariable.getName());
    assertEquals("test101112", historicVariable.getTextValue());
    assertEquals("string", historicVariable.getVariableTypeName());
    assertEquals("string", historicVariable.getTypeName());
    HistoricVariableInstanceEntity historicVariable1 = (HistoricVariableInstanceEntity) variables.get(1);
    assertEquals("myVar1", historicVariable1.getName());
    assertEquals("test789", historicVariable1.getTextValue());
    assertEquals("string", historicVariable1.getVariableTypeName());
    assertEquals("string", historicVariable1.getTypeName());
    assertEquals(18, historyService.createHistoricActivityInstanceQuery().count());
    if (isFullHistoryEnabled()) {
        assertEquals(7, historyService.createHistoricDetailQuery().count());
    }
}
Also used : HistoricVariableInstanceEntity(org.camunda.bpm.engine.impl.persistence.entity.HistoricVariableInstanceEntity) Deployment(org.camunda.bpm.engine.test.Deployment)

Aggregations

HistoricVariableInstanceEntity (org.camunda.bpm.engine.impl.persistence.entity.HistoricVariableInstanceEntity)10 Deployment (org.camunda.bpm.engine.test.Deployment)7 HistoricVariableInstance (org.camunda.bpm.engine.history.HistoricVariableInstance)2 Task (org.camunda.bpm.engine.task.Task)2 TaskQuery (org.camunda.bpm.engine.task.TaskQuery)2 DbEntityManager (org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager)1 ByteArrayEntity (org.camunda.bpm.engine.impl.persistence.entity.ByteArrayEntity)1 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)1 AbstractFoxPlatformIntegrationTest (org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest)1 OperateOnDeployment (org.jboss.arquillian.container.test.api.OperateOnDeployment)1 Test (org.junit.Test)1