cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1404310 - in /cxf/branches/2.5.x-fixes: ./ systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/MultipartStore.java
Date Wed, 31 Oct 2012 19:24:38 GMT
Author: sergeyb
Date: Wed Oct 31 19:24:38 2012
New Revision: 1404310

URL: http://svn.apache.org/viewvc?rev=1404310&view=rev
Log:
Merged revisions 1404309 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/branches/2.6.x-fixes

................
  r1404309 | sergeyb | 2012-10-31 19:22:19 +0000 (Wed, 31 Oct 2012) | 9 lines
  
  Merged revisions 1404308 via svnmerge from 
  https://svn.apache.org/repos/asf/cxf/trunk
  
  ........
    r1404308 | sergeyb | 2012-10-31 19:19:32 +0000 (Wed, 31 Oct 2012) | 1 line
    
    [CXF-4348] Adding one more test
  ........
................

Modified:
    cxf/branches/2.5.x-fixes/   (props changed)
    cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java
    cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/MultipartStore.java

Propchange: cxf/branches/2.5.x-fixes/
------------------------------------------------------------------------------
  Merged /cxf/trunk:r1404308
  Merged /cxf/branches/2.6.x-fixes:r1404309

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

Modified: cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java?rev=1404310&r1=1404309&r2=1404310&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java
(original)
+++ cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java
Wed Oct 31 19:24:38 2012
@@ -50,6 +50,7 @@ import org.apache.commons.httpclient.met
 import org.apache.commons.httpclient.methods.multipart.MultipartRequestEntity;
 import org.apache.commons.httpclient.methods.multipart.Part;
 import org.apache.cxf.helpers.IOUtils;
+import org.apache.cxf.interceptor.LoggingInInterceptor;
 import org.apache.cxf.io.CachedOutputStream;
 import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
 import org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean;
@@ -411,10 +412,29 @@ public class JAXRSMultipartTest extends 
     }
     
     @Test
-    public void testAddBookJaxbJsonImageWebClient() throws Exception {
+    public void testAddBookJaxbJsonImageWebClientMixed() throws Exception {
+        Map<String, String> params = 
+            doTestAddBookJaxbJsonImageWebClient("multipart/mixed");
+        assertEquals(1, params.size());
+        assertNotNull(params.get("boundary"));
+        
+    }
+    
+    @Test
+    public void testAddBookJaxbJsonImageWebClientRelated() throws Exception {
+        Map<String, String> params = 
+            doTestAddBookJaxbJsonImageWebClient("multipart/related");
+        assertEquals(3, params.size());
+        assertNotNull(params.get("boundary"));
+        assertNotNull(params.get("type"));
+        assertNotNull(params.get("start"));
+    }
+    
+    private Map<String, String> doTestAddBookJaxbJsonImageWebClient(String multipartType)
throws Exception {
         String address = "http://localhost:" + PORT + "/bookstore/books/jaxbjsonimage";
         WebClient client = WebClient.create(address);
-        client.type("multipart/mixed").accept("multipart/mixed");
+        WebClient.getConfig(client).getInInterceptors().add(new LoggingInInterceptor());
+        client.type(multipartType).accept(multipartType);
        
         Book jaxb = new Book("jaxb", 1L);
         Book json = new Book("json", 2L);
@@ -441,10 +461,7 @@ public class JAXRSMultipartTest extends 
         String ctString = 
             client.getResponse().getMetadata().getFirst("Content-Type").toString();
         MediaType mt = MediaType.valueOf(ctString);
-        Map<String, String> params = mt.getParameters();
-        assertEquals(1, params.size());
-        assertNotNull(params.get("boundary"));
-        
+        return mt.getParameters();
     }
     
     @Test

Modified: cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/MultipartStore.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/MultipartStore.java?rev=1404310&r1=1404309&r2=1404310&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/MultipartStore.java
(original)
+++ cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/MultipartStore.java
Wed Oct 31 19:24:38 2012
@@ -166,8 +166,8 @@ public class MultipartStore {
     
     @POST
     @Path("/books/jaxbjsonimage")
-    @Consumes("multipart/mixed")
-    @Produces("multipart/mixed")
+    @Consumes({"multipart/mixed", "multipart/related" })
+    @Produces({"multipart/mixed", "multipart/related" })
     public Map<String, Object> addBookJaxbJsonImage(@Multipart("root.message@cxf.apache.org")
Book jaxb, 
                                                     @Multipart("1") Book json, 
                                                     @Multipart("2") byte[] image) throws
Exception {



Mime
View raw message