Repository: cxf Updated Branches: refs/heads/master 84c9e98aa -> 05a01d691
[CXF-6450] Adding an equivalent test Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/05a01d69 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/05a01d69 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/05a01d69 Branch: refs/heads/master Commit: 05a01d691c521c91ad87c1d5768c5a39f9e31058 Parents: 84c9e98 Author: Sergey Beryozkin <[email protected]> Authored: Thu Jul 23 11:55:56 2015 +0300 Committer: Sergey Beryozkin <[email protected]> Committed: Thu Jul 23 11:55:56 2015 +0300 ---------------------------------------------------------------------- .../cxf/systest/jaxrs/GenericBookInterface.java | 29 +++++++++++++ .../jaxrs/GenericBookServiceInterface.java | 28 +++++++++++++ .../jaxrs/GenericBookStoreSpringInt1.java | 43 ++++++++++++++++++++ .../jaxrs/GenericBookStoreSpringInt2.java | 43 ++++++++++++++++++++ ...ServerResourceJacksonSpringProviderTest.java | 27 ++++++++++++ .../jaxrs_jackson_provider/WEB-INF/beans.xml | 13 ++++++ 6 files changed, 183 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/05a01d69/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/GenericBookInterface.java ---------------------------------------------------------------------- diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/GenericBookInterface.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/GenericBookInterface.java new file mode 100644 index 0000000..a0b4260 --- /dev/null +++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/GenericBookInterface.java @@ -0,0 +1,29 @@ +/** + * 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 java.util.List; + +public interface GenericBookInterface<A> { + List<A> getSuperBook(); +} + + http://git-wip-us.apache.org/repos/asf/cxf/blob/05a01d69/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/GenericBookServiceInterface.java ---------------------------------------------------------------------- diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/GenericBookServiceInterface.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/GenericBookServiceInterface.java new file mode 100644 index 0000000..0f887f6 --- /dev/null +++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/GenericBookServiceInterface.java @@ -0,0 +1,28 @@ +/** + * 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; + + + +public interface GenericBookServiceInterface extends GenericBookInterface<SuperBook> { + +} + + http://git-wip-us.apache.org/repos/asf/cxf/blob/05a01d69/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/GenericBookStoreSpringInt1.java ---------------------------------------------------------------------- diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/GenericBookStoreSpringInt1.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/GenericBookStoreSpringInt1.java new file mode 100644 index 0000000..7aaf4e0 --- /dev/null +++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/GenericBookStoreSpringInt1.java @@ -0,0 +1,43 @@ +/** + * 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 java.util.Collections; +import java.util.List; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; + +import org.apache.cxf.annotations.Logging; + +@Path("/int1") +@Produces({"application/json" }) +@Logging +public class GenericBookStoreSpringInt1 implements GenericBookInterface<SuperBook> { + @GET + @Path("/books/superbook") + public List<SuperBook> getSuperBook() { + return Collections.singletonList(new SuperBook("super", 111L, true)); + } +} + + http://git-wip-us.apache.org/repos/asf/cxf/blob/05a01d69/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/GenericBookStoreSpringInt2.java ---------------------------------------------------------------------- diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/GenericBookStoreSpringInt2.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/GenericBookStoreSpringInt2.java new file mode 100644 index 0000000..5c90772 --- /dev/null +++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/GenericBookStoreSpringInt2.java @@ -0,0 +1,43 @@ +/** + * 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 java.util.Collections; +import java.util.List; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; + +import org.apache.cxf.annotations.Logging; + +@Path("/int2") +@Produces({"application/json" }) +@Logging +public class GenericBookStoreSpringInt2 implements GenericBookServiceInterface { + @GET + @Path("/books/superbook") + public List<SuperBook> getSuperBook() { + return Collections.singletonList(new SuperBook("super", 111L, true)); + } +} + + http://git-wip-us.apache.org/repos/asf/cxf/blob/05a01d69/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceJacksonSpringProviderTest.java ---------------------------------------------------------------------- diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceJacksonSpringProviderTest.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceJacksonSpringProviderTest.java index 95184cd..ce9e073 100644 --- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceJacksonSpringProviderTest.java +++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceJacksonSpringProviderTest.java @@ -174,6 +174,33 @@ public class JAXRSClientServerResourceJacksonSpringProviderTest extends Abstract } @Test + public void testGetGenericSuperBookProxy1() throws Exception { + + String endpointAddress = + "http://localhost:" + PORT + "/webapp/genericstoreInt"; + GenericBookStoreSpringInt1 proxy = JAXRSClientFactory.create(endpointAddress, + GenericBookStoreSpringInt1.class, Collections.singletonList(new JacksonJsonProvider())); + WebClient.getConfig(proxy).getHttpConduit().getClient().setReceiveTimeout(1000000000L); + List<SuperBook> books = proxy.getSuperBook(); + assertEquals(1, books.size()); + assertEquals(111L, books.get(0).getId()); + + } + @Test + public void testGetGenericSuperBookProxy2() throws Exception { + + String endpointAddress = + "http://localhost:" + PORT + "/webapp/genericstoreInt"; + GenericBookStoreSpringInt2 proxy = JAXRSClientFactory.create(endpointAddress, + GenericBookStoreSpringInt2.class, Collections.singletonList(new JacksonJsonProvider())); + WebClient.getConfig(proxy).getHttpConduit().getClient().setReceiveTimeout(1000000000L); + List<SuperBook> books = proxy.getSuperBook(); + assertEquals(1, books.size()); + assertEquals(111L, books.get(0).getId()); + + } + + @Test public void testEchoGenericSuperBookProxy2Json() throws Exception { String endpointAddress = http://git-wip-us.apache.org/repos/asf/cxf/blob/05a01d69/systests/jaxrs/src/test/resources/jaxrs_jackson_provider/WEB-INF/beans.xml ---------------------------------------------------------------------- diff --git a/systests/jaxrs/src/test/resources/jaxrs_jackson_provider/WEB-INF/beans.xml b/systests/jaxrs/src/test/resources/jaxrs_jackson_provider/WEB-INF/beans.xml index 6781268..00aa45d 100644 --- a/systests/jaxrs/src/test/resources/jaxrs_jackson_provider/WEB-INF/beans.xml +++ b/systests/jaxrs/src/test/resources/jaxrs_jackson_provider/WEB-INF/beans.xml @@ -81,6 +81,17 @@ http://cxf.apache.org/schemas/jaxrs.xsd"> </jaxrs:providers> </jaxrs:server> + <jaxrs:server id="genericBookStoreInt" + address="/genericstoreInt"> + <jaxrs:serviceBeans> + <ref bean="gBookStoreInt1"/> + <ref bean="gBookStoreInt2"/> + </jaxrs:serviceBeans> + <jaxrs:providers> + <ref bean="jackson"/> + </jaxrs:providers> + </jaxrs:server> + <jaxrs:server id="genericBookStore2type" address="/genericstore2type"> <jaxrs:serviceBeans> @@ -114,4 +125,6 @@ http://cxf.apache.org/schemas/jaxrs.xsd"> <bean id="multipartStore" class="org.apache.cxf.systest.jaxrs.MultipartStore"/> <bean id="gBookStore" class="org.apache.cxf.systest.jaxrs.GenericBookStoreSpring"/> <bean id="gBookStore2" class="org.apache.cxf.systest.jaxrs.GenericBookStoreSpring2"/> + <bean id="gBookStoreInt1" class="org.apache.cxf.systest.jaxrs.GenericBookStoreSpringInt1"/> + <bean id="gBookStoreInt2" class="org.apache.cxf.systest.jaxrs.GenericBookStoreSpringInt2"/> </beans>
