use of org.camunda.bpm.engine.history.HistoricVariableInstanceQuery in project camunda-bpm-platform by camunda.
the class CompensateEventTest method testCompensateActivityRefInEventSubprocess.
@Deployment(resources = { "org/camunda/bpm/engine/test/bpmn/event/compensate/CompensateEventTest.testCompensationInEventSubProcessActivityRef.bpmn20.xml" })
public void testCompensateActivityRefInEventSubprocess() {
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());
assertEquals(0, historyService.createHistoricVariableInstanceQuery().processInstanceId(processInstance.getId()).variableName("undoBookFlight").count());
assertEquals(0, historyService.createHistoricVariableInstanceQuery().processInstanceId(processInstance.getId()).variableName("undoBookHotel").count());
}
}
use of org.camunda.bpm.engine.history.HistoricVariableInstanceQuery in project camunda-bpm-platform by camunda.
the class CompensateEventTest method testCompensateActivityRefTriggeredByEventSubprocessInSubProcess.
@Deployment(resources = { "org/camunda/bpm/engine/test/bpmn/event/compensate/CompensateEventTest.testCompensationTriggeredByEventSubProcessInSubProcessActivityRef.bpmn20.xml" })
public void testCompensateActivityRefTriggeredByEventSubprocessInSubProcess() {
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());
}
}
use of org.camunda.bpm.engine.history.HistoricVariableInstanceQuery in project camunda-bpm-platform by camunda.
the class HistoricVariableInstanceManager method deleteHistoricVariableInstancesByTaskId.
public void deleteHistoricVariableInstancesByTaskId(String taskId) {
if (isHistoryEnabled()) {
HistoricVariableInstanceQuery historicProcessVariableQuery = new HistoricVariableInstanceQueryImpl().taskIdIn(taskId);
List<HistoricVariableInstance> historicProcessVariables = historicProcessVariableQuery.list();
for (HistoricVariableInstance historicProcessVariable : historicProcessVariables) {
((HistoricVariableInstanceEntity) historicProcessVariable).delete();
}
}
}
use of org.camunda.bpm.engine.history.HistoricVariableInstanceQuery in project camunda-bpm-platform by camunda.
the class AsyncEndEventTest method testAsyncEndEventListeners.
@Deployment
public void testAsyncEndEventListeners() {
ProcessInstance pi = runtimeService.startProcessInstanceByKey("asyncEndEvent");
long count = runtimeService.createProcessInstanceQuery().processInstanceId(pi.getId()).active().count();
Assert.assertNull(runtimeService.getVariable(pi.getId(), "listener"));
Assert.assertEquals(1, runtimeService.createExecutionQuery().activityId("endEvent").count());
Assert.assertEquals(1, count);
// as we are standing at the end event, we execute it.
executeAvailableJobs();
count = runtimeService.createProcessInstanceQuery().processInstanceId(pi.getId()).active().count();
Assert.assertEquals(0, count);
if (processEngineConfiguration.getHistoryLevel().getId() > ProcessEngineConfigurationImpl.HISTORYLEVEL_ACTIVITY) {
// after the end event we have a event listener
HistoricVariableInstanceQuery name = historyService.createHistoricVariableInstanceQuery().processInstanceId(pi.getId()).variableName("listener");
Assert.assertNotNull(name);
Assert.assertEquals("listener invoked", name.singleResult().getValue());
}
}
use of org.camunda.bpm.engine.history.HistoricVariableInstanceQuery in project camunda-bpm-platform by camunda.
the class AsyncEndEventTest method testMultipleAsyncEndEvents.
@Deployment
public void testMultipleAsyncEndEvents() {
ProcessInstance pi = runtimeService.startProcessInstanceByKey("multipleAsyncEndEvent");
assertEquals(1, runtimeService.createProcessInstanceQuery().count());
// should stop at both end events
List<Job> jobs = managementService.createJobQuery().withRetriesLeft().list();
assertEquals(2, jobs.size());
// execute one of the end events
managementService.executeJob(jobs.get(0).getId());
jobs = managementService.createJobQuery().withRetriesLeft().list();
assertEquals(1, jobs.size());
// execute the second one
managementService.executeJob(jobs.get(0).getId());
// assert that we have finished our instance now
assertEquals(0, runtimeService.createProcessInstanceQuery().count());
if (processEngineConfiguration.getHistoryLevel().getId() > ProcessEngineConfigurationImpl.HISTORYLEVEL_ACTIVITY) {
// after the end event we have a event listener
HistoricVariableInstanceQuery name = historyService.createHistoricVariableInstanceQuery().processInstanceId(pi.getId()).variableName("message");
Assert.assertNotNull(name);
Assert.assertEquals(true, name.singleResult().getValue());
}
}
Aggregations