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.binding.soap;
19:
20: import javax.wsdl.extensions.soap.SOAPAddress;
21:
22: import com.ibm.wsdl.extensions.soap.SOAPAddressImpl;
23:
24: import org.apache.cxf.binding.soap.model.SoapBindingInfo;
25: import org.apache.cxf.service.model.EndpointInfo;
26: import org.apache.cxf.service.model.ServiceInfo;
27: import org.apache.cxf.transport.Destination;
28: import org.apache.cxf.transport.DestinationFactory;
29: import org.apache.cxf.transport.DestinationFactoryManager;
30: import org.easymock.classextension.EasyMock;
31: import org.easymock.classextension.IMocksControl;
32: import org.junit.Assert;
33: import org.junit.Test;
34:
35: public class SoapDestinationFactoryTest extends Assert {
36:
37: @Test
38: public void testDestination() throws Exception {
39: String wsdlSoapNs = "http://schemas.xmlsoap.org/wsdl/soap/";
40: String transportURI = "http://foo/transport";
41: String location = "http://localhost/service";
42:
43: ServiceInfo si = new ServiceInfo();
44: EndpointInfo ei = new EndpointInfo(si, wsdlSoapNs);
45: SOAPAddress add = new SOAPAddressImpl();
46: add.setLocationURI(location);
47: ei.addExtensor(add);
48:
49: SoapBindingInfo bi = new SoapBindingInfo(si, "", Soap11
50: .getInstance());
51: bi.setTransportURI(transportURI);
52: ei.setBinding(bi);
53:
54: IMocksControl control = EasyMock.createNiceControl();
55: DestinationFactoryManager dfm = control
56: .createMock(DestinationFactoryManager.class);
57: DestinationFactory fooDF = control
58: .createMock(DestinationFactory.class);
59: Destination dest = control.createMock(Destination.class);
60:
61: EasyMock.expect(dfm.getDestinationFactory(transportURI))
62: .andReturn(fooDF);
63: EasyMock.expect(fooDF.getDestination(ei)).andStubReturn(dest);
64:
65: control.replay();
66:
67: // SoapDestinationFactory sdf = new SoapDestinationFactory(dfm);
68: // Destination dest2 = sdf.getDestination(ei);
69: // assertNotNull(dest2);
70:
71: // TODO: doesn't pass because I don't know how to use easymock :-(
72: // assertEquals(dest, dest2);
73: }
74: }
|