| 1 package org.objectweb.celtix.bus.bindings.xml; 2 3 import javax.wsdl.Port; 4 import javax.xml.namespace.QName ; 5 6 import junit.framework.TestCase; 7 8 import org.objectweb.celtix.Bus; 9 import org.objectweb.celtix.bus.configuration.wsdl.WsdlPortProvider; 10 import org.objectweb.celtix.configuration.Configuration; 11 import org.objectweb.celtix.configuration.ConfigurationBuilder; 12 import org.objectweb.celtix.configuration.ConfigurationBuilderFactory; 13 import org.objectweb.celtix.ws.addressing.EndpointReferenceType; 14 import org.objectweb.celtix.wsdl.EndpointReferenceUtils; 15 16 public class XMLBindingTransportTest extends TestCase { 17 18 private static final String PORT_CONFIGURATION_URI = 19 "http://celtix.objectweb.org/bus/jaxws/port-config"; 20 21 TestUtils utils; 22 Bus bus; 23 24 public void setUp() throws Exception { 25 utils = new TestUtils(); 26 bus = Bus.init(); 27 } 28 29 public void testGetAddress() throws Exception { 30 EndpointReferenceType ref = utils.getEndpointReference(); 31 assertNotNull(ref); 32 Configuration portConfiguration = 33 createPortConfiguration(new QName ("http://objectweb.org/xml_http_bare", 34 "XMLPort"), 35 ref); 36 assertNotNull(portConfiguration); 37 String address = portConfiguration.getString("address"); 38 assertNotNull(address); 39 assertEquals("http://localhost:9090/XMLService/XMLPort", address); 40 } 41 42 private Configuration createPortConfiguration(QName portName, 43 EndpointReferenceType ref) throws Exception { 44 Configuration portCfg = null; 45 String id = portName.getLocalPart(); 46 ConfigurationBuilder cb = ConfigurationBuilderFactory.getBuilder(null); 47 portCfg = cb.buildConfiguration(PORT_CONFIGURATION_URI, id, bus.getConfiguration()); 48 49 Port port = EndpointReferenceUtils.getPort(bus.getWSDLManager(), ref); 50 assertNotNull(port); 51 portCfg.getProviders().add(new WsdlPortProvider(port)); 52 return portCfg; 53 } 54 } 55 56 57 | Popular Tags |