public static final QName SERVICE_NAME = new QName("http://jbi.mule.org", "myService");
public static final String ENDPOINT_NAME = "myEndpoint";
public void test() throws Exception {
JbiContainerImpl container = new JbiContainerImpl();
container.setWorkingDir(new File("target/.mule-jbi"));
// Initialize jbi
container.initialize();
// Create components
AgilaComponent provider = new AgilaComponent();
TestComponent consumer = new TestComponent();
// Register components
container.getRegistry().addTransientEngine("consumer", consumer);
Engine agila = container.getRegistry().addTransientEngine("provider", provider, new AgilaBootstrap());
// Start jbi
container.start();
// Deploy service unit
URL url = Thread.currentThread().getContextClassLoader().getResource("loanbroker/process.xml");
File loanbroker = new File(url.toURI()).getParentFile();
container.getRegistry().addTransientUnit("loanbroker", agila, loanbroker.getAbsolutePath());
// Send message exchange
MessageExchangeFactory mef = consumer.getChannel().createExchangeFactory();
InOnly me = mef.createInOnlyExchange();
me.setInterfaceName(new QName("http://www.apache.org/agila/samples/exemple1/definition/", "loanService"));
me.setOperation(new QName("http://www.apache.org/agila/samples/exemple1/definition/", "request"));