use of io.automatiko.engine.api.runtime.process.ProcessRuntime in project automatiko-engine by automatiko-io.
the class DmnDecisionInProcessTest method createProcessRuntime.
protected InternalProcessRuntime createProcessRuntime(Process... process) {
Map<String, Process> mappedProcesses = Stream.of(process).collect(Collectors.toMap(Process::getId, p -> p));
InternalProcessRuntime processRuntime = new ProcessRuntimeImpl(mappedProcesses);
return processRuntime;
}
use of io.automatiko.engine.api.runtime.process.ProcessRuntime in project automatiko-engine by automatiko-io.
the class DmnDecisionInProcessTest method testDmn.
@Test
public void testDmn() {
String namespace = "https://kiegroup.org/dmn/_52CEF9FD-9943-4A89-96D5-6F66810CA4C1";
String modelName = "PersonDecisions";
String decisionName = "isAdult";
ExecutableProcess process = createProcess(namespace, modelName, decisionName);
Map<String, Object> parameters = new HashMap<>();
Person person = new Person("John", 25);
parameters.put("person", person);
parameters.put("isAdult", false);
ProcessRuntime runtime = createProcessRuntime(process);
ProcessInstance pi = runtime.startProcess("process", parameters);
assertEquals(ProcessInstance.STATE_COMPLETED, pi.getState());
boolean result = (boolean) pi.getVariables().get("isAdult");
assertEquals(true, result);
}
Aggregations