Author: matthieu
Date: Fri Dec 11 12:32:35 2015
New Revision: 1719380

URL: http://svn.apache.org/viewvc?rev=1719380&view=rev
Log:
JAMES-1644 Add JMAP integration test project

Added:
    
james/project/trunk/server/container/cassandra-guice/src/main/java/org/apache/james/utils/ExtendedServerProbe.java
      - copied, changed from r1719379, 
james/project/trunk/server/container/cassandra-guice/src/test/java/org/apache/james/modules/TestJMAPServerModule.java
    
james/project/trunk/server/container/cassandra-guice/src/main/java/org/apache/james/utils/GuiceServerProbe.java
    james/project/trunk/server/protocols/jmap-integration-testing/
    james/project/trunk/server/protocols/jmap-integration-testing/pom.xml
      - copied, changed from r1719379, 
james/project/trunk/server/data/data-cassandra/pom.xml
    james/project/trunk/server/protocols/jmap-integration-testing/src/
    james/project/trunk/server/protocols/jmap-integration-testing/src/test/
    james/project/trunk/server/protocols/jmap-integration-testing/src/test/java/
    
james/project/trunk/server/protocols/jmap-integration-testing/src/test/java/org/
    
james/project/trunk/server/protocols/jmap-integration-testing/src/test/java/org/apache/
    
james/project/trunk/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/
    
james/project/trunk/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/
    
james/project/trunk/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/JmapAuthentication.java
    
james/project/trunk/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/JmapServer.java
      - copied, changed from r1719379, 
james/project/trunk/server/container/cassandra-guice/src/test/java/org/apache/james/modules/TestJMAPServerModule.java
    
james/project/trunk/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/
    
james/project/trunk/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraJmapServer.java
    
james/project/trunk/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/methods/
    
james/project/trunk/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/methods/GetMailboxesMethodTest.java
    
james/project/trunk/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/methods/cassandra/
    
james/project/trunk/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/methods/cassandra/CassandraGetMailboxesMethodTest.java
      - copied, changed from r1719379, 
james/project/trunk/server/container/cassandra-guice/src/test/java/org/apache/james/modules/TestJMAPServerModule.java
    
james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/
    
james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/dnsservice.xml
    
james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/fakemailrepositorystore.xml
    
james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/imapserver.xml
    
james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/keystore
    
james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/lmtpserver.xml
    
james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/mailetcontainer.xml
    
james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/mailrepositorystore.xml
    
james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/pop3server.xml
    
james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/smtpserver.xml
    
james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/test.properties
    
james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/test.xml
    
james/project/trunk/server/protocols/jmap/src/main/java/org/apache/james/jmap/DefaultPortConfiguration.java
      - copied, changed from r1719379, 
james/project/trunk/server/container/cassandra-guice/src/test/java/org/apache/james/modules/TestJMAPServerModule.java
    
james/project/trunk/server/protocols/jmap/src/main/java/org/apache/james/jmap/PortConfiguration.java
      - copied, changed from r1719379, 
james/project/trunk/server/container/cassandra-guice/src/test/java/org/apache/james/modules/TestJMAPServerModule.java
Modified:
    james/project/trunk/server/container/cassandra-guice/pom.xml
    
james/project/trunk/server/container/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServer.java
    
james/project/trunk/server/container/cassandra-guice/src/main/java/org/apache/james/jmap/JMAPModule.java
    
james/project/trunk/server/container/cassandra-guice/src/main/java/org/apache/james/modules/CommonServicesModule.java
    
james/project/trunk/server/container/cassandra-guice/src/test/java/org/apache/james/CassandraJamesServerTest.java
    
james/project/trunk/server/container/cassandra-guice/src/test/java/org/apache/james/modules/TestFilesystemModule.java
    
james/project/trunk/server/container/cassandra-guice/src/test/java/org/apache/james/modules/TestJMAPServerModule.java
    james/project/trunk/server/container/jetty/pom.xml
    
james/project/trunk/server/container/jetty/src/main/java/org/apache/james/http/jetty/Configuration.java
    james/project/trunk/server/data/data-cassandra/pom.xml
    james/project/trunk/server/pom.xml
    james/project/trunk/server/protocols/jmap/pom.xml
    
james/project/trunk/server/protocols/jmap/src/main/java/org/apache/james/jmap/JMAPServer.java

Modified: james/project/trunk/server/container/cassandra-guice/pom.xml
URL: 
http://svn.apache.org/viewvc/james/project/trunk/server/container/cassandra-guice/pom.xml?rev=1719380&r1=1719379&r2=1719380&view=diff
==============================================================================
--- james/project/trunk/server/container/cassandra-guice/pom.xml (original)
+++ james/project/trunk/server/container/cassandra-guice/pom.xml Fri Dec 11 
12:32:35 2015
@@ -161,16 +161,30 @@
                     <plugin>
                       <groupId>org.apache.maven.plugins</groupId>
                       <artifactId>maven-jar-plugin</artifactId>
-                      <configuration>
-                        <archive>
-                          <manifest>
-                            <addClasspath>true</addClasspath>
-                            
<classpathPrefix>${project.build.finalName}.lib/</classpathPrefix>
-                            
<mainClass>org.apache.james.CassandraJamesServerMain</mainClass>
-                            <useUniqueVersions>false</useUniqueVersions>
-                          </manifest>
-                        </archive>
-                      </configuration>
+                      <executions>
+                          <execution>
+                              <id>default-jar</id>
+                              <goals>
+                                  <goal>jar</goal>
+                              </goals>
+                              <configuration>
+                                  <archive>
+                                      <manifest>
+                                          <addClasspath>true</addClasspath>
+                                          
<classpathPrefix>${project.build.finalName}.lib/</classpathPrefix>
+                                          
<mainClass>org.apache.james.CassandraJamesServerMain</mainClass>
+                                          
<useUniqueVersions>false</useUniqueVersions>
+                                      </manifest>
+                                  </archive>
+                              </configuration>
+                          </execution>
+                          <execution>
+                              <id>test-jar</id>
+                              <goals>
+                                  <goal>test-jar</goal>
+                              </goals>
+                          </execution>
+                      </executions>
                     </plugin>
                     <plugin>
                         <groupId>org.apache.maven.plugins</groupId>
@@ -298,6 +312,12 @@
                     <artifactId>james-server-protocols-library</artifactId>
                 </dependency>
                 <dependency>
+                    <groupId>org.apache.james</groupId>
+                    <artifactId>james-server-protocols-library</artifactId>
+                    <scope>test</scope>
+                    <type>test-jar</type>
+                </dependency>
+                <dependency>
                     <groupId>${project.groupId}</groupId>
                     <artifactId>james-server-protocols-lmtp</artifactId>
                 </dependency>
@@ -340,17 +360,14 @@
                 <dependency>
                     <groupId>com.fasterxml.jackson.core</groupId>
                     <artifactId>jackson-databind</artifactId>
-                    <version>2.3.3</version>
                 </dependency>
                 <dependency>
                     <groupId>com.fasterxml.jackson.datatype</groupId>
                     <artifactId>jackson-datatype-guava</artifactId>
-                    <version>2.3.3</version>
                 </dependency>
                 <dependency>
                     <groupId>com.fasterxml.jackson.datatype</groupId>
                     <artifactId>jackson-datatype-jdk8</artifactId>
-                    <version>2.4.3</version>
                 </dependency>
                 <dependency>
                     <groupId>com.google.guava</groupId>
@@ -411,7 +428,7 @@
                 <dependency>
                     <groupId>org.cassandraunit</groupId>
                     <artifactId>cassandra-unit</artifactId>
-                    <version>2.0.2.2</version>
+                    <version>${cassandra-unit.version}</version>
                     <scope>test</scope>
                 </dependency>
                 <dependency>

Modified: 
james/project/trunk/server/container/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServer.java
URL: 
http://svn.apache.org/viewvc/james/project/trunk/server/container/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServer.java?rev=1719380&r1=1719379&r2=1719380&view=diff
==============================================================================
--- 
james/project/trunk/server/container/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServer.java
 (original)
+++ 
james/project/trunk/server/container/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServer.java
 Fri Dec 11 12:32:35 2015
@@ -18,7 +18,10 @@
  ****************************************************************/
 package org.apache.james;
 
+import org.apache.james.jmap.JMAPServer;
 import org.apache.james.utils.ConfigurationsPerformer;
+import org.apache.james.utils.ExtendedServerProbe;
+import org.apache.james.utils.GuiceServerProbe;
 import org.apache.onami.lifecycle.jsr250.PreDestroyModule;
 
 import com.google.inject.Guice;
@@ -30,6 +33,8 @@ public class CassandraJamesServer {
 
     private final Module serverModule;
     private final PreDestroyModule preDestroyModule;
+    private GuiceServerProbe serverProbe;
+    private int jmapPort;
 
     public CassandraJamesServer(Module serverModule) {
         this.serverModule = serverModule;
@@ -39,10 +44,19 @@ public class CassandraJamesServer {
     public void start() throws Exception {
         Injector injector = Guice.createInjector(Modules.combine(serverModule, 
preDestroyModule));
         injector.getInstance(ConfigurationsPerformer.class).initModules();
+        serverProbe = injector.getInstance(GuiceServerProbe.class);
+        jmapPort = injector.getInstance(JMAPServer.class).getPort();
     }
 
     public void stop() {
         preDestroyModule.getStager().stage();
     }
 
+    public ExtendedServerProbe serverProbe() {
+        return serverProbe;
+    }
+
+    public int getJmapPort() {
+        return jmapPort;
+    }
 }

Modified: 
james/project/trunk/server/container/cassandra-guice/src/main/java/org/apache/james/jmap/JMAPModule.java
URL: 
http://svn.apache.org/viewvc/james/project/trunk/server/container/cassandra-guice/src/main/java/org/apache/james/jmap/JMAPModule.java?rev=1719380&r1=1719379&r2=1719380&view=diff
==============================================================================
--- 
james/project/trunk/server/container/cassandra-guice/src/main/java/org/apache/james/jmap/JMAPModule.java
 (original)
+++ 
james/project/trunk/server/container/cassandra-guice/src/main/java/org/apache/james/jmap/JMAPModule.java
 Fri Dec 11 12:32:35 2015
@@ -28,19 +28,16 @@ import org.apache.james.jmap.methods.Req
 import com.google.inject.AbstractModule;
 import com.google.inject.Provides;
 import com.google.inject.Singleton;
-import com.google.inject.name.Names;
 
 public class JMAPModule extends AbstractModule {
 
-    private static final int DEFAULT_PORT = 80;
-
     @Override
     protected void configure() {
         install(new JMAPCommonModule());
         install(new MethodsModule());
         bind(RequestHandler.class).in(Singleton.class);
 
-        
bindConstant().annotatedWith(Names.named(JMAPServer.DEFAULT_JMAP_PORT)).to(DEFAULT_PORT);
+        
bind(PortConfiguration.class).to(DefaultPortConfiguration.class).in(Singleton.class);
     }
 
     @Provides

Modified: 
james/project/trunk/server/container/cassandra-guice/src/main/java/org/apache/james/modules/CommonServicesModule.java
URL: 
http://svn.apache.org/viewvc/james/project/trunk/server/container/cassandra-guice/src/main/java/org/apache/james/modules/CommonServicesModule.java?rev=1719380&r1=1719379&r2=1719380&view=diff
==============================================================================
--- 
james/project/trunk/server/container/cassandra-guice/src/main/java/org/apache/james/modules/CommonServicesModule.java
 (original)
+++ 
james/project/trunk/server/container/cassandra-guice/src/main/java/org/apache/james/modules/CommonServicesModule.java
 Fri Dec 11 12:32:35 2015
@@ -31,6 +31,7 @@ import org.apache.james.filesystem.api.F
 import org.apache.james.filesystem.api.JamesDirectoriesProvider;
 import org.apache.james.utils.ConfigurationProvider;
 import org.apache.james.utils.FileConfigurationProvider;
+import org.apache.james.utils.GuiceServerProbe;
 
 import com.google.inject.AbstractModule;
 import com.google.inject.Provides;
@@ -43,6 +44,7 @@ public class CommonServicesModule extend
     protected void configure() {
         bind(FileSystem.class).to(FileSystemImpl.class);
         bind(ConfigurationProvider.class).to(FileConfigurationProvider.class);
+        bind(GuiceServerProbe.class).in(Singleton.class);
     }
 
     @Provides @Singleton @Named(CONFIGURATION_PATH)

Copied: 
james/project/trunk/server/container/cassandra-guice/src/main/java/org/apache/james/utils/ExtendedServerProbe.java
 (from r1719379, 
james/project/trunk/server/container/cassandra-guice/src/test/java/org/apache/james/modules/TestJMAPServerModule.java)
URL: 
http://svn.apache.org/viewvc/james/project/trunk/server/container/cassandra-guice/src/main/java/org/apache/james/utils/ExtendedServerProbe.java?p2=james/project/trunk/server/container/cassandra-guice/src/main/java/org/apache/james/utils/ExtendedServerProbe.java&p1=james/project/trunk/server/container/cassandra-guice/src/test/java/org/apache/james/modules/TestJMAPServerModule.java&r1=1719379&r2=1719380&rev=1719380&view=diff
==============================================================================
--- 
james/project/trunk/server/container/cassandra-guice/src/test/java/org/apache/james/modules/TestJMAPServerModule.java
 (original)
+++ 
james/project/trunk/server/container/cassandra-guice/src/main/java/org/apache/james/utils/ExtendedServerProbe.java
 Fri Dec 11 12:32:35 2015
@@ -17,30 +17,20 @@
  * under the License.                                           *
  ****************************************************************/
 
-package org.apache.james.modules;
+package org.apache.james.utils;
 
-import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.util.Date;
 
-import javax.inject.Singleton;
+import javax.mail.Flags;
 
-import org.apache.commons.configuration.ConfigurationException;
-import org.apache.james.jmap.JMAPConfiguration;
-import org.apache.james.jmap.JMAPServer;
+import org.apache.james.cli.probe.ServerProbe;
+import org.apache.james.mailbox.exception.BadCredentialsException;
+import org.apache.james.mailbox.exception.MailboxException;
+import org.apache.james.mailbox.model.MailboxPath;
 
-import com.google.inject.AbstractModule;
-import com.google.inject.Provides;
-import com.google.inject.name.Names;
+public interface ExtendedServerProbe extends ServerProbe {
 
-public class TestJMAPServerModule extends AbstractModule{
-
-    @Override
-    protected void configure() {
-        
bindConstant().annotatedWith(Names.named(JMAPServer.DEFAULT_JMAP_PORT)).to(1080);
-    }
-
-    @Provides
-    @Singleton
-    JMAPConfiguration provideConfiguration() throws FileNotFoundException, 
ConfigurationException{
-        return new JMAPConfiguration("keystore", "james72laBalle");
-    }
+    void appendMessage(String username, MailboxPath mailboxPath, InputStream 
message, Date internalDate, boolean isRecent, Flags flags) 
+            throws BadCredentialsException, MailboxException;
 }

Added: 
james/project/trunk/server/container/cassandra-guice/src/main/java/org/apache/james/utils/GuiceServerProbe.java
URL: 
http://svn.apache.org/viewvc/james/project/trunk/server/container/cassandra-guice/src/main/java/org/apache/james/utils/GuiceServerProbe.java?rev=1719380&view=auto
==============================================================================
--- 
james/project/trunk/server/container/cassandra-guice/src/main/java/org/apache/james/utils/GuiceServerProbe.java
 (added)
+++ 
james/project/trunk/server/container/cassandra-guice/src/main/java/org/apache/james/utils/GuiceServerProbe.java
 Fri Dec 11 12:32:35 2015
@@ -0,0 +1,292 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+package org.apache.james.utils;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import javax.inject.Inject;
+import javax.mail.Flags;
+
+import org.apache.commons.lang.NotImplementedException;
+import org.apache.james.adapter.mailbox.SerializableQuota;
+import org.apache.james.domainlist.api.DomainList;
+import org.apache.james.mailbox.MailboxManager;
+import org.apache.james.mailbox.MailboxSession;
+import org.apache.james.mailbox.MessageManager;
+import org.apache.james.mailbox.exception.BadCredentialsException;
+import org.apache.james.mailbox.exception.MailboxException;
+import org.apache.james.mailbox.model.MailboxConstants;
+import org.apache.james.mailbox.model.MailboxMetaData;
+import org.apache.james.mailbox.model.MailboxPath;
+import org.apache.james.mailbox.model.MailboxQuery;
+import org.apache.james.rrt.lib.Mappings;
+import org.apache.james.user.api.UsersRepository;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.Throwables;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Iterables;
+
+public class GuiceServerProbe implements ExtendedServerProbe {
+
+    private static final Logger LOGGER = 
LoggerFactory.getLogger(GuiceServerProbe.class);
+
+    private MailboxManager mailboxManager;
+    private DomainList domainList;
+    private UsersRepository usersRepository;
+
+    @Inject
+    private GuiceServerProbe(MailboxManager mailboxManager, DomainList 
domainList, UsersRepository usersRepository) {
+        this.mailboxManager = mailboxManager;
+        this.domainList = domainList;
+        this.usersRepository = usersRepository;
+    }
+
+    @Override
+    public void close() throws IOException {
+    }
+
+    @Override
+    public void addUser(String userName, String password) throws Exception {
+        usersRepository.addUser(userName, password);
+    }
+
+    @Override
+    public void removeUser(String username) throws Exception {
+        usersRepository.removeUser(username);
+    }
+
+    @Override
+    public String[] listUsers() throws Exception {
+        return Iterables.toArray(ImmutableList.copyOf(usersRepository.list()), 
String.class);
+    }
+
+    @Override
+    public void setPassword(String userName, String password) throws Exception 
{
+        throw new NotImplementedException();
+    }
+
+    @Override
+    public void addDomain(String domain) throws Exception {
+        domainList.addDomain(domain);
+    }
+
+    @Override
+    public boolean containsDomain(String domain) throws Exception {
+        return domainList.containsDomain(domain);
+    }
+
+    @Override
+    public void removeDomain(String domain) throws Exception {
+        domainList.removeDomain(domain);
+    }
+
+    @Override
+    public String[] listDomains() throws Exception {
+        return domainList.getDomains();
+    }
+
+    @Override
+    public Map<String, Mappings> listMappings() throws Exception {
+        throw new NotImplementedException();
+    }
+
+    @Override
+    public void addAddressMapping(String user, String domain, String 
toAddress) throws Exception {
+        throw new NotImplementedException();
+    }
+
+    @Override
+    public void removeAddressMapping(String user, String domain, String 
fromAddress) throws Exception {
+        throw new NotImplementedException();
+    }
+
+    @Override
+    public Mappings listUserDomainMappings(String user, String domain) throws 
Exception {
+        throw new NotImplementedException();
+    }
+
+    @Override
+    public void addRegexMapping(String user, String domain, String regex) 
throws Exception {
+        throw new NotImplementedException();
+    }
+
+    @Override
+    public void removeRegexMapping(String user, String domain, String regex) 
throws Exception {
+        throw new NotImplementedException();
+    }
+
+    @Override
+    public void copyMailbox(String srcBean, String dstBean) throws Exception {
+        throw new NotImplementedException();
+    }
+
+    @Override
+    public void deleteUserMailboxesNames(String user) throws Exception {
+        throw new NotImplementedException();
+    }
+
+    @Override
+    public void createMailbox(String namespace, String user, String name) {
+        MailboxSession mailboxSession = null;
+        try {
+            mailboxSession = mailboxManager.createSystemSession(user, LOGGER);
+            mailboxManager.startProcessingRequest(mailboxSession);
+            mailboxManager.createMailbox(new MailboxPath(namespace, user, 
name), mailboxSession);
+        } catch (MailboxException e) {
+            throw Throwables.propagate(e);
+        } finally {
+            closeSession(mailboxSession);
+        }
+    }
+
+    private void closeSession(MailboxSession session) {
+        if (session != null) {
+            mailboxManager.endProcessingRequest(session);
+            try {
+                mailboxManager.logout(session, true);
+            } catch (MailboxException e) {
+                throw Throwables.propagate(e);
+            }
+        }
+    }
+
+    @Override
+    public Collection<String> listUserMailboxes(String user) {
+        MailboxSession mailboxSession = null;
+        try {
+            mailboxSession = mailboxManager.createSystemSession(user, LOGGER);
+            mailboxManager.startProcessingRequest(mailboxSession);
+            return searchUserMailboxes(user, mailboxSession)
+                    .stream()
+                    .map(MailboxMetaData::getPath)
+                    .map(MailboxPath::getName)
+                    .collect(Collectors.toList());
+        } catch (MailboxException e) {
+            throw Throwables.propagate(e);
+        } finally {
+            closeSession(mailboxSession);
+        }
+    }
+
+    private List<MailboxMetaData> searchUserMailboxes(String username, 
MailboxSession session) throws MailboxException {
+        return mailboxManager.search(
+            new MailboxQuery(new MailboxPath(MailboxConstants.USER_NAMESPACE, 
username, ""),
+                "*",
+                session.getPathDelimiter()),
+            session);
+    }
+
+    @Override
+    public void deleteMailbox(String namespace, String user, String name) {
+        MailboxSession mailboxSession = null;
+        try {
+            mailboxSession = mailboxManager.createSystemSession(user, LOGGER);
+            mailboxManager.startProcessingRequest(mailboxSession);
+            mailboxManager.deleteMailbox(new MailboxPath(namespace, user, 
name), mailboxSession);
+        } catch (MailboxException e) {
+            throw Throwables.propagate(e);
+        } finally {
+            closeSession(mailboxSession);
+        }
+    }
+
+    @Override
+    public String getQuotaRoot(String namespace, String user, String name) 
throws MailboxException {
+        throw new NotImplementedException();
+    }
+
+    @Override
+    public SerializableQuota getMessageCountQuota(String quotaRoot) throws 
MailboxException {
+        throw new NotImplementedException();
+    }
+
+    @Override
+    public SerializableQuota getStorageQuota(String quotaRoot) throws 
MailboxException {
+        throw new NotImplementedException();
+    }
+
+    @Override
+    public long getMaxMessageCount(String quotaRoot) throws MailboxException {
+        throw new NotImplementedException();
+    }
+
+    @Override
+    public long getMaxStorage(String quotaRoot) throws MailboxException {
+        throw new NotImplementedException();
+    }
+
+    @Override
+    public long getDefaultMaxMessageCount() throws MailboxException {
+        throw new NotImplementedException();
+    }
+
+    @Override
+    public long getDefaultMaxStorage() throws MailboxException {
+        throw new NotImplementedException();
+    }
+
+    @Override
+    public void setMaxMessageCount(String quotaRoot, long maxMessageCount) 
throws MailboxException {
+        throw new NotImplementedException();
+    }
+
+    @Override
+    public void setMaxStorage(String quotaRoot, long maxSize) throws 
MailboxException {
+        throw new NotImplementedException();
+    }
+
+    @Override
+    public void setDefaultMaxMessageCount(long maxDefaultMessageCount) throws 
MailboxException {
+        throw new NotImplementedException();
+    }
+
+    @Override
+    public void setDefaultMaxStorage(long maxDefaultSize) throws 
MailboxException {
+        throw new NotImplementedException();
+    }
+
+    @Override
+    public void appendMessage(String username, MailboxPath mailboxPath, 
InputStream message, Date internalDate, boolean isRecent, Flags flags) 
+            throws BadCredentialsException, MailboxException {
+        
+        MailboxSession mailboxSession = 
mailboxManager.createSystemSession(username, LOGGER);
+        MessageManager messageManager = mailboxManager.getMailbox(mailboxPath, 
mailboxSession);
+        messageManager.appendMessage(message, internalDate, mailboxSession, 
isRecent, flags);
+    }
+
+    @Override
+    public void reIndexMailbox(String namespace, String user, String name) 
throws Exception {
+        throw new NotImplementedException();
+    }
+
+    @Override
+    public void reIndexAll() throws Exception {
+        throw new NotImplementedException();
+    }
+
+}

Modified: 
james/project/trunk/server/container/cassandra-guice/src/test/java/org/apache/james/CassandraJamesServerTest.java
URL: 
http://svn.apache.org/viewvc/james/project/trunk/server/container/cassandra-guice/src/test/java/org/apache/james/CassandraJamesServerTest.java?rev=1719380&r1=1719379&r2=1719380&view=diff
==============================================================================
--- 
james/project/trunk/server/container/cassandra-guice/src/test/java/org/apache/james/CassandraJamesServerTest.java
 (original)
+++ 
james/project/trunk/server/container/cassandra-guice/src/test/java/org/apache/james/CassandraJamesServerTest.java
 Fri Dec 11 12:32:35 2015
@@ -44,6 +44,7 @@ import org.junit.rules.TemporaryFolder;
 
 import com.google.common.base.Charsets;
 import com.google.inject.AbstractModule;
+import com.google.inject.Module;
 import com.google.inject.Provides;
 import com.google.inject.Singleton;
 import com.google.inject.util.Modules;
@@ -57,7 +58,6 @@ public class CassandraJamesServerTest {
     private static final int POP3_PORT = 1110;
     private static final int SMTP_PORT = 1025;
     private static final int LMTP_PORT = 1024;
-    private static final int JMAP_PORT = 1080;
     public static final int BUFFER_SIZE = 1000;
 
     private CassandraJamesServer server;
@@ -70,9 +70,19 @@ public class CassandraJamesServerTest {
 
     @Before
     public void setup() throws Exception {
-        server = new 
CassandraJamesServer(Modules.override(CassandraJamesServerMain.defaultModule)
+        server = new CassandraJamesServer(createModule());
+        socketChannel = SocketChannel.open();
+
+        server.start();
+
+        RestAssured.port = server.getJmapPort();
+        RestAssured.config = 
newConfig().encoderConfig(encoderConfig().defaultContentCharset(Charsets.UTF_8));
+    }
+
+    private Module createModule() {
+        return Modules.override(CassandraJamesServerMain.defaultModule)
                 .with(new TestElasticSearchModule(embeddedElasticSearch),
-                        new TestFilesystemModule(temporaryFolder.newFolder()),
+                        new TestFilesystemModule(temporaryFolder),
                         new TestJMAPServerModule(),
                         new AbstractModule() {
                     
@@ -87,13 +97,7 @@ public class CassandraJamesServerTest {
                         return cassandra.getConf();
                     }
 
-                }));
-        socketChannel = SocketChannel.open();
-
-        server.start();
-
-        RestAssured.port = JMAP_PORT;
-        RestAssured.config = 
newConfig().encoderConfig(encoderConfig().defaultContentCharset(Charsets.UTF_8));
+                });
     }
 
     @After

Modified: 
james/project/trunk/server/container/cassandra-guice/src/test/java/org/apache/james/modules/TestFilesystemModule.java
URL: 
http://svn.apache.org/viewvc/james/project/trunk/server/container/cassandra-guice/src/test/java/org/apache/james/modules/TestFilesystemModule.java?rev=1719380&r1=1719379&r2=1719380&view=diff
==============================================================================
--- 
james/project/trunk/server/container/cassandra-guice/src/test/java/org/apache/james/modules/TestFilesystemModule.java
 (original)
+++ 
james/project/trunk/server/container/cassandra-guice/src/test/java/org/apache/james/modules/TestFilesystemModule.java
 Fri Dec 11 12:32:35 2015
@@ -20,26 +20,41 @@
 package org.apache.james.modules;
 
 import java.io.File;
+import java.io.IOException;
+import java.util.function.Supplier;
 
 import org.apache.james.core.JamesServerResourceLoader;
 import org.apache.james.filesystem.api.FileSystem;
 import org.apache.james.filesystem.api.JamesDirectoriesProvider;
-import org.apache.james.modules.CommonServicesModule;
+import org.junit.rules.TemporaryFolder;
 
+import com.google.common.base.Throwables;
 import com.google.inject.AbstractModule;
 import com.google.inject.name.Names;
 
 public class TestFilesystemModule extends AbstractModule {
     
-    private File workingDirectory;
+    private Supplier<File> workingDirectory;
 
-    public TestFilesystemModule(File workingDirectory) {
+    private static File createTempDir(TemporaryFolder temporaryFolder) {
+        try {
+            return temporaryFolder.newFolder();
+        } catch (IOException e) {
+            throw Throwables.propagate(e);
+        }
+    }
+
+    public TestFilesystemModule(TemporaryFolder temporaryFolder) {
+        this(() -> TestFilesystemModule.createTempDir(temporaryFolder));
+    }
+
+    public TestFilesystemModule(Supplier<File> workingDirectory) {
         this.workingDirectory = workingDirectory;
     }
 
     @Override
     protected void configure() {
-        bind(JamesDirectoriesProvider.class).toInstance(new 
JamesServerResourceLoader(workingDirectory.getAbsolutePath()));
+        bind(JamesDirectoriesProvider.class).toInstance(new 
JamesServerResourceLoader(workingDirectory.get().getAbsolutePath()));
         
bindConstant().annotatedWith(Names.named(CommonServicesModule.CONFIGURATION_PATH)).to(FileSystem.CLASSPATH_PROTOCOL);
     }
     

Modified: 
james/project/trunk/server/container/cassandra-guice/src/test/java/org/apache/james/modules/TestJMAPServerModule.java
URL: 
http://svn.apache.org/viewvc/james/project/trunk/server/container/cassandra-guice/src/test/java/org/apache/james/modules/TestJMAPServerModule.java?rev=1719380&r1=1719379&r2=1719380&view=diff
==============================================================================
--- 
james/project/trunk/server/container/cassandra-guice/src/test/java/org/apache/james/modules/TestJMAPServerModule.java
 (original)
+++ 
james/project/trunk/server/container/cassandra-guice/src/test/java/org/apache/james/modules/TestJMAPServerModule.java
 Fri Dec 11 12:32:35 2015
@@ -20,22 +20,22 @@
 package org.apache.james.modules;
 
 import java.io.FileNotFoundException;
+import java.util.Optional;
 
 import javax.inject.Singleton;
 
 import org.apache.commons.configuration.ConfigurationException;
 import org.apache.james.jmap.JMAPConfiguration;
-import org.apache.james.jmap.JMAPServer;
+import org.apache.james.jmap.PortConfiguration;
 
 import com.google.inject.AbstractModule;
 import com.google.inject.Provides;
-import com.google.inject.name.Names;
 
 public class TestJMAPServerModule extends AbstractModule{
 
     @Override
     protected void configure() {
-        
bindConstant().annotatedWith(Names.named(JMAPServer.DEFAULT_JMAP_PORT)).to(1080);
+        
bind(PortConfiguration.class).to(RandomPortConfiguration.class).in(Singleton.class);
     }
 
     @Provides
@@ -43,4 +43,12 @@ public class TestJMAPServerModule extend
     JMAPConfiguration provideConfiguration() throws FileNotFoundException, 
ConfigurationException{
         return new JMAPConfiguration("keystore", "james72laBalle");
     }
+    
+    private static class RandomPortConfiguration implements PortConfiguration {
+
+        @Override
+        public Optional<Integer> getPort() {
+            return Optional.empty();
+        }
+    }
 }

Modified: james/project/trunk/server/container/jetty/pom.xml
URL: 
http://svn.apache.org/viewvc/james/project/trunk/server/container/jetty/pom.xml?rev=1719380&r1=1719379&r2=1719380&view=diff
==============================================================================
--- james/project/trunk/server/container/jetty/pom.xml (original)
+++ james/project/trunk/server/container/jetty/pom.xml Fri Dec 11 12:32:35 2015
@@ -135,7 +135,7 @@
                 <dependency>
                     <groupId>com.jayway.restassured</groupId>
                     <artifactId>rest-assured</artifactId>
-                    <version>2.6.0</version>
+                    <scope>test</scope>
                 </dependency>
                 <dependency>
                     <groupId>commons-configuration</groupId>
@@ -155,17 +155,14 @@
                 <dependency>
                     <groupId>org.eclipse.jetty</groupId>
                     <artifactId>jetty-http</artifactId>
-                    <version>9.3.5.v20151012</version>
                 </dependency>
                 <dependency>
                     <groupId>org.eclipse.jetty</groupId>
                     <artifactId>jetty-server</artifactId>
-                    <version>9.3.5.v20151012</version>
                 </dependency>
                 <dependency>
                     <groupId>org.eclipse.jetty</groupId>
                     <artifactId>jetty-servlet</artifactId>
-                    <version>9.3.5.v20151012</version>
                 </dependency>
             </dependencies>
             <build>

Modified: 
james/project/trunk/server/container/jetty/src/main/java/org/apache/james/http/jetty/Configuration.java
URL: 
http://svn.apache.org/viewvc/james/project/trunk/server/container/jetty/src/main/java/org/apache/james/http/jetty/Configuration.java?rev=1719380&r1=1719379&r2=1719380&view=diff
==============================================================================
--- 
james/project/trunk/server/container/jetty/src/main/java/org/apache/james/http/jetty/Configuration.java
 (original)
+++ 
james/project/trunk/server/container/jetty/src/main/java/org/apache/james/http/jetty/Configuration.java
 Fri Dec 11 12:32:35 2015
@@ -109,7 +109,7 @@ public class Configuration {
             this.port = Optional.of(port);
             return this;
         }
-        
+
         public Builder randomPort() {
             this.port = Optional.empty();
             return this;

Modified: james/project/trunk/server/data/data-cassandra/pom.xml
URL: 
http://svn.apache.org/viewvc/james/project/trunk/server/data/data-cassandra/pom.xml?rev=1719380&r1=1719379&r2=1719380&view=diff
==============================================================================
--- james/project/trunk/server/data/data-cassandra/pom.xml (original)
+++ james/project/trunk/server/data/data-cassandra/pom.xml Fri Dec 11 12:32:35 
2015
@@ -243,7 +243,7 @@
                 <dependency>
                     <groupId>org.cassandraunit</groupId>
                     <artifactId>cassandra-unit</artifactId>
-                    <version>2.1.9.2</version>
+                    <version>${cassandra-unit.version}</version>
                     <scope>test</scope>
                 </dependency>
                 <dependency>

Modified: james/project/trunk/server/pom.xml
URL: 
http://svn.apache.org/viewvc/james/project/trunk/server/pom.xml?rev=1719380&r1=1719379&r2=1719380&view=diff
==============================================================================
--- james/project/trunk/server/pom.xml (original)
+++ james/project/trunk/server/pom.xml Fri Dec 11 12:32:35 2015
@@ -90,6 +90,7 @@
         <module>protocols/fetchmail</module>
         <module>protocols/protocols-imap4</module>
         <module>protocols/jmap</module>
+        <module>protocols/jmap-integration-testing</module>
         <module>protocols/protocols-library</module>
         <module>protocols/protocols-lmtp</module>
         <module>protocols/protocols-pop3</module>
@@ -185,6 +186,9 @@
         <backends.version>1.8.3-SNAPSHOT</backends.version>
         
<apache-backends-cassandra.version>1.8.3-SNAPSHOT</apache-backends-cassandra.version>
         <assertj3>3.2.0</assertj3>
+        <jackson-data.version>2.6.3</jackson-data.version>
+        <jetty.version>9.3.5.v20151012</jetty.version>
+        <cassandra-unit.version>2.1.9.2</cassandra-unit.version>
     </properties>
 
     <dependencyManagement>
@@ -212,6 +216,13 @@
             </dependency>
             <dependency>
                 <groupId>org.apache.james</groupId>
+                <artifactId>james-server-cassandra-guice</artifactId>
+                <version>${project.version}</version>
+                <type>test-jar</type>
+                <scope>test</scope>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.james</groupId>
                 <artifactId>james-server-jetty</artifactId>
                 <version>${project.version}</version>
             </dependency>
@@ -544,6 +555,11 @@
                 <version>${project.version}</version>
             </dependency>
             <dependency>
+                <groupId>org.apache.james</groupId>
+                <artifactId>james-server-jmap-integration-testing</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
                 <groupId>org.apache.james.protocols</groupId>
                 <artifactId>protocols-smtp</artifactId>
                 <version>${protocols.version}</version>
@@ -907,6 +923,21 @@
                 <version>${commons-net.version}</version>
                 <scope>test</scope>
             </dependency>
+            <dependency>
+                <groupId>com.fasterxml.jackson.core</groupId>
+                <artifactId>jackson-databind</artifactId>
+                <version>${jackson-data.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>com.fasterxml.jackson.datatype</groupId>
+                <artifactId>jackson-datatype-guava</artifactId>
+                <version>${jackson-data.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>com.fasterxml.jackson.datatype</groupId>
+                <artifactId>jackson-datatype-jdk8</artifactId>
+                <version>${jackson-data.version}</version>
+            </dependency>
 
             <dependency>
                 <groupId>dnsjava</groupId>
@@ -1350,6 +1381,26 @@
                 <artifactId>awaitility</artifactId>
                 <version>1.6.3</version>
             </dependency>
+            <dependency>
+                <groupId>com.jayway.restassured</groupId>
+                <artifactId>rest-assured</artifactId>
+                <version>2.6.0</version>
+            </dependency>
+            <dependency>
+                <groupId>org.eclipse.jetty</groupId>
+                <artifactId>jetty-http</artifactId>
+                <version>${jetty.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.eclipse.jetty</groupId>
+                <artifactId>jetty-server</artifactId>
+                <version>${jetty.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.eclipse.jetty</groupId>
+                <artifactId>jetty-servlet</artifactId>
+                <version>${jetty.version}</version>
+            </dependency>
         </dependencies>
     </dependencyManagement>
 

Copied: james/project/trunk/server/protocols/jmap-integration-testing/pom.xml 
(from r1719379, james/project/trunk/server/data/data-cassandra/pom.xml)
URL: 
http://svn.apache.org/viewvc/james/project/trunk/server/protocols/jmap-integration-testing/pom.xml?p2=james/project/trunk/server/protocols/jmap-integration-testing/pom.xml&p1=james/project/trunk/server/data/data-cassandra/pom.xml&r1=1719379&r2=1719380&rev=1719380&view=diff
==============================================================================
--- james/project/trunk/server/data/data-cassandra/pom.xml (original)
+++ james/project/trunk/server/protocols/jmap-integration-testing/pom.xml Fri 
Dec 11 12:32:35 2015
@@ -29,30 +29,10 @@
     </parent>
 
     <groupId>org.apache.james</groupId>
-    <artifactId>james-server-data-cassandra</artifactId>
-    <name>Apache James :: Server :: Data :: Cassandra Persistence</name>
+    <artifactId>james-server-jmap-integration-testing</artifactId>
+    <packaging>jar</packaging>
 
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-bundle-plugin</artifactId>
-                <extensions>true</extensions>
-            </plugin>
-        </plugins>
-    </build>
-
-    <dependencies>
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.assertj</groupId>
-            <artifactId>assertj-core</artifactId>
-            <scope>test</scope>
-        </dependency>
-    </dependencies>
+    <name>Apache James :: Server :: JMAP :: Integration testing</name>
 
     <profiles>
         <profile>
@@ -171,84 +151,49 @@
             <dependencies>
                 <dependency>
                     <groupId>${project.groupId}</groupId>
-                    <artifactId>apache-james-backends-cassandra</artifactId>
-                </dependency>
-                <dependency>
-                    <groupId>${project.groupId}</groupId>
-                    <artifactId>james-server-data-api</artifactId>
-                </dependency>
-                <dependency>
-                    <groupId>${project.groupId}</groupId>
-                    <artifactId>james-server-data-library</artifactId>
-                </dependency>
-                <dependency>
-                    <groupId>${project.groupId}</groupId>
-                    <artifactId>james-server-dnsservice-api</artifactId>
-                </dependency>
-                <dependency>
-                    <groupId>${project.groupId}</groupId>
-                    <artifactId>james-server-lifecycle-api</artifactId>
-                </dependency>
-                <dependency>
-                    <groupId>com.google.guava</groupId>
-                    <artifactId>guava</artifactId>
-                </dependency>
-                <dependency>
-                    <groupId>commons-codec</groupId>
-                    <artifactId>commons-codec</artifactId>
-                </dependency>
-                <dependency>
-                    <groupId>commons-configuration</groupId>
-                    <artifactId>commons-configuration</artifactId>
+                    <artifactId>apache-james-mailbox-elasticsearch</artifactId>
+                    <type>test-jar</type>
+                    <scope>test</scope>
                 </dependency>
                 <dependency>
-                    <groupId>org.slf4j</groupId>
-                    <artifactId>slf4j-api</artifactId>
+                    <groupId>org.apache.james</groupId>
+                    <artifactId>james-server-cassandra-guice</artifactId>
+                    <scope>test</scope>
                 </dependency>
-
-                <!-- Test dependencies -->
                 <dependency>
-                    <groupId>${project.groupId}</groupId>
-                    <artifactId>apache-james-backends-cassandra</artifactId>
+                    <groupId>org.apache.james</groupId>
+                    <artifactId>james-server-cassandra-guice</artifactId>
                     <scope>test</scope>
                     <type>test-jar</type>
                 </dependency>
                 <dependency>
-                    <groupId>${project.groupId}</groupId>
-                    <artifactId>james-server-data-library</artifactId>
-                    <type>test-jar</type>
+                    <groupId>org.apache.james</groupId>
+                    <artifactId>james-server-protocols-library</artifactId>
                     <scope>test</scope>
+                    <type>test-jar</type>
                 </dependency>
                 <dependency>
-                    <groupId>${project.groupId}</groupId>
-                    <artifactId>james-server-dnsservice-api</artifactId>
-                    <scope>test</scope>
-                    <type>test-jar</type>
+                    <groupId>com.google.inject</groupId>
+                    <artifactId>guice</artifactId>
                 </dependency>
                 <dependency>
-                    <groupId>info.cukes</groupId>
-                    <artifactId>cucumber-java</artifactId>
-                    <scope>test</scope>
+                    <groupId>com.google.inject.extensions</groupId>
+                    <artifactId>guice-multibindings</artifactId>
                 </dependency>
                 <dependency>
-                    <groupId>info.cukes</groupId>
-                    <artifactId>cucumber-junit</artifactId>
+                    <groupId>com.jayway.restassured</groupId>
+                    <artifactId>rest-assured</artifactId>
                     <scope>test</scope>
                 </dependency>
                 <dependency>
-                    <groupId>info.cukes</groupId>
-                    <artifactId>cucumber-picocontainer</artifactId>
+                    <groupId>junit</groupId>
+                    <artifactId>junit</artifactId>
                     <scope>test</scope>
                 </dependency>
                 <dependency>
                     <groupId>org.cassandraunit</groupId>
                     <artifactId>cassandra-unit</artifactId>
-                    <version>2.1.9.2</version>
-                    <scope>test</scope>
-                </dependency>
-                <dependency>
-                    <groupId>org.slf4j</groupId>
-                    <artifactId>slf4j-simple</artifactId>
+                    <version>${cassandra-unit.version}</version>
                     <scope>test</scope>
                 </dependency>
             </dependencies>
@@ -299,5 +244,4 @@
             </build>
         </profile>
     </profiles>
-
 </project>

Added: 
james/project/trunk/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/JmapAuthentication.java
URL: 
http://svn.apache.org/viewvc/james/project/trunk/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/JmapAuthentication.java?rev=1719380&view=auto
==============================================================================
--- 
james/project/trunk/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/JmapAuthentication.java
 (added)
+++ 
james/project/trunk/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/JmapAuthentication.java
 Fri Dec 11 12:32:35 2015
@@ -0,0 +1,55 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+package org.apache.james.jmap;
+
+import static com.jayway.restassured.RestAssured.with;
+
+import org.apache.james.jmap.api.access.AccessToken;
+
+import com.jayway.restassured.http.ContentType;
+
+public class JmapAuthentication {
+
+    public static AccessToken authenticateJamesUser(String username, String 
password) {
+        String continuationToken = getContinuationToken(username);
+
+        return AccessToken.fromString(
+            with()
+                .contentType(ContentType.JSON)
+                .accept(ContentType.JSON)
+                .body("{\"token\": \"" + continuationToken + "\", \"method\": 
\"password\", \"password\": \"" + password + "\"}")
+            .post("/authentication")
+                .body()
+                .jsonPath()
+                .getString("accessToken")
+        );
+    }
+
+    private static String getContinuationToken(String username) {
+        return with()
+            .contentType(ContentType.JSON)
+            .accept(ContentType.JSON)
+            .body("{\"username\": \"" + username + "\", \"clientName\": 
\"Mozilla Thunderbird\", \"clientVersion\": \"42.0\", \"deviceName\": \"Joe 
Blogg’s iPhone\"}")
+        .post("/authentication")
+            .body()
+            .path("continuationToken")
+            .toString();
+    }
+}

Copied: 
james/project/trunk/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/JmapServer.java
 (from r1719379, 
james/project/trunk/server/container/cassandra-guice/src/test/java/org/apache/james/modules/TestJMAPServerModule.java)
URL: 
http://svn.apache.org/viewvc/james/project/trunk/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/JmapServer.java?p2=james/project/trunk/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/JmapServer.java&p1=james/project/trunk/server/container/cassandra-guice/src/test/java/org/apache/james/modules/TestJMAPServerModule.java&r1=1719379&r2=1719380&rev=1719380&view=diff
==============================================================================
--- 
james/project/trunk/server/container/cassandra-guice/src/test/java/org/apache/james/modules/TestJMAPServerModule.java
 (original)
+++ 
james/project/trunk/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/JmapServer.java
 Fri Dec 11 12:32:35 2015
@@ -17,30 +17,16 @@
  * under the License.                                           *
  ****************************************************************/
 
-package org.apache.james.modules;
+package org.apache.james.jmap;
 
-import java.io.FileNotFoundException;
+import org.apache.james.utils.ExtendedServerProbe;
+import org.junit.rules.TestRule;
 
-import javax.inject.Singleton;
+public interface JmapServer extends TestRule {
 
-import org.apache.commons.configuration.ConfigurationException;
-import org.apache.james.jmap.JMAPConfiguration;
-import org.apache.james.jmap.JMAPServer;
+    void clean();
 
-import com.google.inject.AbstractModule;
-import com.google.inject.Provides;
-import com.google.inject.name.Names;
+    int getPort();
 
-public class TestJMAPServerModule extends AbstractModule{
-
-    @Override
-    protected void configure() {
-        
bindConstant().annotatedWith(Names.named(JMAPServer.DEFAULT_JMAP_PORT)).to(1080);
-    }
-
-    @Provides
-    @Singleton
-    JMAPConfiguration provideConfiguration() throws FileNotFoundException, 
ConfigurationException{
-        return new JMAPConfiguration("keystore", "james72laBalle");
-    }
+    ExtendedServerProbe serverProbe();
 }

Added: 
james/project/trunk/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraJmapServer.java
URL: 
http://svn.apache.org/viewvc/james/project/trunk/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraJmapServer.java?rev=1719380&view=auto
==============================================================================
--- 
james/project/trunk/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraJmapServer.java
 (added)
+++ 
james/project/trunk/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraJmapServer.java
 Fri Dec 11 12:32:35 2015
@@ -0,0 +1,113 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+package org.apache.james.jmap.cassandra;
+
+import javax.inject.Singleton;
+
+import org.apache.james.CassandraJamesServer;
+import org.apache.james.CassandraJamesServerMain;
+import org.apache.james.backends.cassandra.CassandraCluster;
+import org.apache.james.backends.cassandra.components.CassandraModule;
+import org.apache.james.jmap.JmapServer;
+import org.apache.james.mailbox.elasticsearch.EmbeddedElasticSearch;
+import org.apache.james.modules.TestElasticSearchModule;
+import org.apache.james.modules.TestFilesystemModule;
+import org.apache.james.modules.TestJMAPServerModule;
+import org.apache.james.utils.ExtendedServerProbe;
+import org.junit.rules.TemporaryFolder;
+import org.junit.runner.Description;
+import org.junit.runners.model.Statement;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.Module;
+import com.google.inject.Provides;
+import com.google.inject.util.Modules;
+
+public class CassandraJmapServer implements JmapServer {
+
+    private CassandraJamesServer server;
+    private CassandraCluster cassandra;
+
+    private final Module module;
+
+    public CassandraJmapServer(TemporaryFolder temporaryFolder, 
EmbeddedElasticSearch embeddedElasticSearch) {
+        this.module = createServerModule(temporaryFolder, 
embeddedElasticSearch);
+    }
+
+    private Module createServerModule(TemporaryFolder temporaryFolder, 
EmbeddedElasticSearch embeddedElasticSearch) {
+        return Modules.override(CassandraJamesServerMain.defaultModule)
+                .with(new TestElasticSearchModule(embeddedElasticSearch),
+                        new TestFilesystemModule(temporaryFolder),
+                        new TestJMAPServerModule(),
+                        new AbstractModule() {
+
+                    @Override
+                    protected void configure() {
+                    }
+
+                    @Provides
+                    @Singleton
+                    com.datastax.driver.core.Session 
provideSession(CassandraModule cassandraModule) {
+                        cassandra = CassandraCluster.create(cassandraModule);
+                        return cassandra.getConf();
+                    }
+                });
+    }
+
+    @Override
+    public Statement apply(Statement base, Description description) {
+        return new Statement() {
+            
+            @Override
+            public void evaluate() throws Throwable {
+                try {
+                    before();
+                    base.evaluate();
+                } finally {
+                    after();
+                }
+            }
+        };
+    }
+
+    private void before() throws Throwable {
+        server = new CassandraJamesServer(module);
+        server.start();
+    }
+
+    private void after() {
+        server.stop();
+    }
+
+    @Override
+    public void clean() {
+        cassandra.clearAllTables();
+    }
+
+    @Override
+    public int getPort() {
+        return server.getJmapPort();
+    }
+
+    @Override
+    public ExtendedServerProbe serverProbe() {
+        return server.serverProbe();
+    }
+}

Added: 
james/project/trunk/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/methods/GetMailboxesMethodTest.java
URL: 
http://svn.apache.org/viewvc/james/project/trunk/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/methods/GetMailboxesMethodTest.java?rev=1719380&view=auto
==============================================================================
--- 
james/project/trunk/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/methods/GetMailboxesMethodTest.java
 (added)
+++ 
james/project/trunk/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/methods/GetMailboxesMethodTest.java
 Fri Dec 11 12:32:35 2015
@@ -0,0 +1,176 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+package org.apache.james.jmap.methods;
+
+import static com.jayway.restassured.RestAssured.given;
+import static com.jayway.restassured.config.EncoderConfig.encoderConfig;
+import static com.jayway.restassured.config.RestAssuredConfig.newConfig;
+import static org.hamcrest.Matchers.endsWith;
+import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.startsWith;
+
+import java.io.ByteArrayInputStream;
+import java.util.Date;
+
+import javax.mail.Flags;
+
+import org.apache.james.jmap.JmapAuthentication;
+import org.apache.james.jmap.JmapServer;
+import org.apache.james.jmap.api.access.AccessToken;
+import org.apache.james.mailbox.elasticsearch.EmbeddedElasticSearch;
+import org.apache.james.mailbox.model.MailboxConstants;
+import org.apache.james.mailbox.model.MailboxPath;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.RuleChain;
+import org.junit.rules.TemporaryFolder;
+
+import com.google.common.base.Charsets;
+import com.jayway.restassured.RestAssured;
+import com.jayway.restassured.http.ContentType;
+
+public abstract class GetMailboxesMethodTest {
+
+    private TemporaryFolder temporaryFolder = new TemporaryFolder();
+    private EmbeddedElasticSearch embeddedElasticSearch = new 
EmbeddedElasticSearch(temporaryFolder);
+    private JmapServer jmapServer = jmapServer(temporaryFolder, 
embeddedElasticSearch);
+
+    protected abstract JmapServer jmapServer(TemporaryFolder temporaryFolder, 
EmbeddedElasticSearch embeddedElasticSearch);
+
+    @Rule
+    public RuleChain chain = RuleChain
+        .outerRule(temporaryFolder)
+        .around(embeddedElasticSearch)
+        .around(jmapServer);
+
+    private AccessToken accessToken;
+
+    @Before
+    public void setup() throws Exception {
+        RestAssured.port = jmapServer.getPort();
+        RestAssured.config = 
newConfig().encoderConfig(encoderConfig().defaultContentCharset(Charsets.UTF_8));
+
+        String domain = "domain.tld";
+        String username = "username@" + domain;
+        String password = "password";
+        jmapServer.serverProbe().addDomain(domain);
+        jmapServer.serverProbe().addUser(username, password);
+        accessToken = JmapAuthentication.authenticateJamesUser(username, 
password);
+    }
+
+    @After
+    public void tearDown() {
+        jmapServer.clean();
+    }
+
+    @Test
+    public void 
getMailboxesShouldErrorNotSupportedWhenRequestContainsNonNullAccountId() throws 
Exception {
+        given()
+            .accept(ContentType.JSON)
+            .contentType(ContentType.JSON)
+            .header("Authorization", accessToken.serialize())
+            .body("[[\"getMailboxes\", {\"accountId\": \"1\"}, \"#0\"]]")
+        .when()
+            .post("/jmap")
+        .then()
+            .statusCode(200)
+            .content(equalTo("[[\"error\",{\"type\":\"Not yet 
implemented\"},\"#0\"]]"));
+    }
+
+    
+    @Test
+    public void 
getMailboxesShouldErrorNotSupportedWhenRequestContainsNonNullIds() throws 
Exception {
+        given()
+            .accept(ContentType.JSON)
+            .contentType(ContentType.JSON)
+            .header("Authorization", accessToken.serialize())
+            .body("[[\"getMailboxes\", {\"ids\": []}, \"#0\"]]")
+        .when()
+            .post("/jmap")
+        .then()
+            .statusCode(200)
+            .content(equalTo("[[\"error\",{\"type\":\"Not yet 
implemented\"},\"#0\"]]"));
+    }
+    
+    @Test
+    public void 
getMailboxesShouldErrorNotSupportedWhenRequestContainsNonNullProperties() 
throws Exception {
+        given()
+            .accept(ContentType.JSON)
+            .contentType(ContentType.JSON)
+            .header("Authorization", accessToken.serialize())
+            .body("[[\"getMailboxes\", {\"properties\": []}, \"#0\"]]")
+        .when()
+            .post("/jmap")
+        .then()
+            .statusCode(200)
+            .content(equalTo("[[\"error\",{\"type\":\"Not yet 
implemented\"},\"#0\"]]"));
+    }
+
+    @Test
+    public void getMailboxesShouldErrorInvalidArgumentsWhenRequestIsInvalid() 
throws Exception {
+        given()
+            .accept(ContentType.JSON)
+            .contentType(ContentType.JSON)
+            .header("Authorization", accessToken.serialize())
+            .body("[[\"getMailboxes\", {\"ids\": true}, \"#0\"]]")
+        .when()
+            .post("/jmap")
+        .then()
+            .statusCode(200)
+            
.content(equalTo("[[\"error\",{\"type\":\"invalidArguments\"},\"#0\"]]"));
+    }
+
+    @Test
+    public void getMailboxesShouldReturnEmptyListWhenNoMailboxes() throws 
Exception {
+        given()
+            .accept(ContentType.JSON)
+            .contentType(ContentType.JSON)
+            .header("Authorization", accessToken.serialize())
+            .body("[[\"getMailboxes\", {}, \"#0\"]]")
+        .when()
+            .post("/jmap")
+        .then()
+            .statusCode(200)
+            
.content(equalTo("[[\"getMailboxes\",{\"accountId\":null,\"state\":null,\"list\":[],\"notFound\":null},\"#0\"]]"));
+    }
+
+    @Test
+    public void getMailboxesShouldReturnMailboxesWhenAvailable() throws 
Exception {
+        String user = "user";
+        
jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, user, 
"name");
+
+        jmapServer.serverProbe().appendMessage(user, new 
MailboxPath(MailboxConstants.USER_NAMESPACE, user, "name"), 
+                new ByteArrayInputStream("Subject: 
test\r\n\r\ntestmail".getBytes()), new Date(), false, new Flags());
+
+        given()
+            .accept(ContentType.JSON)
+            .contentType(ContentType.JSON)
+            .header("Authorization", accessToken.serialize())
+            .body("[[\"getMailboxes\", {}, \"#0\"]]")
+        .when()
+            .post("/jmap")
+        .then()
+            .statusCode(200)
+            
.content(startsWith("[[\"getMailboxes\",{\"accountId\":null,\"state\":null,\"list\":[{\"id\":\""),
 
+                    
endsWith("\",\"name\":\"name\",\"parentId\":null,\"role\":null,\"sortOrder\":0,\"mustBeOnlyMailbox\":false,\"mayReadItems\":false,\"mayAddItems\":false,\"mayRemoveItems\":false,\"mayCreateChild\":false,\"mayRename\":false,\"mayDelete\":false,\"totalMessages\":0,\"unreadMessages\":1,\"totalThreads\":0,\"unreadThreads\":0}],\"notFound\":null},\"#0\"]]"));
+    }
+}

Copied: 
james/project/trunk/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/methods/cassandra/CassandraGetMailboxesMethodTest.java
 (from r1719379, 
james/project/trunk/server/container/cassandra-guice/src/test/java/org/apache/james/modules/TestJMAPServerModule.java)
URL: 
http://svn.apache.org/viewvc/james/project/trunk/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/methods/cassandra/CassandraGetMailboxesMethodTest.java?p2=james/project/trunk/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/methods/cassandra/CassandraGetMailboxesMethodTest.java&p1=james/project/trunk/server/container/cassandra-guice/src/test/java/org/apache/james/modules/TestJMAPServerModule.java&r1=1719379&r2=1719380&rev=1719380&view=diff
==============================================================================
--- 
james/project/trunk/server/container/cassandra-guice/src/test/java/org/apache/james/modules/TestJMAPServerModule.java
 (original)
+++ 
james/project/trunk/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/methods/cassandra/CassandraGetMailboxesMethodTest.java
 Fri Dec 11 12:32:35 2015
@@ -17,30 +17,18 @@
  * under the License.                                           *
  ****************************************************************/
 
-package org.apache.james.modules;
+package org.apache.james.jmap.methods.cassandra;
 
-import java.io.FileNotFoundException;
+import org.apache.james.jmap.JmapServer;
+import org.apache.james.jmap.cassandra.CassandraJmapServer;
+import org.apache.james.jmap.methods.GetMailboxesMethodTest;
+import org.apache.james.mailbox.elasticsearch.EmbeddedElasticSearch;
+import org.junit.rules.TemporaryFolder;
 
-import javax.inject.Singleton;
-
-import org.apache.commons.configuration.ConfigurationException;
-import org.apache.james.jmap.JMAPConfiguration;
-import org.apache.james.jmap.JMAPServer;
-
-import com.google.inject.AbstractModule;
-import com.google.inject.Provides;
-import com.google.inject.name.Names;
-
-public class TestJMAPServerModule extends AbstractModule{
+public class CassandraGetMailboxesMethodTest extends GetMailboxesMethodTest {
 
     @Override
-    protected void configure() {
-        
bindConstant().annotatedWith(Names.named(JMAPServer.DEFAULT_JMAP_PORT)).to(1080);
-    }
-
-    @Provides
-    @Singleton
-    JMAPConfiguration provideConfiguration() throws FileNotFoundException, 
ConfigurationException{
-        return new JMAPConfiguration("keystore", "james72laBalle");
+    protected JmapServer jmapServer(TemporaryFolder temporaryFolder, 
EmbeddedElasticSearch embeddedElasticSearch) {
+        return new CassandraJmapServer(temporaryFolder, embeddedElasticSearch);
     }
 }

Added: 
james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/dnsservice.xml
URL: 
http://svn.apache.org/viewvc/james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/dnsservice.xml?rev=1719380&view=auto
==============================================================================
--- 
james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/dnsservice.xml
 (added)
+++ 
james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/dnsservice.xml
 Fri Dec 11 12:32:35 2015
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one   
+  or more contributor license agreements.  See the NOTICE file 
+  distributed with this work for additional information        
+  regarding copyright ownership.  The ASF licenses this file   
+  to you under the Apache License, Version 2.0 (the            
+  "License"); you may not use this file except in compliance   
+  with the License.  You may obtain a copy of the License at   
+                                                               
+    http://www.apache.org/licenses/LICENSE-2.0                 
+                                                               
+  Unless required by applicable law or agreed to in writing,   
+  software distributed under the License is distributed on an  
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       
+  KIND, either express or implied.  See the License for the    
+  specific language governing permissions and limitations      
+  under the License.                                           
+ -->
+
+<dnsservice>
+  <servers>
+    <server>8.8.8.8</server>
+    <server>62.210.16.6</server>
+  </servers>
+  <autodiscover>false</autodiscover>
+  <authoritative>false</authoritative>
+  <maxcachesize>50000</maxcachesize>
+</dnsservice>

Added: 
james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/fakemailrepositorystore.xml
URL: 
http://svn.apache.org/viewvc/james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/fakemailrepositorystore.xml?rev=1719380&view=auto
==============================================================================
--- 
james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/fakemailrepositorystore.xml
 (added)
+++ 
james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/fakemailrepositorystore.xml
 Fri Dec 11 12:32:35 2015
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+ -->
+
+<mailrepositorystore>
+    <mailrepositories>
+        <mailrepository class="org.apache.james.mailrepository.None">
+            <protocols>
+                <protocol>file</protocol>
+            </protocols>
+            <config FIFO="false" CACHEKEYS="true"/>
+        </mailrepository>
+    </mailrepositories>
+</mailrepositorystore>

Added: 
james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/imapserver.xml
URL: 
http://svn.apache.org/viewvc/james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/imapserver.xml?rev=1719380&view=auto
==============================================================================
--- 
james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/imapserver.xml
 (added)
+++ 
james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/imapserver.xml
 Fri Dec 11 12:32:35 2015
@@ -0,0 +1,54 @@
+<?xml version="1.0"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+
+<imapservers>
+       <imapserver enabled="true">
+               <jmxName>imapserver</jmxName>
+               <bind>0.0.0.0:1143</bind>
+               <connectionBacklog>200</connectionBacklog>
+               <tls socketTLS="false" startTLS="false">
+                       <!-- To create a new keystore execute:
+            keytool -genkey -alias james -keyalg RSA -keystore 
/path/to/james/conf/keystore
+              -->
+                       <keystore>file://conf/keystore</keystore>
+                       <secret>james72laBalle</secret>
+                       
<provider>org.bouncycastle.jce.provider.BouncyCastleProvider</provider>
+               </tls>
+               <connectionLimit>0</connectionLimit>
+               <connectionLimitPerIP>0</connectionLimitPerIP>
+       </imapserver>
+       <imapserver enabled="true">
+               <jmxName>imapserver-ssl</jmxName>
+               <bind>0.0.0.0:1993</bind>
+               <connectionBacklog>200</connectionBacklog>
+               <tls socketTLS="false" startTLS="false">
+                       <!-- To create a new keystore execute:
+              keytool -genkey -alias james -keyalg RSA -keystore 
/path/to/james/conf/keystore
+             -->
+                       <keystore>file://conf/keystore</keystore>
+                       <secret>james72laBalle</secret>
+                       
<provider>org.bouncycastle.jce.provider.BouncyCastleProvider</provider>
+               </tls>
+               <connectionLimit>0</connectionLimit>
+               <connectionLimitPerIP>0</connectionLimitPerIP>
+       </imapserver>
+</imapservers>

Added: 
james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/keystore
URL: 
http://svn.apache.org/viewvc/james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/keystore?rev=1719380&view=auto
==============================================================================
Binary files 
james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/keystore
 (added) and 
james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/keystore
 Fri Dec 11 12:32:35 2015 differ

Added: 
james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/lmtpserver.xml
URL: 
http://svn.apache.org/viewvc/james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/lmtpserver.xml?rev=1719380&view=auto
==============================================================================
--- 
james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/lmtpserver.xml
 (added)
+++ 
james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/lmtpserver.xml
 Fri Dec 11 12:32:35 2015
@@ -0,0 +1,41 @@
+<?xml version="1.0"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one   
+  or more contributor license agreements.  See the NOTICE file 
+  distributed with this work for additional information        
+  regarding copyright ownership.  The ASF licenses this file   
+  to you under the Apache License, Version 2.0 (the            
+  "License"); you may not use this file except in compliance   
+  with the License.  You may obtain a copy of the License at   
+                                                               
+    http://www.apache.org/licenses/LICENSE-2.0                 
+                                                               
+  Unless required by applicable law or agreed to in writing,   
+  software distributed under the License is distributed on an  
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       
+  KIND, either express or implied.  See the License for the    
+  specific language governing permissions and limitations      
+  under the License.                                           
+ -->
+
+<lmtpservers>
+
+    <lmtpserver enabled="true">
+        <jmxName>lmtpserver</jmxName>
+        <!-- LMTP should not be reachable from outside your network so bind it 
to loopback-->
+        <bind>127.0.0.1:1024</bind>
+        <connectionBacklog>200</connectionBacklog>
+        <connectiontimeout>1200</connectiontimeout>
+        <!-- Set the maximum simultaneous incoming connections for this 
service -->
+        <connectionLimit>0</connectionLimit>
+        <!-- Set the maximum simultaneous incoming connections per IP for this 
service -->
+        <connectionLimitPerIP>0</connectionLimitPerIP>
+        <!--  This sets the maximum allowed message size (in kilobytes) for 
this -->
+        <!--  LMTP service. If unspecified, the value defaults to 0, which 
means no limit. -->
+        <maxmessagesize>0</maxmessagesize>
+        <handlerchain>
+            <handler class="org.apache.james.lmtpserver.CoreCmdHandlerLoader"/>
+        </handlerchain>
+    </lmtpserver>
+
+</lmtpservers>

Added: 
james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/mailetcontainer.xml
URL: 
http://svn.apache.org/viewvc/james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/mailetcontainer.xml?rev=1719380&view=auto
==============================================================================
--- 
james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/mailetcontainer.xml
 (added)
+++ 
james/project/trunk/server/protocols/jmap-integration-testing/src/test/resources/mailetcontainer.xml
 Fri Dec 11 12:32:35 2015
@@ -0,0 +1,165 @@
+<?xml version="1.0"?>
+
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+ -->
+
+<mailetcontainer enableJmx="false">
+
+    <context>
+        <postmaster>[email protected]</postmaster>
+    </context>
+
+    <spooler>
+        <threads>20</threads>
+    </spooler>
+
+    <processors>
+        <processor state="root" enableJmx="false">
+            <mailet match="All" class="PostmasterAlias"/>
+            <mailet match="RelayLimit=30" class="Null"/>
+            <!-- Hook on [email protected]
+                 Mail send to this address will get interpreted with SIEVE 
Manage -->
+            <mailet match="[email protected]" 
class="ToProcessor">
+                <processor>sieve-manager-check</processor>
+            </mailet>
+            <mailet match="HasMailAttribute=spamChecked" class="ToProcessor">
+                <processor>transport</processor>
+            </mailet>
+            <mailet match="All" class="SetMailAttribute">
+                <spamChecked>true</spamChecked>
+            </mailet>
+            <mailet match="SMTPAuthSuccessful" class="ToProcessor">
+                <processor>transport</processor>
+            </mailet>
+            <mailet match="InSpammerBlacklist=query.bondedsender.org." 
class="ToProcessor">
+                <processor>transport</processor>
+            </mailet>
+            <!-- Check for delivery from a known spam server -->
+            <!-- This set of matchers/mailets redirect all emails from known 
-->
+            <!-- black holes, open relays, and spam servers to the spam 
processor -->
+            <!-- For this set to function properly, the spam processor must be 
configured. -->
+            <mailet match="InSpammerBlacklist=dnsbl.njabl.org." 
class="ToProcessor">
+                <processor>spam</processor>
+                <notice>550 Requested action not taken: rejected - see 
http://njabl.org/</notice>
+            </mailet>
+            <mailet match="All" class="ToProcessor">
+                <processor>transport</processor>
+            </mailet>
+        </processor>
+
+        <processor state="error" enableJmx="false">
+            <mailet match="All" class="Bounce"/>
+            <mailet match="All" class="ToRepository">
+                <repositoryPath>file://var/mail/error/</repositoryPath>
+            </mailet>
+        </processor>
+
+
+        <processor state="transport" enableJmx="false">
+            <mailet match="SMTPAuthSuccessful" class="SetMimeHeader">
+                <name>X-UserIsAuth</name>
+                <value>true</value>
+            </mailet>
+            <mailet 
match="HasMailAttribute=org.apache.james.SMIMECheckSignature" 
class="SetMimeHeader">
+                <name>X-WasSigned</name>
+                <value>true</value>
+            </mailet>
+            <mailet match="All" class="RecipientRewriteTable" />
+            <mailet match="RecipientIsLocal" class="LocalDelivery"/>
+            <mailet match="HostIsLocal" class="ToProcessor">
+                <processor>local-address-error</processor>
+                <notice>550 - Requested action not taken: no such user 
here</notice>
+            </mailet>
+            <mailet match="SMTPAuthSuccessful" class="RemoteDelivery">
+                <outgoingQueue>outgoing</outgoingQueue>
+                <delayTime>5000, 100000, 500000</delayTime>
+                <maxRetries>25</maxRetries>
+                <maxDnsProblemRetries>0</maxDnsProblemRetries>
+                <deliveryThreads>10</deliveryThreads>
+                <sendpartial>true</sendpartial>
+                <bounceProcessor>bounces</bounceProcessor>
+            </mailet>
+            <mailet match="All" class="ToProcessor">
+                <processor>relay-denied</processor>
+            </mailet>
+        </processor>
+
+        <processor state="spam" enableJmx="false">
+            <mailet match="All" class="ToRepository">
+                <repositoryPath>file://var/mail/spam/</repositoryPath>
+            </mailet>
+        </processor>
+
+        <processor state="local-address-error" enableJmx="false">
+            <mailet match="All" class="Bounce">
+                <attachment>none</attachment>
+            </mailet>
+            <mailet match="All" class="ToRepository">
+                <repositoryPath>file://var/mail/address-error/</repositoryPath>
+            </mailet>
+        </processor>
+
+        <processor state="relay-denied" enableJmx="false">
+            <mailet match="All" class="Bounce">
+                <attachment>none</attachment>
+            </mailet>
+            <mailet match="All" class="ToRepository">
+                <repositoryPath>file://var/mail/relay-denied/</repositoryPath>
+                <notice>Warning: You are sending an e-mail to a remote server. 
You must be authentified to perform such an operation</notice>
+            </mailet>
+        </processor>
+
+        <processor state="bounces" enableJmx="false">
+            <mailet match="All" class="DSNBounce">
+                <passThrough>false</passThrough>
+            </mailet>
+        </processor>
+
+        <processor state="sieve-manager-check" enableJmx="false">
+            <!-- Only local users can manage their scripts -->
+            <mailet match="RecipientIsLocal" class="ToProcessor">
+                <processor>sieve-manager</processor>
+            </mailet>
+            <!-- Notify other people about their failure -->
+            <mailet match="All" class="Bounce">
+                <inline>heads</inline>
+                <attachment>none</attachment>
+                <passThrough>false</passThrough>
+                <prefix>[REJECTED]</prefix>
+                <notice>
+                    You can't send messages to configure SIEVE on this serveur 
unless you are the official SIEVE manager.
+                </notice>
+            </mailet>
+            <mailet match="All" class="Null"/>
+        </processor>
+
+        <processor state="sieve-manager">
+            <mailet match="All" class="SetMailAttribute">
+                
<org.apache.james.SMTPAuthUser>true</org.apache.james.SMTPAuthUser>
+            </mailet>
+            <mailet match="All" 
class="org.apache.james.transport.mailets.managesieve.ManageSieveMailet">
+                
<helpURL>file:/root/james-server-app-3.0.0-beta5-SNAPSHOT/conf/managesieve.help.txt</helpURL>
+            </mailet>
+            <mailet match="All" class="Null"/>
+        </processor>
+    </processors>
+
+</mailetcontainer>
+
+




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to