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.systest.servlet;
19:
20: import org.w3c.dom.Document;
21:
22: import com.meterware.httpunit.PostMethodWebRequest;
23: import com.meterware.httpunit.WebRequest;
24: import com.meterware.httpunit.WebResponse;
25:
26: import org.apache.cxf.Bus;
27: import org.apache.cxf.BusException;
28: import org.apache.cxf.helpers.DOMUtils;
29: import org.junit.Test;
30:
31: public class ExternalServicesServletTest extends AbstractServletTest {
32:
33: @Override
34: protected Bus createBus() throws BusException {
35: return null;
36: }
37:
38: @Override
39: protected String getConfiguration() {
40: return "/org/apache/cxf/systest/servlet/web-external.xml";
41: }
42:
43: @Test
44: public void testPostInvokeServices() throws Exception {
45: newClient();
46:
47: WebRequest req = new PostMethodWebRequest(CONTEXT_URL
48: + "/services/greeter", getClass().getResourceAsStream(
49: "GreeterMessage.xml"), "text/xml; charset=UTF-8");
50:
51: WebResponse response = newClient().getResponse(req);
52:
53: assertEquals("text/xml", response.getContentType());
54: assertEquals("UTF-8", response.getCharacterSet());
55:
56: Document doc = DOMUtils.readXml(response.getInputStream());
57: assertNotNull(doc);
58:
59: addNamespace("h",
60: "http://apache.org/hello_world_soap_http/types");
61:
62: assertValid("/s:Envelope/s:Body", doc);
63: assertValid("//h:sayHiResponse", doc);
64: }
65: }
|