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 ad...@apache.org on 2016/02/03 11:01:06 UTC
[1/2] james-project git commit: JAMES-1678 Don't throw unsupported
exception when collapseThreads is false
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 <lr...@linagora.com>
Authored: Fri Jan 29 15:06:57 2016 +0100
Committer: Antoine Duprat <an...@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-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
[2/2] james-project git commit: JAMES-1678
GetMailboxMessageListRequestTest renamed to GetMessageListRequestTest
Posted by ad...@apache.org.
JAMES-1678 GetMailboxMessageListRequestTest renamed to GetMessageListRequestTest
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/00199af1
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/00199af1
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/00199af1
Branch: refs/heads/master
Commit: 00199af12528560997107c2beec2134cf6699f87
Parents: c6f8836
Author: Laura Royet <lr...@linagora.com>
Authored: Tue Feb 2 17:32:30 2016 +0100
Committer: Antoine Duprat <an...@gmail.com>
Committed: Wed Feb 3 11:00:49 2016 +0100
----------------------------------------------------------------------
.../model/GetMailboxMessageListRequestTest.java | 100 -------------------
.../jmap/model/GetMessageListRequestTest.java | 100 +++++++++++++++++++
2 files changed, 100 insertions(+), 100 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/james-project/blob/00199af1/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
deleted file mode 100644
index ef8a69f..0000000
--- a/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/GetMailboxMessageListRequestTest.java
+++ /dev/null
@@ -1,100 +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.model;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-import java.util.List;
-import java.util.Optional;
-
-import org.apache.commons.lang.NotImplementedException;
-import org.junit.Test;
-
-import com.google.common.collect.ImmutableList;
-
-public class GetMailboxMessageListRequestTest {
-
- @Test(expected=IllegalStateException.class)
- public void builderShouldThrowWhenPositionIsNegative() {
- GetMessageListRequest.builder().position(-1).build();
- }
-
- @Test(expected=IllegalStateException.class)
- public void builderShouldThrowWhenLimitIsNegative() {
- GetMessageListRequest.builder().limit(-1).build();
- }
-
- @Test(expected=NotImplementedException.class)
- public void builderShouldThrowWhenAccountId() {
- GetMessageListRequest.builder().accountId(null);
- }
-
- @Test(expected=NotImplementedException.class)
- public void builderShouldThrowWhenCollapseThreadsIsTrue() {
- GetMessageListRequest.builder().collapseThreads(true);
- }
-
- @Test(expected=NotImplementedException.class)
- public void builderShouldThrowWhenAnchor() {
- GetMessageListRequest.builder().anchor(null);
- }
-
- @Test(expected=NotImplementedException.class)
- public void builderShouldThrowWhenAnchorOffset() {
- GetMessageListRequest.builder().anchorOffset(0);
- }
-
- @Test(expected=NotImplementedException.class)
- public void builderShouldThrowWhenFetchThreads() {
- GetMessageListRequest.builder().fetchThreads(false);
- }
-
- @Test(expected=NotImplementedException.class)
- public void builderShouldThrowWhenFetchMessages() {
- GetMessageListRequest.builder().fetchMessages(false);
- }
-
- @Test(expected=NotImplementedException.class)
- public void builderShouldThrowWhenFetchSearchSnippets() {
- GetMessageListRequest.builder().fetchSearchSnippets(false);
- }
-
- @Test
- public void builderShouldWork() {
- FilterCondition filterCondition = FilterCondition.builder()
- .inMailboxes(ImmutableList.of("1", "2"))
- .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.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)
- .build();
-
- assertThat(getMessageListRequest).isEqualToComparingFieldByField(expectedGetMessageListRequest);
- }
-}
http://git-wip-us.apache.org/repos/asf/james-project/blob/00199af1/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/GetMessageListRequestTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/GetMessageListRequestTest.java b/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/GetMessageListRequestTest.java
new file mode 100644
index 0000000..029600d
--- /dev/null
+++ b/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/GetMessageListRequestTest.java
@@ -0,0 +1,100 @@
+/****************************************************************
+ * 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.model;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.util.List;
+import java.util.Optional;
+
+import org.apache.commons.lang.NotImplementedException;
+import org.junit.Test;
+
+import com.google.common.collect.ImmutableList;
+
+public class GetMessageListRequestTest {
+
+ @Test(expected=IllegalStateException.class)
+ public void builderShouldThrowWhenPositionIsNegative() {
+ GetMessageListRequest.builder().position(-1).build();
+ }
+
+ @Test(expected=IllegalStateException.class)
+ public void builderShouldThrowWhenLimitIsNegative() {
+ GetMessageListRequest.builder().limit(-1).build();
+ }
+
+ @Test(expected=NotImplementedException.class)
+ public void builderShouldThrowWhenAccountId() {
+ GetMessageListRequest.builder().accountId(null);
+ }
+
+ @Test(expected=NotImplementedException.class)
+ public void builderShouldThrowWhenCollapseThreadsIsTrue() {
+ GetMessageListRequest.builder().collapseThreads(true);
+ }
+
+ @Test(expected=NotImplementedException.class)
+ public void builderShouldThrowWhenAnchor() {
+ GetMessageListRequest.builder().anchor(null);
+ }
+
+ @Test(expected=NotImplementedException.class)
+ public void builderShouldThrowWhenAnchorOffset() {
+ GetMessageListRequest.builder().anchorOffset(0);
+ }
+
+ @Test(expected=NotImplementedException.class)
+ public void builderShouldThrowWhenFetchThreads() {
+ GetMessageListRequest.builder().fetchThreads(false);
+ }
+
+ @Test(expected=NotImplementedException.class)
+ public void builderShouldThrowWhenFetchMessages() {
+ GetMessageListRequest.builder().fetchMessages(false);
+ }
+
+ @Test(expected=NotImplementedException.class)
+ public void builderShouldThrowWhenFetchSearchSnippets() {
+ GetMessageListRequest.builder().fetchSearchSnippets(false);
+ }
+
+ @Test
+ public void builderShouldWork() {
+ FilterCondition filterCondition = FilterCondition.builder()
+ .inMailboxes(ImmutableList.of("1", "2"))
+ .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.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)
+ .build();
+
+ assertThat(getMessageListRequest).isEqualToComparingFieldByField(expectedGetMessageListRequest);
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org