cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r963932 - in /cxf/branches/2.2.x-fixes: ./ rt/core/src/main/java/org/apache/cxf/attachment/AttachmentSerializer.java rt/core/src/test/java/org/apache/cxf/attachment/AttachmentSerializerTest.java
Date Wed, 14 Jul 2010 03:00:54 GMT
Author: ningjiang
Date: Wed Jul 14 03:00:53 2010
New Revision: 963932

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

........
  r963925 | ningjiang | 2010-07-14 10:14:42 +0800 (Wed, 14 Jul 2010) | 1 line
  
  CXF-2892 write the right content type if XOP is not enabled
........

Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentSerializer.java
    cxf/branches/2.2.x-fixes/rt/core/src/test/java/org/apache/cxf/attachment/AttachmentSerializerTest.java

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jul 14 03:00:53 2010
@@ -1 +1 @@
-/cxf/trunk:959789,959793,960506,961051,961818
+/cxf/trunk:959789,959793,960506,961051,961818,963925

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

Modified: cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentSerializer.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentSerializer.java?rev=963932&r1=963931&r2=963932&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentSerializer.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentSerializer.java
Wed Jul 14 03:00:53 2010
@@ -129,7 +129,7 @@ public class AttachmentSerializer {
         StringBuilder mimeBodyCt = new StringBuilder();
         String bodyType = getHeaderValue("Content-Type", null);
         if (bodyType == null) {
-            mimeBodyCt.append("application/xop+xml; charset=")
+            mimeBodyCt.append((xop ? "application/xop+xml" : "text/xml") + "; charset=")
                 .append(encoding)
                 .append("; type=\"")
                 .append(bodyCt)

Modified: cxf/branches/2.2.x-fixes/rt/core/src/test/java/org/apache/cxf/attachment/AttachmentSerializerTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/core/src/test/java/org/apache/cxf/attachment/AttachmentSerializerTest.java?rev=963932&r1=963931&r2=963932&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/core/src/test/java/org/apache/cxf/attachment/AttachmentSerializerTest.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/core/src/test/java/org/apache/cxf/attachment/AttachmentSerializerTest.java
Wed Jul 14 03:00:53 2010
@@ -43,7 +43,16 @@ import org.junit.Test;
 public class AttachmentSerializerTest extends Assert {
     
     @Test
-    public void testMessageWrite() throws Exception {
+    public void testMessageWriteXopOn() throws Exception {
+        doTestMessageWrite(true);
+    }
+    
+    @Test
+    public void testMessageWriteXopOff() throws Exception {
+        doTestMessageWrite(false);
+    }
+    
+    private void doTestMessageWrite(boolean xop) throws Exception {
         MessageImpl msg = new MessageImpl();
         
         Collection<Attachment> atts = new ArrayList<Attachment>();
@@ -64,6 +73,10 @@ public class AttachmentSerializerTest ex
         msg.setContent(OutputStream.class, out);
         
         AttachmentSerializer serializer = new AttachmentSerializer(msg);
+        if (!xop) {
+            // default is "on"
+            serializer.setXop(xop);
+        }
         
         serializer.writeProlog();
 
@@ -84,8 +97,14 @@ public class AttachmentSerializerTest ex
         MimeMultipart multipart = (MimeMultipart) inMsg.getContent();
         
         MimeBodyPart part = (MimeBodyPart) multipart.getBodyPart(0);
-        assertEquals("application/xop+xml; charset=UTF-8; type=\"application/soap+xml\";",

-                     part.getHeader("Content-Type")[0]);
+        if (xop) {
+            assertEquals("application/xop+xml; charset=UTF-8; type=\"application/soap+xml\";",

+                         part.getHeader("Content-Type")[0]);
+        } else {
+            assertEquals("text/xml; charset=UTF-8; type=\"application/soap+xml\";", 
+                         part.getHeader("Content-Type")[0]);
+        }
+        
         assertEquals("binary", part.getHeader("Content-Transfer-Encoding")[0]);
         assertEquals("<root.message@cxf.apache.org>", part.getHeader("Content-ID")[0]);
         
@@ -101,7 +120,7 @@ public class AttachmentSerializerTest ex
         assertEquals("application/octet-stream", part2.getHeader("Content-Type")[0]);
         assertEquals("binary", part2.getHeader("Content-Transfer-Encoding")[0]);
         assertEquals("<test.xml>", part2.getHeader("Content-ID")[0]);
-        
+
     }
     
     @Test



Mime
View raw message