use of org.camunda.bpm.engine.history.HistoricVariableInstanceQuery in project camunda-bpm-platform by camunda.
the class HistoricVariableInstanceAuthorizationTest method testQueryWithReadHistoryPermissionOnAnyProcessDefinition.
public void testQueryWithReadHistoryPermissionOnAnyProcessDefinition() {
// given
startProcessInstanceByKey(PROCESS_KEY, getVariables());
startProcessInstanceByKey(PROCESS_KEY, getVariables());
startProcessInstanceByKey(PROCESS_KEY, getVariables());
startProcessInstanceByKey(MESSAGE_START_PROCESS_KEY, getVariables());
startProcessInstanceByKey(MESSAGE_START_PROCESS_KEY, getVariables());
startProcessInstanceByKey(MESSAGE_START_PROCESS_KEY, getVariables());
startProcessInstanceByKey(MESSAGE_START_PROCESS_KEY, getVariables());
createGrantAuthorization(PROCESS_DEFINITION, ANY, userId, READ_HISTORY);
// when
HistoricVariableInstanceQuery query = historyService.createHistoricVariableInstanceQuery();
// then
verifyQueryResults(query, 7);
}
use of org.camunda.bpm.engine.history.HistoricVariableInstanceQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyHistoricVariableInstanceQueryTest method testQueryNoAuthenticatedTenants.
public void testQueryNoAuthenticatedTenants() {
identityService.setAuthentication("user", null, null);
HistoricVariableInstanceQuery query = historyService.createHistoricVariableInstanceQuery();
assertThat(query.count(), is(0L));
}
use of org.camunda.bpm.engine.history.HistoricVariableInstanceQuery in project camunda-bpm-platform by camunda.
the class CompensateEventTest method testCompensateInEventSubprocess.
/**
* enable test case when bug is fixed
*
* @see https://app.camunda.com/jira/browse/CAM-4304
*/
@Deployment(resources = { "org/camunda/bpm/engine/test/bpmn/event/compensate/CompensateEventTest.testCompensationInEventSubProcess.bpmn20.xml" })
public void testCompensateInEventSubprocess() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("compensateProcess");
assertProcessEnded(processInstance.getId());
HistoricVariableInstanceQuery historicVariableInstanceQuery = historyService.createHistoricVariableInstanceQuery().variableName("undoBookSecondHotel");
if (processEngineConfiguration.getHistoryLevel().getId() >= ProcessEngineConfigurationImpl.HISTORYLEVEL_AUDIT) {
assertEquals(1, historicVariableInstanceQuery.count());
assertEquals("undoBookSecondHotel", historicVariableInstanceQuery.list().get(0).getVariableName());
assertEquals(5, historicVariableInstanceQuery.list().get(0).getValue());
historicVariableInstanceQuery = historyService.createHistoricVariableInstanceQuery().variableName("undoBookFlight");
assertEquals(1, historicVariableInstanceQuery.count());
assertEquals(5, historicVariableInstanceQuery.list().get(0).getValue());
historicVariableInstanceQuery = historyService.createHistoricVariableInstanceQuery().variableName("undoBookHotel");
assertEquals(1, historicVariableInstanceQuery.count());
assertEquals(5, historicVariableInstanceQuery.list().get(0).getValue());
}
}
use of org.camunda.bpm.engine.history.HistoricVariableInstanceQuery in project camunda-bpm-platform by camunda.
the class CompensateEventTest method testConcurrentScopeCompensation.
@Deployment
public void testConcurrentScopeCompensation() {
// given a process instance with two concurrent tasks, one of which is waiting
// before throwing compensation
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("concurrentScopeCompensation");
Task beforeCompensationTask = taskService.createTaskQuery().taskDefinitionKey("beforeCompensationTask").singleResult();
Task concurrentTask = taskService.createTaskQuery().taskDefinitionKey("concurrentTask").singleResult();
// when throwing compensation such that two subprocesses are compensated
taskService.complete(beforeCompensationTask.getId());
// then both compensation handlers have been executed
if (processEngineConfiguration.getHistoryLevel().getId() >= ProcessEngineConfigurationImpl.HISTORYLEVEL_AUDIT) {
HistoricVariableInstanceQuery historicVariableInstanceQuery = historyService.createHistoricVariableInstanceQuery().variableName("compensateScope1Task");
assertEquals(1, historicVariableInstanceQuery.count());
assertEquals(1, historicVariableInstanceQuery.list().get(0).getValue());
historicVariableInstanceQuery = historyService.createHistoricVariableInstanceQuery().variableName("compensateScope2Task");
assertEquals(1, historicVariableInstanceQuery.count());
assertEquals(1, historicVariableInstanceQuery.list().get(0).getValue());
}
// and after completing the concurrent task, the process instance ends successfully
taskService.complete(concurrentTask.getId());
assertProcessEnded(processInstance.getId());
}
use of org.camunda.bpm.engine.history.HistoricVariableInstanceQuery in project camunda-bpm-platform by camunda.
the class CompensateEventTest method testCompensateActivityRefTriggeredByEventSubprocess.
@Deployment(resources = { "org/camunda/bpm/engine/test/bpmn/event/compensate/CompensateEventTest.testCompensationTriggeredByEventSubProcessActivityRef.bpmn20.xml" })
public void testCompensateActivityRefTriggeredByEventSubprocess() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("compensateProcess");
assertProcessEnded(processInstance.getId());
HistoricVariableInstanceQuery historicVariableInstanceQuery = historyService.createHistoricVariableInstanceQuery().processInstanceId(processInstance.getId()).variableName("undoBookHotel");
if (processEngineConfiguration.getHistoryLevel().getId() >= ProcessEngineConfigurationImpl.HISTORYLEVEL_AUDIT) {
assertEquals(1, historicVariableInstanceQuery.count());
assertEquals("undoBookHotel", historicVariableInstanceQuery.list().get(0).getVariableName());
assertEquals(5, historicVariableInstanceQuery.list().get(0).getValue());
assertEquals(0, historyService.createHistoricVariableInstanceQuery().processInstanceId(processInstance.getId()).variableName("undoBookFlight").count());
}
}
Aggregations