"end\n" +
"]]></x>";
public void testMediator() throws Exception {
RuleMediatorDescription ruleMediatorDescription = new RuleMediatorDescription();
ResourceDescription inputOne = new ResourceDescription();
inputOne.setName("symbol");
inputOne.setType(POJOResourceAdapter.TYPE);
Symbol ibm = new Symbol("IBM");
ResourceDescription childOfInputOne = new ResourceDescription();
childOfInputOne.setName("symbol");
childOfInputOne.setValue("IBM");
childOfInputOne.setType(String.class.getName());
ResourceDescription childOfInputTwo = new ResourceDescription();
childOfInputTwo.setName("price");
childOfInputTwo.setValue("10000.00");
childOfInputTwo.setType(Double.class.getName());
inputOne.addChildResource(childOfInputOne);
inputOne.addChildResource(childOfInputTwo);
inputOne.setType(ibm.getClass().getName());
inputOne.setValue(ibm);
ResourceDescription outputOne = new ResourceDescription();
outputOne.setName("symbolCustom");
outputOne.setType(POJOResourceAdapter.TYPE);
outputOne.addChildResource(childOfInputOne);
outputOne.setType(ibm.getClass().getName());
ResourceDescription outputsTwo = new ResourceDescription();
outputsTwo.setName("om");
outputsTwo.setType(OMElementResourceAdapter.TYPE);
// outputsTwo.addChildResource(childOfInputOne);
ResourceDescription outputThree = new ResourceDescription();
AXIOMXPath target = new AXIOMXPath("//m:request/m:symbol");
target.addNamespace("m", "http://services.samples/xsd/xsd");
outputThree.setName("symbol");
outputThree.setType(String.class.getName());
AXIOMXPath target2 = new AXIOMXPath("//m:request/m:Symbol");
target2.addNamespace("m", "http://services.samples/xsd/xsd");
outputOne.setExpression(target);
outputsTwo.setExpression(target);
outputThree.setExpression(target2);
// PropertyDescription enrtyPoint = new PropertyDescription();
// enrtyPoint.setName("symbol");
// enrtyPoint.setValue("Stock Stream");
SessionDescription sessionDescription = new SessionDescription();
sessionDescription.setSessionType(SessionDescription.STATEFUL_SESSION);
RuleServerManager ruleServerManager = new RuleServerManager();// TODO to get from a OSGI service
RuleServerConfiguration configuration = new RuleServerConfiguration(new JSR94BackendRuntimeFactory());
ruleServerManager.init(configuration); //TODO
// sessionDescription.addSessionPropertyDescription(enrtyPoint);
ruleMediatorDescription.setSessionDescription(sessionDescription);
ruleMediatorDescription.addFactDescription(inputOne);
// configuration.addOutputResourceDescription(outputThree);
// configuration.addOutputResourceDescription(outputOne);
ruleMediatorDescription.addResultDescription(outputsTwo);
RuleSetDescription setDescription = new RuleSetDescription();
setDescription.setBindURI("RoutingRules");
setDescription.setRuleSource(createOMElement(drlRule));
PropertyDescription creationDescription = new PropertyDescription();
creationDescription.setName(RuleConstants.SOURCE);
creationDescription.setValue("drl");
setDescription.addCreationProperty(creationDescription);
ruleMediatorDescription.setRuleSetDescription(setDescription);
RuleMediator ruleMediator = new RuleMediator(ruleMediatorDescription);
ruleMediator.init(null);
for (int i = 0; i < 3; i++) {
MessageContext mcTemp = getMessageContext();