cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: [CXF-7493] Adding another test
Date Wed, 06 Sep 2017 11:21:55 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 53479782d -> 6f588b0ce


[CXF-7493] Adding another test


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

Branch: refs/heads/master
Commit: 6f588b0cef87d157864c52c140bec616f9c5f029
Parents: 5347978
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Wed Sep 6 12:21:39 2017 +0100
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Wed Sep 6 12:21:39 2017 +0100

----------------------------------------------------------------------
 .../org/apache/cxf/systest/jaxrs/BookStore.java | 21 ++++++++++++++++++++
 .../jaxrs/JAXRS20ClientServerBookTest.java      | 11 ++++++++++
 2 files changed, 32 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/6f588b0c/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 304b7fe..fe84366 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
@@ -50,6 +50,7 @@ import javax.ws.rs.Encoded;
 import javax.ws.rs.GET;
 import javax.ws.rs.HEAD;
 import javax.ws.rs.HeaderParam;
+import javax.ws.rs.InternalServerErrorException;
 import javax.ws.rs.MatrixParam;
 import javax.ws.rs.OPTIONS;
 import javax.ws.rs.POST;
@@ -166,6 +167,26 @@ public class BookStore {
         return new BookType("root", 124L);
     }
     @GET
+    @Path("/listoflonganddouble")
+    @Produces("text/xml")
+    public Book getBookFromListOfLongAndDouble(@QueryParam("value") List<Long> lValue,
+                                               @QueryParam("value") List<Double> dValue)
{
+        StringBuilder lBuilder = new StringBuilder();
+        for (Long v : lValue) {
+            lBuilder.append(v.longValue());
+        }
+        StringBuilder dBuilder = new StringBuilder();
+        for (Double v : dValue) {
+            dBuilder.append(v.longValue());
+        }
+        String lStr = lBuilder.toString();
+        String dStr = dBuilder.toString();
+        if (!lStr.equals(dStr)) {
+            throw new InternalServerErrorException();
+        }
+        return new Book("cxf", Long.parseLong(lStr));
+    }
+    @GET
     @Path("/")
     public Book getBookRoot() {
         return new Book("root", 124L);

http://git-wip-us.apache.org/repos/asf/cxf/blob/6f588b0c/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 1d1fdf5..dc61df7 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
@@ -110,6 +110,17 @@ public class JAXRS20ClientServerBookTest extends AbstractBusClientServerTestBase
     }
 
     @Test
+    public void testListOfLongAndDoubleQuery() throws Exception {
+        WebTarget echoEndpointTarget = ClientBuilder
+            .newClient()
+            .target("http://localhost:" + PORT + "/bookstore/listoflonganddouble")
+            .queryParam("value", 1, 0, 2, 3);
+
+        Book book = echoEndpointTarget.request().accept("text/xml").get(Book.class);
+        assertEquals(1023L, book.getId());
+    }
+    
+    @Test
     public void testGetGenericBook() throws Exception {
         String address = "http://localhost:" + PORT + "/bookstore/genericbooks/123";
         doTestGetGenericBook(address, 124L, false);


Mime
View raw message