JAMES-1872 Add integration test for JMAP for downloading images with the same 
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/2c1ef3ba
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/2c1ef3ba
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/2c1ef3ba

Branch: refs/heads/master
Commit: 2c1ef3ba338c11e5fb6eed23e98b5d77dfa99b61
Parents: 9643615
Author: Quynh Nguyen <[email protected]>
Authored: Mon Mar 27 11:27:13 2017 +0700
Committer: benwa <[email protected]>
Committed: Thu Mar 30 11:28:03 2017 +0700

----------------------------------------------------------------------
 .../integration/cucumber/DownloadStepdefs.java  | 14 +++-
 .../resources/cucumber/DownloadEndpoint.feature | 12 ++-
 .../test/resources/eml/sameInlinedImages.eml    | 84 ++++++++++++++++++++
 3 files changed, 106 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/2c1ef3ba/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/DownloadStepdefs.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/DownloadStepdefs.java
 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/DownloadStepdefs.java
index 829b21d..68ba2ae 100644
--- 
a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/DownloadStepdefs.java
+++ 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/DownloadStepdefs.java
@@ -92,7 +92,7 @@ public class DownloadStepdefs {
                 
ClassLoader.getSystemResourceAsStream("eml/oneAttachment.eml"), new Date(), 
false, new Flags());
         
         attachmentsByMessageId.put(messageId, attachmentId);
-        blobIdByAttachmentId.put(attachmentId, 
"4000c5145f633410b80be368c44e1c394bff9437");
+        blobIdByAttachmentId.put(attachmentId, 
ONE_ATTACHMENT_EML_ATTACHMENT_BLOB_ID);
     }
 
     @Given("^\"([^\"]*)\" mailbox \"([^\"]*)\" contains a message \"([^\"]*)\" 
with an inlined attachment \"([^\"]*)\"$")
@@ -107,6 +107,18 @@ public class DownloadStepdefs {
         //blobIdByAttachmentId.put(attachmentId, "<correctComputedBlobId>");
     }
 
+    @Given("^\"([^\"]*)\" mailbox \"([^\"]*)\" contains a message \"([^\"]*)\" 
with multiple same inlined attachments \"([^\"]*)\"$")
+    public void appendMessageWithSameInlinedAttachmentsToMailbox(String user, 
String mailbox, String messageName, String attachmentId) throws Throwable {
+        MailboxPath mailboxPath = new 
MailboxPath(MailboxConstants.USER_NAMESPACE, user, mailbox);
+
+        
mainStepdefs.jmapServer.getProbe(MailboxProbeImpl.class).appendMessage(user, 
mailboxPath,
+            
ClassLoader.getSystemResourceAsStream("eml/sameInlinedImages.eml"), new Date(), 
false, new Flags());
+
+        attachmentsByMessageId.put(messageName, attachmentId);
+
+        blobIdByAttachmentId.put(attachmentId, 
ONE_ATTACHMENT_EML_ATTACHMENT_BLOB_ID);
+    }
+
     @When("^\"([^\"]*)\" checks for the availability of the attachment 
endpoint$")
     public void optionDownload(String username) throws Throwable {
         AccessToken accessToken = userStepdefs.tokenByUser.get(username);

http://git-wip-us.apache.org/repos/asf/james-project/blob/2c1ef3ba/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/DownloadEndpoint.feature
----------------------------------------------------------------------
diff --git 
a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/DownloadEndpoint.feature
 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/DownloadEndpoint.feature
index e46a4fe..f4be86e 100644
--- 
a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/DownloadEndpoint.feature
+++ 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/DownloadEndpoint.feature
@@ -7,7 +7,7 @@ Feature: Download endpoint
     And some users "[email protected]", "[email protected]", "[email protected]"
     And "[email protected]" has a mailbox "INBOX"
     And "[email protected]" mailbox "INBOX" contains a message "m1" with an 
attachment "a1"
-    
+
   Scenario: An authenticated user should initiate the access to the download 
endpoint
     Given "[email protected]" is connected
     When "[email protected]" checks for the availability of the attachment 
endpoint
@@ -74,9 +74,15 @@ Feature: Download endpoint
     When "[email protected]" downloads "a1"
     Then the user should be authorized
 
-  @Ignore
-  Scenario: A user should have acess to an inlined attachment
+  Scenario: A user should have access to an inlined attachment
     Given "[email protected]" is connected
     And "[email protected]" mailbox "INBOX" contains a message "m2" with an 
inlined attachment "ia1"
     When "[email protected]" downloads "ia1"
     Then the user should be authorized
+
+  Scenario: A user should have access to multiple same inlined attachments
+    Given "[email protected]" is connected
+    And "[email protected]" mailbox "INBOX" contains a message "m2" with 
multiple same inlined attachments "ia1"
+    When "[email protected]" downloads "ia1"
+    And "[email protected]" downloads "ia1"
+    Then the user should be authorized

http://git-wip-us.apache.org/repos/asf/james-project/blob/2c1ef3ba/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/eml/sameInlinedImages.eml
----------------------------------------------------------------------
diff --git 
a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/eml/sameInlinedImages.eml
 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/eml/sameInlinedImages.eml
new file mode 100644
index 0000000..2705094
--- /dev/null
+++ 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/eml/sameInlinedImages.eml
@@ -0,0 +1,84 @@
+Return-Path: <[email protected]>
+Received: from alderaan.linagora.com (smtp.linagora.dc1 [172.16.18.53])
+        by imap (Cyrus v2.2.13-Debian-2.2.13-19+squeeze3) with LMTPA;
+        Thu, 29 Dec 2016 04:19:28 +0100
+X-Sieve: CMU Sieve 2.2
+Received: from extranet.linagora.com (ldap.linagora.com [172.16.18.50])
+       by alderaan.linagora.com (Postfix) with ESMTP id F33174499
+       for <[email protected]>; Thu, 29 Dec 2016 04:19:27 +0100 (CET)
+MIME-Version: 1.0
+Content-Type: multipart/alternative;
+ boundary="=_c0feb3c9f3d562fc7adebe39b63a7f62"
+Date: Thu, 29 Dec 2016 04:19:27 +0100
+From: Test <[email protected]>
+To: test <[email protected]>
+Subject: Send many inlined images
+Message-ID: <[email protected]>
+X-Sender: [email protected]
+User-Agent: Roundcube Webmail/1.1.4
+
+--=_c0feb3c9f3d562fc7adebe39b63a7f62
+Content-Transfer-Encoding: 7bit
+Content-Type: text/plain; charset=US-ASCII
+
+Add more images 
+
+  
+--=_c0feb3c9f3d562fc7adebe39b63a7f62
+Content-Type: multipart/related;
+ boundary="=_ebeed74b39dc10b43908b65b893b4ea4"
+
+--=_ebeed74b39dc10b43908b65b893b4ea4
+Content-Transfer-Encoding: quoted-printable
+Content-Type: text/html; charset=UTF-8
+
+<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html; charset=
+=3DUTF-8" /></head><body style=3D'font-size: 10pt; font-family: Verdana,Gen=
+eva,sans-serif'>
+<p>Add more images <img src=3D"cid:1482981567586480bfca67b793175279@linagor=
+a.com" alt=3D"" width=3D"163" height=3D"71" /><img src=3D"cid:1482981567586=
[email protected]" alt=3D"" width=3D"163" height=3D"71" /><i=
+mg src=3D"cid:[email protected]" alt=3D"" width=
+=3D"163" height=3D"71" /></p>
+<div>&nbsp;</div>
+</body></html>
+
+--=_ebeed74b39dc10b43908b65b893b4ea4
+Content-Transfer-Encoding: base64
+Content-ID: <[email protected]>
+Content-Type: image/png;
+ name="g3619(1).png"
+Content-Disposition: inline;
+ filename="g3619(1).png";
+ size=1510
+
+iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAFrUlEQVRYw8WWW2wc1RnHf+fMZS+z
+O7veXXZtr+M4Bl+IHNwrSau0ahEkNIloeCgttKo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KMU65U6UuYLK8U6M9lmTs3z8Tk
+7kjx5da9o+0qmVSVdj2/ALy8oSCM1M4d9T1o+tBeXmGH9S6FSoN0doByrUHCTFCp1jDjBpVqjaQZ
+p1Spkc5kKFQa5HfuonbiTyhWCcsH14N0e+2WDWXB+Rfv0bXG4o0e4HjQ63bJvvoA/TM/o/nOcyTU
+DuVqGSORpNzoEo0nKdZbmDGD2vIcw933kU//mKE3HkW260HBAgyneOCVh7+p/UcJtFbh00q7POZp
+YHcuF5j4/AyRlRnUkyaG3o8fTROPxhASkp6N0i6Sb67QK9XRinBRBVUBRQWpQaRnTWQj3Wng5L8F
+oNfnjkiBQIVMEipl8D1AD05Lx0IpWaiAqoFUQWggVPAE9BRQ9IDahA5D/ZDqg2gCmc51Dn8cwD9J
+sPrq/TLkzB1SIqBEYWAHTF0DEQFeB7ze+hRBD3AVcOW6Yx96XfB7oAhIGfDZPbBrEsxBCKVBa84e
+smYfEVdkQHfXJnV/9TqMwJGUkAtBOg2tBnQc8Lrrtd8LnPl+0BakEpRiPQJmDlQJ0gDCAYMyBMK7
+8CnXLY8BZz8ZQPvvBzXdUz0VFDfoer4elNlEIqDLdz/CRA+EEmishECELveJXutyq8YPJBKaq2vO
+uzddEUCYMwdlEqS33u1k0GQ8Fbw6+CJwosh/DR5//eETnNOyIDPBfcS6LRW0zmvfAX7ziQCs99/b
+l5w+tG7lMgAxAEqPIJ8ueRMfK6mXVhkwhxYA+XB/HYS7+MI+9Uox8NQzyZ9PzbzwINs4zhYTP/3e
+0U38km3X+Aeuu0L8ysHGdwAAAABJRU5ErkJggg==
+--=_ebeed74b39dc10b43908b65b893b4ea4--
+
+--=_c0feb3c9f3d562fc7adebe39b63a7f62--


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to