}
@Test
public void testSignalProcess() throws Exception {
final Map<String,String> testAssertionMap = new HashMap<String,String>();
Service serviceOne = serviceDomain.registerService(new QName("ServiceOne"), new InOnlyService(), new BaseHandler(){
public void handleMessage(Exchange exchange) throws HandlerException {
Holder h = exchange.getMessage().getContent(Holder.class);
testAssertionMap.put("ServiceOne", h.getValue());
}
});
Service serviceTwo = serviceDomain.registerService(new QName("ServiceTwo"), new InOutService(), new BaseHandler(){
public void handleMessage(Exchange exchange) throws HandlerException {
Holder h = exchange.getMessage().getContent(Holder.class);
testAssertionMap.put("ServiceTwo", h.getValue());
}
});
serviceDomain.registerServiceReference(serviceOne.getName(), serviceOne.getInterface(), serviceOne.getProviderHandler());
serviceDomain.registerServiceReference(serviceTwo.getName(), serviceTwo.getInterface(), serviceTwo.getProviderHandler());
BPMComponentImplementationModel bci_model = (BPMComponentImplementationModel)new BPMSwitchYardScanner().scan(SignalProcess.class).getImplementation();
// setting the component name to null so that the service reference doesn't use the component-qualified name
bci_model.getComponent().setName(null);
QName serviceName = new QName("SignalProcess");
BPMExchangeHandler handler = new BPMExchangeHandler(bci_model, serviceDomain, serviceName);
Service signalService = serviceDomain.registerService(serviceName, JavaService.fromClass(SignalProcess.class), handler);
serviceDomain.registerServiceReference(signalService.getName(), signalService.getInterface(), signalService.getProviderHandler());
handler.start();
Invoker processInvoker = new Invoker(serviceDomain, serviceName);
Holder holderOne = new Holder();
holderOne.setValue("HolderOne");
Message processResponse = processInvoker.operation("process").sendInOut(holderOne);