james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From matth...@apache.org
Subject svn commit: r1709409 - in /james/project/trunk/mpt: antlib/src/main/java/org/apache/james/mpt/ant/ app/src/main/java/org/apache/james/mpt/app/ core/ core/src/main/java/org/apache/james/mpt/api/ core/src/main/java/org/apache/james/mpt/host/ core/src/tes...
Date Mon, 19 Oct 2015 13:04:34 GMT
Author: matthieu
Date: Mon Oct 19 13:04:34 2015
New Revision: 1709409

URL: http://svn.apache.org/viewvc?rev=1709409&view=rev
Log:
MPT-33 introduce namespace support feature and run related tests only when supported

	This uses junit Assume that allowes to disable a test when a
	condition if false.

	ImapHostSystem is supposed to implements supports(Feature... feature)
	for this purpose

Added:
    james/project/trunk/mpt/core/src/main/java/org/apache/james/mpt/api/ImapFeatures.java
    james/project/trunk/mpt/core/src/test/java/org/apache/james/mpt/api/
    james/project/trunk/mpt/core/src/test/java/org/apache/james/mpt/api/ImapFeaturesTest.java
Modified:
    james/project/trunk/mpt/antlib/src/main/java/org/apache/james/mpt/ant/MailProtocolTestTask.java
    james/project/trunk/mpt/app/src/main/java/org/apache/james/mpt/app/RunScript.java
    james/project/trunk/mpt/core/pom.xml
    james/project/trunk/mpt/core/src/main/java/org/apache/james/mpt/api/ImapHostSystem.java
    james/project/trunk/mpt/core/src/main/java/org/apache/james/mpt/host/ExternalHostSystem.java
    james/project/trunk/mpt/core/src/test/java/org/apache/james/mpt/TestExternalHostSystem.java
    james/project/trunk/mpt/impl/imap-mailbox/cassandra/src/test/java/org/apache/james/mpt/imapmailbox/cassandra/host/CassandraHostSystem.java
    james/project/trunk/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/AuthenticatedState.java
    james/project/trunk/mpt/impl/imap-mailbox/cyrus/src/test/java/org/apache/james/mpt/imapmailbox/cyrus/host/CyrusHostSystem.java
    james/project/trunk/mpt/impl/imap-mailbox/elasticsearch/src/test/java/org/apache/james/mpt/imapmailbox/elasticsearch/host/ElasticSearchHostSystem.java
    james/project/trunk/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/ExternalJamesHostSystem.java
    james/project/trunk/mpt/impl/imap-mailbox/hbase/src/test/java/org/apache/james/mpt/imapmailbox/hbase/host/HBaseHostSystem.java
    james/project/trunk/mpt/impl/imap-mailbox/inmemory/src/test/java/org/apache/james/mpt/imapmailbox/inmemory/host/InMemoryHostSystem.java
    james/project/trunk/mpt/impl/imap-mailbox/jcr/src/test/java/org/apache/james/mpt/imapmailbox/jcr/host/JCRHostSystem.java
    james/project/trunk/mpt/impl/imap-mailbox/jpa/src/test/java/org/apache/james/mpt/imapmailbox/jpa/host/JPAHostSystem.java
    james/project/trunk/mpt/impl/imap-mailbox/maildir/src/test/java/org/apache/james/mpt/imapmailbox/maildir/host/MaildirHostSystem.java
    james/project/trunk/mpt/mavenplugin/src/main/java/org/apache/james/mpt/maven/MailProtocolTest.java

Modified: james/project/trunk/mpt/antlib/src/main/java/org/apache/james/mpt/ant/MailProtocolTestTask.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mpt/antlib/src/main/java/org/apache/james/mpt/ant/MailProtocolTestTask.java?rev=1709409&r1=1709408&r2=1709409&view=diff
==============================================================================
--- james/project/trunk/mpt/antlib/src/main/java/org/apache/james/mpt/ant/MailProtocolTestTask.java
(original)
+++ james/project/trunk/mpt/antlib/src/main/java/org/apache/james/mpt/ant/MailProtocolTestTask.java
Mon Oct 19 13:04:34 2015
@@ -30,6 +30,8 @@ import java.util.Collection;
 import java.util.Iterator;
 
 import org.apache.james.mpt.Runner;
+import org.apache.james.mpt.api.ImapFeatures;
+import org.apache.james.mpt.api.ImapFeatures.Feature;
 import org.apache.james.mpt.api.Monitor;
 import org.apache.james.mpt.host.ExternalHostSystem;
 import org.apache.james.mpt.protocol.ProtocolSessionBuilder;
@@ -48,6 +50,8 @@ import org.apache.tools.ant.types.resour
  */
 public class MailProtocolTestTask extends Task implements Monitor {
 
+    private static final ImapFeatures SUPPORTED_FEATURES = ImapFeatures.of(Feature.NAMESPACE_SUPPORT);
+    
     private boolean quiet = false;
     private File script;
     private Union scripts;
@@ -230,7 +234,7 @@ public class MailProtocolTestTask extend
             userAdder.execute();
         }
         
-        final ExternalHostSystem host = new ExternalHostSystem(getHost(), getPort(), this,
getShabang(), null);
+        final ExternalHostSystem host = new ExternalHostSystem(SUPPORTED_FEATURES, getHost(),
getPort(), this, getShabang(), null);
         final ProtocolSessionBuilder builder = new ProtocolSessionBuilder();
         
         if (scripts == null) {

Modified: james/project/trunk/mpt/app/src/main/java/org/apache/james/mpt/app/RunScript.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mpt/app/src/main/java/org/apache/james/mpt/app/RunScript.java?rev=1709409&r1=1709408&r2=1709409&view=diff
==============================================================================
--- james/project/trunk/mpt/app/src/main/java/org/apache/james/mpt/app/RunScript.java (original)
+++ james/project/trunk/mpt/app/src/main/java/org/apache/james/mpt/app/RunScript.java Mon
Oct 19 13:04:34 2015
@@ -23,6 +23,8 @@ import java.io.File;
 import java.io.FileInputStream;
 
 import org.apache.james.mpt.Runner;
+import org.apache.james.mpt.api.ImapFeatures;
+import org.apache.james.mpt.api.ImapFeatures.Feature;
 import org.apache.james.mpt.host.ExternalHostSystem;
 import org.apache.james.mpt.monitor.SystemLoggingMonitor;
 import org.apache.james.mpt.protocol.ProtocolSessionBuilder;
@@ -32,6 +34,8 @@ import org.apache.james.mpt.protocol.Pro
  */
 class RunScript {
 
+    private static final ImapFeatures SUPPORTED_FEATURES = ImapFeatures.of(Feature.NAMESPACE_SUPPORT);
+    
     private final File file;
     private final int port;
     private final String host;
@@ -53,7 +57,7 @@ class RunScript {
     public void run() throws Exception {
        System.out.println("Running " + file + " against " + host + ":"  + port + "...");
        
-       final ExternalHostSystem host = new ExternalHostSystem(this.host, port, monitor, shabang,
null);
+       final ExternalHostSystem host = new ExternalHostSystem(SUPPORTED_FEATURES, this.host,
port, monitor, shabang, null);
        final ProtocolSessionBuilder builder = new ProtocolSessionBuilder();
        final Runner runner = new Runner();
        

Modified: james/project/trunk/mpt/core/pom.xml
URL: http://svn.apache.org/viewvc/james/project/trunk/mpt/core/pom.xml?rev=1709409&r1=1709408&r2=1709409&view=diff
==============================================================================
--- james/project/trunk/mpt/core/pom.xml (original)
+++ james/project/trunk/mpt/core/pom.xml Mon Oct 19 13:04:34 2015
@@ -93,6 +93,12 @@
             <scope>compile</scope>
         </dependency>
         <dependency>
+            <groupId>org.assertj</groupId>
+            <artifactId>assertj-core</artifactId>
+            <version>1.7.1</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-api</artifactId>
         </dependency>

Added: james/project/trunk/mpt/core/src/main/java/org/apache/james/mpt/api/ImapFeatures.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mpt/core/src/main/java/org/apache/james/mpt/api/ImapFeatures.java?rev=1709409&view=auto
==============================================================================
--- james/project/trunk/mpt/core/src/main/java/org/apache/james/mpt/api/ImapFeatures.java
(added)
+++ james/project/trunk/mpt/core/src/main/java/org/apache/james/mpt/api/ImapFeatures.java
Mon Oct 19 13:04:34 2015
@@ -0,0 +1,36 @@
+package org.apache.james.mpt.api;
+
+import java.util.Set;
+
+import com.google.common.base.Preconditions;
+import com.google.common.base.Predicates;
+import com.google.common.collect.FluentIterable;
+import com.google.common.collect.ImmutableSet;
+
+public class ImapFeatures {
+    
+    public enum Feature {
+        NAMESPACE_SUPPORT
+    }
+
+    public static ImapFeatures of(Feature... features) {
+        return new ImapFeatures(ImmutableSet.copyOf(features));
+    }
+
+    private final ImmutableSet<Feature> supportedFeatures;
+    
+    private ImapFeatures(ImmutableSet<Feature> supportedFeatures) {
+        this.supportedFeatures = supportedFeatures;
+    }
+    
+    public Set<Feature> supportedFeatures() {
+        return supportedFeatures;
+    }
+    
+    public boolean supports(Feature... features) {
+        Preconditions.checkNotNull(features);
+        ImmutableSet<Feature> requestedFeatures = ImmutableSet.copyOf(features);
+        return FluentIterable.from(requestedFeatures).allMatch(Predicates.in(supportedFeatures));
+    }
+    
+}

Modified: james/project/trunk/mpt/core/src/main/java/org/apache/james/mpt/api/ImapHostSystem.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mpt/core/src/main/java/org/apache/james/mpt/api/ImapHostSystem.java?rev=1709409&r1=1709408&r2=1709409&view=diff
==============================================================================
--- james/project/trunk/mpt/core/src/main/java/org/apache/james/mpt/api/ImapHostSystem.java
(original)
+++ james/project/trunk/mpt/core/src/main/java/org/apache/james/mpt/api/ImapHostSystem.java
Mon Oct 19 13:04:34 2015
@@ -19,10 +19,12 @@
 package org.apache.james.mpt.api;
 
 import org.apache.james.mailbox.model.MailboxPath;
+import org.apache.james.mpt.api.ImapFeatures.Feature;
 
 public interface ImapHostSystem extends HostSystem {
 
-    public abstract void createMailbox(MailboxPath mailboxPath)
-            throws Exception;
+    boolean supports(Feature... features);
+    
+    void createMailbox(MailboxPath mailboxPath) throws Exception;
 
 }
\ No newline at end of file

Modified: james/project/trunk/mpt/core/src/main/java/org/apache/james/mpt/host/ExternalHostSystem.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mpt/core/src/main/java/org/apache/james/mpt/host/ExternalHostSystem.java?rev=1709409&r1=1709408&r2=1709409&view=diff
==============================================================================
--- james/project/trunk/mpt/core/src/main/java/org/apache/james/mpt/host/ExternalHostSystem.java
(original)
+++ james/project/trunk/mpt/core/src/main/java/org/apache/james/mpt/host/ExternalHostSystem.java
Mon Oct 19 13:04:34 2015
@@ -21,6 +21,8 @@ package org.apache.james.mpt.host;
 
 import org.apache.commons.lang.NotImplementedException;
 import org.apache.james.mailbox.model.MailboxPath;
+import org.apache.james.mpt.api.ImapFeatures;
+import org.apache.james.mpt.api.ImapFeatures.Feature;
 import org.apache.james.mpt.api.ImapHostSystem;
 import org.apache.james.mpt.api.Monitor;
 import org.apache.james.mpt.api.UserAdder;
@@ -40,10 +42,13 @@ import org.apache.james.mpt.session.Exte
 public class ExternalHostSystem extends ExternalSessionFactory implements ImapHostSystem
{
 
     private final UserAdder userAdder;
+    private final ImapFeatures features;
 
     /**
      * Constructs a host system suitable for connection to an open port.
      * 
+     * @param supportedFeatures
+     *            set of features supported by the system
      * @param host
      *            host name that will be connected to, not null
      * @param port
@@ -59,15 +64,16 @@ public class ExternalHostSystem extends
      * @param userAdder
      *            null when test system has appropriate users already set
      */
-    public ExternalHostSystem(final String host, final int port, final Monitor monitor, final
String shabang,
-            final UserAdder userAdder) {
+    public ExternalHostSystem(ImapFeatures features, String host, int port, 
+            Monitor monitor, String shabang, UserAdder userAdder) {
         super(host, port, monitor, shabang);
+        this.features = features;
         this.userAdder = userAdder;
     }
     
-    public ExternalHostSystem(final Monitor monitor, final String shabang,
-            final UserAdder userAdder) {
+    public ExternalHostSystem(ImapFeatures features, Monitor monitor, String shabang, UserAdder
userAdder) {
         super(monitor, shabang);
+        this.features = features;
         this.userAdder = userAdder;
     }
     public boolean addUser(String user, String password) throws Exception {
@@ -96,4 +102,10 @@ public class ExternalHostSystem extends
     
     public void afterTest() throws Exception {
     }
+
+    @Override
+    public boolean supports(Feature... features) {
+        return this.features.supports(features);
+    }
+    
 }

Modified: james/project/trunk/mpt/core/src/test/java/org/apache/james/mpt/TestExternalHostSystem.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mpt/core/src/test/java/org/apache/james/mpt/TestExternalHostSystem.java?rev=1709409&r1=1709408&r2=1709409&view=diff
==============================================================================
--- james/project/trunk/mpt/core/src/test/java/org/apache/james/mpt/TestExternalHostSystem.java
(original)
+++ james/project/trunk/mpt/core/src/test/java/org/apache/james/mpt/TestExternalHostSystem.java
Mon Oct 19 13:04:34 2015
@@ -20,6 +20,8 @@
 package org.apache.james.mpt;
 
 import org.apache.james.mpt.api.Continuation;
+import org.apache.james.mpt.api.ImapFeatures;
+import org.apache.james.mpt.api.ImapFeatures.Feature;
 import org.apache.james.mpt.api.Session;
 import org.apache.james.mpt.api.UserAdder;
 import org.apache.james.mpt.host.ExternalHostSystem;
@@ -38,6 +40,9 @@ public class TestExternalHostSystem exte
     private static final String SHABANG = "This Is The Shabang";
 
     private static final int PORT = 10001;
+
+    private static final ImapFeatures SUPPORTED_FEATURES = ImapFeatures.of(Feature.NAMESPACE_SUPPORT);
+
     
     private DiscardProtocol protocol;
     
@@ -87,7 +92,7 @@ public class TestExternalHostSystem exte
     }
 
     private ExternalHostSystem buildSystem(final String shabang) {
-        ExternalHostSystem system = new ExternalHostSystem("localhost", PORT ,
+        ExternalHostSystem system = new ExternalHostSystem(SUPPORTED_FEATURES, "localhost",
PORT ,
                 new NullMonitor(), shabang, userAdder);
         return system;
     }

Added: james/project/trunk/mpt/core/src/test/java/org/apache/james/mpt/api/ImapFeaturesTest.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mpt/core/src/test/java/org/apache/james/mpt/api/ImapFeaturesTest.java?rev=1709409&view=auto
==============================================================================
--- james/project/trunk/mpt/core/src/test/java/org/apache/james/mpt/api/ImapFeaturesTest.java
(added)
+++ james/project/trunk/mpt/core/src/test/java/org/apache/james/mpt/api/ImapFeaturesTest.java
Mon Oct 19 13:04:34 2015
@@ -0,0 +1,66 @@
+package org.apache.james.mpt.api;
+
+import org.apache.james.mpt.api.ImapFeatures.Feature;
+import org.junit.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class ImapFeaturesTest {
+
+    @Test
+    public void supportedFeaturesShouldReturnEmptySetWhenNoFeatures() {
+        assertThat(ImapFeatures.of().supportedFeatures()).isEmpty();
+    }
+
+    @Test
+    public void supportedFeaturesShouldReturnNamespaceInSetWhenNamespaceSupported() {
+        assertThat(ImapFeatures.of(Feature.NAMESPACE_SUPPORT).supportedFeatures()).containsExactly(Feature.NAMESPACE_SUPPORT);
+    }
+
+    @Test
+    public void supportsShouldReturnFalseOnNamespaceWhenNamespaceIsNotSupported() {
+        assertThat(ImapFeatures.of().supports(Feature.NAMESPACE_SUPPORT)).isFalse();
+    }
+
+    @Test
+    public void supportsShouldReturnTrueOnNamespaceWhenNamespaceIsSupported() {
+        assertThat(ImapFeatures.of(Feature.NAMESPACE_SUPPORT).supports(Feature.NAMESPACE_SUPPORT)).isTrue();
+    }
+
+    @Test
+    public void supportsShouldReturnTrueOnDuplicateNamespaceEntryWhenNamespaceIsSupported()
{
+        assertThat(ImapFeatures.of(Feature.NAMESPACE_SUPPORT).supports(Feature.NAMESPACE_SUPPORT,
Feature.NAMESPACE_SUPPORT)).isTrue();
+    }
+
+    
+    @Test
+    public void supportsShouldReturnTrueOnEmptyListWhenNamespaceIsSupported() {
+        assertThat(ImapFeatures.of(Feature.NAMESPACE_SUPPORT).supports()).isTrue();
+    }
+
+    @Test
+    public void supportsShouldReturnTrueOnEmptyListWhenNoFeatures() {
+        assertThat(ImapFeatures.of().supports()).isTrue();
+    }
+
+    @Test(expected=NullPointerException.class)
+    public void supportsShouldThrowOnNullFeature() {
+        assertThat(ImapFeatures.of().supports((Feature)null));
+    }
+
+    @Test(expected=NullPointerException.class)
+    public void supportsShouldThrowOnNullFeatureArray() {
+        assertThat(ImapFeatures.of().supports((Feature[])null));
+    }
+
+    
+    @Test(expected=NullPointerException.class)
+    public void ofShouldThrowOnNullFeature() {
+        ImapFeatures.of((Feature)null);
+    }
+
+    @Test(expected=NullPointerException.class)
+    public void ofShouldThrowOnNullFeatureArray() {
+        ImapFeatures.of((Feature[])null);
+    }
+}

Modified: james/project/trunk/mpt/impl/imap-mailbox/cassandra/src/test/java/org/apache/james/mpt/imapmailbox/cassandra/host/CassandraHostSystem.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mpt/impl/imap-mailbox/cassandra/src/test/java/org/apache/james/mpt/imapmailbox/cassandra/host/CassandraHostSystem.java?rev=1709409&r1=1709408&r2=1709409&view=diff
==============================================================================
--- james/project/trunk/mpt/impl/imap-mailbox/cassandra/src/test/java/org/apache/james/mpt/imapmailbox/cassandra/host/CassandraHostSystem.java
(original)
+++ james/project/trunk/mpt/impl/imap-mailbox/cassandra/src/test/java/org/apache/james/mpt/imapmailbox/cassandra/host/CassandraHostSystem.java
Mon Oct 19 13:04:34 2015
@@ -38,11 +38,15 @@ import org.apache.james.mailbox.store.St
 import org.apache.james.mailbox.store.quota.DefaultQuotaRootResolver;
 import org.apache.james.mailbox.store.quota.ListeningCurrentQuotaUpdater;
 import org.apache.james.mailbox.store.quota.StoreQuotaManager;
+import org.apache.james.mpt.api.ImapFeatures;
+import org.apache.james.mpt.api.ImapFeatures.Feature;
 import org.apache.james.mpt.host.JamesImapHostSystem;
 import org.apache.james.mpt.imapmailbox.MailboxCreationDelegate;
 
 public class CassandraHostSystem extends JamesImapHostSystem {
 
+    private static final ImapFeatures IMAP_FEATURES = ImapFeatures.of(Feature.NAMESPACE_SUPPORT);
+    
     private final CassandraMailboxManager mailboxManager;
     private final MockAuthenticator userManager;
     private CassandraClusterSingleton cassandraClusterSingleton;
@@ -107,4 +111,10 @@ public class CassandraHostSystem extends
     public void createMailbox(MailboxPath mailboxPath) throws Exception{
         new MailboxCreationDelegate(mailboxManager).createMailbox(mailboxPath);
     }
+    
+    @Override
+    public boolean supports(Feature... features) {
+        return IMAP_FEATURES.supports(features);
+    }
+    
 }

Modified: james/project/trunk/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/AuthenticatedState.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/AuthenticatedState.java?rev=1709409&r1=1709408&r2=1709409&view=diff
==============================================================================
--- james/project/trunk/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/AuthenticatedState.java
(original)
+++ james/project/trunk/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/AuthenticatedState.java
Mon Oct 19 13:04:34 2015
@@ -24,14 +24,17 @@ import java.util.Locale;
 import javax.inject.Inject;
 
 import org.apache.james.mailbox.model.MailboxPath;
+import org.apache.james.mpt.api.ImapFeatures.Feature;
 import org.apache.james.mpt.api.ImapHostSystem;
 import org.apache.james.mpt.imapmailbox.suite.base.BaseAuthenticatedState;
+import org.junit.Assume;
 import org.junit.Test;
 
 public class AuthenticatedState extends BaseAuthenticatedState {
     
     @Inject
     private static ImapHostSystem system;
+
     
     public AuthenticatedState() throws Exception {
         super(system);
@@ -324,18 +327,21 @@ public class AuthenticatedState extends
 
     @Test
     public void listShouldNotListMailboxWithOtherNamspaceUS() throws Exception {
+        Assume.assumeTrue(system.supports(Feature.NAMESPACE_SUPPORT));
         system.createMailbox(new MailboxPath("#namespace", USER, "Other"));
         scriptTest("ListMailboxes", Locale.US);
     }
 
     @Test
     public void listShouldNotListMailboxWithOtherNamspaceITALY() throws Exception {
+        Assume.assumeTrue(system.supports(Feature.NAMESPACE_SUPPORT));
         system.createMailbox(new MailboxPath("#namespace", USER, "Other"));
         scriptTest("ListMailboxes", Locale.ITALY);
     }
 
     @Test
     public void listShouldNotListMailboxWithOtherNamspaceKOREA() throws Exception {
+        Assume.assumeTrue(system.supports(Feature.NAMESPACE_SUPPORT));
         system.createMailbox(new MailboxPath("#namespace", USER, "Other"));
         scriptTest("ListMailboxes", Locale.KOREA);
     }

Modified: james/project/trunk/mpt/impl/imap-mailbox/cyrus/src/test/java/org/apache/james/mpt/imapmailbox/cyrus/host/CyrusHostSystem.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mpt/impl/imap-mailbox/cyrus/src/test/java/org/apache/james/mpt/imapmailbox/cyrus/host/CyrusHostSystem.java?rev=1709409&r1=1709408&r2=1709409&view=diff
==============================================================================
--- james/project/trunk/mpt/impl/imap-mailbox/cyrus/src/test/java/org/apache/james/mpt/imapmailbox/cyrus/host/CyrusHostSystem.java
(original)
+++ james/project/trunk/mpt/impl/imap-mailbox/cyrus/src/test/java/org/apache/james/mpt/imapmailbox/cyrus/host/CyrusHostSystem.java
Mon Oct 19 13:04:34 2015
@@ -20,16 +20,18 @@ package org.apache.james.mpt.imapmailbox
 
 import java.net.InetSocketAddress;
 
-import com.google.common.base.Joiner;
-import com.google.common.base.Strings;
 import org.apache.james.mailbox.model.MailboxConstants;
 import org.apache.james.mailbox.model.MailboxPath;
+import org.apache.james.mpt.api.ImapFeatures;
+import org.apache.james.mpt.api.ImapFeatures.Feature;
 import org.apache.james.mpt.api.Session;
 import org.apache.james.mpt.api.UserAdder;
 import org.apache.james.mpt.host.ExternalHostSystem;
 import org.apache.james.mpt.monitor.NullMonitor;
 import org.apache.james.mpt.protocol.ProtocolSession;
 
+import com.google.common.base.Joiner;
+import com.google.common.base.Strings;
 import com.google.common.base.Supplier;
 import com.google.common.base.Throwables;
 import com.google.inject.Inject;
@@ -42,13 +44,15 @@ public class CyrusHostSystem extends Ext
 
     private static final String CREATE_MAILBOX_LOCATION = "CyrusHostSystem.createMailbox";
     private static final String SHABANG = "* OK IMAP4rev1 Server ready";
+    private static final ImapFeatures SUPPORTED_FEATURES = ImapFeatures.of(Feature.NAMESPACE_SUPPORT);
+
     private final Docker docker;
     private Supplier<InetSocketAddress> addressSupplier;
     private ContainerCreation container;
 
     @Inject
     private CyrusHostSystem(Docker docker, UserAdder userAdder) {
-        super(new NullMonitor(), SHABANG, userAdder);
+        super(SUPPORTED_FEATURES, new NullMonitor(), SHABANG, userAdder);
         this.docker = docker;
         
     }
@@ -131,4 +135,6 @@ public class CyrusHostSystem extends Ext
             Throwables.propagate(e);
         }
     }
+    
+
 }

Modified: james/project/trunk/mpt/impl/imap-mailbox/elasticsearch/src/test/java/org/apache/james/mpt/imapmailbox/elasticsearch/host/ElasticSearchHostSystem.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mpt/impl/imap-mailbox/elasticsearch/src/test/java/org/apache/james/mpt/imapmailbox/elasticsearch/host/ElasticSearchHostSystem.java?rev=1709409&r1=1709408&r2=1709409&view=diff
==============================================================================
--- james/project/trunk/mpt/impl/imap-mailbox/elasticsearch/src/test/java/org/apache/james/mpt/imapmailbox/elasticsearch/host/ElasticSearchHostSystem.java
(original)
+++ james/project/trunk/mpt/impl/imap-mailbox/elasticsearch/src/test/java/org/apache/james/mpt/imapmailbox/elasticsearch/host/ElasticSearchHostSystem.java
Mon Oct 19 13:04:34 2015
@@ -52,6 +52,8 @@ import org.apache.james.mailbox.store.St
 import org.apache.james.mailbox.store.extractor.DefaultTextExtractor;
 import org.apache.james.mailbox.store.quota.DefaultQuotaRootResolver;
 import org.apache.james.mailbox.store.quota.NoQuotaManager;
+import org.apache.james.mpt.api.ImapFeatures;
+import org.apache.james.mpt.api.ImapFeatures.Feature;
 import org.apache.james.mpt.host.JamesImapHostSystem;
 import org.apache.james.mpt.imapmailbox.MailboxCreationDelegate;
 
@@ -60,6 +62,8 @@ import com.google.inject.Inject;
 
 public class ElasticSearchHostSystem extends JamesImapHostSystem {
 
+    private static final ImapFeatures SUPPORTED_FEATURES = ImapFeatures.of(Feature.NAMESPACE_SUPPORT);
+    
     private EmbeddedElasticSearch embeddedElasticSearch;
     private Path tempDirectory;
     private StoreMailboxManager<InMemoryId> mailboxManager;
@@ -131,4 +135,9 @@ public class ElasticSearchHostSystem ext
         new MailboxCreationDelegate(mailboxManager).createMailbox(mailboxPath);
     }
 
+    @Override
+    public boolean supports(Feature... features) {
+        return SUPPORTED_FEATURES.supports(features);
+    }
+    
 }

Modified: james/project/trunk/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/ExternalJamesHostSystem.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/ExternalJamesHostSystem.java?rev=1709409&r1=1709408&r2=1709409&view=diff
==============================================================================
--- james/project/trunk/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/ExternalJamesHostSystem.java
(original)
+++ james/project/trunk/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/ExternalJamesHostSystem.java
Mon Oct 19 13:04:34 2015
@@ -20,26 +20,31 @@ package org.apache.james.mpt.imapmailbox
 
 import java.net.InetSocketAddress;
 
-import com.google.common.base.Preconditions;
-import com.google.common.base.Supplier;
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
 import org.apache.commons.lang.NotImplementedException;
 import org.apache.james.mailbox.model.MailboxPath;
+import org.apache.james.mpt.api.ImapFeatures;
+import org.apache.james.mpt.api.ImapFeatures.Feature;
 import org.apache.james.mpt.host.ExternalHostSystem;
 import org.apache.james.mpt.monitor.NullMonitor;
 
+import com.google.common.base.Preconditions;
+import com.google.common.base.Supplier;
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+
 @Singleton
 public class ExternalJamesHostSystem extends ExternalHostSystem {
+    
     private static final String ENV_JAMES_ADDRESS = "JAMES_ADDRESS";
     private static final String ENV_JAMES_IMAP_PORT = "JAMES_IMAP_PORT";
-
+    private static final ImapFeatures SUPPORTED_FEATURES = ImapFeatures.of(Feature.NAMESPACE_SUPPORT);
+    
     private static final String SHABANG = "* OK IMAP4rev1 Server ready";
     private final Supplier<InetSocketAddress> addressSupplier;
 
     @Inject
     private ExternalJamesHostSystem(ExternalJamesUserAdder userAdder) {
-        super(new NullMonitor(), SHABANG, userAdder);
+        super(SUPPORTED_FEATURES, new NullMonitor(), SHABANG, userAdder);
         Preconditions.checkState(System.getenv(ENV_JAMES_ADDRESS) != null, "You must have
exported an environment variable called JAMES_ADDRESS in order to run these tests. For instance
export JAMES_ADDRESS=127.0.0.1");
         Preconditions.checkState(System.getenv(ENV_JAMES_IMAP_PORT) != null,"You must have
exported an environment variable called JAMES_IMAP_PORT in order to run these tests. For instance
export JAMES_IMAP_PORT=143");
         this.addressSupplier = () -> new InetSocketAddress(
@@ -69,5 +74,5 @@ public class ExternalJamesHostSystem ext
     public void createMailbox(MailboxPath mailboxPath) {
         throw new NotImplementedException();
     }
-
+    
 }

Modified: james/project/trunk/mpt/impl/imap-mailbox/hbase/src/test/java/org/apache/james/mpt/imapmailbox/hbase/host/HBaseHostSystem.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mpt/impl/imap-mailbox/hbase/src/test/java/org/apache/james/mpt/imapmailbox/hbase/host/HBaseHostSystem.java?rev=1709409&r1=1709408&r2=1709409&view=diff
==============================================================================
--- james/project/trunk/mpt/impl/imap-mailbox/hbase/src/test/java/org/apache/james/mpt/imapmailbox/hbase/host/HBaseHostSystem.java
(original)
+++ james/project/trunk/mpt/impl/imap-mailbox/hbase/src/test/java/org/apache/james/mpt/imapmailbox/hbase/host/HBaseHostSystem.java
Mon Oct 19 13:04:34 2015
@@ -35,7 +35,6 @@ import org.apache.james.mailbox.acl.Grou
 import org.apache.james.mailbox.acl.MailboxACLResolver;
 import org.apache.james.mailbox.acl.SimpleGroupMembershipResolver;
 import org.apache.james.mailbox.acl.UnionMailboxACLResolver;
-import org.apache.james.mailbox.hbase.HBaseId;
 import org.apache.james.mailbox.hbase.HBaseMailboxManager;
 import org.apache.james.mailbox.hbase.HBaseMailboxSessionMapperFactory;
 import org.apache.james.mailbox.hbase.mail.HBaseModSeqProvider;
@@ -45,6 +44,8 @@ import org.apache.james.mailbox.store.Mo
 import org.apache.james.mailbox.store.StoreSubscriptionManager;
 import org.apache.james.mailbox.store.quota.DefaultQuotaRootResolver;
 import org.apache.james.mailbox.store.quota.NoQuotaManager;
+import org.apache.james.mpt.api.ImapFeatures;
+import org.apache.james.mpt.api.ImapFeatures.Feature;
 import org.apache.james.mpt.host.JamesImapHostSystem;
 import org.apache.james.mpt.imapmailbox.MailboxCreationDelegate;
 import org.slf4j.LoggerFactory;
@@ -52,6 +53,8 @@ import org.slf4j.LoggerFactory;
 public class HBaseHostSystem extends JamesImapHostSystem {
 
     public static final String META_DATA_DIRECTORY = "target/user-meta-data";
+    private static final ImapFeatures SUPPORTED_FEATURES = ImapFeatures.of(Feature.NAMESPACE_SUPPORT);
+
     public static HBaseHostSystem host = null;
     /** Set this to false if you wish to test it against a real cluster.
      * In that case you should provide the configuration file for the real
@@ -146,4 +149,9 @@ public class HBaseHostSystem extends Jam
     public void createMailbox(MailboxPath mailboxPath) throws Exception{
         new MailboxCreationDelegate(mailboxManager).createMailbox(mailboxPath);
     }
+    
+    @Override
+    public boolean supports(Feature... features) {
+        return SUPPORTED_FEATURES.supports(features);
+    }
 }

Modified: james/project/trunk/mpt/impl/imap-mailbox/inmemory/src/test/java/org/apache/james/mpt/imapmailbox/inmemory/host/InMemoryHostSystem.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mpt/impl/imap-mailbox/inmemory/src/test/java/org/apache/james/mpt/imapmailbox/inmemory/host/InMemoryHostSystem.java?rev=1709409&r1=1709408&r2=1709409&view=diff
==============================================================================
--- james/project/trunk/mpt/impl/imap-mailbox/inmemory/src/test/java/org/apache/james/mpt/imapmailbox/inmemory/host/InMemoryHostSystem.java
(original)
+++ james/project/trunk/mpt/impl/imap-mailbox/inmemory/src/test/java/org/apache/james/mpt/imapmailbox/inmemory/host/InMemoryHostSystem.java
Mon Oct 19 13:04:34 2015
@@ -41,11 +41,15 @@ import org.apache.james.mailbox.store.qu
 import org.apache.james.mailbox.store.quota.DefaultQuotaRootResolver;
 import org.apache.james.mailbox.store.quota.ListeningCurrentQuotaUpdater;
 import org.apache.james.mailbox.store.quota.StoreQuotaManager;
+import org.apache.james.mpt.api.ImapFeatures;
+import org.apache.james.mpt.api.ImapFeatures.Feature;
 import org.apache.james.mpt.host.JamesImapHostSystem;
 import org.apache.james.mpt.imapmailbox.MailboxCreationDelegate;
 
 public class InMemoryHostSystem extends JamesImapHostSystem {
 
+    private static final ImapFeatures SUPPORTED_FEATURES = ImapFeatures.of(Feature.NAMESPACE_SUPPORT);
+
     private StoreMailboxManager<InMemoryId> mailboxManager;
     private MockAuthenticator userManager;
 
@@ -108,4 +112,10 @@ public class InMemoryHostSystem extends
     public void createMailbox(MailboxPath mailboxPath) throws Exception{
         new MailboxCreationDelegate(mailboxManager).createMailbox(mailboxPath);
     }
+    
+    @Override
+    public boolean supports(Feature... features) {
+        return SUPPORTED_FEATURES.supports(features);
+    }
+    
 }

Modified: james/project/trunk/mpt/impl/imap-mailbox/jcr/src/test/java/org/apache/james/mpt/imapmailbox/jcr/host/JCRHostSystem.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mpt/impl/imap-mailbox/jcr/src/test/java/org/apache/james/mpt/imapmailbox/jcr/host/JCRHostSystem.java?rev=1709409&r1=1709408&r2=1709409&view=diff
==============================================================================
--- james/project/trunk/mpt/impl/imap-mailbox/jcr/src/test/java/org/apache/james/mpt/imapmailbox/jcr/host/JCRHostSystem.java
(original)
+++ james/project/trunk/mpt/impl/imap-mailbox/jcr/src/test/java/org/apache/james/mpt/imapmailbox/jcr/host/JCRHostSystem.java
Mon Oct 19 13:04:34 2015
@@ -33,7 +33,6 @@ import org.apache.james.mailbox.acl.Mail
 import org.apache.james.mailbox.acl.SimpleGroupMembershipResolver;
 import org.apache.james.mailbox.acl.UnionMailboxACLResolver;
 import org.apache.james.mailbox.jcr.GlobalMailboxSessionJCRRepository;
-import org.apache.james.mailbox.jcr.JCRId;
 import org.apache.james.mailbox.jcr.JCRMailboxManager;
 import org.apache.james.mailbox.jcr.JCRMailboxSessionMapperFactory;
 import org.apache.james.mailbox.jcr.JCRSubscriptionManager;
@@ -45,6 +44,8 @@ import org.apache.james.mailbox.store.JV
 import org.apache.james.mailbox.store.MockAuthenticator;
 import org.apache.james.mailbox.store.quota.DefaultQuotaRootResolver;
 import org.apache.james.mailbox.store.quota.NoQuotaManager;
+import org.apache.james.mpt.api.ImapFeatures;
+import org.apache.james.mpt.api.ImapFeatures.Feature;
 import org.apache.james.mpt.host.JamesImapHostSystem;
 import org.apache.james.mpt.imapmailbox.MailboxCreationDelegate;
 import org.slf4j.LoggerFactory;
@@ -61,6 +62,8 @@ public class JCRHostSystem extends James
 
     private static final String JACKRABBIT_HOME = "target/jackrabbit";
     public static final String META_DATA_DIRECTORY = "target/user-meta-data";
+    private static final ImapFeatures SUPPORTED_FEATURES = ImapFeatures.of(Feature.NAMESPACE_SUPPORT);
+
     private RepositoryImpl repository;
     
     public JCRHostSystem() throws Exception {
@@ -159,4 +162,9 @@ public class JCRHostSystem extends James
         new MailboxCreationDelegate(mailboxManager).createMailbox(mailboxPath);
     }
     
+    @Override
+    public boolean supports(Feature... features) {
+        return SUPPORTED_FEATURES.supports(features);
+    }
+    
 }

Modified: james/project/trunk/mpt/impl/imap-mailbox/jpa/src/test/java/org/apache/james/mpt/imapmailbox/jpa/host/JPAHostSystem.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mpt/impl/imap-mailbox/jpa/src/test/java/org/apache/james/mpt/imapmailbox/jpa/host/JPAHostSystem.java?rev=1709409&r1=1709408&r2=1709409&view=diff
==============================================================================
--- james/project/trunk/mpt/impl/imap-mailbox/jpa/src/test/java/org/apache/james/mpt/imapmailbox/jpa/host/JPAHostSystem.java
(original)
+++ james/project/trunk/mpt/impl/imap-mailbox/jpa/src/test/java/org/apache/james/mpt/imapmailbox/jpa/host/JPAHostSystem.java
Mon Oct 19 13:04:34 2015
@@ -35,7 +35,6 @@ import org.apache.james.mailbox.acl.Grou
 import org.apache.james.mailbox.acl.MailboxACLResolver;
 import org.apache.james.mailbox.acl.SimpleGroupMembershipResolver;
 import org.apache.james.mailbox.acl.UnionMailboxACLResolver;
-import org.apache.james.mailbox.jpa.JPAId;
 import org.apache.james.mailbox.jpa.JPAMailboxSessionMapperFactory;
 import org.apache.james.mailbox.jpa.JPASubscriptionManager;
 import org.apache.james.mailbox.jpa.mail.JPAModSeqProvider;
@@ -52,6 +51,8 @@ import org.apache.james.mailbox.store.JV
 import org.apache.james.mailbox.store.MockAuthenticator;
 import org.apache.james.mailbox.store.quota.DefaultQuotaRootResolver;
 import org.apache.james.mailbox.store.quota.NoQuotaManager;
+import org.apache.james.mpt.api.ImapFeatures;
+import org.apache.james.mpt.api.ImapFeatures.Feature;
 import org.apache.james.mpt.host.JamesImapHostSystem;
 import org.apache.james.mpt.imapmailbox.MailboxCreationDelegate;
 import org.apache.openjpa.persistence.OpenJPAPersistence;
@@ -60,6 +61,7 @@ import org.slf4j.LoggerFactory;
 public class JPAHostSystem extends JamesImapHostSystem {
 
     public static final String META_DATA_DIRECTORY = "target/user-meta-data";
+    private static final ImapFeatures SUPPORTED_FEATURES = ImapFeatures.of(Feature.NAMESPACE_SUPPORT);
 
     public static JamesImapHostSystem build() throws Exception {
         JPAHostSystem host =  new JPAHostSystem();
@@ -162,5 +164,10 @@ public class JPAHostSystem extends James
     public void createMailbox(MailboxPath mailboxPath) throws Exception {
         new MailboxCreationDelegate(mailboxManager).createMailbox(mailboxPath);
     }
+    
+    @Override
+    public boolean supports(Feature... features) {
+        return SUPPORTED_FEATURES.supports(features);
+    }
 
 }

Modified: james/project/trunk/mpt/impl/imap-mailbox/maildir/src/test/java/org/apache/james/mpt/imapmailbox/maildir/host/MaildirHostSystem.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mpt/impl/imap-mailbox/maildir/src/test/java/org/apache/james/mpt/imapmailbox/maildir/host/MaildirHostSystem.java?rev=1709409&r1=1709408&r2=1709409&view=diff
==============================================================================
--- james/project/trunk/mpt/impl/imap-mailbox/maildir/src/test/java/org/apache/james/mpt/imapmailbox/maildir/host/MaildirHostSystem.java
(original)
+++ james/project/trunk/mpt/impl/imap-mailbox/maildir/src/test/java/org/apache/james/mpt/imapmailbox/maildir/host/MaildirHostSystem.java
Mon Oct 19 13:04:34 2015
@@ -40,6 +40,8 @@ import org.apache.james.mailbox.store.St
 import org.apache.james.mailbox.store.StoreSubscriptionManager;
 import org.apache.james.mailbox.store.quota.DefaultQuotaRootResolver;
 import org.apache.james.mailbox.store.quota.NoQuotaManager;
+import org.apache.james.mpt.api.ImapFeatures;
+import org.apache.james.mpt.api.ImapFeatures.Feature;
 import org.apache.james.mpt.host.JamesImapHostSystem;
 import org.apache.james.mpt.imapmailbox.MailboxCreationDelegate;
 
@@ -47,6 +49,7 @@ public class MaildirHostSystem extends J
 
     public static final String META_DATA_DIRECTORY = "target/user-meta-data";
     private static final String MAILDIR_HOME = "target/Maildir";
+    private static final ImapFeatures SUPPORTED_FEATURES = ImapFeatures.of();
     
     private final StoreMailboxManager<MaildirId> mailboxManager;
     private final MockAuthenticator userManager;
@@ -104,6 +107,9 @@ public class MaildirHostSystem extends J
         new MailboxCreationDelegate(mailboxManager).createMailbox(mailboxPath);
     }
 
-
+    @Override
+    public boolean supports(Feature... features) {
+        return SUPPORTED_FEATURES.supports(features);
+    }
 
 }

Modified: james/project/trunk/mpt/mavenplugin/src/main/java/org/apache/james/mpt/maven/MailProtocolTest.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mpt/mavenplugin/src/main/java/org/apache/james/mpt/maven/MailProtocolTest.java?rev=1709409&r1=1709408&r2=1709409&view=diff
==============================================================================
--- james/project/trunk/mpt/mavenplugin/src/main/java/org/apache/james/mpt/maven/MailProtocolTest.java
(original)
+++ james/project/trunk/mpt/mavenplugin/src/main/java/org/apache/james/mpt/maven/MailProtocolTest.java
Mon Oct 19 13:04:34 2015
@@ -28,6 +28,8 @@ import java.io.Reader;
 import java.io.StringReader;
 
 import org.apache.james.mpt.Runner;
+import org.apache.james.mpt.api.ImapFeatures;
+import org.apache.james.mpt.api.ImapFeatures.Feature;
 import org.apache.james.mpt.api.Monitor;
 import org.apache.james.mpt.host.ExternalHostSystem;
 import org.apache.james.mpt.protocol.ProtocolSessionBuilder;
@@ -37,6 +39,8 @@ import org.apache.maven.plugin.MojoFailu
 
 public class MailProtocolTest implements Monitor{
 
+   private static final ImapFeatures SUPPORTED_FEATURES = ImapFeatures.of(Feature.NAMESPACE_SUPPORT);
+
    private Integer port;
    
    private File scriptFile;
@@ -117,7 +121,7 @@ public class MailProtocolTest implements
 		try {
 			inputStream = new FileInputStream(scriptFile);
 
-			final ExternalHostSystem hostSystem = new ExternalHostSystem(host, port, this, shabang,
null);
+			final ExternalHostSystem hostSystem = new ExternalHostSystem(SUPPORTED_FEATURES, host,
port, this, shabang, null);
 		    final ProtocolSessionBuilder builder = new ProtocolSessionBuilder();
 		     
 	        builder.addProtocolLines(scriptFile.getName(), inputStream, runner.getTestElements());




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