01: package org.objectweb.celtix.bus.bindings.soap;
02:
03: import java.net.URL;
04:
05: import javax.xml.namespace.QName;
06: import javax.xml.ws.Binding;
07:
08: import junit.framework.TestCase;
09:
10: import org.objectweb.celtix.Bus;
11: import org.objectweb.celtix.bindings.BindingFactory;
12: import org.objectweb.celtix.bindings.ClientBinding;
13: import org.objectweb.celtix.ws.addressing.EndpointReferenceType;
14: import org.objectweb.celtix.wsdl.EndpointReferenceUtils;
15:
16: public class SoapBindingFactoryTest extends TestCase {
17:
18: public SoapBindingFactoryTest(String arg0) {
19: super (arg0);
20: }
21:
22: public static void main(String[] args) {
23: junit.textui.TestRunner.run(SoapBindingFactoryTest.class);
24: }
25:
26: public void testCreateClientBinding() throws Exception {
27: Bus bus = Bus.init(new String[0]);
28: BindingFactory factory = bus.getBindingManager()
29: .getBindingFactory(
30: "http://schemas.xmlsoap.org/wsdl/soap/");
31: assertNotNull(factory);
32:
33: URL url = getClass().getClassLoader().getResource(".");
34: URL wsdlUrl = new URL(url,
35: "../classes-tests/wsdl/hello_world.wsdl");
36: assertNotNull(wsdlUrl);
37: QName serviceName = new QName(
38: "http://objectweb.org/hello_world_soap_http",
39: "SOAPService");
40: EndpointReferenceType address = EndpointReferenceUtils
41: .getEndpointReference(wsdlUrl, serviceName, "SoapPort");
42:
43: ClientBinding clientBinding = factory
44: .createClientBinding(address);
45: assertNotNull(clientBinding);
46: assertTrue(SOAPClientBinding.class.isInstance(clientBinding));
47:
48: SOAPClientBinding soapClientBinding = (SOAPClientBinding) clientBinding;
49: Binding b = soapClientBinding.getBinding();
50: assertNotNull(b);
51: assertTrue(SOAPBindingImpl.class.isInstance(b));
52:
53: bus.shutdown(true);
54: }
55:
56: }
|