james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [10/13] james-project git commit: JAMES-1929 Adding integration tests for hasAttachment filter support
Date Wed, 15 Feb 2017 00:01:28 GMT
JAMES-1929 Adding integration tests for hasAttachment filter support


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

Branch: refs/heads/master
Commit: 983de8dd1e0714dbf5256d7be7bea21aa7123221
Parents: 46feedc
Author: Benoit Tellier <btellier@linagora.com>
Authored: Wed Feb 8 17:04:36 2017 +0700
Committer: Benoit Tellier <btellier@linagora.com>
Committed: Wed Feb 15 06:59:46 2017 +0700

----------------------------------------------------------------------
 .../integration/GetMessageListMethodTest.java   | 46 ++++++++++++++++++++
 1 file changed, 46 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/983de8dd/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetMessageListMethodTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetMessageListMethodTest.java
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetMessageListMethodTest.java
index be275d9..034575c 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetMessageListMethodTest.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetMessageListMethodTest.java
@@ -127,6 +127,52 @@ public abstract class GetMessageListMethodTest {
     }
 
     @Test
+    public void getMessageListShouldSupportHasAttachmentSetToTrue() throws Exception {
+        jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username,
"mailbox");
+
+        jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE,
username, "mailbox"),
+            new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new Date(),
false, new Flags());
+        ComposedMessageId message2 = jmapServer.serverProbe().appendMessage(username, new
MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+            ClassLoader.getSystemResourceAsStream("eml/twoAttachments.eml"), new Date(),
false, new Flags());
+        jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE,
username, "mailbox"),
+            ClassLoader.getSystemResourceAsStream("eml/oneInlinedImage.eml"), new Date(),
false, new Flags());
+        await();
+
+        given()
+            .header("Authorization", accessToken.serialize())
+            .body("[[\"getMessageList\", {\"filter\":{\"hasAttachment\":\"true\"}}, \"#0\"]]")
+        .when()
+            .post("/jmap")
+        .then()
+            .statusCode(200)
+            .body(NAME, equalTo("messageList"))
+            .body(ARGUMENTS + ".messageIds", contains(message2.getMessageId().serialize()));
+    }
+
+    @Test
+    public void getMessageListShouldSupportHasAttachmentSetToFalse() throws Exception {
+        jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username,
"mailbox");
+
+        ComposedMessageId message1 = jmapServer.serverProbe().appendMessage(username, new
MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+            new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new Date(),
false, new Flags());
+        jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE,
username, "mailbox"),
+            ClassLoader.getSystemResourceAsStream("eml/twoAttachments.eml"), new Date(),
false, new Flags());
+        ComposedMessageId message3 = jmapServer.serverProbe().appendMessage(username, new
MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+            ClassLoader.getSystemResourceAsStream("eml/oneInlinedImage.eml"), new Date(),
false, new Flags());
+        await();
+
+        given()
+            .header("Authorization", accessToken.serialize())
+            .body("[[\"getMessageList\", {\"filter\":{\"hasAttachment\":\"false\"}}, \"#0\"]]")
+        .when()
+            .post("/jmap")
+        .then()
+            .statusCode(200)
+            .body(NAME, equalTo("messageList"))
+            .body(ARGUMENTS + ".messageIds", contains(message1.getMessageId().serialize(),
message3.getMessageId().serialize()));
+    }
+
+    @Test
     public void getMessageListShouldNotFailWhenHeaderIsValid() throws Exception {
         given()
             .header("Authorization", accessToken.serialize())


---------------------------------------------------------------------
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