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.http.bare;
19:
20: import java.util.HashMap;
21: import java.util.Map;
22:
23: import org.w3c.dom.Document;
24:
25: import org.apache.cxf.binding.BindingFactoryManager;
26: import org.apache.cxf.binding.http.AbstractRestTest;
27: import org.apache.cxf.binding.http.HttpBindingFactory;
28: import org.apache.cxf.endpoint.ServerImpl;
29: import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
30: import org.junit.Test;
31:
32: public class UserServiceTest extends AbstractRestTest {
33:
34: @Test
35: public void testInterfaceImplCombo() throws Exception {
36: BindingFactoryManager bfm = getBus().getExtension(
37: BindingFactoryManager.class);
38: HttpBindingFactory factory = new HttpBindingFactory();
39: factory.setBus(getBus());
40: bfm.registerBindingFactory(HttpBindingFactory.HTTP_BINDING_ID,
41: factory);
42:
43: JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
44: sf.setBus(getBus());
45: sf.setBindingId(HttpBindingFactory.HTTP_BINDING_ID);
46: sf.setAddress("http://localhost:9001/foo/");
47: sf.setServiceBean(new UserServiceImpl());
48:
49: Map<String, Object> props = new HashMap<String, Object>();
50: props.put("contextMatchStrategy", "stem");
51: sf.setProperties(props);
52:
53: ServerImpl svr = (ServerImpl) sf.create();
54:
55: Document res = get("http://localhost:9001/foo/login/bleh/bar");
56: assertNotNull(res);
57:
58: addNamespace("c", "http://bare.http.binding.cxf.apache.org/");
59: assertValid("/c:loginResponse/return", res);
60:
61: svr.stop();
62: }
63:
64: }
|