cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: Adding a test with two BeanParams in the same method signature
Date Sun, 18 Oct 2015 14:57:19 GMT
Repository: cxf
Updated Branches:
  refs/heads/2.7.x-fixes 6c9872a48 -> abc7838f0


Adding a test with two BeanParams in the same method signature


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/abc7838f
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/abc7838f
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/abc7838f

Branch: refs/heads/2.7.x-fixes
Commit: abc7838f0df1e7a09c84ad4a06ee08d1741823ec
Parents: 6c9872a
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Sun Oct 18 15:56:50 2015 +0100
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Sun Oct 18 15:56:50 2015 +0100

----------------------------------------------------------------------
 .../org/apache/cxf/systest/jaxrs/BookStore.java | 57 ++++++++++++++++++++
 .../jaxrs/JAXRSClientServerBookTest.java        | 14 ++++-
 2 files changed, 70 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/abc7838f/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java
index 6195701..ee9c071 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java
@@ -298,6 +298,18 @@ public class BookStore {
         
         return books.get(id);
     }
+    @GET
+    @Path("/twoBeanParams/{id}")
+    @Produces("application/xml")
+    public Book getTwoBeanParamsBook(@BeanParam BookBean2 bean1, 
+                                     @BeanParam BookBeanNested bean2) {
+        
+        long id = bean1.getId() + bean1.getId2() + bean1.getId3(); 
+        if (bean2.getId4() != id) {
+            throw new RuntimeException();
+        }
+        return books.get(id);
+    }
     
     @POST
     @Path("/mapperonbus")
@@ -1682,7 +1694,52 @@ public class BookStore {
 
         
     }
+    public static class BookBeanNested {
+        private long id4;
+
+        public long getId4() {
+            return id4;
+        }
+        @QueryParam("id4")
+        public void setId4(long id4) {
+            this.id4 = id4;
+        }
+        
+    }
     
+    public static class BookBean2 {
+        private long id;
+        private long id2;
+        private long id3;
+        public long getId() {
+            return id;
+        }
+
+        @PathParam("id")
+        public void setId(long id) {
+            this.id = id;
+        }
+        
+        public long getId2() {
+            return id2;
+        }
+        @QueryParam("id2")
+        public void setId2(long id2) {
+            this.id2 = id2;
+        }
+        
+        @Context
+        public void setUriInfo(UriInfo ui) {
+            String id3Value = ui.getQueryParameters().getFirst("id3");
+            if (id3Value != null) {
+                this.id3 = Long.valueOf(id3Value);
+            }
+        }
+
+        public long getId3() {
+            return id3;
+        }
+    }
     public static class BookNotReturnedException extends RuntimeException {
 
         private static final long serialVersionUID = 4935423670510083220L;

http://git-wip-us.apache.org/repos/asf/cxf/blob/abc7838f/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
index 86375fe..75f15f0 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
@@ -398,7 +398,19 @@ public class JAXRSClientServerBookTest extends AbstractBusClientServerTestBase
{
         assertEquals(123L, book.getId());
         
     }
-    
+    @Test
+    public void testProxyBeanParam2() throws Exception {
+        BookStore store = JAXRSClientFactory.create("http://localhost:" + PORT, BookStore.class);
+        WebClient.getConfig(store).getHttpConduit().getClient().setReceiveTimeout(10000000L);
+        BookStore.BookBean2 bean = new BookStore.BookBean2();
+        bean.setId(100L);
+        bean.setId2(23L);
+        BookStore.BookBeanNested nested = new BookStore.BookBeanNested();
+        nested.setId4(123);
+        Book book = store.getTwoBeanParamsBook(bean, nested);
+        assertEquals(123L, book.getId());
+        
+    }
     @Test
     public void testGetBookWithCustomHeader() throws Exception {
         


Mime
View raw message