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.helpers.DOMUtils;
27: import org.junit.Test;
28:
29: public class JsFrontEndServletTest extends AbstractServletTest {
30:
31: protected String getConfiguration() {
32: return "/org/apache/cxf/systest/servlet/web-js.xml";
33: }
34:
35: @Test
36: public void testPostInvokeServices() throws Exception {
37:
38: WebRequest req = new PostMethodWebRequest(CONTEXT_URL
39: + "/services/Greeter", getClass().getResourceAsStream(
40: "GreeterMessage.xml"), "text/xml; charset=UTF-8");
41:
42: WebResponse response = newClient().getResponse(req);
43:
44: assertEquals("text/xml", response.getContentType());
45: //assertEquals("UTF-8", response.getCharacterSet());
46:
47: Document doc = DOMUtils.readXml(response.getInputStream());
48: assertNotNull(doc);
49:
50: addNamespace("h",
51: "http://apache.org/hello_world_soap_http/types");
52:
53: assertValid("/s:Envelope/s:Body", doc);
54: assertValid("//h:sayHiResponse", doc);
55: assertValid("//h:responseType", doc);
56:
57: }
58:
59: }
|