public void testNestedIterable() throws Exception {
Options xjcOpts = new Options();
xjcOpts.setSchemaLanguage( Language.XMLSCHEMA );
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
JaxbConfiguration jaxbConf = KnowledgeBuilderFactory.newJaxbConfiguration( xjcOpts, "xsd" );
kbuilder.add( ResourceFactory.newClassPathResource( "order.xsd",
getClass() ), ResourceType.XSD,
jaxbConf );
assertFalse( kbuilder.hasErrors() );
kbuilder.add( ResourceFactory.newClassPathResource( "test_Jaxb.drl",
getClass() ),
ResourceType.DRL );
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
List list1 = new ArrayList();
List list2 = new ArrayList();
ksession.setGlobal( "list1",
list1 );
ksession.setGlobal( "list2",
list2 );
Action executeResultHandler = PipelineFactory.newExecuteResultHandler();
KnowledgeRuntimeCommand insertStage = PipelineFactory.newStatefulKnowledgeSessionInsert();
insertStage.setReceiver( executeResultHandler );
Splitter splitter = PipelineFactory.newIterateSplitter();
splitter.setReceiver( insertStage );
Expression expression = PipelineFactory.newMvelExpression( "this.orderItem" );
expression.setReceiver( splitter );
JAXBContext jaxbCtx = KnowledgeBuilderHelper.newJAXBContext( jaxbConf.getClasses().toArray( new String[jaxbConf.getClasses().size()] ),
kbase );
Unmarshaller unmarshaller = jaxbCtx.createUnmarshaller();
Transformer transformer = PipelineFactory.newJaxbFromXmlTransformer( unmarshaller );
transformer.setReceiver( expression );