cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1421253 - in /cxf/branches/2.6.x-fixes: ./ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/ systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/
Date Thu, 13 Dec 2012 12:35:02 GMT
Author: sergeyb
Date: Thu Dec 13 12:35:02 2012
New Revision: 1421253

URL: http://svn.apache.org/viewvc?rev=1421253&view=rev
Log:
Merged revisions 1421245,1421247 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1421245 | sergeyb | 2012-12-13 12:27:08 +0000 (Thu, 13 Dec 2012) | 1 line
  
  [CXF-4697] Fixing MultipartProvider to correctly read Maps by applying a quality patch from
William Tam
........
  r1421247 | sergeyb | 2012-12-13 12:30:57 +0000 (Thu, 13 Dec 2012) | 1 line
  
  [CXF-4697] Adding a test resource
........

Added:
    cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/attachmentFormMixed
      - copied unchanged from r1421247, cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/attachmentFormMixed
Modified:
    cxf/branches/2.6.x-fixes/   (props changed)
    cxf/branches/2.6.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/MultipartProvider.java
    cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java
    cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/MultipartStore.java

Propchange: cxf/branches/2.6.x-fixes/
------------------------------------------------------------------------------
  Merged /cxf/trunk:r1421245-1421247

Propchange: cxf/branches/2.6.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.6.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/MultipartProvider.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/MultipartProvider.java?rev=1421253&r1=1421252&r2=1421253&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/MultipartProvider.java
(original)
+++ cxf/branches/2.6.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/MultipartProvider.java
Thu Dec 13 12:35:02 2012
@@ -142,7 +142,7 @@ public class MultipartProvider extends A
             && AnnotationUtils.getAnnotation(anns, Multipart.class) == null) {
             return getAttachmentCollection(t, infos, anns);
         }
-        if (Map.class.isAssignableFrom(c)) {
+        if (c.isAssignableFrom(Map.class)) {
             Map<String, Object> map = new LinkedHashMap<String, Object>(infos.size());
             Class<?> actual = getActualType(t, 1);
             for (Attachment a : infos) {

Modified: cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java?rev=1421253&r1=1421252&r2=1421253&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java
(original)
+++ cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java
Thu Dec 13 12:35:02 2012
@@ -244,6 +244,12 @@ public class JAXRSMultipartTest extends 
     }
     
     @Test
+    public void testAddBookMixedMultiValueMapParameter() throws Exception {
+        String address = "http://localhost:" + PORT + "/bookstore/books/mixedmultivaluedmap";
+        doAddBook("multipart/mixed", address, "attachmentFormMixed", 200);              

+    }
+    
+    @Test
     public void testAddBookAsJAXBJSON() throws Exception {
         String address = "http://localhost:" + PORT + "/bookstore/books/jaxbjson";
         doAddBook(address, "attachmentData2", 200);               

Modified: cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/MultipartStore.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/MultipartStore.java?rev=1421253&r1=1421252&r2=1421253&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/MultipartStore.java
(original)
+++ cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/MultipartStore.java
Thu Dec 13 12:35:02 2012
@@ -652,6 +652,36 @@ public class MultipartStore {
         throw new WebApplicationException();
     }
     
+    @POST
+    @Path("/books/mixedmultivaluedmap")
+    @Consumes("multipart/mixed")
+    @Produces("text/xml")
+    public Response addBookFromFormConsumesMixed(
+        @Multipart(value = "mapdata", type = MediaType.APPLICATION_FORM_URLENCODED) 
+        MultivaluedMap<String, String> data,
+        @Multipart(value = "test-cid", type = MediaType.APPLICATION_XML) 
+        String testXml) throws Exception {
+        if (!"Dreams".equals(data.get("id-name").get(0))) {
+            throw new Exception("Map entry 0 does not match");
+        }
+        if (!"True".equals(data.get("entity-name").get(0))) {
+            throw new Exception("Map entry 1 does not match");
+        }
+        if (!"NAT5\n".equals(data.get("native-id").get(0))) {
+            throw new Exception("Map entry 2 does not match");
+        }
+        if (data.size() != 3) {
+            throw new Exception("Map size does not match");
+        }
+        if ("<hello>World2</hello>".equals(testXml)) {
+            throw new Exception("testXml does not match");
+        }
+        
+        Book b = new Book();
+        b.setId(124);
+        b.setName("CXF in Action - 2");
+        return Response.ok(b).build();
+    }
     private Response readBookFromInputStream(InputStream is) throws Exception {
         JAXBContext c = JAXBContext.newInstance(new Class[]{Book.class});
         Unmarshaller u = c.createUnmarshaller();



Mime
View raw message