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.common.util.factory.Factory;
21: import org.apache.cxf.jaxws.service.Hello;
22: import org.apache.cxf.message.Exchange;
23: import org.apache.cxf.service.invoker.ScopePolicy;
24: import org.easymock.classextension.EasyMock;
25: import org.junit.Assert;
26: import org.junit.Test;
27:
28: public class JAXWSMethodInvokerTest {
29: Factory factory = EasyMock.createMock(Factory.class);
30: Object target = EasyMock.createMock(Hello.class);
31: ScopePolicy scope = EasyMock.createMock(ScopePolicy.class);
32:
33: @Test
34: public void testFactoryBeans() throws Throwable {
35: EasyMock.reset(factory);
36: factory.create();
37: EasyMock.expectLastCall().andReturn(target);
38: EasyMock.replay(factory);
39: JAXWSMethodInvoker jaxwsMethodInvoker = new JAXWSMethodInvoker(
40: factory);
41: Exchange ex = EasyMock.createMock(Exchange.class);
42: Object object = jaxwsMethodInvoker.getServiceObject(ex);
43: Assert
44: .assertEquals(
45: "the target object and service object should be equal ",
46: object, target);
47: EasyMock.verify(factory);
48: }
49:
50: }
|