james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [2/2] james-project git commit: JAMES-2361 mime4j MDN report must include the right disposition
Date Tue, 17 Apr 2018 03:20:10 GMT
JAMES-2361 mime4j MDN report must include the right disposition


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/8bae242a
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/8bae242a
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/8bae242a

Branch: refs/heads/master
Commit: 8bae242a05473b33d47765aa04af812e56ec86e7
Parents: 4e44ec1
Author: Matthieu Baechler <matthieu@apache.org>
Authored: Fri Apr 6 15:11:19 2018 +0200
Committer: Matthieu Baechler <matthieu@apache.org>
Committed: Mon Apr 16 15:11:46 2018 +0200

----------------------------------------------------------------------
 mdn/src/main/java/org/apache/james/mdn/MDN.java     | 1 +
 mdn/src/test/java/org/apache/james/mdn/MDNTest.java | 6 ++----
 2 files changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/8bae242a/mdn/src/main/java/org/apache/james/mdn/MDN.java
----------------------------------------------------------------------
diff --git a/mdn/src/main/java/org/apache/james/mdn/MDN.java b/mdn/src/main/java/org/apache/james/mdn/MDN.java
index 082c6ce..02e1ac4 100644
--- a/mdn/src/main/java/org/apache/james/mdn/MDN.java
+++ b/mdn/src/main/java/org/apache/james/mdn/MDN.java
@@ -136,6 +136,7 @@ public class MDN {
 
     private Multipart asMime4JMultipart() throws IOException {
         MultipartBuilder builder = MultipartBuilder.create(REPORT_SUB_TYPE);
+        builder.addContentTypeParameter(new NameValuePair("report-type", DISPOSITION_NOTIFICATION_REPORT_TYPE));
         builder.addBodyPart(BodyPartBuilder.create()
             .use(new BasicBodyFactory())
             .setBody(humanReadableText, Charsets.UTF_8)

http://git-wip-us.apache.org/repos/asf/james-project/blob/8bae242a/mdn/src/test/java/org/apache/james/mdn/MDNTest.java
----------------------------------------------------------------------
diff --git a/mdn/src/test/java/org/apache/james/mdn/MDNTest.java b/mdn/src/test/java/org/apache/james/mdn/MDNTest.java
index 6decac0..905a209 100644
--- a/mdn/src/test/java/org/apache/james/mdn/MDNTest.java
+++ b/mdn/src/test/java/org/apache/james/mdn/MDNTest.java
@@ -33,7 +33,6 @@ import org.apache.james.mdn.sending.mode.DispositionSendingMode;
 import org.apache.james.mdn.type.DispositionType;
 import org.apache.james.mime4j.dom.Message;
 import org.apache.james.mime4j.message.DefaultMessageWriter;
-import org.junit.Ignore;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
@@ -73,7 +72,7 @@ public class MDNTest {
 
         assertThat(new String(byteArrayOutputStream.toByteArray(), StandardCharsets.UTF_8))
             .containsPattern(
-                Pattern.compile("Content-Type: multipart/report;.*report-type=disposition-notification",
Pattern.DOTALL));
+                Pattern.compile("Content-Type: multipart/report;.*(\r\n.+)*report-type=disposition-notification.*\r\n\r\n"));
     }
 
     @Test
@@ -211,7 +210,6 @@ public class MDNTest {
     }
 
 
-    @Ignore("Content-Type Parameters are not supported by mime4j")
     @Test
     public void mime4JMessageExportShouldGenerateExpectedContentType() throws Exception {
         Message message = MDN.builder()
@@ -222,7 +220,7 @@ public class MDNTest {
             .build();
 
         assertThat(asString(message))
-            .containsPattern(Pattern.compile("Content-Type: multipart/report;.*report-type=disposition-notification",
Pattern.DOTALL));
+            .containsPattern(Pattern.compile("Content-Type: multipart/report;.*(\r\n.+)*report-type=disposition-notification.*(\r\n.+)*\r\n\r\n"));
     }
 
     private String asString(Message message) throws Exception {


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message