01: package org.objectweb.celtix.bus.bindings.xml;
02:
03: import javax.wsdl.Port;
04: import javax.xml.namespace.QName;
05:
06: import junit.framework.TestCase;
07:
08: import org.objectweb.celtix.Bus;
09: 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 = "http://celtix.objectweb.org/bus/jaxws/port-config";
19:
20: TestUtils utils;
21: Bus bus;
22:
23: public void setUp() throws Exception {
24: utils = new TestUtils();
25: bus = Bus.init();
26: }
27:
28: public void testGetAddress() throws Exception {
29: EndpointReferenceType ref = utils.getEndpointReference();
30: assertNotNull(ref);
31: Configuration portConfiguration = createPortConfiguration(
32: new QName("http://objectweb.org/xml_http_bare",
33: "XMLPort"), ref);
34: assertNotNull(portConfiguration);
35: String address = portConfiguration.getString("address");
36: assertNotNull(address);
37: assertEquals("http://localhost:9090/XMLService/XMLPort",
38: address);
39: }
40:
41: private Configuration createPortConfiguration(QName portName,
42: EndpointReferenceType ref) throws Exception {
43: Configuration portCfg = null;
44: String id = portName.getLocalPart();
45: ConfigurationBuilder cb = ConfigurationBuilderFactory
46: .getBuilder(null);
47: portCfg = cb.buildConfiguration(PORT_CONFIGURATION_URI, id, bus
48: .getConfiguration());
49:
50: Port port = EndpointReferenceUtils.getPort(
51: bus.getWSDLManager(), ref);
52: assertNotNull(port);
53: portCfg.getProviders().add(new WsdlPortProvider(port));
54: return portCfg;
55: }
56: }
|