Repository: cxf Updated Branches: refs/heads/3.0.x-fixes 3e2caed40 -> 83edbb3b9
[CXF-5980] 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/83edbb3b Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/83edbb3b Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/83edbb3b Branch: refs/heads/3.0.x-fixes Commit: 83edbb3b978f42bc2273ded1056123123cd80966 Parents: 3e2caed Author: Sergey Beryozkin <sberyoz...@talend.com> Authored: Mon Sep 1 14:45:17 2014 +0100 Committer: Sergey Beryozkin <sberyoz...@talend.com> Committed: Mon Sep 1 14:47:32 2014 +0100 ---------------------------------------------------------------------- .../jaxrs/JAXRS20ClientServerBookTest.java | 29 ++++++++++++++++++++ 1 file changed, 29 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/83edbb3b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRS20ClientServerBookTest.java ---------------------------------------------------------------------- diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRS20ClientServerBookTest.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRS20ClientServerBookTest.java index 4a593a2..01feee0 100644 --- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRS20ClientServerBookTest.java +++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRS20ClientServerBookTest.java @@ -385,6 +385,35 @@ public class JAXRS20ClientServerBookTest extends AbstractBusClientServerTestBase assertEquals(200, wc.getResponse().getStatus()); } + @Test + public void testPostGetCollectionGenericEntityAndType3() throws Exception { + + String endpointAddress = + "http://localhost:" + PORT + "/bookstore/collections"; + WebClient wc = WebClient.create(endpointAddress); + wc.accept("application/xml").type("application/xml"); + GenericEntity<List<Book>> collectionEntity = createGenericEntity(); + GenericType<List<Book>> genericResponseType = new GenericType<List<Book>>() { + }; + + Future<Response> future = wc.async().post(Entity.entity(collectionEntity, "application/xml")); + + Response r = future.get(); + List<Book> books2 = r.readEntity(genericResponseType); + assertNotNull(books2); + + List<Book> books = collectionEntity.getEntity(); + assertNotSame(books, books2); + assertEquals(2, books2.size()); + Book b11 = books.get(0); + assertEquals(123L, b11.getId()); + assertEquals("CXF in Action", b11.getName()); + Book b22 = books.get(1); + assertEquals(124L, b22.getId()); + assertEquals("CXF Rocks", b22.getName()); + assertEquals(200, wc.getResponse().getStatus()); + } + private GenericEntity<List<Book>> createGenericEntity() { Book b1 = new Book("CXF in Action", 123L); Book b2 = new Book("CXF Rocks", 124L);