Repository: james-project
Updated Branches:
  refs/heads/master ba2fbaef4 -> 00199af12


JAMES-1678 Don't throw unsupported exception when collapseThreads is false


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

Branch: refs/heads/master
Commit: c6f8836d713812fe598017f1777ded0b33d19c7b
Parents: ba2fbae
Author: Laura Royet <lro...@linagora.com>
Authored: Fri Jan 29 15:06:57 2016 +0100
Committer: Antoine Duprat <antdup...@gmail.com>
Committed: Wed Feb 3 11:00:48 2016 +0100

----------------------------------------------------------------------
 .../jmap/methods/GetMessageListMethodTest.java  | 28 ++++++++++++++++
 ...assandraGetMailboxMessageListMethodTest.java | 35 --------------------
 .../CassandraGetMessageListMethodTest.java      | 35 ++++++++++++++++++++
 .../james/jmap/model/GetMessageListRequest.java |  4 +++
 .../model/GetMailboxMessageListRequestTest.java |  7 ++--
 5 files changed, 71 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/c6f8836d/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/methods/GetMessageListMethodTest.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/methods/GetMessageListMethodTest.java
 
b/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/methods/GetMessageListMethodTest.java
index d67457d..803ad88 100644
--- 
a/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/methods/GetMessageListMethodTest.java
+++ 
b/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/methods/GetMessageListMethodTest.java
@@ -332,6 +332,34 @@ public abstract class GetMessageListMethodTest {
     }
 
     @Test
+    public void getMessageListShouldWorkWhenCollapseThreadIsFalse() {
+        given()
+            .accept(ContentType.JSON)
+            .contentType(ContentType.JSON)
+            .header("Authorization", accessToken.serialize())
+            .body("[[\"getMessageList\", {\"collapseThreads\":false}, 
\"#0\"]]")
+        .when()
+            .post("/jmap")
+        .then()
+            .statusCode(200)
+            .content(startsWith("[[\"messageList\","));
+    }
+    
+    @Test
+    public void getMessageListShouldReturnErrorWhenCollapseThreadIsTrue() {
+        given()
+            .accept(ContentType.JSON)
+            .contentType(ContentType.JSON)
+            .header("Authorization", accessToken.serialize())
+            .body("[[\"getMessageList\", {\"collapseThreads\":true}, \"#0\"]]")
+        .when()
+            .post("/jmap")
+        .then()
+            .statusCode(200)
+            .content(equalTo("[[\"error\",{\"type\":\"Not yet 
implemented\"},\"#0\"]]"));
+    }
+    
+    @Test
     public void getMessageListShouldReturnAllMessagesWhenPositionIsNotGiven() 
throws Exception {
         
jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, 
username, "mailbox");
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/c6f8836d/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/methods/cassandra/CassandraGetMailboxMessageListMethodTest.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/methods/cassandra/CassandraGetMailboxMessageListMethodTest.java
 
b/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/methods/cassandra/CassandraGetMailboxMessageListMethodTest.java
deleted file mode 100644
index b00a443..0000000
--- 
a/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/methods/cassandra/CassandraGetMailboxMessageListMethodTest.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-
-package org.apache.james.jmap.methods.cassandra;
-
-import org.apache.james.backends.cassandra.EmbeddedCassandra;
-import org.apache.james.jmap.JmapServer;
-import org.apache.james.jmap.cassandra.CassandraJmapServer;
-import org.apache.james.jmap.methods.GetMessageListMethodTest;
-import org.apache.james.mailbox.elasticsearch.EmbeddedElasticSearch;
-import org.junit.rules.TemporaryFolder;
-
-public class CassandraGetMailboxMessageListMethodTest extends 
GetMessageListMethodTest {
-
-    @Override
-    protected JmapServer jmapServer(TemporaryFolder temporaryFolder, 
EmbeddedElasticSearch embeddedElasticSearch, EmbeddedCassandra cassandra) {
-        return new 
CassandraJmapServer(CassandraJmapServer.defaultOverrideModule(temporaryFolder, 
embeddedElasticSearch, cassandra));
-    }
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/c6f8836d/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/methods/cassandra/CassandraGetMessageListMethodTest.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/methods/cassandra/CassandraGetMessageListMethodTest.java
 
b/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/methods/cassandra/CassandraGetMessageListMethodTest.java
new file mode 100644
index 0000000..524f523
--- /dev/null
+++ 
b/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/methods/cassandra/CassandraGetMessageListMethodTest.java
@@ -0,0 +1,35 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+package org.apache.james.jmap.methods.cassandra;
+
+import org.apache.james.backends.cassandra.EmbeddedCassandra;
+import org.apache.james.jmap.JmapServer;
+import org.apache.james.jmap.cassandra.CassandraJmapServer;
+import org.apache.james.jmap.methods.GetMessageListMethodTest;
+import org.apache.james.mailbox.elasticsearch.EmbeddedElasticSearch;
+import org.junit.rules.TemporaryFolder;
+
+public class CassandraGetMessageListMethodTest extends 
GetMessageListMethodTest {
+
+    @Override
+    protected JmapServer jmapServer(TemporaryFolder temporaryFolder, 
EmbeddedElasticSearch embeddedElasticSearch, EmbeddedCassandra cassandra) {
+        return new 
CassandraJmapServer(CassandraJmapServer.defaultOverrideModule(temporaryFolder, 
embeddedElasticSearch, cassandra));
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/c6f8836d/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/GetMessageListRequest.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/GetMessageListRequest.java
 
b/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/GetMessageListRequest.java
index c226bb5..9beee33 100644
--- 
a/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/GetMessageListRequest.java
+++ 
b/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/GetMessageListRequest.java
@@ -74,6 +74,10 @@ public class GetMessageListRequest implements JmapRequest {
         }
 
         public Builder collapseThreads(boolean collapseThreads) {
+            if (collapseThreads == false) {
+                this.collapseThreads = collapseThreads;
+                return this;
+            }
             throw new NotImplementedException();
         }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/c6f8836d/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/GetMailboxMessageListRequestTest.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/GetMailboxMessageListRequestTest.java
 
b/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/GetMailboxMessageListRequestTest.java
index 33e2c0d..ef8a69f 100644
--- 
a/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/GetMailboxMessageListRequestTest.java
+++ 
b/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/GetMailboxMessageListRequestTest.java
@@ -47,8 +47,8 @@ public class GetMailboxMessageListRequestTest {
     }
 
     @Test(expected=NotImplementedException.class)
-    public void builderShouldThrowWhenCollapseThreads() {
-        GetMessageListRequest.builder().collapseThreads(false);
+    public void builderShouldThrowWhenCollapseThreadsIsTrue() {
+        GetMessageListRequest.builder().collapseThreads(true);
     }
 
     @Test(expected=NotImplementedException.class)
@@ -83,12 +83,13 @@ public class GetMailboxMessageListRequestTest {
                 .build();
         List<String> sort = ImmutableList.of("date desc");
         List<String> fetchMessageProperties = ImmutableList.of("id", "blobId");
-        GetMessageListRequest expectedGetMessageListRequest = new 
GetMessageListRequest(Optional.empty(), Optional.of(filterCondition), sort, 
Optional.empty(), 1, Optional.empty(), Optional.empty(), Optional.of(2),
+        GetMessageListRequest expectedGetMessageListRequest = new 
GetMessageListRequest(Optional.empty(), Optional.of(filterCondition), sort, 
Optional.of(false), 1, Optional.empty(), Optional.empty(), Optional.of(2),
                 Optional.empty(), Optional.empty(), fetchMessageProperties, 
Optional.empty());
 
         GetMessageListRequest getMessageListRequest = 
GetMessageListRequest.builder()
             .filter(filterCondition)
             .sort(sort)
+            .collapseThreads(false)
             .position(1)
             .limit(2)
             .fetchMessageProperties(fetchMessageProperties)


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

Reply via email to