Repository: cxf Updated Branches: refs/heads/3.1.x-fixes f62e09bea -> 067142ddb
[CXF-7304] Adding a test Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/067142dd Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/067142dd Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/067142dd Branch: refs/heads/3.1.x-fixes Commit: 067142ddba05f9c320595177c67aaee58039b28d Parents: f62e09b Author: Sergey Beryozkin <[email protected]> Authored: Fri Mar 31 17:22:18 2017 +0100 Committer: Sergey Beryozkin <[email protected]> Committed: Fri Mar 31 17:23:16 2017 +0100 ---------------------------------------------------------------------- .../cxf/systest/jaxrs/JAXRSUnicodeTest.java | 71 ++++++++++++++++++++ .../resources/jaxrs_unicode/WEB-INF/beans.xml | 35 ++++++++++ .../resources/jaxrs_unicode/WEB-INF/web.xml | 45 +++++++++++++ 3 files changed, 151 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/067142dd/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSUnicodeTest.java ---------------------------------------------------------------------- diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSUnicodeTest.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSUnicodeTest.java new file mode 100644 index 0000000..6f7fd30 --- /dev/null +++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSUnicodeTest.java @@ -0,0 +1,71 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cxf.systest.jaxrs; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; + +import org.apache.cxf.jaxrs.client.WebClient; +import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase; + +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; + +public class JAXRSUnicodeTest extends AbstractBusClientServerTestBase { + public static final int PORT = SpringServer.PORT; + + @BeforeClass + public static void beforeClass() throws Exception { + // must be 'in-process' to communicate with inner class in single JVM + // and to spawn class SpringServer w/o using main() method + launchServer(SpringServer.class, true); + } + @Ignore + public static class SpringServer extends AbstractSpringServer { + public static final int PORT = allocatePortAsInt(SpringServer.class); + public SpringServer() { + super("/jaxrs_unicode", PORT); + } + } + + + @Test + public void testGetHelloMessage() { + WebClient wc = WebClient.create("http://localhost:" + PORT + "/киÑилиÑа"); + WebClient.getConfig(wc).getHttpConduit().getClient().setReceiveTimeout(10000000L); + wc.accept("text/plain"); + assertEquals("Hello", wc.get(String.class)); + } + + @Ignore + @Path("/") + public static class Resource { + + @GET + @Produces("text/plain") + public String getHello() { + return "Hello"; + } + + } + +} + http://git-wip-us.apache.org/repos/asf/cxf/blob/067142dd/systests/jaxrs/src/test/resources/jaxrs_unicode/WEB-INF/beans.xml ---------------------------------------------------------------------- diff --git a/systests/jaxrs/src/test/resources/jaxrs_unicode/WEB-INF/beans.xml b/systests/jaxrs/src/test/resources/jaxrs_unicode/WEB-INF/beans.xml new file mode 100644 index 0000000..5b922e1 --- /dev/null +++ b/systests/jaxrs/src/test/resources/jaxrs_unicode/WEB-INF/beans.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to you under the Apache License, Version + 2.0 (the "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 Unless required by + applicable law or agreed to in writing, software distributed under the + License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the + License. + --> +<!-- START SNIPPET: beans --> +<!-- + beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:simple="http://cxf.apache.org/simple" xsi:schemaLocation=" + http://www.springframework.org/schema/beans + http://www.springframework.org/schema/beans/spring-beans-4.2.xsd + http://cxf.apache.org/simple http://cxf.apache.org/schemas/simple.xsd" + --> +<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxrs="http://cxf.apache.org/jaxrs" xmlns:util="http://www.springframework.org/schema/util" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.2.xsd"> + <import resource="classpath:META-INF/cxf/cxf.xml"/> + <import resource="classpath:META-INF/cxf/cxf-servlet.xml"/> + <jaxrs:server address="/%D0%BA%D0%B8%D1%80%D0%B8%D0%BB%D0%B8%D1%86%D0%B0"> + <jaxrs:serviceBeans> + <bean class="org.apache.cxf.systest.jaxrs.JAXRSUnicodeTest$Resource"/> + </jaxrs:serviceBeans> + </jaxrs:server> +</beans> +<!-- END SNIPPET: beans --> http://git-wip-us.apache.org/repos/asf/cxf/blob/067142dd/systests/jaxrs/src/test/resources/jaxrs_unicode/WEB-INF/web.xml ---------------------------------------------------------------------- diff --git a/systests/jaxrs/src/test/resources/jaxrs_unicode/WEB-INF/web.xml b/systests/jaxrs/src/test/resources/jaxrs_unicode/WEB-INF/web.xml new file mode 100644 index 0000000..a8cae3f --- /dev/null +++ b/systests/jaxrs/src/test/resources/jaxrs_unicode/WEB-INF/web.xml @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> +<!-- START SNIPPET: webxml --> +<web-app> + <context-param> + <param-name>contextConfigLocation</param-name> + <param-value>WEB-INF/beans.xml</param-value> + </context-param> + <listener> + <listener-class> + org.springframework.web.context.ContextLoaderListener + </listener-class> + </listener> + <servlet> + <servlet-name>CXFServlet</servlet-name> + <display-name>CXF Servlet</display-name> + <servlet-class> + org.apache.cxf.transport.servlet.CXFServlet + </servlet-class> + <load-on-startup>1</load-on-startup> + </servlet> + <servlet-mapping> + <servlet-name>CXFServlet</servlet-name> + <url-pattern>/*</url-pattern> + </servlet-mapping> +</web-app> +<!-- END SNIPPET: webxml -->
