public List<VariableInstanceLog> execute(Context cntxt) { setLogEnvironment(cntxt); if( variableId == null || variableId.isEmpty() ) { return this.auditLogService.findVariableInstances(processInstanceId); } else { return this.auditLogService.findVariableInstances(processInstanceId, variableId); } }
Assertions.assertThat(processInstance.getProcessInstanceId().longValue()).isEqualTo(processInstanceId); Assertions.assertThat(processInstance.getProcessId()).isEqualTo("com.sample.ruleflow3"); List<VariableInstanceLog> variableInstances = auditLogService.findVariableInstances(processInstanceId); Assertions.assertThat(variableInstances.size()).isEqualTo(11); for (VariableInstanceLog variableInstance: variableInstances) {
Assertions.assertThat(processInstance.getProcessInstanceId().longValue()).isEqualTo(processInstanceId); Assertions.assertThat(processInstance.getProcessId()).isEqualTo("com.sample.ruleflow3"); List<VariableInstanceLog> variableInstances = auditLogService.findVariableInstances(processInstanceId); Assertions.assertThat(variableInstances.size()).isEqualTo(12); for (VariableInstanceLog variableInstance: variableInstances) {
public String getProcessVarValue(ProcessInstance processInstance, String varName) { String actualValue = null; if (sessionPersistence) { List<VariableInstanceLog> log = logService.findVariableInstances(processInstance.getId(), varName); if (log != null && !log.isEmpty()) { actualValue = log.get(log.size()-1).getValue(); } } else { Object value = ((WorkflowProcessInstanceImpl) processInstance).getVariable(varName); if (value != null) { actualValue = value.toString(); } } return actualValue; }
Assertions.assertThat(processInstance.getProcessInstanceId().longValue()).isEqualTo(processInstanceId); Assertions.assertThat(processInstance.getProcessId()).isEqualTo("com.sample.ruleflow3"); List<VariableInstanceLog> variableInstances = auditLogService.findVariableInstances(processInstanceId); Assertions.assertThat(variableInstances.size()).isEqualTo(13); for (VariableInstanceLog variableInstance: variableInstances) {
@Test public void specificCompensationOfASubProcess() throws Exception { KieSession ksession = createKnowledgeSession("compensation/BPMN2-Compensation-ThrowSpecificForSubProcess.bpmn2"); TestWorkItemHandler workItemHandler = new TestWorkItemHandler(); ksession.getWorkItemManager().registerWorkItemHandler("Human Task", workItemHandler); Map<String, Object> params = new HashMap<String, Object>(); params.put("x", 1); ProcessInstance processInstance = ksession.startProcess("CompensationSpecificSubProcess", params); // compensation activity (assoc. with script task) signaled *after* to-compensate script task assertProcessInstanceCompleted(processInstance.getId(), ksession); if( ! isPersistence() ) { assertProcessVarValue(processInstance, "x", null); } else { // We need to check it this way because of some databases like Oracle RAC etc. List<VariableInstanceLog> logs = logService.findVariableInstances(processInstance.getId(), "x"); List<String> values = logs.stream().map(VariableInstanceLog::getValue).collect(Collectors.toList()); assertThat(values, IsCollectionContaining.hasItem(AnyOf.anyOf(Is.is(" "), Is.is(""), Is.is((String) null)))); } }
Assertions.assertThat(processInstance.getProcessInstanceId().longValue()).isEqualTo(processInstanceId); Assertions.assertThat(processInstance.getProcessId()).isEqualTo("com.sample.ruleflow3"); List<VariableInstanceLog> variableInstances = auditLogService.findVariableInstances(processInstanceId); Assertions.assertThat(variableInstances.size()).isEqualTo(11); for (VariableInstanceLog variableInstance: variableInstances) {
Assertions.assertThat(processInstance.getProcessInstanceId().longValue()).isEqualTo(processInstanceId); Assertions.assertThat(processInstance.getProcessId()).isEqualTo("com.sample.ruleflow3"); List<VariableInstanceLog> variableInstances = auditLogService.findVariableInstances(processInstanceId); Assertions.assertThat(variableInstances.size()).isEqualTo(8); for (VariableInstanceLog variableInstance: variableInstances) {
Assertions.assertThat(processInstance.getProcessInstanceId().longValue()).isEqualTo(processInstanceId); Assertions.assertThat(processInstance.getProcessId()).isEqualTo("com.sample.ruleflow3"); List<VariableInstanceLog> variableInstances = auditLogService.findVariableInstances(processInstanceId); Assertions.assertThat(variableInstances.size()).isEqualTo(12); for (VariableInstanceLog variableInstance: variableInstances) {
List<VariableInstanceLog> variables = logService.findVariableInstances(processInstance.getId()); Assertions.assertThat(variables).isNotNull(); Assertions.assertThat(variables.size()).isEqualTo(8);
Assertions.assertThat(processInstance.getProcessInstanceId().longValue()).isEqualTo(processInstanceId); Assertions.assertThat(processInstance.getProcessId()).isEqualTo("com.sample.ruleflow3"); List<VariableInstanceLog> variableInstances = auditLogService.findVariableInstances(processInstanceId); Assertions.assertThat(variableInstances.size()).isEqualTo(13); for (VariableInstanceLog variableInstance: variableInstances) {
List<VariableInstanceLog> variables = logService.findVariableInstances(processInstance.getId()); Assertions.assertThat(variables).isNotNull(); Assertions.assertThat(variables).hasSize(2);
public String getProcessVarValue(ProcessInstance processInstance, String varName) { String actualValue = null; if (sessionPersistence) { List<VariableInstanceLog> log = logService.findVariableInstances(processInstance.getId(), varName); if (log != null && !log.isEmpty()) { actualValue = log.get(log.size()-1).getValue(); } } else { Object value = ((WorkflowProcessInstanceImpl) processInstance).getVariable(varName); if (value != null) { actualValue = value.toString(); } } return actualValue; }
@Test public void specificCompensationOfASubProcess() throws Exception { KieSession ksession = createKnowledgeSession("compensation/BPMN2-Compensation-ThrowSpecificForSubProcess.bpmn2"); TestWorkItemHandler workItemHandler = new TestWorkItemHandler(); ksession.getWorkItemManager().registerWorkItemHandler("Human Task", workItemHandler); Map<String, Object> params = new HashMap<String, Object>(); params.put("x", 1); ProcessInstance processInstance = ksession.startProcess("CompensationSpecificSubProcess", params); // compensation activity (assoc. with script task) signaled *after* to-compensate script task assertProcessInstanceCompleted(processInstance.getId(), ksession); if( ! isPersistence() ) { assertProcessVarValue(processInstance, "x", null); } else { // We need to check it this way because of some databases like Oracle RAC etc. List<VariableInstanceLog> logs = logService.findVariableInstances(processInstance.getId(), "x"); List<String> values = logs.stream().map(VariableInstanceLog::getValue).collect(Collectors.toList()); assertThat(values, IsCollectionContaining.hasItem(AnyOf.anyOf(Is.is(" "), Is.is(""), Is.is((String) null)))); } }
Assertions.assertThat(processInstance.getProcessInstanceId().longValue()).isEqualTo(processInstanceId); Assertions.assertThat(processInstance.getProcessId()).isEqualTo("com.sample.ruleflow3"); List<VariableInstanceLog> variableInstances = auditLogService.findVariableInstances(processInstanceId); Assertions.assertThat(variableInstances.size()).isEqualTo(8); for (VariableInstanceLog variableInstance: variableInstances) {
List<VariableInstanceLog> vils = logService.findVariableInstances(procInstId); assertTrue( "No variable instance logs found", vils != null && ! vils.isEmpty() ); assertTrue( "Too few variable instance logs found", vils.size() > 3 );
List<VariableInstanceLog> variables = logService.findVariableInstances(processInstance.getId()); Assertions.assertThat(variables).isNotNull(); Assertions.assertThat(variables.size()).isEqualTo(8);
List<VariableInstanceLog> variables = logService.findVariableInstances(processInstance.getId()); Assertions.assertThat(variables).isNotNull(); Assertions.assertThat(variables).hasSize(2);
List<VariableInstanceLog> vils = logService.findVariableInstances(procInstId); assertTrue( "No variable instance logs found", vils != null && ! vils.isEmpty() ); assertTrue( "Too few variable instance logs found: " + vils.size(), vils.size() >= 3 );