Skip to content
Permalink
Browse files
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).

git-svn-id: https://svn.apache.org/repos/asf/james/jsieve/trunk@1292256 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
Stefano Bagnara committed Feb 22, 2012
1 parent 71275ac commit c7944aa861df6bf5fedaa149cc444916fc29ec7b
Showing 1 changed file with 10 additions and 1 deletion.
@@ -197,6 +197,11 @@ public final void testPutScript() throws MessagingException, IOException, UserNo
"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 final void testPutScript() throws MessagingException, IOException, UserNo
"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 final void testCheckScript() throws MessagingException, IOException, User
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 final void testCheckScript() throws MessagingException, IOException, User
"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 final void testHelp() throws MessagingException, IOException {
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());

0 comments on commit c7944aa

Please sign in to comment.