Unmarshaller unmarshaller = jaxbCtx.createUnmarshaller();
Transformer transformer = PipelineFactory.newJaxbFromXmlTransformer( unmarshaller );
transformer.setReceiver(setGlobalStage );
Pipeline pipeline = PipelineFactory.newStatefulKnowledgeSessionPipeline( ksession );
pipeline.setReceiver( transformer );
String xml = StringUtils.readFileAsString( new InputStreamReader( getClass().getResourceAsStream( "order.xml" ) ) );
ResultHandlerImpl resultHandler = new ResultHandlerImpl();
pipeline.insert( xml,
resultHandler );
// now round trip that global
Action executeResult = PipelineFactory.newExecuteResultHandler();
Action assignAsResult = PipelineFactory.newAssignObjectAsResult();
assignAsResult.setReceiver( executeResult );
//transformer = PipelineFactory.newXStreamToXmlTransformer( xstream );
Marshaller marshaller = jaxbCtx.createMarshaller();
transformer = PipelineFactory.newJaxbToXmlTransformer( marshaller );
transformer.setReceiver( assignAsResult );
KnowledgeRuntimeCommand getGlobalStage = PipelineFactory.newStatefulKnowledgeSessionGetGlobal( );
getGlobalStage.setReceiver( transformer );
pipeline = PipelineFactory.newStatefulKnowledgeSessionPipeline( ksession );
pipeline.setReceiver( getGlobalStage );
resultHandler = new ResultHandlerImpl();
pipeline.insert( "order", resultHandler );
assertEqualsIgnoreWhitespace( xml, (String) resultHandler.getObject() );
}