use of org.jbpm.services.api.model.VariableDesc in project jbpm by kiegroup.
the class EObjectVariableTest method testFloatArrayProcessVariable.
@Test
public void testFloatArrayProcessVariable() {
Map<String, Object> parameters = new HashMap<>();
parameters.put("myobject", new Float[] { 10.3f, 5.6f });
long pid = ejb.startProcess(ProcessDefinitions.OBJECT_VARIABLE, parameters);
List<VariableDesc> typeVarHistory = ejb.getVariableHistory(pid, "type");
Assertions.assertThat(typeVarHistory).isNotNull();
Assertions.assertThat(typeVarHistory.size()).isEqualTo(1);
VariableDesc typeVarLog = typeVarHistory.get(0);
Assertions.assertThat(typeVarLog.getNewValue()).isEqualTo(Float[].class.getName());
List<VariableDesc> contentVarHistory = ejb.getVariableHistory(pid, "myobject");
Assertions.assertThat(contentVarHistory).isNotNull();
Assertions.assertThat(contentVarHistory.size()).isEqualTo(1);
VariableDesc contentVarLog = contentVarHistory.get(0);
Assertions.assertThat(contentVarLog.getNewValue()).startsWith("[Ljava.lang.Float;@");
}
use of org.jbpm.services.api.model.VariableDesc in project jbpm by kiegroup.
the class ProcessServiceWithServiceRegistryTest method testRunScriptProcessWithServiceRegistryInScriptTask.
@Test
public void testRunScriptProcessWithServiceRegistryInScriptTask() {
long processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), PROCESS_ID_SCRIPT_TASK);
assertNotNull(processInstanceId);
try {
ProcessInstance pi = processService.getProcessInstance(processInstanceId);
if (pi != null) {
fail("Process should be already completed");
}
} catch (ProcessInstanceNotFoundException e) {
// expected
}
Collection<VariableDesc> variables = runtimeDataService.getVariableHistory(processInstanceId, "correlationKey", new QueryContext());
assertNotNull(variables);
assertEquals(1, variables.size());
VariableDesc ckVar = variables.iterator().next();
assertNotNull(ckVar);
assertEquals("1", ckVar.getNewValue());
}
use of org.jbpm.services.api.model.VariableDesc in project jbpm by kiegroup.
the class RuntimeDataServiceImplTest method testGetVariableLogs.
@Test
public void testGetVariableLogs() {
Map<String, Object> params = new HashMap<String, Object>();
params.put("approval_document", "initial content");
processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "org.jbpm.writedocument", params);
assertNotNull(processInstanceId);
Collection<VariableDesc> variableLogs = runtimeDataService.getVariableHistory(processInstanceId, "approval_document", new QueryContext());
assertNotNull(variableLogs);
assertEquals(1, variableLogs.size());
processService.setProcessVariable(processInstanceId, "approval_document", "updated content");
variableLogs = runtimeDataService.getVariableHistory(processInstanceId, "approval_document", new QueryContext());
assertNotNull(variableLogs);
assertEquals(2, variableLogs.size());
processService.setProcessVariable(processInstanceId, "approval_reviewComment", "under review - content");
variableLogs = runtimeDataService.getVariablesCurrentState(processInstanceId);
assertNotNull(variableLogs);
assertEquals(2, variableLogs.size());
for (VariableDesc vDesc : variableLogs) {
if (vDesc.getVariableId().equals("approval_document")) {
assertEquals("updated content", vDesc.getNewValue());
} else if (vDesc.getVariableId().equals("approval_reviewComment")) {
assertEquals("under review - content", vDesc.getNewValue());
}
}
}
Aggregations