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:06 UTC
[06/15] james-project git commit: JAMES-1785 Copying a message to
trash is allowed
JAMES-1785 Copying a message to trash is allowed
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/b0e8e3ed
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/b0e8e3ed
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/b0e8e3ed
Branch: refs/heads/master
Commit: b0e8e3ed38e2069acecc6fdf81e10e21ea5f87fa
Parents: 52be7f0
Author: Benoit Tellier <bt...@linagora.com>
Authored: Tue Jan 17 15:09:33 2017 +0700
Committer: Quynh Nguyen <qn...@linagora.com>
Committed: Tue Jan 24 09:46:06 2017 +0700
----------------------------------------------------------------------
.../integration/SetMessagesMethodTest.java | 44 ++++++++++++++++++++
1 file changed, 44 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/james-project/blob/b0e8e3ed/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 3fb43cd..93b7a50 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
@@ -1718,6 +1718,50 @@ public abstract class SetMessagesMethodTest {
.body(NOT_UPDATED + "[\""+messageToMoveId+"\"].properties[0]", equalTo("inMailboxes"))
.body(ARGUMENTS + ".updated", hasSize(0));
}
+
+ @Test
+ public void copyToTrashShouldWork() 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 mailboxId = message.getMailboxId().serialize();
+ String requestBody = "[" +
+ " [" +
+ " \"setMessages\","+
+ " {" +
+ " \"update\": { \"" + messageToMoveId + "\" : {" +
+ " \"mailboxIds\": [\"" + trashId + "," + mailboxId + "\"]" +
+ " }}" +
+ " }," +
+ " \"#0\"" +
+ " ]" +
+ "]";
+
+ given()
+ .header("Authorization", accessToken.serialize())
+ .body(requestBody)
+ .when()
+ .post("/jmap");
+
+ String firstMessage = ARGUMENTS + ".list[0]";
+ given()
+ .header("Authorization", accessToken.serialize())
+ .body("[[\"getMessages\", {\"ids\": [\"" + messageToMoveId + "\"]}, \"#0\"]]")
+ .when()
+ .post("/jmap")
+ .then()
+ .statusCode(200)
+ .log().ifValidationFails()
+ .body(NAME, equalTo("messages"))
+ .body(ARGUMENTS + ".list", hasSize(1))
+ .body(firstMessage + ".mailboxIds", contains(trashId, mailboxId));
+ }
@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