import org.jbpm.workflow.instance.node.DynamicUtils;
public class ProcessDynamicNodeTest extends JbpmTestCase {
public void TODOtestDynamicActions() {
PackageBuilder builder = new PackageBuilder();
Reader source = new StringReader(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<process xmlns=\"http://drools.org/drools-5.0/process\"\n" +
" xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
" xs:schemaLocation=\"http://drools.org/drools-5.0/process drools-processes-5.0.xsd\"\n" +
" type=\"RuleFlow\" name=\"ruleflow\" id=\"org.drools.dynamic\" package-name=\"org.drools\" >\n" +
"\n" +
" <header>\n" +
" <globals>\n" +
" <global identifier=\"list\" type=\"java.util.List\" />\n" +
" </globals>\n" +
" </header>\n" +
"\n" +
" <nodes>\n" +
" <start id=\"1\" name=\"Start\" />\n" +
" <dynamic id=\"2\" name=\"DynamicNode\" >\n" +
" <nodes>\n" +
" <actionNode id=\"1\" name=\"Action1\" >\n" +
" <action type=\"expression\" dialect=\"mvel\" >System.out.println(\"Action1\");\n" +
"list.add(\"Action1\");</action>\n" +
" </actionNode>\n" +
" <actionNode id=\"2\" name=\"Action2\" >\n" +
" <action type=\"expression\" dialect=\"mvel\" >System.out.println(\"Action2\");\n" +
"list.add(\"Action2\");</action>\n" +
" </actionNode>\n" +
" <actionNode id=\"3\" name=\"Action3\" >\n" +
" <action type=\"expression\" dialect=\"mvel\" >System.out.println(\"Action3\");\n" +
"list.add(\"Action3\");</action>\n" +
" </actionNode>\n" +
" </nodes>\n" +
" <connections>\n" +
" <connection from=\"1\" to=\"3\" />\n" +
" </connections>\n" +
" <in-ports/>\n" +
" <out-ports/>\n" +
" </dynamic>\n" +
" <actionNode id=\"3\" name=\"Action4\" >\n" +
" <action type=\"expression\" dialect=\"mvel\" >System.out.println(\"Action4\");\n" +
"list.add(\"Action4\");</action>\n" +
" </actionNode>\n" +
" <end id=\"4\" name=\"End\" />\n" +
" </nodes>\n" +
"\n" +
" <connections>\n" +
" <connection from=\"1\" to=\"2\" />\n" +
" <connection from=\"2\" to=\"3\" />\n" +
" <connection from=\"3\" to=\"4\" />\n" +
" </connections>\n" +
"</process>");
builder.addRuleFlow(source);
Package pkg = builder.getPackage();
for (DroolsError error: builder.getErrors().getErrors()) {
System.err.println(error);
}
RuleBase ruleBase = RuleBaseFactory.newRuleBase();
ruleBase.addPackage( pkg );
WorkingMemory workingMemory = ruleBase.newStatefulSession();