Repository: james-project Updated Branches: refs/heads/master a5bd1c743 -> bc5afa0c8
JAMES-1786 Add test on JMAP message creation Demonstrate it works with arbitrary message ID. Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/bc5afa0c Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/bc5afa0c Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/bc5afa0c Branch: refs/heads/master Commit: bc5afa0c8662e626c364fa191406325f2c1b4fa0 Parents: a5bd1c7 Author: Benoit Tellier <[email protected]> Authored: Tue Jun 28 14:47:59 2016 +0700 Committer: Benoit Tellier <[email protected]> Committed: Thu Jun 30 16:27:47 2016 +0700 ---------------------------------------------------------------------- .../integration/SetMessagesMethodTest.java | 33 ++++++++++++++++++++ 1 file changed, 33 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/james-project/blob/bc5afa0c/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 f10c73d..1b6dab5 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 @@ -666,6 +666,39 @@ public abstract class SetMessagesMethodTest { } @Test + public void setMessageShouldSupportArbitraryMessageId() { + String messageCreationId = "1717fcd1-603e-44a5-b2a6-1234dbcd5723"; + String fromAddress = username; + String requestBody = "[" + + " [" + + " \"setMessages\","+ + " {" + + " \"create\": { \"" + messageCreationId + "\" : {" + + " \"from\": { \"name\": \"Me\", \"email\": \"" + fromAddress + "\"}," + + " \"to\": [{ \"name\": \"BOB\", \"email\": \"[email protected]\"}]," + + " \"subject\": \"Thank you for joining example.com!\"," + + " \"textBody\": \"Hello someone, and thank you for joining example.com!\"," + + " \"mailboxIds\": [\"" + getOutboxId() + "\"]" + + " }}" + + " }," + + " \"#0\"" + + " ]" + + "]"; + + given() + .header("Authorization", accessToken.serialize()) + .body(requestBody) + .when() + .post("/jmap") + .then() + .log().ifValidationFails() + .statusCode(200) + .body(NAME, equalTo("messagesSet")) + .body(ARGUMENTS + ".notCreated", aMapWithSize(0)) + .body(ARGUMENTS + ".created", aMapWithSize(1)); + } + + @Test public void setMessagesShouldCreateMessageInOutboxWhenSendingMessage() throws MailboxException { // Given String messageCreationId = "user|inbox|1"; --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
