Search in sources :

Example 1 with TestProcessEventListener

use of io.automatiko.engine.workflow.process.test.TestProcessEventListener in project automatiko-engine by automatiko-io.

the class NodeInnerClassesTest method testNodeReading.

@Test
public void testNodeReading() {
    ExecutableProcess process = new ExecutableProcess();
    process.setId("org.company.core.process.event");
    process.setName("Event Process");
    List<Variable> variables = new ArrayList<Variable>();
    Variable variable = new Variable();
    variable.setName("event");
    ObjectDataType personDataType = new ObjectDataType(Person.class);
    variable.setType(personDataType);
    variables.add(variable);
    process.getVariableScope().setVariables(variables);
    process.setDynamic(true);
    CompositeNode compositeNode = new CompositeNode();
    compositeNode.setName("CompositeNode");
    compositeNode.setId(2);
    ForEachNode forEachNode = new ForEachNode();
    ForEachNode.ForEachSplitNode split = new ForEachNode.ForEachSplitNode();
    split.setName("ForEachSplit");
    split.setMetaData("hidden", true);
    split.setMetaData("UniqueId", forEachNode.getMetaData("Uniqueid") + ":foreach:split");
    forEachNode.internalAddNode(split);
    forEachNode.linkIncomingConnections(io.automatiko.engine.workflow.process.core.Node.CONNECTION_DEFAULT_TYPE, new CompositeNode.NodeAndType(split, io.automatiko.engine.workflow.process.core.Node.CONNECTION_DEFAULT_TYPE));
    process.addNode(forEachNode);
    InternalProcessRuntime ksession = createProcessRuntime(process);
    TestProcessEventListener procEventListener = new TestProcessEventListener();
    ksession.addEventListener(procEventListener);
    ProcessInstance processInstance = ksession.startProcess("org.company.core.process.event");
    assertNotNull(processInstance);
}
Also used : Variable(io.automatiko.engine.workflow.base.core.context.variable.Variable) ArrayList(java.util.ArrayList) ObjectDataType(io.automatiko.engine.workflow.base.core.datatype.impl.type.ObjectDataType) CompositeNode(io.automatiko.engine.workflow.process.core.node.CompositeNode) ExecutableProcess(io.automatiko.engine.workflow.process.executable.core.ExecutableProcess) ForEachNode(io.automatiko.engine.workflow.process.core.node.ForEachNode) InternalProcessRuntime(io.automatiko.engine.workflow.base.instance.InternalProcessRuntime) ProcessInstance(io.automatiko.engine.api.runtime.process.ProcessInstance) TestProcessEventListener(io.automatiko.engine.workflow.process.test.TestProcessEventListener) Test(org.junit.jupiter.api.Test) AbstractBaseTest(io.automatiko.engine.workflow.test.util.AbstractBaseTest)

Aggregations

ProcessInstance (io.automatiko.engine.api.runtime.process.ProcessInstance)1 Variable (io.automatiko.engine.workflow.base.core.context.variable.Variable)1 ObjectDataType (io.automatiko.engine.workflow.base.core.datatype.impl.type.ObjectDataType)1 InternalProcessRuntime (io.automatiko.engine.workflow.base.instance.InternalProcessRuntime)1 CompositeNode (io.automatiko.engine.workflow.process.core.node.CompositeNode)1 ForEachNode (io.automatiko.engine.workflow.process.core.node.ForEachNode)1 ExecutableProcess (io.automatiko.engine.workflow.process.executable.core.ExecutableProcess)1 TestProcessEventListener (io.automatiko.engine.workflow.process.test.TestProcessEventListener)1 AbstractBaseTest (io.automatiko.engine.workflow.test.util.AbstractBaseTest)1 ArrayList (java.util.ArrayList)1 Test (org.junit.jupiter.api.Test)1