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:24:12 UTC

svn commit: r594267 - in /incubator/servicemix/branches/servicemix-3.2/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:24:11 2007
New Revision: 594267

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

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

Modified: incubator/servicemix/branches/servicemix-3.2/common/servicemix-soap/src/main/java/org/apache/servicemix/soap/marshalers/SoapWriter.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-3.2/common/servicemix-soap/src/main/java/org/apache/servicemix/soap/marshalers/SoapWriter.java?rev=594267&r1=594266&r2=594267&view=diff
==============================================================================
--- incubator/servicemix/branches/servicemix-3.2/common/servicemix-soap/src/main/java/org/apache/servicemix/soap/marshalers/SoapWriter.java (original)
+++ incubator/servicemix/branches/servicemix-3.2/common/servicemix-soap/src/main/java/org/apache/servicemix/soap/marshalers/SoapWriter.java Mon Nov 12 11:24:11 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/branches/servicemix-3.2/common/servicemix-soap/src/test/java/org/apache/servicemix/soap/marshalers/SoapWriterTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-3.2/common/servicemix-soap/src/test/java/org/apache/servicemix/soap/marshalers/SoapWriterTest.java?rev=594267&r1=594266&r2=594267&view=diff
==============================================================================
--- incubator/servicemix/branches/servicemix-3.2/common/servicemix-soap/src/test/java/org/apache/servicemix/soap/marshalers/SoapWriterTest.java (original)
+++ incubator/servicemix/branches/servicemix-3.2/common/servicemix-soap/src/test/java/org/apache/servicemix/soap/marshalers/SoapWriterTest.java Mon Nov 12 11:24:11 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());
-	}
-	
-	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\""));		
-	}
-}
\ No newline at end of file
+
+    public void testGetContentTypeSimpleMessage() throws Exception {
+        SoapWriter writer = new SoapWriter(new SoapMarshaler(), new SoapMessage());
+        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\""));
+    }
+}