@Test
public void interfaceESB() throws Exception {
InputStream swConfigStream = Classes.getResourceAsStream("/switchyard-config-interface-esb-01.xml", getClass());
Deployment deployment = new Deployment(swConfigStream);
swConfigStream.close();
MockDomain serviceDomain = new MockDomain();
deployment.init(serviceDomain, ActivatorLoader.createActivators(serviceDomain));
deployment.start();
// Test the service
Service service = serviceDomain.getServiceRegistry().getServices(
new QName("urn:switchyard-interface-esb", "HelloService")).get(0);
Assert.assertNotNull(service);
ServiceInterface iface = service.getInterface();
Assert.assertEquals(EsbInterfaceModel.ESB, iface.getType());
ServiceOperation op = iface.getOperation(ServiceInterface.DEFAULT_OPERATION);
Assert.assertNotNull(op);
Assert.assertEquals(ExchangePattern.IN_ONLY, op.getExchangePattern());
// Test the reference
ServiceReference reference = serviceDomain.getServiceReference(
new QName("urn:switchyard-interface-esb", "HelloService/SomeOtherService"));
Assert.assertNotNull(reference);
Assert.assertEquals(EsbInterfaceModel.ESB, service.getInterface().getType());
ServiceOperation rop = reference.getInterface().getOperation(ServiceInterface.DEFAULT_OPERATION);
Assert.assertNotNull(rop);