james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From matth...@apache.org
Subject [4/5] james-project git commit: MAILBOX-269 ensure MessageManager has Attachment capability
Date Tue, 07 Jun 2016 06:52:00 GMT
MAILBOX-269 ensure MessageManager has Attachment capability

	x define capabilites as an EnumSet
	x make InMemory and Cassandra backend advertise Attachment
	x check Attachment capability on JMAP server start


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

Branch: refs/heads/master
Commit: 9b5641b972bf3cdc5f7dedc02d8f8309b27d9554
Parents: 45f4356
Author: Matthieu Baechler <matthieu.baechler@linagora.com>
Authored: Thu Jun 2 16:29:14 2016 +0200
Committer: Matthieu Baechler <matthieu.baechler@linagora.com>
Committed: Tue Jun 7 08:50:58 2016 +0200

----------------------------------------------------------------------
 .../apache/james/mailbox/MailboxManager.java    | 13 +++++++--
 .../cassandra/CassandraMailboxManager.java      | 14 ++++++----
 .../inmemory/InMemoryMailboxManager.java        | 13 +++++----
 .../mailbox/store/StoreMailboxManager.java      | 12 +++++---
 .../mailbox/store/StoreMessageManager.java      |  1 -
 .../imap/processor/DefaultProcessorChain.java   |  2 +-
 .../james/imap/processor/MoveProcessor.java     |  2 +-
 .../james/imap/processor/MoveProcessorTest.java |  8 ++++--
 .../base/MailboxEventAnalyserTest.java          | 13 ++++++---
 .../james/JamesCapabilitiesServerTest.java      | 29 ++++++++++++++++----
 .../java/org/apache/james/jmap/JMAPModule.java  | 11 +++++---
 .../FirstUserConnectionFilterThreadTest.java    |  8 +++++-
 12 files changed, 88 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/9b5641b9/mailbox/api/src/main/java/org/apache/james/mailbox/MailboxManager.java
----------------------------------------------------------------------
diff --git a/mailbox/api/src/main/java/org/apache/james/mailbox/MailboxManager.java b/mailbox/api/src/main/java/org/apache/james/mailbox/MailboxManager.java
index 1375d1d..ee0be38 100644
--- a/mailbox/api/src/main/java/org/apache/james/mailbox/MailboxManager.java
+++ b/mailbox/api/src/main/java/org/apache/james/mailbox/MailboxManager.java
@@ -19,6 +19,7 @@
 
 package org.apache.james.mailbox;
 
+import java.util.EnumSet;
 import java.util.List;
 
 import org.apache.james.mailbox.exception.BadCredentialsException;
@@ -69,14 +70,20 @@ import org.slf4j.Logger;
 
 public interface MailboxManager extends RequestAware, MailboxListenerSupport {
 
-    enum Capabilities {
-        Basic,
+    enum MailboxCapabilities {
         Move,
         UserFlags
     }
 
-    List<Capabilities> getSupportedCapabilities();
+    EnumSet<MailboxCapabilities> getSupportedMailboxCapabilities();
+    
+    enum MessageCapabilities {
+        Attachment
+    }
 
+    EnumSet<MessageCapabilities> getSupportedMessageCapabilities();
+    
+    
     /**
      * Return the delimiter to use for folders
      * 

http://git-wip-us.apache.org/repos/asf/james-project/blob/9b5641b9/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/CassandraMailboxManager.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/CassandraMailboxManager.java
b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/CassandraMailboxManager.java
index 3a9375e..cce0b14 100644
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/CassandraMailboxManager.java
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/CassandraMailboxManager.java
@@ -19,10 +19,11 @@
 
 package org.apache.james.mailbox.cassandra;
 
-import java.util.List;
+import java.util.EnumSet;
 
 import javax.inject.Inject;
 
+import org.apache.james.mailbox.MailboxManager;
 import org.apache.james.mailbox.MailboxPathLocker;
 import org.apache.james.mailbox.MailboxSession;
 import org.apache.james.mailbox.acl.SimpleGroupMembershipResolver;
@@ -38,8 +39,6 @@ import org.apache.james.mailbox.store.mail.model.impl.MessageParser;
 import org.apache.james.mailbox.store.mail.model.impl.SimpleMailbox;
 import org.apache.james.mailbox.store.search.MessageSearchIndex;
 
-import com.google.common.collect.Lists;
-
 /**
  * Cassandra implementation of {@link StoreMailboxManager}
  */
@@ -64,11 +63,16 @@ public class CassandraMailboxManager extends StoreMailboxManager {
     }
 
     @Override
-    public List<Capabilities> getSupportedCapabilities() {
-        return Lists.newArrayList(Capabilities.Basic, Capabilities.Move, Capabilities.UserFlags);
+    public EnumSet<MailboxManager.MailboxCapabilities> getSupportedMailboxCapabilities()
{
+        return EnumSet.of(MailboxCapabilities.Move, MailboxCapabilities.UserFlags);
     }
 
     @Override
+    public EnumSet<MessageCapabilities> getSupportedMessageCapabilities() {
+        return EnumSet.of(MessageCapabilities.Attachment);
+    }
+    
+    @Override
     protected Mailbox doCreateMailbox(MailboxPath mailboxPath, MailboxSession session) throws
MailboxException {
         SimpleMailbox cassandraMailbox = new SimpleMailbox(mailboxPath, randomUidValidity());
         cassandraMailbox.setACL(SimpleMailboxACL.EMPTY);

http://git-wip-us.apache.org/repos/asf/james-project/blob/9b5641b9/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/InMemoryMailboxManager.java
----------------------------------------------------------------------
diff --git a/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/InMemoryMailboxManager.java
b/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/InMemoryMailboxManager.java
index 003eb46..9b373d0 100644
--- a/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/InMemoryMailboxManager.java
+++ b/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/InMemoryMailboxManager.java
@@ -19,7 +19,7 @@
 
 package org.apache.james.mailbox.inmemory;
 
-import java.util.List;
+import java.util.EnumSet;
 
 import javax.inject.Inject;
 
@@ -35,8 +35,6 @@ import org.apache.james.mailbox.store.StoreMessageManager;
 import org.apache.james.mailbox.store.mail.model.Mailbox;
 import org.apache.james.mailbox.store.mail.model.impl.MessageParser;
 
-import com.google.common.collect.Lists;
-
 public class InMemoryMailboxManager extends StoreMailboxManager {
 
     @Inject
@@ -45,8 +43,13 @@ public class InMemoryMailboxManager extends StoreMailboxManager {
     }
 
     @Override
-    public List<Capabilities> getSupportedCapabilities() {
-        return Lists.newArrayList(Capabilities.Basic, Capabilities.Move, Capabilities.UserFlags);
+    public EnumSet<MailboxCapabilities> getSupportedMailboxCapabilities() {
+        return EnumSet.of(MailboxCapabilities.Move, MailboxCapabilities.UserFlags);
+    }
+    
+    @Override
+    public EnumSet<MessageCapabilities> getSupportedMessageCapabilities() {
+        return EnumSet.of(MessageCapabilities.Attachment);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/james-project/blob/9b5641b9/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java
----------------------------------------------------------------------
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java
b/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java
index d701c46..4dbb447 100644
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java
@@ -21,6 +21,7 @@ package org.apache.james.mailbox.store;
 
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.EnumSet;
 import java.util.List;
 import java.util.Locale;
 import java.util.Random;
@@ -70,8 +71,6 @@ import org.apache.james.mailbox.store.transaction.Mapper;
 import org.apache.james.mailbox.store.transaction.TransactionalMapper;
 import org.slf4j.Logger;
 
-import com.google.common.collect.Lists;
-
 /**
  * This base class of an {@link MailboxManager} implementation provides a high-level api
for writing your own
  * {@link MailboxManager} implementation. If you plan to write your own {@link MailboxManager}
its most times so easiest
@@ -199,10 +198,15 @@ public class StoreMailboxManager implements MailboxManager {
     }
 
     @Override
-    public List<Capabilities> getSupportedCapabilities() {
-        return Lists.newArrayList(Capabilities.Basic);
+    public EnumSet<MailboxCapabilities> getSupportedMailboxCapabilities() {
+        return EnumSet.noneOf(MailboxCapabilities.class);
     }
 
+    @Override
+    public EnumSet<MessageCapabilities> getSupportedMessageCapabilities() {
+        return EnumSet.noneOf(MessageCapabilities.class);
+    }
+    
     /**
      * Return the {@link DelegatingMailboxListener} which is used by this {@link MailboxManager}
      *

http://git-wip-us.apache.org/repos/asf/james-project/blob/9b5641b9/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMessageManager.java
----------------------------------------------------------------------
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMessageManager.java
b/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMessageManager.java
index 752fa41..e5295f7 100644
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMessageManager.java
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMessageManager.java
@@ -833,5 +833,4 @@ public class StoreMessageManager implements org.apache.james.mailbox.MessageMana
     protected MailboxACL getResolvedMailboxACL(MailboxSession mailboxSession) throws UnsupportedRightException
{
         return aclResolver.applyGlobalACL(mailbox.getACL(), new GroupFolderResolver(mailboxSession).isGroupFolder(mailbox));
     }
-
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/9b5641b9/protocols/imap/src/main/java/org/apache/james/imap/processor/DefaultProcessorChain.java
----------------------------------------------------------------------
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/DefaultProcessorChain.java
b/protocols/imap/src/main/java/org/apache/james/imap/processor/DefaultProcessorChain.java
index 176f347..b9dcf69 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/DefaultProcessorChain.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/DefaultProcessorChain.java
@@ -58,7 +58,7 @@ public class DefaultProcessorChain {
         final SubscribeProcessor subscribeProcessor = new SubscribeProcessor(unsubscribeProcessor,
mailboxManager, subscriptionManager, statusResponseFactory);
         final CopyProcessor copyProcessor = new CopyProcessor(subscribeProcessor, mailboxManager,
statusResponseFactory);
         AuthenticateProcessor authenticateProcessor;
-        if (mailboxManager.getSupportedCapabilities().contains(MailboxManager.Capabilities.Move))
{
+        if (mailboxManager.getSupportedMailboxCapabilities().contains(MailboxManager.MailboxCapabilities.Move))
{
             final MoveProcessor moveProcessor = new MoveProcessor(copyProcessor, mailboxManager,
statusResponseFactory);
             authenticateProcessor = new AuthenticateProcessor(moveProcessor, mailboxManager,
statusResponseFactory);
             capabilityProcessor.addProcessor(moveProcessor);

http://git-wip-us.apache.org/repos/asf/james-project/blob/9b5641b9/protocols/imap/src/main/java/org/apache/james/imap/processor/MoveProcessor.java
----------------------------------------------------------------------
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/MoveProcessor.java
b/protocols/imap/src/main/java/org/apache/james/imap/processor/MoveProcessor.java
index a2a2f84..d0f5332 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/MoveProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/MoveProcessor.java
@@ -41,7 +41,7 @@ public class MoveProcessor extends AbstractMessageRangeProcessor<MoveRequest>
im
 
     public MoveProcessor(ImapProcessor next, MailboxManager mailboxManager, StatusResponseFactory
factory) {
         super(MoveRequest.class, next, mailboxManager, factory);
-        moveCapabilitySupported = mailboxManager.getSupportedCapabilities().contains(MailboxManager.Capabilities.Move);
+        moveCapabilitySupported = mailboxManager.getSupportedMailboxCapabilities().contains(MailboxManager.MailboxCapabilities.Move);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/james-project/blob/9b5641b9/protocols/imap/src/test/java/org/apache/james/imap/processor/MoveProcessorTest.java
----------------------------------------------------------------------
diff --git a/protocols/imap/src/test/java/org/apache/james/imap/processor/MoveProcessorTest.java
b/protocols/imap/src/test/java/org/apache/james/imap/processor/MoveProcessorTest.java
index 63b299e..a016ace 100644
--- a/protocols/imap/src/test/java/org/apache/james/imap/processor/MoveProcessorTest.java
+++ b/protocols/imap/src/test/java/org/apache/james/imap/processor/MoveProcessorTest.java
@@ -26,6 +26,8 @@ import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.verifyNoMoreInteractions;
 import static org.mockito.Mockito.when;
 
+import java.util.EnumSet;
+
 import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapConstants;
 import org.apache.james.imap.api.ImapSessionState;
@@ -75,9 +77,9 @@ public class MoveProcessorTest {
         mockImapSession = mock(ImapSession.class);
         mockMailboxSession = mock(MailboxSession.class);
 
-        when(mockMailboxManager.getSupportedCapabilities()).thenReturn(Lists.newArrayList(MailboxManager.Capabilities.Move,
MailboxManager.Capabilities.Basic));
+        when(mockMailboxManager.getSupportedMailboxCapabilities()).thenReturn(EnumSet.allOf(MailboxManager.MailboxCapabilities.class));
         testee = new MoveProcessor(mockNextProcessor, mockMailboxManager, mockStatusResponseFactory);
-        verify(mockMailboxManager).getSupportedCapabilities();
+        verify(mockMailboxManager).getSupportedMailboxCapabilities();
     }
 
     @Test
@@ -87,7 +89,7 @@ public class MoveProcessorTest {
 
     @Test
     public void getImplementedCapabilitiesShouldNotContainMoveWhenUnSupportedByMailboxManager()
{
-        when(mockMailboxManager.getSupportedCapabilities()).thenReturn(Lists.newArrayList(MailboxManager.Capabilities.Basic));
+        when(mockMailboxManager.getSupportedMailboxCapabilities()).thenReturn(EnumSet.complementOf(EnumSet.of(MailboxManager.MailboxCapabilities.Move)));
         assertThat(new MoveProcessor(mockNextProcessor, mockMailboxManager, mockStatusResponseFactory).getImplementedCapabilities(null)).isEmpty();
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/9b5641b9/protocols/imap/src/test/java/org/apache/james/imap/processor/base/MailboxEventAnalyserTest.java
----------------------------------------------------------------------
diff --git a/protocols/imap/src/test/java/org/apache/james/imap/processor/base/MailboxEventAnalyserTest.java
b/protocols/imap/src/test/java/org/apache/james/imap/processor/base/MailboxEventAnalyserTest.java
index d5286b3..e34ec64 100644
--- a/protocols/imap/src/test/java/org/apache/james/imap/processor/base/MailboxEventAnalyserTest.java
+++ b/protocols/imap/src/test/java/org/apache/james/imap/processor/base/MailboxEventAnalyserTest.java
@@ -29,6 +29,7 @@ import java.io.InputStream;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Date;
+import java.util.EnumSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -66,8 +67,6 @@ import org.apache.james.mailbox.model.UpdatedFlags;
 import org.junit.Test;
 import org.slf4j.Logger;
 
-import com.google.common.collect.Lists;
-
 public class MailboxEventAnalyserTest {
 
     private static final long BASE_SESSION_ID = 99;
@@ -77,10 +76,15 @@ public class MailboxEventAnalyserTest {
     private final MailboxManager mockManager = new MailboxManager() {
 
         @Override
-        public List<Capabilities> getSupportedCapabilities() {
-            return Lists.newArrayList(Capabilities.Basic);
+        public EnumSet<MailboxCapabilities> getSupportedMailboxCapabilities() {
+            return EnumSet.noneOf(MailboxCapabilities.class);
         }
 
+        @Override
+        public EnumSet<MessageCapabilities> getSupportedMessageCapabilities() {
+            return EnumSet.noneOf(MessageCapabilities.class);
+        }
+        
         public void removeListener(MailboxPath mailboxPath, MailboxListener listner, MailboxSession
session) throws MailboxException {
             
         }
@@ -305,6 +309,7 @@ public class MailboxEventAnalyserTest {
                     throw new UnsupportedOperationException("Not implemented");
 
                 }
+                
             };
         }
         

http://git-wip-us.apache.org/repos/asf/james-project/blob/9b5641b9/server/container/guice/cassandra-guice/src/test/java/org/apache/james/JamesCapabilitiesServerTest.java
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/JamesCapabilitiesServerTest.java
b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/JamesCapabilitiesServerTest.java
index ebbb0cb..6c889e6 100644
--- a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/JamesCapabilitiesServerTest.java
+++ b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/JamesCapabilitiesServerTest.java
@@ -22,6 +22,8 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
+import java.util.EnumSet;
+
 import org.apache.james.backends.cassandra.CassandraCluster;
 import org.apache.james.backends.cassandra.components.CassandraModule;
 import org.apache.james.jmap.methods.GetMessageListMethod;
@@ -37,7 +39,6 @@ import org.junit.rules.RuleChain;
 import org.junit.rules.TemporaryFolder;
 
 import com.datastax.driver.core.Session;
-import com.google.common.collect.ImmutableList;
 import com.google.inject.AbstractModule;
 import com.google.inject.Module;
 import com.google.inject.Provides;
@@ -85,18 +86,34 @@ public class JamesCapabilitiesServerTest {
     @Test
     public void startShouldFailWhenNoMoveCapability() throws Exception {
         MailboxManager mailboxManager = mock(MailboxManager.class);
-        when(mailboxManager.getSupportedCapabilities())
-            .thenReturn(ImmutableList.of(MailboxManager.Capabilities.Basic));
+        when(mailboxManager.getSupportedMailboxCapabilities())
+            .thenReturn(EnumSet.complementOf(EnumSet.of(MailboxManager.MailboxCapabilities.Move)));
+        when(mailboxManager.getSupportedMessageCapabilities())
+            .thenReturn(EnumSet.of(MailboxManager.MessageCapabilities.Attachment));
+        server = createCassandraJamesServer(mailboxManager);
+        
+        assertThatThrownBy(() -> server.start()).isInstanceOf(IllegalArgumentException.class);
+    }
+    
+    @Test
+    public void startShouldFailWhenNoAttachmentCapability() throws Exception {
+        MailboxManager mailboxManager = mock(MailboxManager.class);
+        when(mailboxManager.getSupportedMailboxCapabilities())
+            .thenReturn(EnumSet.allOf(MailboxManager.MailboxCapabilities.class));
+        when(mailboxManager.getSupportedMessageCapabilities())
+            .thenReturn(EnumSet.noneOf(MailboxManager.MessageCapabilities.class));
         server = createCassandraJamesServer(mailboxManager);
 
         assertThatThrownBy(() -> server.start()).isInstanceOf(IllegalArgumentException.class);
     }
 
     @Test
-    public void startShouldSucceedWhenMoveCapability() throws Exception {
+    public void startShouldSucceedWhenRequiredCapabilities() throws Exception {
         MailboxManager mailboxManager = mock(MailboxManager.class);
-        when(mailboxManager.getSupportedCapabilities())
-            .thenReturn(ImmutableList.of(MailboxManager.Capabilities.Move));
+        when(mailboxManager.getSupportedMailboxCapabilities())
+            .thenReturn(EnumSet.of(MailboxManager.MailboxCapabilities.Move));
+        when(mailboxManager.getSupportedMessageCapabilities())
+            .thenReturn(EnumSet.of(MailboxManager.MessageCapabilities.Attachment));
         server = createCassandraJamesServer(mailboxManager);
 
         server.start();

http://git-wip-us.apache.org/repos/asf/james-project/blob/9b5641b9/server/container/guice/guice-common/src/main/java/org/apache/james/jmap/JMAPModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/jmap/JMAPModule.java
b/server/container/guice/guice-common/src/main/java/org/apache/james/jmap/JMAPModule.java
index 40ff85f..744a220 100644
--- a/server/container/guice/guice-common/src/main/java/org/apache/james/jmap/JMAPModule.java
+++ b/server/container/guice/guice-common/src/main/java/org/apache/james/jmap/JMAPModule.java
@@ -62,7 +62,8 @@ public class JMAPModule extends AbstractModule {
         bind(MailboxBasedHtmlTextExtractor.class).in(Scopes.SINGLETON);
 
         bind(HtmlTextExtractor.class).to(MailboxBasedHtmlTextExtractor.class);
-        Multibinder.newSetBinder(binder(), ConfigurationPerformer.class).addBinding().to(MoveCapabilityPrecondition.class);
+        Multibinder.newSetBinder(binder(), ConfigurationPerformer.class).addBinding().to(RequiredCapabilitiesPrecondition.class);
+        Multibinder.newSetBinder(binder(), ConfigurationPerformer.class).addBinding().to(RequiredCapabilitiesPrecondition.class);
 
         Multibinder<CamelMailetContainerModule.TransportProcessorCheck> transportProcessorChecks
= Multibinder.newSetBinder(binder(), CamelMailetContainerModule.TransportProcessorCheck.class);
         transportProcessorChecks.addBinding().to(VacationMailetCheck.class);
@@ -90,19 +91,21 @@ public class JMAPModule extends AbstractModule {
     }
 
     @Singleton
-    public static class MoveCapabilityPrecondition implements ConfigurationPerformer {
+    public static class RequiredCapabilitiesPrecondition implements ConfigurationPerformer
{
 
         private final MailboxManager mailboxManager;
 
         @Inject
-        public MoveCapabilityPrecondition(MailboxManager mailboxManager) {
+        public RequiredCapabilitiesPrecondition(MailboxManager mailboxManager) {
             this.mailboxManager = mailboxManager;
         }
 
         @Override
         public void initModule() {
-            Preconditions.checkArgument(mailboxManager.getSupportedCapabilities().contains(MailboxManager.Capabilities.Move),
+            Preconditions.checkArgument(mailboxManager.getSupportedMailboxCapabilities().contains(MailboxManager.MailboxCapabilities.Move),
                     "MOVE support in MailboxManager is required by JMAP Module");
+            Preconditions.checkArgument(mailboxManager.getSupportedMessageCapabilities().contains(MailboxManager.MessageCapabilities.Attachment),
+                    "Attachment support in MailboxManager is required by JMAP Module");
         }
 
         @Override

http://git-wip-us.apache.org/repos/asf/james-project/blob/9b5641b9/server/protocols/jmap/src/test/java/org/apache/james/jmap/FirstUserConnectionFilterThreadTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap/src/test/java/org/apache/james/jmap/FirstUserConnectionFilterThreadTest.java
b/server/protocols/jmap/src/test/java/org/apache/james/jmap/FirstUserConnectionFilterThreadTest.java
index 3918c91..1eb33c9 100644
--- a/server/protocols/jmap/src/test/java/org/apache/james/jmap/FirstUserConnectionFilterThreadTest.java
+++ b/server/protocols/jmap/src/test/java/org/apache/james/jmap/FirstUserConnectionFilterThreadTest.java
@@ -18,6 +18,7 @@
  ****************************************************************/
 package org.apache.james.jmap;
 
+import java.util.EnumSet;
 import java.util.List;
 
 import org.apache.james.mailbox.MailboxListener;
@@ -193,7 +194,12 @@ public class FirstUserConnectionFilterThreadTest {
         }
 
         @Override
-        public List<Capabilities> getSupportedCapabilities() {
+        public EnumSet<MailboxCapabilities> getSupportedMailboxCapabilities() {
+            return null;
+        }
+        
+        @Override
+        public EnumSet<MessageCapabilities> getSupportedMessageCapabilities() {
             return null;
         }
         


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