01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one
03: * or more contributor license agreements. See the NOTICE file
04: * distributed with this work for additional information
05: * regarding copyright ownership. The ASF licenses this file
06: * to you under the Apache License, Version 2.0 (the
07: * "License"); you may not use this file except in compliance
08: * with the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing,
13: * software distributed under the License is distributed on an
14: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15: * KIND, either express or implied. See the License for the
16: * specific language governing permissions and limitations
17: * under the License.
18: */package org.apache.cxf.jaxws;
19:
20: import org.apache.cxf.binding.BindingFactoryManager;
21: import org.apache.cxf.binding.soap.SoapBindingFactory;
22: import org.apache.cxf.binding.soap.SoapTransportFactory;
23: import org.apache.cxf.test.AbstractCXFTest;
24: import org.apache.cxf.transport.ConduitInitiatorManager;
25: import org.apache.cxf.transport.DestinationFactoryManager;
26: import org.apache.cxf.transport.local.LocalTransportFactory;
27: import org.apache.cxf.wsdl.WSDLManager;
28: import org.apache.cxf.wsdl11.WSDLManagerImpl;
29: import org.junit.Before;
30:
31: /**
32: * Abstract test which sets up the local transport and soap binding.
33: */
34: public abstract class AbstractJaxWsTest extends AbstractCXFTest {
35:
36: protected LocalTransportFactory localTransport;
37:
38: @Before
39: public void setUpBus() throws Exception {
40: super .setUpBus();
41:
42: SoapBindingFactory bindingFactory = new SoapBindingFactory();
43: bindingFactory.setBus(bus);
44: bus.getExtension(BindingFactoryManager.class)
45: .registerBindingFactory(
46: "http://schemas.xmlsoap.org/wsdl/soap/",
47: bindingFactory);
48: bus.getExtension(BindingFactoryManager.class)
49: .registerBindingFactory(
50: "http://schemas.xmlsoap.org/wsdl/soap/http",
51: bindingFactory);
52:
53: DestinationFactoryManager dfm = bus
54: .getExtension(DestinationFactoryManager.class);
55:
56: SoapTransportFactory soapDF = new SoapTransportFactory();
57: soapDF.setBus(bus);
58: dfm.registerDestinationFactory(
59: "http://schemas.xmlsoap.org/wsdl/soap/", soapDF);
60: dfm.registerDestinationFactory(
61: "http://schemas.xmlsoap.org/soap/", soapDF);
62: dfm.registerDestinationFactory(
63: "http://cxf.apache.org/transports/local", soapDF);
64:
65: localTransport = new LocalTransportFactory();
66: dfm.registerDestinationFactory(
67: "http://schemas.xmlsoap.org/soap/http", localTransport);
68: dfm.registerDestinationFactory(
69: "http://schemas.xmlsoap.org/wsdl/soap/http",
70: localTransport);
71: dfm.registerDestinationFactory(
72: "http://cxf.apache.org/bindings/xformat",
73: localTransport);
74: dfm.registerDestinationFactory(
75: "http://cxf.apache.org/transports/local",
76: localTransport);
77:
78: ConduitInitiatorManager extension = bus
79: .getExtension(ConduitInitiatorManager.class);
80: extension.registerConduitInitiator(
81: LocalTransportFactory.TRANSPORT_ID, localTransport);
82: extension
83: .registerConduitInitiator(
84: "http://schemas.xmlsoap.org/wsdl/soap/",
85: localTransport);
86: extension.registerConduitInitiator(
87: "http://schemas.xmlsoap.org/soap/http", localTransport);
88: extension.registerConduitInitiator(
89: "http://schemas.xmlsoap.org/soap/", localTransport);
90:
91: WSDLManagerImpl manager = new WSDLManagerImpl();
92: manager.setBus(bus);
93: bus.setExtension(manager, WSDLManager.class);
94: }
95: }
|