JAMES-1833 Integration test

Test eml is supplied by Michael Bailly from Linagora


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

Branch: refs/heads/master
Commit: 0d685ea37052ef46d15f2275dc77e2c14d8a6ce8
Parents: 21b6953
Author: Benoit Tellier <btell...@linagora.com>
Authored: Wed Oct 12 17:52:00 2016 +0200
Committer: Benoit Tellier <btell...@linagora.com>
Committed: Fri Oct 14 08:59:05 2016 +0200

----------------------------------------------------------------------
 .../cucumber/GetMessagesMethodStepdefs.java     | 10 ++++++
 .../test/resources/cucumber/GetMessages.feature |  8 +++++
 .../src/test/resources/eml/inlinedMultipart.eml | 36 ++++++++++++++++++++
 3 files changed, 54 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/0d685ea3/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessagesMethodStepdefs.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessagesMethodStepdefs.java
 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessagesMethodStepdefs.java
index 7deb095..6bd40c2 100644
--- 
a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessagesMethodStepdefs.java
+++ 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessagesMethodStepdefs.java
@@ -35,6 +35,7 @@ import java.util.stream.Collectors;
 import javax.inject.Inject;
 import javax.mail.Flags;
 
+import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang3.StringEscapeUtils;
 import org.apache.http.HttpResponse;
 import org.apache.http.client.fluent.Request;
@@ -95,6 +96,15 @@ public class GetMessagesMethodStepdefs {
         appendMessage(mailbox, ContentType.noContentType(), subject, content, 
Optional.of(headers.asMap(String.class, String.class)));
     }
 
+    @Given("^the user has a message in \"([^\"]*)\" mailbox, composed of a 
multipart with inlined text part and inlined html part$")
+    public void appendMessageFromFileInlinedMultipart(String mailbox) throws 
Throwable {
+        ZonedDateTime dateTime = ZonedDateTime.parse("2014-10-30T14:12:00Z");
+        
mainStepdefs.jmapServer.serverProbe().appendMessage(userStepdefs.lastConnectedUser,
+            new MailboxPath(MailboxConstants.USER_NAMESPACE, 
userStepdefs.lastConnectedUser, mailbox),
+            ClassLoader.getSystemResourceAsStream("eml/inlinedMultipart.eml"),
+            Date.from(dateTime.toInstant()), false, new Flags());
+    }
+
     private void appendMessage(String mailbox, ContentType contentType, String 
subject, String content, Optional<Map<String, String>> headers) throws 
Exception {
         ZonedDateTime dateTime = ZonedDateTime.parse("2014-10-30T14:12:00Z");
         
mainStepdefs.jmapServer.serverProbe().appendMessage(userStepdefs.lastConnectedUser,
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/0d685ea3/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/GetMessages.feature
----------------------------------------------------------------------
diff --git 
a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/GetMessages.feature
 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/GetMessages.feature
index b01c137..377a306 100644
--- 
a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/GetMessages.feature
+++ 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/GetMessages.feature
@@ -199,3 +199,11 @@ Feature: GetMessages method
     And the preview of the message is "multipart/related content"
     And the property "textBody" of the message is null
     And the htmlBody of the message is "<html>multipart/related 
content</html>\n"
+
+  Scenario: Retrieving message should return textBody and htmlBody when 
incoming mail have an inlined HTML and text body without Content-ID
+    Given the user has a message in "inbox" mailbox, composed of a multipart 
with inlined text part and inlined html part
+    When the user ask for messages "["usern...@domain.tld|inbox|1"]"
+    Then no error is returned
+    And the list should contain 1 message
+    And the textBody of the message is "Hello text body\n"
+    And the htmlBody of the message is "<html>Hello html body</html>\n"

http://git-wip-us.apache.org/repos/asf/james-project/blob/0d685ea3/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/eml/inlinedMultipart.eml
----------------------------------------------------------------------
diff --git 
a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/eml/inlinedMultipart.eml
 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/eml/inlinedMultipart.eml
new file mode 100644
index 0000000..d9fc2bf
--- /dev/null
+++ 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/eml/inlinedMultipart.eml
@@ -0,0 +1,36 @@
+Return-Path: <returnPath>
+Received: from localhost (localhost [127.0.0.1])
+       by localhost (Postfix) with ESMTP id 27358B3A09;
+       Tue, 11 Oct 2016 11:59:12 +0200 (CEST)
+Date: Tue, 11 Oct 2016 02:59:07 -0700
+From: y...@apache.org
+To: m...@apache.org
+Message-ID: messageId
+Subject: Confirm your email address
+MIME-Version: 1.0
+Content-Type: multipart/mixed; 
+       boundary="----=_Part_5211_53602129.1476179947600"
+Content-Disposition: inline
+
+------=_Part_5211_53602129.1476179947600
+Content-Type: multipart/alternative; 
+       boundary="----=_Part_5210_1271316664.1476179947600"
+
+------=_Part_5210_1271316664.1476179947600
+Content-Type: text/plain; charset=utf-8
+Content-Transfer-Encoding: 7bit
+Content-Disposition: inline
+
+Hello text body
+
+------=_Part_5210_1271316664.1476179947600
+Content-Type: text/html; charset=UTF-8
+Content-Transfer-Encoding: 7bit
+Content-Disposition: inline
+
+<html>Hello html body</html>
+
+------=_Part_5210_1271316664.1476179947600--
+
+------=_Part_5211_53602129.1476179947600--
+


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

Reply via email to