james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adup...@apache.org
Subject [1/7] james-project git commit: JAMES-1664 Add integration test on GetMessages when bad id given
Date Mon, 01 Feb 2016 12:25:22 GMT
Repository: james-project
Updated Branches:
  refs/heads/master df5d417ae -> fec98a5d6


JAMES-1664 Add integration test on GetMessages when bad id given


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

Branch: refs/heads/master
Commit: a2a68259dc70e0835a6be84b8f9d32de80afe407
Parents: 6b87c3d
Author: Antoine Duprat <antduprat@gmail.com>
Authored: Fri Jan 22 11:00:48 2016 +0100
Committer: Antoine Duprat <antduprat@gmail.com>
Committed: Mon Feb 1 13:20:34 2016 +0100

----------------------------------------------------------------------
 .../jmap/methods/GetMessagesMethodTest.java     | 30 ++++++++++++++++++++
 1 file changed, 30 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/a2a68259/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/methods/GetMessagesMethodTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/methods/GetMessagesMethodTest.java
b/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/methods/GetMessagesMethodTest.java
index 7930c8f..8d217e2 100644
--- a/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/methods/GetMessagesMethodTest.java
+++ b/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/methods/GetMessagesMethodTest.java
@@ -290,4 +290,34 @@ public abstract class GetMessagesMethodTest {
         assertThat(jsonPath.parse(response).<Map<String, String>>read(firstMessagePath
+ ".headers")).containsOnly(MapEntry.entry("from", "user@domain.tld"), MapEntry.entry("header2",
"Header2Content"));
         assertThat(jsonPath.parse(response).<String>read(firstMessagePath + ".date")).isNull();
     }
+
+    @Test
+    public void getMessagesShouldReturnNotFoundWhenIdDoesntMatch() throws Exception {
+        jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username,
"inbox");
+
+        ZonedDateTime dateTime = ZonedDateTime.parse("2014-10-30T14:12:00Z");
+        jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE,
username, "inbox"),
+                new ByteArrayInputStream("Subject: my test subject\r\n\r\ntestmail".getBytes()),
Date.from(dateTime.toInstant()), false, new Flags());
+        
+        embeddedElasticSearch.awaitForElasticSearch();
+        
+        String response = given()
+            .accept(ContentType.JSON)
+            .contentType(ContentType.JSON)
+            .header("Authorization", accessToken.serialize())
+            .body("[[\"getMessages\", {\"ids\": [\"username|inbox|1\"]}, \"#0\"]]")
+        .when()
+            .post("/jmap")
+        .then()
+            .statusCode(200)
+            .content(startsWith("[[\"messages\","))
+            .extract()
+            .asString();
+
+        String firstResponsePath = "$.[0].[1]";
+
+        assertThat(jsonPath.parse(response).<Integer>read("$.length()")).isEqualTo(1);
+        assertThat(jsonPath.parse(response).<Integer>read(firstResponsePath + ".list.length()")).isEqualTo(0);
+        assertThat(jsonPath.parse(response).<Integer>read(firstResponsePath + ".notFound.length()")).isEqualTo(1);
+    }
 }


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