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.ws.addressing.spring;
19:
20: import org.apache.cxf.Bus;
21: import org.apache.cxf.BusException;
22: import org.apache.cxf.bus.spring.SpringBusFactory;
23: import org.apache.cxf.configuration.Configurer;
24: import org.apache.cxf.endpoint.Endpoint;
25: import org.apache.cxf.endpoint.Server;
26: import org.apache.cxf.interceptor.Interceptor;
27: import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
28: import org.apache.cxf.test.AbstractCXFTest;
29: import org.apache.cxf.ws.addressing.MAPAggregator;
30: import org.apache.cxf.ws.addressing.soap.MAPCodec;
31: import org.apache.hello_world_soap_http.GreeterImpl;
32: import org.junit.Test;
33:
34: public class WSAFeatureXmlTest extends AbstractCXFTest {
35:
36: @Override
37: protected Bus createBus() throws BusException {
38: return new SpringBusFactory()
39: .createBus("/org/apache/cxf/ws/addressing/spring/server.xml");
40: }
41:
42: @Test
43: public void testServerFactory() {
44: JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
45: sf.setServiceBean(new GreeterImpl());
46: sf.setAddress("http://localhost/test");
47: sf.setStart(false);
48: sf.setBus(getBus());
49:
50: Configurer c = getBus().getExtension(Configurer.class);
51: c.configureBean("test", sf);
52:
53: Server server = sf.create();
54:
55: Endpoint endpoint = server.getEndpoint();
56: boolean hasAg = false;
57: boolean hasCodec = false;
58:
59: for (Interceptor i : endpoint.getInInterceptors()) {
60: if (i instanceof MAPAggregator) {
61: hasAg = true;
62: } else if (i instanceof MAPCodec) {
63: hasCodec = true;
64: }
65: }
66: assertTrue(hasAg);
67: assertTrue(hasCodec);
68: }
69: }
|