@Test public void testReadComplete() throws Exception { SwitchYardModel switchyard = _puller.pull(COMPLETE_XML, getClass()); CompositeModel composite = switchyard.getComposite(); ComponentModel component = composite.getComponents().get(0); ComponentImplementationModel implementation = component.getImplementation(); Assert.assertTrue(implementation instanceof BeanComponentImplementationModel); BeanComponentImplementationModel bci = (BeanComponentImplementationModel) implementation; Assert.assertEquals("bean", bci.getType()); Assert.assertEquals("org.switchyard.example.m1app.SimpleBean", bci.getClazz()); Configuration config = bci.getModelConfiguration(); Assert.assertEquals("implementation.bean", config.getName()); QName qname = config.getQName(); Assert.assertEquals("urn:switchyard-component-bean:config:1.0", qname.getNamespaceURI()); Assert.assertEquals("implementation.bean", qname.getLocalPart()); }
/** {@inheritDoc} */ @Override public void setDomainPropertyResolver() { DomainModel domain = getDomain(); if (domain != null) { PropertiesModel properties = domain.getProperties(); if (properties != null) { PropertyResolver pr = new CompoundPropertyResolver(SystemAndTestPropertyResolver.instance(), properties); getModelConfiguration().setPropertyResolver(pr); } } if (_composite != null) { _composite.setCompositePropertyResolver(); } }
@Before public void setUp() throws Exception { _puller = new ModelPuller<CompositeModel>(); CompositeModel composite = _puller.pull("/HelloSwitchYard.xml", getClass()); composite.assertModelValid(); CompositeServiceModel compositeService = composite.getServices().get(0); _config = (HttpBindingModel) compositeService.getBindings().get(0); // Massive hack for Test Runner. Register both a service and a reference binding. _domain.registerService(_config.getServiceName(), new InOutService(), mockService); _domain.registerServiceReference(_config.getServiceName(), new InOutService()); _httpInbound = new InboundHandler(_config, _domain); _httpInbound.start(); CompositeReferenceModel compositeReference = composite.getReferences().get(0); _configRef = (HttpBindingModel) compositeReference.getBindings().get(0); _httpOutbound = new OutboundHandler(_configRef); // Massive hack for Test Runner. Register both a service and a reference binding. _domain.registerService(_configRef.getServiceName(), new HelloInterface(), _httpOutbound); _domain.registerServiceReference(_configRef.getServiceName(), new HelloInterface()); _httpOutbound.start(); }