james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From matth...@apache.org
Subject james-project git commit: JAMES-1753 Support notInMailboxes filtering in getMessageList
Date Thu, 09 Jun 2016 15:22:46 GMT
Repository: james-project
Updated Branches:
  refs/heads/master b9629e9a8 -> af7b1c63b


JAMES-1753 Support notInMailboxes filtering in getMessageList


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

Branch: refs/heads/master
Commit: af7b1c63b6d9c6df7102f863b0a00f119b6f4b89
Parents: b9629e9
Author: Raphael Ouazana <raphael.ouazana@linagora.com>
Authored: Tue Jun 7 17:51:45 2016 +0200
Committer: Raphael Ouazana <raphael.ouazana@linagora.com>
Committed: Thu Jun 9 12:04:24 2016 +0200

----------------------------------------------------------------------
 .../integration/GetMessageListMethodTest.java   | 116 +++++++++++++++++++
 .../jmap/methods/GetMessageListMethod.java      |  51 ++++----
 .../james/jmap/model/FilterCondition.java       |  29 ++---
 .../james/jmap/model/FilterConditionTest.java   |  18 +--
 .../GetMailboxMessageListResponseTest.java      |   3 +-
 .../jmap/model/GetMessageListRequestTest.java   |   2 +-
 6 files changed, 176 insertions(+), 43 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/af7b1c63/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 566280f..336af25 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
@@ -41,6 +41,7 @@ import org.apache.james.jmap.JmapAuthentication;
 import org.apache.james.jmap.api.access.AccessToken;
 import org.apache.james.mailbox.model.MailboxConstants;
 import org.apache.james.mailbox.model.MailboxPath;
+import org.apache.james.mailbox.store.mail.model.MailboxId;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -240,6 +241,121 @@ public abstract class GetMessageListMethodTest {
     }
 
     @Test
+    public void getMessageListShouldFilterMessagesWhenNotInMailboxesFilterMatches() throws
Exception {
+        jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username,
"mailbox");
+        jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE,
username, "mailbox"),
+                new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new
Date(), false, new Flags());
+        MailboxId mailboxId = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE,
username, "mailbox").getMailboxId();
+
+        jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username,
"mailbox2");
+        await();
+        
+        given()
+            .accept(ContentType.JSON)
+            .contentType(ContentType.JSON)
+            .header("Authorization", accessToken.serialize())
+            .body(String.format("[[\"getMessageList\", {\"filter\":{\"notInMailboxes\":[\"%s\"]}},
\"#0\"]]", mailboxId.serialize()))
+        .when()
+            .post("/jmap")
+        .then()
+            .statusCode(200)
+            .body(NAME, equalTo("messageList"))
+            .body(ARGUMENTS + ".messageIds", empty());
+    }
+
+    @Test
+    public void getMessageListShouldFilterMessagesWhenNotInMailboxesFilterMatchesTwice()
throws Exception {
+        jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username,
"mailbox");
+        jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE,
username, "mailbox"),
+                new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new
Date(), false, new Flags());
+        MailboxId mailboxId = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE,
username, "mailbox").getMailboxId();
+
+        jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username,
"mailbox2");
+        jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE,
username, "mailbox2"),
+                new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new
Date(), false, new Flags());
+        MailboxId mailbox2Id = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE,
username, "mailbox2").getMailboxId();
+        await();
+
+        given()
+            .accept(ContentType.JSON)
+            .contentType(ContentType.JSON)
+            .header("Authorization", accessToken.serialize())
+            .body(String.format("[[\"getMessageList\", {\"filter\":{\"notInMailboxes\":[\"%s\",
\"%s\"]}}, \"#0\"]]", mailboxId.serialize(), mailbox2Id.serialize()))
+        .when()
+            .post("/jmap")
+        .then()
+            .statusCode(200)
+            .body(NAME, equalTo("messageList"))
+            .body(ARGUMENTS + ".messageIds", empty());
+    }
+
+    @Test
+    public void getMessageListShouldFilterMessagesWhenIdenticalNotInMailboxesAndInmailboxesFilterMatch()
throws Exception {
+        jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username,
"mailbox");
+        jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE,
username, "mailbox"),
+                new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new
Date(), false, new Flags());
+        MailboxId mailboxId = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE,
username, "mailbox").getMailboxId();
+        await();
+
+        given()
+            .accept(ContentType.JSON)
+            .contentType(ContentType.JSON)
+            .header("Authorization", accessToken.serialize())
+            .body(String.format("[[\"getMessageList\", {\"filter\":{\"notInMailboxes\":[\"%s\"],
\"inMailboxes\":[\"%s\"]}}, \"#0\"]]", mailboxId.serialize(), mailboxId.serialize()))
+        .when()
+            .post("/jmap")
+        .then()
+            .statusCode(200)
+            .body(NAME, equalTo("messageList"))
+            .body(ARGUMENTS + ".messageIds", empty());
+    }
+
+    @Test
+    public void getMessageListShouldNotFilterMessagesWhenNotInMailboxesFilterDoesNotMatch()
throws Exception {
+        jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username,
"mailbox");
+        jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE,
username, "mailbox"),
+                new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new
Date(), false, new Flags());
+
+        jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username,
"mailbox2");
+        MailboxId mailbox2Id = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE,
username, "mailbox2").getMailboxId();
+        await();
+
+        given()
+            .accept(ContentType.JSON)
+            .contentType(ContentType.JSON)
+            .header("Authorization", accessToken.serialize())
+            .body(String.format("[[\"getMessageList\", {\"filter\":{\"notInMailboxes\":[\"%s\"]}},
\"#0\"]]", mailbox2Id.serialize()))
+        .when()
+            .post("/jmap")
+        .then()
+            .statusCode(200)
+            .body(NAME, equalTo("messageList"))
+            .body(ARGUMENTS + ".messageIds", contains("username@domain.tld|mailbox|1"));
+    }
+
+    @Test
+    public void getMessageListShouldNotFilterMessagesWhenEmptyNotInMailboxesFilter() throws
Exception {
+        jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username,
"mailbox");
+        jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE,
username, "mailbox"),
+                new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new
Date(), false, new Flags());
+
+        jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username,
"mailbox2");
+        await();
+
+        given()
+            .accept(ContentType.JSON)
+            .contentType(ContentType.JSON)
+            .header("Authorization", accessToken.serialize())
+            .body(String.format("[[\"getMessageList\", {\"filter\":{\"notInMailboxes\":[]}},
\"#0\"]]"))
+        .when()
+            .post("/jmap")
+        .then()
+            .statusCode(200)
+            .body(NAME, equalTo("messageList"))
+            .body(ARGUMENTS + ".messageIds", contains("username@domain.tld|mailbox|1"));
+    }
+
+    @Test
     public void getMessageListShouldFilterMessagesWhenInMailboxesFilterDoesntMatches() throws
Exception {
         jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username,
"mailbox");
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/af7b1c63/server/protocols/jmap/src/main/java/org/apache/james/jmap/methods/GetMessageListMethod.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap/src/main/java/org/apache/james/jmap/methods/GetMessageListMethod.java
b/server/protocols/jmap/src/main/java/org/apache/james/jmap/methods/GetMessageListMethod.java
index 0248549..73edc6c 100644
--- a/server/protocols/jmap/src/main/java/org/apache/james/jmap/methods/GetMessageListMethod.java
+++ b/server/protocols/jmap/src/main/java/org/apache/james/jmap/methods/GetMessageListMethod.java
@@ -22,7 +22,7 @@ package org.apache.james.jmap.methods;
 import java.util.Comparator;
 import java.util.List;
 import java.util.Optional;
-import java.util.Set;
+import java.util.function.Predicate;
 import java.util.stream.Stream;
 
 import javax.inject.Inject;
@@ -34,6 +34,7 @@ import org.apache.james.jmap.model.GetMessageListRequest;
 import org.apache.james.jmap.model.GetMessageListResponse;
 import org.apache.james.jmap.model.GetMessagesRequest;
 import org.apache.james.jmap.model.MessageId;
+import org.apache.james.jmap.utils.MailboxUtils;
 import org.apache.james.jmap.utils.SortToComparatorConvertor;
 import org.apache.james.mailbox.MailboxManager;
 import org.apache.james.mailbox.MailboxSession;
@@ -45,7 +46,6 @@ import org.apache.james.mailbox.model.MailboxQuery;
 import org.apache.james.mailbox.model.MessageRange;
 import org.apache.james.mailbox.model.SearchQuery;
 import org.apache.james.mailbox.store.MailboxSessionMapperFactory;
-import org.apache.james.mailbox.store.StoreMailboxPath;
 import org.apache.james.mailbox.store.mail.MessageMapper;
 import org.apache.james.mailbox.store.mail.MessageMapper.FetchType;
 import org.apache.james.mailbox.store.mail.model.Mailbox;
@@ -59,8 +59,6 @@ import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Preconditions;
 import com.google.common.base.Throwables;
 import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Sets;
 
 public class GetMessageListMethod implements Method {
 
@@ -76,15 +74,17 @@ public class GetMessageListMethod implements Method {
     private final MailboxSessionMapperFactory mailboxSessionMapperFactory;
     private final int maximumLimit;
     private final GetMessagesMethod getMessagesMethod;
+    private final MailboxUtils mailboxUtils;
 
     @Inject
     @VisibleForTesting public GetMessageListMethod(MailboxManager mailboxManager, MailboxSessionMapperFactory
mailboxSessionMapperFactory,
-            @Named(MAXIMUM_LIMIT) int maximumLimit, GetMessagesMethod getMessagesMethod)
{
+            @Named(MAXIMUM_LIMIT) int maximumLimit, GetMessagesMethod getMessagesMethod,
MailboxUtils mailboxUtils) {
 
         this.mailboxManager = mailboxManager;
         this.mailboxSessionMapperFactory = mailboxSessionMapperFactory;
         this.maximumLimit = maximumLimit;
         this.getMessagesMethod = getMessagesMethod;
+        this.mailboxUtils = mailboxUtils;
     }
 
     @Override
@@ -169,24 +169,35 @@ public class GetMessageListMethod implements Method {
         return SortToComparatorConvertor.comparatorFor(messageListRequest.getSort());
     }
 
-    private ImmutableSet<MailboxPath> listRequestedMailboxes(GetMessageListRequest
messageListRequest, List<MailboxPath> mailboxPaths, MailboxSession session) {
-        ImmutableSet<MailboxPath> mailboxPathSet = ImmutableSet.copyOf(mailboxPaths);
+    private List<MailboxPath> listRequestedMailboxes(GetMessageListRequest messageListRequest,
List<MailboxPath> mailboxPaths, MailboxSession session) {
         return messageListRequest.getFilter()
-            .filter(FilterCondition.class::isInstance)
-            .map(FilterCondition.class::cast)
-            .map(FilterCondition::getInMailboxes)
-            .map(Throwing.function(mailboxIds -> mailboxIdsToMailboxPaths(mailboxIds,
session)))
-            .map(requestedMailboxPaths -> Sets.intersection(requestedMailboxPaths, mailboxPathSet).immutableCopy())
-            .orElse(mailboxPathSet);
+                .filter(FilterCondition.class::isInstance)
+                .map(FilterCondition.class::cast)
+                .map(filterCondition -> filterMailboxPaths(mailboxPaths, session, filterCondition))
+                .orElse(mailboxPaths);
+    }
+
+    private List<MailboxPath> filterMailboxPaths(List<MailboxPath> mailboxPaths,
MailboxSession session, FilterCondition filterCondition) {
+        Predicate<MailboxPath> inMailboxesPredicate = filterCondition.getInMailboxes()
+                .map(list -> mailboxIdsToMailboxPaths(list, session))
+                .<Predicate<MailboxPath>>map(list -> mailboxPath -> list.contains(mailboxPath))
+                .orElse(x -> true);
+        Predicate<MailboxPath> notInMailboxesPredicate = filterCondition.getNotInMailboxes()
+                .map(list -> mailboxIdsToMailboxPaths(list, session))
+                .<Predicate<MailboxPath>>map(list -> mailboxPath -> !list.contains(mailboxPath))
+                .orElse(x -> true);
+        return mailboxPaths.stream()
+                .filter(inMailboxesPredicate)
+                .filter(notInMailboxesPredicate)
+                .collect(ImmutableCollectors.toImmutableList());
     }
 
-    private Set<MailboxPath> mailboxIdsToMailboxPaths(List<String> mailboxIds,
MailboxSession session) throws MailboxException {
-        Set<String> mailboxIdSet = Sets.newHashSet(mailboxIds);
-        return mailboxSessionMapperFactory.createMailboxMapper(session).list()
-                .stream()
-                .filter(mailbox -> mailboxIdSet.contains(mailbox.getMailboxId().serialize()))
-                .map(mailbox -> new StoreMailboxPath(mailbox))
-                .collect(ImmutableCollectors.toImmutableSet());
+    private List<MailboxPath> mailboxIdsToMailboxPaths(List<String> mailboxIds,
MailboxSession session) {
+        return mailboxIds.stream()
+            .map(id -> mailboxUtils.mailboxPathFromMailboxId(id, session))
+            .filter(Optional::isPresent)
+            .map(Optional::get)
+            .collect(ImmutableCollectors.toImmutableList());
     }
     
     private Optional<MessageManager> getMessageManager(MailboxPath mailboxPath, MailboxSession
mailboxSession) {

http://git-wip-us.apache.org/repos/asf/james-project/blob/af7b1c63/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/FilterCondition.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/FilterCondition.java
b/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/FilterCondition.java
index 2bb33c7..8802da5 100644
--- a/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/FilterCondition.java
+++ b/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/FilterCondition.java
@@ -40,8 +40,8 @@ public class FilterCondition implements Filter {
     @JsonPOJOBuilder(withPrefix = "")
     public static class Builder {
 
-        private final ImmutableList.Builder<String> inMailboxes;
-        private final ImmutableList.Builder<String> notInMailboxes;
+        private Optional<List<String>> inMailboxes;
+        private Optional<List<String>> notInMailboxes;
         private Date before;
         private Date after;
         private Integer minSize;
@@ -61,18 +61,19 @@ public class FilterCondition implements Filter {
         private final ImmutableList.Builder<String> header;
 
         private Builder() {
-            inMailboxes = ImmutableList.builder();
-            notInMailboxes = ImmutableList.builder();
+            inMailboxes = Optional.empty();
+            notInMailboxes = Optional.empty();
             header = ImmutableList.builder();
         }
 
-        public Builder inMailboxes(List<String> inMailboxes) {
-            this.inMailboxes.addAll(inMailboxes);
+        public Builder inMailboxes(Optional<List<String>> inMailboxes) {
+            this.inMailboxes = inMailboxes.map(ImmutableList::copyOf);
             return this;
         }
 
-        public Builder notInMailboxes(List<Filter> notInMailboxes) {
-            throw new NotImplementedException();
+        public Builder notInMailboxes(Optional<List<String>> notInMailboxes)
{
+            this.notInMailboxes = notInMailboxes.map(ImmutableList::copyOf);
+            return this;
         }
 
         public Builder before(Date before) {
@@ -144,14 +145,14 @@ public class FilterCondition implements Filter {
         }
 
         public FilterCondition build() {
-            return new FilterCondition(inMailboxes.build(), notInMailboxes.build(), Optional.ofNullable(before),
Optional.ofNullable(after), Optional.ofNullable(minSize), Optional.ofNullable(maxSize),
+            return new FilterCondition(inMailboxes, notInMailboxes, Optional.ofNullable(before),
Optional.ofNullable(after), Optional.ofNullable(minSize), Optional.ofNullable(maxSize),
                     Optional.ofNullable(isFlagged), Optional.ofNullable(isUnread), Optional.ofNullable(isAnswered),
Optional.ofNullable(isDraft), Optional.ofNullable(hasAttachment),
                     Optional.ofNullable(text), Optional.ofNullable(from), Optional.ofNullable(to),
Optional.ofNullable(cc), Optional.ofNullable(bcc), Optional.ofNullable(subject), Optional.ofNullable(body),
header.build());
         }
     }
 
-    private final List<String> inMailboxes;
-    private final List<String> notInMailboxes;
+    private final Optional<List<String>> inMailboxes;
+    private final Optional<List<String>> notInMailboxes;
     private final Optional<Date> before;
     private final Optional<Date> after;
     private final Optional<Integer> minSize;
@@ -170,7 +171,7 @@ public class FilterCondition implements Filter {
     private final Optional<String> body;
     private final List<String> header;
 
-    @VisibleForTesting FilterCondition(List<String> inMailboxes, List<String>
notInMailboxes, Optional<Date> before, Optional<Date> after, Optional<Integer>
minSize, Optional<Integer> maxSize,
+    @VisibleForTesting FilterCondition(Optional<List<String>> inMailboxes, Optional<List<String>>
notInMailboxes, Optional<Date> before, Optional<Date> after, Optional<Integer>
minSize, Optional<Integer> maxSize,
             Optional<Boolean> isFlagged, Optional<Boolean> isUnread, Optional<Boolean>
isAnswered, Optional<Boolean> isDraft, Optional<Boolean> hasAttachment,
             Optional<String> text, Optional<String> from, Optional<String>
to, Optional<String> cc, Optional<String> bcc, Optional<String> subject,
Optional<String> body, List<String> header) {
 
@@ -195,11 +196,11 @@ public class FilterCondition implements Filter {
         this.header = header;
     }
 
-    public List<String> getInMailboxes() {
+    public Optional<List<String>> getInMailboxes() {
         return inMailboxes;
     }
 
-    public List<String> getNotInMailboxes() {
+    public Optional<List<String>> getNotInMailboxes() {
         return notInMailboxes;
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/af7b1c63/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/FilterConditionTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/FilterConditionTest.java
b/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/FilterConditionTest.java
index e0afb92..e034275 100644
--- a/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/FilterConditionTest.java
+++ b/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/FilterConditionTest.java
@@ -39,14 +39,17 @@ public class FilterConditionTest {
     @Test
     public void buildShouldWorkWhenGivenInMailboxes() {
         FilterCondition filterCondition = FilterCondition.builder()
-                .inMailboxes(ImmutableList.of("1", "2"))
+                .inMailboxes(Optional.of(ImmutableList.of("1", "2")))
                 .build();
-        assertThat(filterCondition.getInMailboxes()).containsOnly("1", "2");
+        assertThat(filterCondition.getInMailboxes()).isEqualTo(Optional.of(ImmutableList.of("1",
"2")));
     }
 
-    @Test(expected=NotImplementedException.class)
-    public void builderShouldThrowWhenNotInMailboxes() {
-        FilterCondition.builder().notInMailboxes(ImmutableList.of());
+    @Test
+    public void builderShouldBuildWhenGivenNotInMailboxes() {
+        FilterCondition filterCondition = FilterCondition.builder()
+                .notInMailboxes(Optional.of(ImmutableList.of("1", "2")))
+                .build();
+        assertThat(filterCondition.getNotInMailboxes()).isEqualTo(Optional.of(ImmutableList.of("1",
"2")));
     }
 
     @Test(expected=NotImplementedException.class)
@@ -136,12 +139,13 @@ public class FilterConditionTest {
 
     @Test
     public void buildShouldWork() {
-        FilterCondition expectedFilterCondition = new FilterCondition(ImmutableList.of("1"),
ImmutableList.of(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(),

+        FilterCondition expectedFilterCondition = new FilterCondition(Optional.of(ImmutableList.of("1")),
Optional.of(ImmutableList.of("2")), Optional.empty(), Optional.empty(), Optional.empty(),
Optional.empty(), 
                 Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(),
Optional.empty(), Optional.empty(), 
                 Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(),
ImmutableList.of());
 
         FilterCondition filterCondition = FilterCondition.builder()
-                .inMailboxes(ImmutableList.of("1"))
+                .inMailboxes(Optional.of(ImmutableList.of("1")))
+                .notInMailboxes(Optional.of(ImmutableList.of("2")))
                 .build();
 
         assertThat(filterCondition).isEqualToComparingFieldByField(expectedFilterCondition);

http://git-wip-us.apache.org/repos/asf/james-project/blob/af7b1c63/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/GetMailboxMessageListResponseTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/GetMailboxMessageListResponseTest.java
b/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/GetMailboxMessageListResponseTest.java
index 3c04ce5..31d7ca8 100644
--- a/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/GetMailboxMessageListResponseTest.java
+++ b/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/GetMailboxMessageListResponseTest.java
@@ -22,6 +22,7 @@ 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;
@@ -68,7 +69,7 @@ public class GetMailboxMessageListResponseTest {
     @Test
     public void builderShouldWork() {
         FilterCondition filterCondition = FilterCondition.builder()
-                .inMailboxes(ImmutableList.of("1", "2"))
+                .inMailboxes(Optional.of(ImmutableList.of("1", "2")))
                 .build();
         List<String> sort = ImmutableList.of("date desc");
         List<MessageId> messageIds = ImmutableList.of(MessageId.of("user|mailbox|3"),
MessageId.of("user|mailbox|4"));

http://git-wip-us.apache.org/repos/asf/james-project/blob/af7b1c63/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
index 6ed8c68..1adcdd1 100644
--- 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
@@ -69,7 +69,7 @@ public class GetMessageListRequestTest {
     @Test
     public void builderShouldWork() {
         FilterCondition filterCondition = FilterCondition.builder()
-                .inMailboxes(ImmutableList.of("1", "2"))
+                .inMailboxes(Optional.of(ImmutableList.of("1", "2")))
                 .build();
         List<String> sort = ImmutableList.of("date desc");
         List<String> fetchMessageProperties = ImmutableList.of("id", "blobId");


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