Search in sources :

Example 36 with HistoricVariableInstanceQuery

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

the class MultiTenancyHistoricVariableInstanceQueryTest method testQueryAuthenticatedTenant.

public void testQueryAuthenticatedTenant() {
    identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE));
    HistoricVariableInstanceQuery query = historyService.createHistoricVariableInstanceQuery();
    assertThat(query.count(), is(1L));
    assertThat(query.tenantIdIn(TENANT_ONE).count(), is(1L));
    assertThat(query.tenantIdIn(TENANT_TWO).count(), is(0L));
    assertThat(query.tenantIdIn(TENANT_ONE, TENANT_TWO).count(), is(1L));
}
Also used : HistoricVariableInstanceQuery(org.camunda.bpm.engine.history.HistoricVariableInstanceQuery)

Example 37 with HistoricVariableInstanceQuery

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

the class MultiTenancyHistoricVariableInstanceQueryTest method testQueryByNonExistingTenantId.

public void testQueryByNonExistingTenantId() {
    HistoricVariableInstanceQuery query = historyService.createHistoricVariableInstanceQuery().tenantIdIn("nonExisting");
    assertThat(query.count(), is(0L));
}
Also used : HistoricVariableInstanceQuery(org.camunda.bpm.engine.history.HistoricVariableInstanceQuery)

Example 38 with HistoricVariableInstanceQuery

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

the class MultiTenancyHistoricVariableInstanceQueryTest method testQueryAuthenticatedTenants.

public void testQueryAuthenticatedTenants() {
    identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE, TENANT_TWO));
    HistoricVariableInstanceQuery query = historyService.createHistoricVariableInstanceQuery();
    assertThat(query.count(), is(2L));
    assertThat(query.tenantIdIn(TENANT_ONE).count(), is(1L));
    assertThat(query.tenantIdIn(TENANT_TWO).count(), is(1L));
}
Also used : HistoricVariableInstanceQuery(org.camunda.bpm.engine.history.HistoricVariableInstanceQuery)

Example 39 with HistoricVariableInstanceQuery

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

the class ExecutionListenerTest method testScriptResourceListener.

@Test
@Deployment(resources = { "org/camunda/bpm/engine/test/bpmn/executionlistener/ExecutionListenerTest.testScriptResourceListener.bpmn20.xml", "org/camunda/bpm/engine/test/bpmn/executionlistener/executionListener.groovy" })
public void testScriptResourceListener() {
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process");
    assertTrue(processInstance.isEnded());
    if (processEngineRule.getProcessEngineConfiguration().getHistoryLevel().getId() >= HISTORYLEVEL_AUDIT) {
        HistoricVariableInstanceQuery query = historyService.createHistoricVariableInstanceQuery();
        long count = query.count();
        assertEquals(5, count);
        HistoricVariableInstance variableInstance = null;
        String[] variableNames = new String[] { "start-start", "start-end", "start-take", "end-start", "end-end" };
        for (String variableName : variableNames) {
            variableInstance = query.variableName(variableName).singleResult();
            assertNotNull("Unable ot find variable with name '" + variableName + "'", variableInstance);
            assertTrue("Variable '" + variableName + "' should be set to true", (Boolean) variableInstance.getValue());
        }
    }
}
Also used : HistoricVariableInstanceQuery(org.camunda.bpm.engine.history.HistoricVariableInstanceQuery) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) HistoricVariableInstance(org.camunda.bpm.engine.history.HistoricVariableInstance) Test(org.junit.Test) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 40 with HistoricVariableInstanceQuery

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

the class ExecutionListenerTest method testScriptListener.

@Test
@Deployment
public void testScriptListener() {
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process");
    assertTrue(processInstance.isEnded());
    if (processEngineRule.getProcessEngineConfiguration().getHistoryLevel().getId() >= HISTORYLEVEL_AUDIT) {
        HistoricVariableInstanceQuery query = historyService.createHistoricVariableInstanceQuery();
        long count = query.count();
        assertEquals(5, count);
        HistoricVariableInstance variableInstance = null;
        String[] variableNames = new String[] { "start-start", "start-end", "start-take", "end-start", "end-end" };
        for (String variableName : variableNames) {
            variableInstance = query.variableName(variableName).singleResult();
            assertNotNull("Unable ot find variable with name '" + variableName + "'", variableInstance);
            assertTrue("Variable '" + variableName + "' should be set to true", (Boolean) variableInstance.getValue());
        }
    }
}
Also used : HistoricVariableInstanceQuery(org.camunda.bpm.engine.history.HistoricVariableInstanceQuery) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) HistoricVariableInstance(org.camunda.bpm.engine.history.HistoricVariableInstance) Test(org.junit.Test) Deployment(org.camunda.bpm.engine.test.Deployment)

Aggregations

HistoricVariableInstanceQuery (org.camunda.bpm.engine.history.HistoricVariableInstanceQuery)48 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)21 Deployment (org.camunda.bpm.engine.test.Deployment)21 HistoricVariableInstance (org.camunda.bpm.engine.history.HistoricVariableInstance)18 Task (org.camunda.bpm.engine.task.Task)8 Test (org.junit.Test)5 HashMap (java.util.HashMap)4 HistoricProcessInstance (org.camunda.bpm.engine.history.HistoricProcessInstance)3 ExecutionEntity (org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity)3 ArrayList (java.util.ArrayList)2 HistoricActivityInstance (org.camunda.bpm.engine.history.HistoricActivityInstance)2 HistoricDetail (org.camunda.bpm.engine.history.HistoricDetail)2 HistoricVariableUpdate (org.camunda.bpm.engine.history.HistoricVariableUpdate)2 SimpleDateFormat (java.text.SimpleDateFormat)1 Date (java.util.Date)1 HistoricVariableInstanceQueryImpl (org.camunda.bpm.engine.impl.HistoricVariableInstanceQueryImpl)1 CountResultDto (org.camunda.bpm.engine.rest.dto.CountResultDto)1 HistoricVariableInstanceDto (org.camunda.bpm.engine.rest.dto.history.HistoricVariableInstanceDto)1 Job (org.camunda.bpm.engine.runtime.Job)1 SerializableVariable (org.camunda.bpm.engine.test.history.SerializableVariable)1