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 ad...@apache.org on 2016/07/04 04:58:39 UTC

[2/2] james-project git commit: JAMES-1787 Add acceptance test for inline attachment

JAMES-1787 Add acceptance test for inline attachment


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

Branch: refs/heads/master
Commit: 4986bca6ff9a826cf52ba1595799e7ad1909ca8c
Parents: b6e967d
Author: Raphael Ouazana <ra...@linagora.com>
Authored: Thu Jun 30 11:36:02 2016 +0200
Committer: Raphael Ouazana <ra...@linagora.com>
Committed: Fri Jul 1 17:34:01 2016 +0200

----------------------------------------------------------------------
 .../integration/cucumber/DownloadStepdefs.java  | 12 +++
 .../resources/cucumber/DownloadEndpoint.feature |  7 ++
 .../src/test/resources/eml/oneInlinedImage.eml  | 82 ++++++++++++++++++++
 3 files changed, 101 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/4986bca6/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 e675d10..b414de9 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
@@ -75,6 +75,18 @@ public class DownloadStepdefs {
         blobIdByAttachmentId.put(attachmentId, "4000c5145f633410b80be368c44e1c394bff9437");
     }
 
+    @Given("^\"([^\"]*)\" mailbox \"([^\"]*)\" contains a message \"([^\"]*)\" with an inlined attachment \"([^\"]*)\"$")
+    public void appendMessageWithInlinedAttachmentToMailbox(String user, String mailbox, String messageId, String attachmentId) throws Throwable {
+        MailboxPath mailboxPath = new MailboxPath(MailboxConstants.USER_NAMESPACE, user, mailbox);
+
+        mainStepdefs.jmapServer.serverProbe().appendMessage(user, mailboxPath,
+                ClassLoader.getSystemResourceAsStream("eml/oneInlinedImage.eml"), new Date(), false, new Flags());
+        
+        attachmentsByMessageId.put(messageId, attachmentId);
+        // TODO
+        //blobIdByAttachmentId.put(attachmentId, "<correctComputedBlobId>");
+    }
+
     @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/4986bca6/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 df26b7f..d059572 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
@@ -50,3 +50,10 @@ Feature: Download endpoint
     And "userb@domain.tld" is connected
     When "userb@domain.tld" downloads "a1"
     Then the user should be authorized
+
+  @Ignore
+  Scenario: A user should have acess to an inlined attachment
+    Given "usera@domain.tld" is connected
+    And "usera@domain.tld" mailbox "INBOX" contains a message "m2" with an inlined attachment "ia1"
+    When "usera@domain.tld" downloads "ia1"
+    Then the user should be authorized

http://git-wip-us.apache.org/repos/asf/james-project/blob/4986bca6/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/eml/oneInlinedImage.eml
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/eml/oneInlinedImage.eml b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/eml/oneInlinedImage.eml
new file mode 100644
index 0000000..4a32093
--- /dev/null
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/eml/oneInlinedImage.eml
@@ -0,0 +1,82 @@
+Return-Path: <te...@linagora.com>
+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, 30 Jun 2016 11:26:28 +0200
+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 D9D01743
+	for <te...@linagora.com>; Thu, 30 Jun 2016 11:26:28 +0200 (CEST)
+MIME-Version: 1.0
+Content-Type: multipart/alternative;
+ boundary="=_78be9b39405e216b14ea426a30eef65c"
+Date: Thu, 30 Jun 2016 11:26:28 +0200
+From: Test <te...@linagora.com>
+To: test <te...@linagora.com>
+Subject: Mail with inlined image
+Message-ID: <e5...@linagora.com>
+X-Sender: test@linagora.com
+User-Agent: Roundcube Webmail/1.1.4
+
+--=_78be9b39405e216b14ea426a30eef65c
+Content-Transfer-Encoding: 7bit
+Content-Type: text/plain; charset=US-ASCII
+
+Inlined image: 
+
+Signature. 
+--=_78be9b39405e216b14ea426a30eef65c
+Content-Type: multipart/related;
+ boundary="=_09507e56cd9618e600636c7ef4ea9f8f"
+
+--=_09507e56cd9618e600636c7ef4ea9f8f
+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>Inlined image:</p>
+<p><img src=3D"cid:14672787885774e5c4d4cee471352039@linagora.com" alt=3D"" =
+width=3D"32" height=3D"32" /></p>
+<p>Signature.</p>
+</body></html>
+
+--=_09507e56cd9618e600636c7ef4ea9f8f
+Content-Transfer-Encoding: base64
+Content-ID: <14...@linagora.com>
+Content-Type: image/png;
+ name=vlc.png
+Content-Disposition: inline;
+ filename=vlc.png;
+ size=1510
+
+iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAFrUlEQVRYw8WWW2wc1RnHf+fMZS+z
+O7veXXZtr+M4Bl+IHNwrSau0ahEkNIloeCgttKoaJFT1oZUqRUJqEaqqPoAoSLRqK4FaISFUIVQQ
+IMETCBmqBpSGm9OIOKbEju11vNfZnZ29zUwfxiGUkta17PZIZ85I55zv+8///11G+L7P/3Oom704
+c2ff8R169ftCF2LBijz65cfs+zdjR2yGgSe+O5KciizOT2S9lBaF2bPCOtXIjB576mLpv7UlN/X5
+DWt/POKlXBd6LiQivql1e1/ajKlNAYhJ55AhgRaILpgaxGjd/D+R4JcPPahPpDgzHZ0bDbUdhGhi
+qzn+vJT425LfN3338eO9bQ3C/PDoFz0zPeLuOcaq0yYeCbFSrDI4XL529dRf9wBvbqsEyyuF/SP5
+q6RdK2HqPrZVJmMoVCtlkR/I3bHtMTA+dvVttuMQixlYdZuYEaVWbzCcH6Swunb9tgJ4/Mmnd5fr
+zlgmlabesDHjBg27SdKMU7HqjI2P773v4d8NbxsA56WH9l17lRa2bJuYmaTaBsNMU3Vcspk01tzJ
+UHb+2Ru3LQjN8385HP3jUZLXXI00hsipCWQIdno1eoUFxt+e5/RF/yDwhy1Pw9/fviuetRffmxh0
+B/pM0NugeiBjIMLQacOFBZgtKIVaenDyricXalsqgddsfj6mugOKCijgSXB18FTwlIBLLQRR4fZ7
+dnPflseA1ra/FgmBAPAB7yObPggJmgpRHdRu5+YtBfDrH92ihEXvQFiCFIHD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eETnNOyIDPBfcS6LRW0zmvfAX7ziQCs99/b
+l5w+tG7lMgAxAEqPIJ8ueRMfK6mXVhkwhxYA+XB/HYS7+MI+9Uox8NQzyZ9PzbzwINs4zhYTP/3e
+0U38km3X+Aeuu0L8ysHGdwAAAABJRU5ErkJggg==
+--=_09507e56cd9618e600636c7ef4ea9f8f--
+
+--=_78be9b39405e216b14ea426a30eef65c--


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