You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by bt...@apache.org on 2017/06/07 10:46:27 UTC

[17/21] james-project git commit: JAMES-2048 Add IT testing for attachment with blank CID

JAMES-2048 Add IT testing for attachment with blank CID


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

Branch: refs/heads/master
Commit: 2e1d41da91331e343ae1d99b6396f1281f35d1a1
Parents: 730f44f
Author: quynhn <qn...@linagora.com>
Authored: Tue Jun 6 13:48:36 2017 +0700
Committer: benwa <bt...@linagora.com>
Committed: Wed Jun 7 17:35:54 2017 +0700

----------------------------------------------------------------------
 .../cucumber/GetMessagesMethodStepdefs.java     |  5 ++
 .../test/resources/cucumber/GetMessages.feature | 13 ++++
 .../mailWithInlinedAttachmentAndBlankCid.eml    | 74 ++++++++++++++++++++
 3 files changed, 92 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/2e1d41da/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 107eaf3..97dbc64 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
@@ -221,6 +221,11 @@ public class GetMessagesMethodStepdefs {
         appendMessage(messageName, "eml/mailWithInlinedAttachmentButNoCid.eml");
     }
 
+    @Given("^the user has a message \"([^\"]*)\" in \"([^\"]*)\" mailbox with inline attachment and blank CID$")
+    public void appendMessageWithInlineAttachmentAndBlankCid(String messageName, String mailbox) throws Throwable {
+        appendMessage(messageName, "eml/mailWithInlinedAttachmentAndBlankCid.eml");
+    }
+
     @Given("^the user has a message \"([^\"]*)\" in \"([^\"]*)\" mailbox with HTML body with many empty tags$")
     public void appendMessageWithNoPreview(String messageName, String mailbox) throws Exception {
         appendMessage(messageName, "eml/htmlBodyWithManyEmptyTags.eml");

http://git-wip-us.apache.org/repos/asf/james-project/blob/2e1d41da/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 a0c4104..9f0255f 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
@@ -262,6 +262,19 @@ Feature: GetMessages method
       |cid      |null                                       |
       |isInline |true                                      |
 
+  Scenario: Retrieving message with inline attachment and blank CID should convert that inlined attachment to normal attachment
+    Given the user has a message "m1" in "INBOX" mailbox with inline attachment and blank CID
+    When the user ask for messages "m1"
+    Then no error is returned
+    And the list should contain 1 message
+    And the hasAttachment of the message is "true"
+    And the list of attachments of the message contains 1 attachments
+    And the first attachment is:
+        |key      | value            |
+        |type     |"application/pdf" |
+        |cid      |null              |
+        |isInline |true              |
+
   Scenario: Preview should be computed even when HTML body contains many tags without content
     Given the user has a message "m1" in "INBOX" mailbox with HTML body with many empty tags
     When the user ask for messages "m1"

http://git-wip-us.apache.org/repos/asf/james-project/blob/2e1d41da/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/eml/mailWithInlinedAttachmentAndBlankCid.eml
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/eml/mailWithInlinedAttachmentAndBlankCid.eml b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/eml/mailWithInlinedAttachmentAndBlankCid.eml
new file mode 100644
index 0000000..39facf2
--- /dev/null
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/eml/mailWithInlinedAttachmentAndBlankCid.eml
@@ -0,0 +1,74 @@
+Return-Path: <se...@gmail.com>
+MIME-Version: 1.0
+Delivered-To: test@localhost
+Received: from localhost
+X-Virus-Scanned: Debian
+X-Spam-Flag: NO
+X-Spam-Score: -1.78
+X-Spam-Level:
+X-Spam-Status: No, score=-1.78 tagged_above=-99 required=2
+	tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, FREEMAIL_FROM=0.001,
+	RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, T_DKIM_INVALID=0.01,
+	T_FREEMAIL_DOC_PDF=0.01] autolearn=no
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
+        d=gmail.com; s=20161025;
+        h=from:mime-version:subject:message-id:date:cc:to;
+        bh=lgK1xUjmh9FzAPFKLN2lvhSSlfI6ujj8K57kqImKrA8=;
+        b=tw7ave7egTqm3ZcXDe0NeuPSli3nkOBuqjOWLaK0MivSzO8FTQEWzCMEAlyhG4PMcP
+         jkxmhKAAjNPshiFnAYzPB4LNQV6GKPNUQ5igA9HDzh4dfbdT/6GiTEvUyWKZ6VpGVASR
+         x9Ioyiwxrdf4phsMYSHT7/Y+94/SvmAQj5gZZXfQ8JvmIAlxN9F4mvMnk2JQM4wcGv8Z
+         15zNoTxcUPODEybnawotJUewQu2sCKL7S46vFfKiuYEiKPC/XhGPFsjvwBAvcMBfRgbm
+         jJSAPk0TlXERVjhd3CSCHC1ukQ1nICb3yTZacuOK0gUgJ7rKY25zQoq2QvYgX97SuThz
+         BpHw==
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
+        d=1e100.net; s=20161025;
+        h=x-gm-message-state:from:mime-version:subject:message-id:date:cc:to;
+        bh=lgK1xUjmh9FzAPFKLN2lvhSSlfI6ujj8K57kqImKrA8=;
+        b=VmTt7K8LRHq/MdOYtIhRnA/Lkbx41VnZh6+SYior8s5kLaKgrJWi+N/ql7SU6lCR2m
+         JFTyvIfUqsNFiHy0wPMlI4RauXHNVQWe9C+UQ5hc5BT+Z67O/5dxe+KDhtchRqh7JWC5
+         aWDjuvROFqhEEqphuEtGLqEqnHPbmweMZBIouasP2Z0TiHTSASSJq60HUcwf7UcVbmbw
+         m5O35XykCkecEX+H9fGAqgzlvFvtfy4PDENWfz8Yhzv730FsAmDutRjww0HYriyLwgpN
+         OjrT1o6p6DrWs5JlcgRh7F5qauiR/WTq+srbWbe/tLD7Lx8WRKyeXuzjKyTKJ5TjV6c5
+         AHKA==
+X-Gm-Message-State: AFeK/H1blcvejtSjL0KgKvb81Bc5uVOYQpq8wm/HouMZgtBr1kw+d9+VOes+FQrObRJdbQ==
+X-Received: by 10.28.133.84 with SMTP id h81mr8649035wmd.23.1489999897292;
+        Mon, 20 Mar 2017 01:51:37 -0700 (PDT)
+From: <fr...@localhost>
+Content-Type: multipart/mixed;
+ boundary="Apple-Mail=_DF3869A6-784C-445C-8AA0-EBEFE28034A4"
+Subject: mail with attachment from apple mail
+Message-Id: <15...@gmail.com>
+Date: Mon, 20 Mar 2017 09:51:28 +0100
+To: <to...@localhost>
+X-Mailer: Apple Mail (2.3259)
+
+
+--Apple-Mail=_DF3869A6-784C-445C-8AA0-EBEFE28034A4
+Content-Transfer-Encoding: quoted-printable
+Content-Type: text/plain;
+	charset=utf-8
+
+Voil=C3=A0
+
+--=20
+Voila=
+
+--Apple-Mail=_DF3869A6-784C-445C-8AA0-EBEFE28034A4
+Content-Disposition: inline;
+	filename=deromaCollection-628.pdf
+Content-ID:
+Content-Type: application/pdf;
+	x-unix-mode=0644;
+	name="deromaCollection-628.pdf"
+Content-ID: <   >
+Content-Transfer-Encoding: base64
+
+JVBERi0xLjQKJeLjz9MKMSAwIG9iaiAKPDwvVHlwZSAvQ2F0YWxvZyAvVmVyc2lvbiAvMS40IC9Q
+YWdlcyAyIDAgUiAvTmFtZXMgNiAwIFIgPj4KZW5kb2JqCjIgMCBvYmogCjw8L1R5cGUgL1BhZ2Vz
+IC9LaWRzIFsxMCAwIFIgMTIgMCBSIDE5IDAgUiBdIC9Db3VudCAzID4+CmVuZG9iagozIDAgb2Jq
+IAo8PC9UaXRsZSAo/v8AVADpAG4A6QByAOkpIC9BdXRob3IgKERlcm9tYSBTcGEpIC9TdWJqZWN0
+ICj+/wBDAG8AbABsAGUAYwB0AGkAbwBuACAAVADpAG4A6QByAOkpIC9LZXl3b3JkcyAo/v8ARABl
+AHMALABwAGkA6ABjAGUAcwAsAHUAbgBpAHEAdQBlAHMALAAsAGMAcgDpAOkAZQBzACwAcABhAHIA
+LABkAGUALAB0AGEAbABlAG4AdAB1AGUAdQB4ACwAYQByAHQAaQBzAGEAbgBzACwAcABvAHQAaQBl
+bmZvIDMgMCBSID4+CnN0YXJ0eHJlZgoyOTQ0MDcKJSVFT0YK
+--Apple-Mail=_DF3869A6-784C-445C-8AA0-EBEFE28034A4--


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