assertEquals(ProcessInstance.STATE_COMPLETED, processInstance.getState());
assertEquals(0, workingMemory.getProcessInstances().size());
}
private static RuleBase readDynamicSubProcess() throws Exception {
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=\"com.sample.ruleflow\" package-name=\"com.sample\" >\n" +
"\n" +
" <header>\n" +
" <variables>\n" +
" <variable name=\"x\" >\n" +
" <type name=\"org.drools.process.core.datatype.impl.type.StringDataType\" />\n" +
" <value></value>\n" +
" </variable>\n" +
" </variables>\n" +
" </header>\n" +
"\n" +
" <nodes>\n" +
" <start id=\"1\" name=\"Start\" />\n" +
" <subProcess id=\"2\" name=\"SubProcess\" processId=\"com.sample.#{x}\" />\n" +
" <end id=\"3\" name=\"End\" />\n" +
" </nodes>\n" +
"\n" +
" <connections>\n" +
" <connection from=\"1\" to=\"2\" />\n" +
" <connection from=\"2\" to=\"3\" />\n" +
" </connections>\n" +
"\n" +
"</process>");
builder.addRuleFlow(source);
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=\"flow\" id=\"com.sample.subflow\" package-name=\"com.sample\" >\n" +
"\n" +
" <header>\n" +
" <imports>\n" +
" <import name=\"org.jbpm.Person\" />\n" +
" </imports>\n" +
" </header>\n" +
"\n" +
" <nodes>\n" +
" <start id=\"1\" name=\"Start\" />\n" +
" <milestone id=\"2\" name=\"Event Wait\" >\n" +
" <constraint type=\"rule\" dialect=\"mvel\" >Person( )</constraint>" +
" </milestone>\n" +
" <end id=\"3\" name=\"End\" />\n" +
" </nodes>\n" +
"\n" +
" <connections>\n" +
" <connection from=\"1\" to=\"2\" />\n" +
" <connection from=\"2\" to=\"3\" />\n" +
" </connections>\n" +
"\n" +
"</process>");
builder.addRuleFlow(source);
Package pkg = builder.getPackage();
RuleBase ruleBase = RuleBaseFactory.newRuleBase();
ruleBase.addPackage( pkg );
return ruleBase;
}