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));
}
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));
}
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));
}
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());
}
}
}
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());
}
}
}
Aggregations