You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by ge...@apache.org on 2007/11/12 20:06:36 UTC

svn commit: r594259 - in /incubator/servicemix/trunk/common/servicemix-soap/src: main/java/org/apache/servicemix/soap/marshalers/SoapWriter.java test/java/org/apache/servicemix/soap/marshalers/SoapWriterTest.java

Author: gertv
Date: Mon Nov 12 11:06:35 2007
New Revision: 594259

URL: http://svn.apache.org/viewvc?rev=594259&view=rev
Log:
SM-1119: Taking SourceTransformer.defaultCharset into account

Modified:
    incubator/servicemix/trunk/common/servicemix-soap/src/main/java/org/apache/servicemix/soap/marshalers/SoapWriter.java
    incubator/servicemix/trunk/common/servicemix-soap/src/test/java/org/apache/servicemix/soap/marshalers/SoapWriterTest.java

Modified: incubator/servicemix/trunk/common/servicemix-soap/src/main/java/org/apache/servicemix/soap/marshalers/SoapWriter.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/common/servicemix-soap/src/main/java/org/apache/servicemix/soap/marshalers/SoapWriter.java?rev=594259&r1=594258&r2=594259&view=diff
==============================================================================
--- incubator/servicemix/trunk/common/servicemix-soap/src/main/java/org/apache/servicemix/soap/marshalers/SoapWriter.java (original)
+++ incubator/servicemix/trunk/common/servicemix-soap/src/main/java/org/apache/servicemix/soap/marshalers/SoapWriter.java Mon Nov 12 11:06:35 2007
@@ -98,7 +98,7 @@
             parts = new MimeMultipart("related; type=\"text/xml\"; start=\"<" + SOAP_PART_ID + ">\"");
             return parts.getContentType();
         } else {
-            return "text/xml;charset=utf-8";
+            return "text/xml;charset=" + SourceTransformer.getDefaultCharset();
         }
     }
 

Modified: incubator/servicemix/trunk/common/servicemix-soap/src/test/java/org/apache/servicemix/soap/marshalers/SoapWriterTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/common/servicemix-soap/src/test/java/org/apache/servicemix/soap/marshalers/SoapWriterTest.java?rev=594259&r1=594258&r2=594259&view=diff
==============================================================================
--- incubator/servicemix/trunk/common/servicemix-soap/src/test/java/org/apache/servicemix/soap/marshalers/SoapWriterTest.java (original)
+++ incubator/servicemix/trunk/common/servicemix-soap/src/test/java/org/apache/servicemix/soap/marshalers/SoapWriterTest.java Mon Nov 12 11:06:35 2007
@@ -20,19 +20,28 @@
 
 import junit.framework.TestCase;
 
+import org.apache.servicemix.jbi.jaxp.SourceTransformer;
+
 public class SoapWriterTest extends TestCase {
-            
+
     public void testGetContentTypeSimpleMessage() throws Exception {
         SoapWriter writer = new SoapWriter(new SoapMarshaler(), new SoapMessage());
-        assertEquals("text/xml;charset=utf-8", writer.getContentType());
+        assertEquals("text/xml;charset=UTF-8", writer.getContentType());
     }
-    
+
+    public void testGetContentTypeSimpleMessageDefaultCharsetChanged() throws Exception {
+        SourceTransformer.setDefaultCharset("ISO-8859-1");
+        SoapWriter writer = new SoapWriter(new SoapMarshaler(), new SoapMessage());
+        assertEquals("text/xml;charset=ISO-8859-1", writer.getContentType());
+        SourceTransformer.setDefaultCharset("UTF-8");
+    }
+
     public void testGetContentTypeComplexMessage() throws Exception {
         SoapMessage message = new SoapMessage();
         DataHandler handler = new DataHandler(new Object(), "mime/type");
         message.addAttachment("attachment", handler);
-        
+
         SoapWriter writer = new SoapWriter(new SoapMarshaler(), message);
-        assertTrue(writer.getContentType().startsWith("multipart/related; type=\"text/xml\""));     
+        assertTrue(writer.getContentType().startsWith("multipart/related; type=\"text/xml\""));
     }
-}
\ No newline at end of file
+}