Loading...

server-dev@james.apache.org

[Prev] Thread [Next]  |  [Prev] Date [Next]

svn commit: r1292256 - /james/jsieve/trunk/manager/mailet/src/test/java/org/apache/james/managesieve/mailet/ManageSieveMailetTestCase.java bago Wed Feb 22 05:00:44 2012

Author: bago
Date: Wed Feb 22 12:37:35 2012
New Revision: 1292256

URL: http://svn.apache.org/viewvc?rev=1292256&view=rev
Log:
Make sure to set the right content type when creating test messages 
(application/sieve is not declared/added to the mailcap so oracle javamail 
allow an undocumented behaviour, while geronimo is more strict and remove the 
unknown content type).

Modified:
    
james/jsieve/trunk/manager/mailet/src/test/java/org/apache/james/managesieve/mailet/ManageSieveMailetTestCase.java

Modified: 
james/jsieve/trunk/manager/mailet/src/test/java/org/apache/james/managesieve/mailet/ManageSieveMailetTestCase.java
URL: 
http://svn.apache.org/viewvc/james/jsieve/trunk/manager/mailet/src/test/java/org/apache/james/managesieve/mailet/ManageSieveMailetTestCase.java?rev=1292256&r1=1292255&r2=1292256&view=diff
==============================================================================
--- 
james/jsieve/trunk/manager/mailet/src/test/java/org/apache/james/managesieve/mailet/ManageSieveMailetTestCase.java
 (original)
+++ 
james/jsieve/trunk/manager/mailet/src/test/java/org/apache/james/managesieve/mailet/ManageSieveMailetTestCase.java
 Wed Feb 22 12:37:35 2012
@@ -197,6 +197,11 @@ public class ManageSieveMailetTestCase {
                                 "application/sieve; charset=UTF-8")
                           ));
         scriptPart.setDisposition(MimeBodyPart.ATTACHMENT);
+        // setting a DataHandler with no mailcap definition is not
+        // supported by the specs. Javamail activation still work,
+        // but Geronimo activation translate it to text/plain. 
+        // Let's manually force the header.
+        scriptPart.setHeader("Content-Type", "application/sieve; 
charset=UTF-8");
         scriptPart.setFileName(scriptName);
         multipart.addBodyPart(scriptPart);
         message.setContent(multipart);
@@ -264,6 +269,7 @@ public class ManageSieveMailetTestCase {
                                     "SyntaxException", 
                                     "application/sieve; charset=UTF-8")
                               ));
+            scriptPart.setHeader("Content-Type", "application/sieve; 
charset=UTF-8");
             scriptPart.setDisposition(MimeBodyPart.ATTACHMENT);
             scriptPart.setFileName(scriptName);
             multipart.addBodyPart(scriptPart);
@@ -469,6 +475,7 @@ public class ManageSieveMailetTestCase {
                                 scriptContent, 
                                 "application/sieve; charset=UTF-8")
                           ));
+        scriptPart.setHeader("Content-Type", "application/sieve; 
charset=UTF-8");
         scriptPart.setDisposition(MimeBodyPart.ATTACHMENT);
         scriptPart.setFileName(scriptName);
         multipart.addBodyPart(scriptPart);
@@ -536,6 +543,7 @@ public class ManageSieveMailetTestCase {
                                     "SyntaxException", 
                                     "application/sieve; charset=UTF-8")
                               ));
+            scriptPart.setHeader("Content-Type", "application/sieve; 
charset=UTF-8");
             scriptPart.setDisposition(MimeBodyPart.ATTACHMENT);
             scriptPart.setFileName(scriptName);
             multipart.addBodyPart(scriptPart);
@@ -1164,7 +1172,8 @@ public class ManageSieveMailetTestCase {
             MimeMessage result = ((MockMailetContext) 
_mailet.getMailetContext()).getMessage();
             assertNotNull(result);
             // Check the subject header
-            assertEquals("Re: ", result.getSubject());
+            // Javamail returns "Re: " instead Geronimo returns "Re:" (no 
trailing space)
+            assertEquals("Re:", result.getSubject().trim());
             // Check the response
             MimeMultipart multipart = (MimeMultipart) result.getContent();
             assertEquals(1, multipart.getCount());



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]