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