Repository: james-project Updated Branches: refs/heads/master ed02e924d -> a82724a45
JAMES-1894 Add an integration test on GetMessageList mixing limit and skip Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/b52f3dab Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/b52f3dab Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/b52f3dab Branch: refs/heads/master Commit: b52f3dab01cec3fb27f5e223b935fe8a50de5d27 Parents: 84c6694 Author: Benoit Tellier <btell...@linagora.com> Authored: Fri Dec 23 18:05:12 2016 +0700 Committer: Benoit Tellier <btell...@linagora.com> Committed: Mon Jan 9 21:58:27 2017 +0700 ---------------------------------------------------------------------- .../integration/GetMessageListMethodTest.java | 26 +++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/james-project/blob/b52f3dab/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 949eadd..3cb3184 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 @@ -506,7 +506,31 @@ public abstract class GetMessageListMethodTest { given() .header("Authorization", accessToken.serialize()) - .body("[[\"getMessageList\", {\"position\":1}, \"#0\"]]") + .body("[[\"getMessageList\", {\"position\":1, \"sort\":[\"date desc\"]}, \"#0\"]]") + .when() + .post("/jmap") + .then() + .statusCode(200) + .body(NAME, equalTo("messageList")) + .body(ARGUMENTS + ".messageIds", contains(message2.getMessageId().serialize())); + } + + @Test + public void getMessageListShouldReturnSkipMessagesWhenPositionAndLimitGiven() throws Exception { + jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox"); + + LocalDate date = LocalDate.now(); + jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"), + new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), convertToDate(date.plusDays(2)), false, new Flags()); + ComposedMessageId message2 = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"), + new ByteArrayInputStream("Subject: test2\r\n\r\ntestmail".getBytes()), convertToDate(date.plusDays(1)), false, new Flags()); + jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"), + new ByteArrayInputStream("Subject: test3\r\n\r\ntestmail".getBytes()), convertToDate(date), false, new Flags()); + await(); + + given() + .header("Authorization", accessToken.serialize()) + .body("[[\"getMessageList\", {\"position\":1, \"limit\":1, \"sort\":[\"date desc\"]}, \"#0\"]]") .when() .post("/jmap") .then() --------------------------------------------------------------------- To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org