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/01/24 05:49:07 UTC

[07/15] james-project git commit: JAMES-1785 Moving to trash is not yet supported

JAMES-1785 Moving to trash is not yet supported


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

Branch: refs/heads/master
Commit: 52be7f0373ad321574b08985d5b91bafa43e148d
Parents: 89994c3
Author: Benoit Tellier <bt...@linagora.com>
Authored: Tue Jan 17 14:41:16 2017 +0700
Committer: Quynh Nguyen <qn...@linagora.com>
Committed: Tue Jan 24 09:46:06 2017 +0700

----------------------------------------------------------------------
 .../integration/SetMessagesMethodTest.java      | 41 ++++++++++++++++++++
 1 file changed, 41 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/52be7f03/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMessagesMethodTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMessagesMethodTest.java b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMessagesMethodTest.java
index 4eec224..3fb43cd 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMessagesMethodTest.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMessagesMethodTest.java
@@ -123,6 +123,8 @@ public abstract class SetMessagesMethodTest {
         accessToken = JmapAuthentication.authenticateJamesUser(USERNAME, password);
 
         jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, "outbox");
+        jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, "trash");
+        jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, "draft");
         await();
 
         Duration slowPacedPollInterval = Duration.FIVE_HUNDRED_MILLISECONDS;
@@ -1677,6 +1679,45 @@ public abstract class SetMessagesMethodTest {
                         + "(through reference chain: org.apache.james.jmap.model.Builder[\"mailboxIds\"])"))
                .body(ARGUMENTS + ".updated", hasSize(0));
     }
+
+    @Test
+    public void moveToTrashIsNotYetSupported() throws Exception {
+        String newMailboxName = "heartFolder";
+        jmapServer.serverProbe().createMailbox("#private", USERNAME, newMailboxName);
+        String trashId = jmapServer.serverProbe().getMailbox("#private", USERNAME, "trash").getMailboxId().serialize();
+
+        ZonedDateTime dateTime = ZonedDateTime.parse("2014-10-30T14:12:00Z");
+        ComposedMessageId message = jmapServer.serverProbe().appendMessage(USERNAME, new MailboxPath("#private", USERNAME, "inbox"),
+            new ByteArrayInputStream("Subject: my test subject\r\n\r\ntestmail".getBytes(Charsets.UTF_8)), Date.from(dateTime.toInstant()), false, new Flags());
+
+        String messageToMoveId = message.getMessageId().serialize();
+        String requestBody = "[" +
+            "  [" +
+            "    \"setMessages\","+
+            "    {" +
+            "      \"update\": { \"" + messageToMoveId + "\" : {" +
+            "        \"mailboxIds\": [\"" + trashId + "\"]" +
+            "      }}" +
+            "    }," +
+            "    \"#0\"" +
+            "  ]" +
+            "]";
+
+        given()
+            .header("Authorization", accessToken.serialize())
+            .body(requestBody)
+        .when()
+            .post("/jmap")
+        .then()
+            .log().ifValidationFails()
+            .statusCode(200)
+            .body(NAME, equalTo("messagesSet"))
+            .body(NOT_UPDATED, hasKey(messageToMoveId))
+            .body(NOT_UPDATED + "[\""+messageToMoveId+"\"].type", equalTo("invalidProperties"))
+            .body(NOT_UPDATED + "[\""+messageToMoveId+"\"].properties", hasSize(1))
+            .body(NOT_UPDATED + "[\""+messageToMoveId+"\"].properties[0]", equalTo("inMailboxes"))
+            .body(ARGUMENTS + ".updated", hasSize(0));
+    }
     
     @Test
     public void setMessagesShouldReturnAttachmentsNotFoundWhenBlobIdDoesntExist() throws Exception {


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