james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adup...@apache.org
Subject [2/2] james-project git commit: JAMES-1864 use @Rule for server start in tests
Date Tue, 22 Nov 2016 08:24:23 GMT
JAMES-1864 use @Rule for server start in tests


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

Branch: refs/heads/master
Commit: 2a30769097da75e3293d6a25aac3dcf41bd6f7a8
Parents: 644ecaa
Author: Matthieu Baechler <matthieu.baechler@linagora.com>
Authored: Mon Nov 21 12:30:38 2016 +0100
Committer: Matthieu Baechler <matthieu.baechler@linagora.com>
Committed: Mon Nov 21 21:04:39 2016 +0100

----------------------------------------------------------------------
 .../apache/james/CassandraJamesServerTest.java  | 41 +------------
 .../org/apache/james/CassandraJmapTestRule.java | 60 ++++++++++++++++++++
 .../java/org/apache/james/JmapJamesServer.java  |  2 +-
 .../org/apache/james/MemoryJamesServerTest.java | 11 +---
 .../org/apache/james/MemoryJmapTestRule.java    | 47 +++++++++++++++
 server/pom.xml                                  |  6 ++
 .../CassandraGetMailboxesMethodTest.java        | 23 ++------
 .../CassandraGetMessageListMethodTest.java      | 23 ++------
 .../CassandraGetVacationResponseTest.java       | 29 +++-------
 .../CassandraJmapAuthenticationTest.java        | 27 +++------
 .../CassandraSetMailboxesMethodTest.java        | 27 +++------
 .../CassandraSetMessagesMethodTest.java         | 28 +++------
 .../CassandraSetVacationResponseTest.java       | 28 +++------
 .../CassandraVacationIntegrationTest.java       | 26 +++------
 .../memory-jmap-integration-testing/pom.xml     |  6 ++
 .../memory/MemoryGetMailboxesMethodTest.java    | 10 +---
 .../memory/MemoryGetMessageListMethodTest.java  | 10 +---
 .../MemoryGetVacationResponseMethodTest.java    | 14 ++---
 .../memory/MemoryJmapAuthenticationTest.java    | 14 ++---
 .../memory/MemorySetMailboxesMethodTest.java    | 10 +---
 .../memory/MemorySetMessagesMethodTest.java     | 10 +---
 .../MemorySetVacationResponseMethodTest.java    | 12 ++--
 .../memory/MemoryVacationIntegrationTest.java   | 10 +---
 .../WebAdminServerIntegrationTest.java          | 21 ++-----
 24 files changed, 212 insertions(+), 283 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/2a307690/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraJamesServerTest.java
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraJamesServerTest.java b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraJamesServerTest.java
index 769b789..41d6b71 100644
--- a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraJamesServerTest.java
+++ b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraJamesServerTest.java
@@ -19,57 +19,20 @@
 
 package org.apache.james;
 
-import org.apache.james.backends.cassandra.CassandraCluster;
-import org.apache.james.backends.cassandra.components.CassandraModule;
-import org.apache.james.jmap.methods.GetMessageListMethod;
-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.junit.Rule;
-import org.junit.rules.RuleChain;
-import org.junit.rules.TemporaryFolder;
-
-import com.datastax.driver.core.Session;
-import com.google.inject.AbstractModule;
-import com.google.inject.Provides;
-import com.google.inject.Singleton;
 
 public class CassandraJamesServerTest extends AbstractJmapJamesServerTest {
 
-    private TemporaryFolder temporaryFolder = new TemporaryFolder();
-    private EmbeddedElasticSearch embeddedElasticSearch = new EmbeddedElasticSearch(temporaryFolder);
-    private CassandraCluster cassandra;
-
     @Rule
-    public RuleChain chain = RuleChain.outerRule(temporaryFolder).around(embeddedElasticSearch);
+    public CassandraJmapTestRule cassandraJmap = new CassandraJmapTestRule();
 
     @Override
     protected JmapJamesServer createJamesServer() {
-        return new JmapJamesServer()
-                .combineWith(CassandraJamesServerMain.cassandraServerModule)
-                .overrideWith(new TestElasticSearchModule(embeddedElasticSearch),
-                        new TestFilesystemModule(temporaryFolder),
-                        new TestJMAPServerModule(GetMessageListMethod.DEFAULT_MAXIMUM_LIMIT),
-                        new AbstractModule() {
-                    
-                    @Override
-                    protected void configure() {
-                    }
-                    
-                    @Provides
-                    @Singleton
-                    Session provideSession(CassandraModule cassandraModule) {
-                        cassandra = CassandraCluster.create(cassandraModule);
-                        return cassandra.getConf();
-                    }
-                });
+        return cassandraJmap.jmapServer();
     }
 
     @Override
     protected void clean() {
-        cassandra.clearAllTables();
     }
-    
 
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/2a307690/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraJmapTestRule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraJmapTestRule.java b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraJmapTestRule.java
new file mode 100644
index 0000000..5951c31
--- /dev/null
+++ b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraJmapTestRule.java
@@ -0,0 +1,60 @@
+/****************************************************************
+ * 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;
+import org.apache.james.backends.cassandra.EmbeddedCassandra;
+import org.apache.james.mailbox.elasticsearch.EmbeddedElasticSearch;
+import org.apache.james.modules.CassandraJmapServerModule;
+import org.junit.rules.RuleChain;
+import org.junit.rules.TemporaryFolder;
+import org.junit.rules.TestRule;
+import org.junit.runner.Description;
+import org.junit.runners.model.Statement;
+
+
+public class CassandraJmapTestRule implements TestRule {
+
+    private TemporaryFolder temporaryFolder = new TemporaryFolder();
+    private EmbeddedElasticSearch embeddedElasticSearch = new EmbeddedElasticSearch(temporaryFolder);
+    private EmbeddedCassandra cassandra = EmbeddedCassandra.createStartServer();
+
+    public RuleChain chain = RuleChain
+        .outerRule(temporaryFolder)
+        .around(embeddedElasticSearch);
+
+    public JmapJamesServer jmapServer() {
+        return new JmapJamesServer()
+                    .combineWith(CassandraJamesServerMain.cassandraServerModule)
+                    .overrideWith(new CassandraJmapServerModule(temporaryFolder, embeddedElasticSearch, cassandra));
+    }
+
+    @Override
+    public Statement apply(Statement base, Description description) {
+        return chain.apply(base, description);
+    }
+    
+
+    public EmbeddedElasticSearch getElasticSearch() {
+        return embeddedElasticSearch;
+    }
+    
+    public void await() {
+        embeddedElasticSearch.awaitForElasticSearch();
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/2a307690/server/container/guice/guice-common/src/main/java/org/apache/james/JmapJamesServer.java
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/JmapJamesServer.java b/server/container/guice/guice-common/src/main/java/org/apache/james/JmapJamesServer.java
index ee66967..9dabe86 100644
--- a/server/container/guice/guice-common/src/main/java/org/apache/james/JmapJamesServer.java
+++ b/server/container/guice/guice-common/src/main/java/org/apache/james/JmapJamesServer.java
@@ -33,7 +33,7 @@ public class JmapJamesServer extends GuiceJamesServerImpl implements GuiceJamesS
         super();
     }
 
-    public JmapJamesServer(Module module) {
+    private JmapJamesServer(Module module) {
         super(module);
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/2a307690/server/container/guice/memory-guice/src/test/java/org/apache/james/MemoryJamesServerTest.java
----------------------------------------------------------------------
diff --git a/server/container/guice/memory-guice/src/test/java/org/apache/james/MemoryJamesServerTest.java b/server/container/guice/memory-guice/src/test/java/org/apache/james/MemoryJamesServerTest.java
index 808a5bf..6da4804 100644
--- a/server/container/guice/memory-guice/src/test/java/org/apache/james/MemoryJamesServerTest.java
+++ b/server/container/guice/memory-guice/src/test/java/org/apache/james/MemoryJamesServerTest.java
@@ -19,23 +19,16 @@
 
 package org.apache.james;
 
-import org.apache.james.jmap.methods.GetMessageListMethod;
-import org.apache.james.modules.TestFilesystemModule;
-import org.apache.james.modules.TestJMAPServerModule;
 import org.junit.Rule;
-import org.junit.rules.TemporaryFolder;
 
 public class MemoryJamesServerTest extends AbstractJmapJamesServerTest {
 
     @Rule
-    public TemporaryFolder temporaryFolder = new TemporaryFolder();
+    public MemoryJmapTestRule memoryJmap = new MemoryJmapTestRule();
 
     @Override
     protected JmapJamesServer createJamesServer() {
-        return new JmapJamesServer()
-                .combineWith(MemoryJamesServerMain.inMemoryServerModule)
-                .overrideWith(new TestFilesystemModule(temporaryFolder),
-                        new TestJMAPServerModule(GetMessageListMethod.DEFAULT_MAXIMUM_LIMIT));
+        return memoryJmap.jmapServer();
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/james-project/blob/2a307690/server/container/guice/memory-guice/src/test/java/org/apache/james/MemoryJmapTestRule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/memory-guice/src/test/java/org/apache/james/MemoryJmapTestRule.java b/server/container/guice/memory-guice/src/test/java/org/apache/james/MemoryJmapTestRule.java
new file mode 100644
index 0000000..fb87792
--- /dev/null
+++ b/server/container/guice/memory-guice/src/test/java/org/apache/james/MemoryJmapTestRule.java
@@ -0,0 +1,47 @@
+/****************************************************************
+ * 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;
+
+import org.apache.james.modules.TestFilesystemModule;
+import org.apache.james.modules.TestJMAPServerModule;
+import org.junit.rules.TemporaryFolder;
+import org.junit.rules.TestRule;
+import org.junit.runner.Description;
+import org.junit.runners.model.Statement;
+
+public class MemoryJmapTestRule implements TestRule {
+
+    private static final int LIMIT_TO_3_MESSAGES = 3;
+    
+    public TemporaryFolder temporaryFolder = new TemporaryFolder();
+
+    public JmapJamesServer jmapServer() {
+        return new JmapJamesServer()
+                .combineWith(MemoryJamesServerMain.inMemoryServerModule)
+                .overrideWith(new TestFilesystemModule(temporaryFolder),
+                        new TestJMAPServerModule(LIMIT_TO_3_MESSAGES));
+    }
+
+    @Override
+    public Statement apply(Statement base, Description description) {
+        return temporaryFolder.apply(base, description);
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/2a307690/server/pom.xml
----------------------------------------------------------------------
diff --git a/server/pom.xml b/server/pom.xml
index f86c171..e0de06a 100644
--- a/server/pom.xml
+++ b/server/pom.xml
@@ -593,6 +593,12 @@
             </dependency>
             <dependency>
                 <groupId>org.apache.james</groupId>
+                <artifactId>james-server-memory-guice</artifactId>
+                <version>${project.version}</version>
+                <type>test-jar</type>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.james</groupId>
                 <artifactId>james-server-jmap</artifactId>
                 <version>${project.version}</version>
             </dependency>

http://git-wip-us.apache.org/repos/asf/james-project/blob/2a307690/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraGetMailboxesMethodTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraGetMailboxesMethodTest.java b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraGetMailboxesMethodTest.java
index 815d2ff..7a6eb13 100644
--- a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraGetMailboxesMethodTest.java
+++ b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraGetMailboxesMethodTest.java
@@ -19,33 +19,20 @@
 
 package org.apache.james.jmap.cassandra;
 
-import org.apache.james.CassandraJamesServerMain;
+import org.apache.james.CassandraJmapTestRule;
 import org.apache.james.JmapJamesServer;
-import org.apache.james.backends.cassandra.EmbeddedCassandra;
 import org.apache.james.jmap.methods.integration.GetMailboxesMethodTest;
-import org.apache.james.mailbox.elasticsearch.EmbeddedElasticSearch;
-import org.apache.james.modules.CassandraJmapServerModule;
 import org.junit.Rule;
-import org.junit.rules.RuleChain;
-import org.junit.rules.TemporaryFolder;
 
 
 public class CassandraGetMailboxesMethodTest extends GetMailboxesMethodTest {
 
-    private TemporaryFolder temporaryFolder = new TemporaryFolder();
-    private EmbeddedElasticSearch embeddedElasticSearch = new EmbeddedElasticSearch(temporaryFolder);
-    private EmbeddedCassandra cassandra = EmbeddedCassandra.createStartServer();
-
-    @Rule
-    public RuleChain chain = RuleChain
-        .outerRule(temporaryFolder)
-        .around(embeddedElasticSearch);
-
+    @Rule 
+    public CassandraJmapTestRule rule = new CassandraJmapTestRule();
+    
     @Override
     protected JmapJamesServer createJmapServer() {
-        return new JmapJamesServer()
-                    .combineWith(CassandraJamesServerMain.cassandraServerModule)
-                    .overrideWith(new CassandraJmapServerModule(temporaryFolder, embeddedElasticSearch, cassandra));
+        return rule.jmapServer();
     }
     
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/2a307690/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraGetMessageListMethodTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraGetMessageListMethodTest.java b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraGetMessageListMethodTest.java
index 4e469dc..8d5aa57 100644
--- a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraGetMessageListMethodTest.java
+++ b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraGetMessageListMethodTest.java
@@ -19,36 +19,23 @@
 
 package org.apache.james.jmap.cassandra;
 
-import org.apache.james.CassandraJamesServerMain;
+import org.apache.james.CassandraJmapTestRule;
 import org.apache.james.JmapJamesServer;
-import org.apache.james.backends.cassandra.EmbeddedCassandra;
 import org.apache.james.jmap.methods.integration.GetMessageListMethodTest;
-import org.apache.james.mailbox.elasticsearch.EmbeddedElasticSearch;
-import org.apache.james.modules.CassandraJmapServerModule;
 import org.junit.Rule;
-import org.junit.rules.RuleChain;
-import org.junit.rules.TemporaryFolder;
 
 public class CassandraGetMessageListMethodTest extends GetMessageListMethodTest {
 
-    private TemporaryFolder temporaryFolder = new TemporaryFolder();
-    private EmbeddedElasticSearch embeddedElasticSearch = new EmbeddedElasticSearch(temporaryFolder);
-    private EmbeddedCassandra cassandra = EmbeddedCassandra.createStartServer();
-
-    @Rule
-    public RuleChain chain = RuleChain
-        .outerRule(temporaryFolder)
-        .around(embeddedElasticSearch);
+    @Rule 
+    public CassandraJmapTestRule rule = new CassandraJmapTestRule();
     
     @Override
     protected JmapJamesServer createJmapServer() {
-        return new JmapJamesServer()
-                .combineWith(CassandraJamesServerMain.cassandraServerModule)
-                .overrideWith(new CassandraJmapServerModule(temporaryFolder, embeddedElasticSearch, cassandra));
+        return rule.jmapServer();
     }
 
     @Override
     protected void await() {
-        embeddedElasticSearch.awaitForElasticSearch();
+        rule.await();
     }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/2a307690/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraGetVacationResponseTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraGetVacationResponseTest.java b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraGetVacationResponseTest.java
index 121ad02..6e52b05 100644
--- a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraGetVacationResponseTest.java
+++ b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraGetVacationResponseTest.java
@@ -19,38 +19,25 @@
 
 package org.apache.james.jmap.cassandra;
 
-import org.apache.james.CassandraJamesServerMain;
+import org.apache.james.CassandraJmapTestRule;
 import org.apache.james.JmapJamesServer;
-import org.apache.james.backends.cassandra.EmbeddedCassandra;
 import org.apache.james.jmap.methods.integration.GetVacationResponseTest;
-import org.apache.james.mailbox.elasticsearch.EmbeddedElasticSearch;
-import org.apache.james.modules.CassandraJmapServerModule;
 import org.apache.james.util.date.ZonedDateTimeProvider;
 import org.junit.Rule;
-import org.junit.rules.RuleChain;
-import org.junit.rules.TemporaryFolder;
 
 public class CassandraGetVacationResponseTest extends GetVacationResponseTest {
 
-    private TemporaryFolder temporaryFolder = new TemporaryFolder();
-    private EmbeddedElasticSearch embeddedElasticSearch = new EmbeddedElasticSearch(temporaryFolder);
-    private EmbeddedCassandra cassandra = EmbeddedCassandra.createStartServer();
-
-    @Rule
-    public RuleChain chain = RuleChain
-        .outerRule(temporaryFolder)
-        .around(embeddedElasticSearch);
-
+    @Rule 
+    public CassandraJmapTestRule rule = new CassandraJmapTestRule();
+    
     @Override
     protected JmapJamesServer createJmapServer(ZonedDateTimeProvider zonedDateTimeProvider) {
-        return new JmapJamesServer()
-                    .combineWith(CassandraJamesServerMain.cassandraServerModule)
-                    .overrideWith(new CassandraJmapServerModule(temporaryFolder, embeddedElasticSearch, cassandra),
-                        binder -> binder.bind(ZonedDateTimeProvider.class).toInstance(zonedDateTimeProvider));
+        return rule.jmapServer()
+                .overrideWith(binder -> binder.bind(ZonedDateTimeProvider.class).toInstance(zonedDateTimeProvider));
     }
-    
+
     @Override
     protected void await() {
-        embeddedElasticSearch.awaitForElasticSearch();
+        rule.await();
     }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/2a307690/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraJmapAuthenticationTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraJmapAuthenticationTest.java b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraJmapAuthenticationTest.java
index d7fff9e..28667a3 100644
--- a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraJmapAuthenticationTest.java
+++ b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraJmapAuthenticationTest.java
@@ -18,35 +18,22 @@
  ****************************************************************/
 package org.apache.james.jmap.cassandra;
 
-import org.apache.james.CassandraJamesServerMain;
+import org.apache.james.CassandraJmapTestRule;
 import org.apache.james.JmapJamesServer;
-import org.apache.james.backends.cassandra.EmbeddedCassandra;
 import org.apache.james.jmap.FixedDateZonedDateTimeProvider;
 import org.apache.james.jmap.JMAPAuthenticationTest;
-import org.apache.james.mailbox.elasticsearch.EmbeddedElasticSearch;
-import org.apache.james.modules.CassandraJmapServerModule;
 import org.apache.james.util.date.ZonedDateTimeProvider;
 import org.junit.Rule;
-import org.junit.rules.RuleChain;
-import org.junit.rules.TemporaryFolder;
 
 public class CassandraJmapAuthenticationTest extends JMAPAuthenticationTest {
 
-    private TemporaryFolder temporaryFolder = new TemporaryFolder();
-    private EmbeddedElasticSearch embeddedElasticSearch = new EmbeddedElasticSearch(temporaryFolder);
-    private EmbeddedCassandra cassandra = EmbeddedCassandra.createStartServer();
-
-    @Rule
-    public RuleChain chain = RuleChain
-        .outerRule(temporaryFolder)
-        .around(embeddedElasticSearch);
-
+    @Rule 
+    public CassandraJmapTestRule rule = new CassandraJmapTestRule();
+    
     @Override
     protected JmapJamesServer createJmapServer(FixedDateZonedDateTimeProvider zonedDateTimeProvider) {
-        return new JmapJamesServer()
-                    .combineWith(CassandraJamesServerMain.cassandraServerModule)
-                    .overrideWith(new CassandraJmapServerModule(temporaryFolder, embeddedElasticSearch, cassandra),
-                            (binder) -> binder.bind(ZonedDateTimeProvider.class).toInstance(zonedDateTimeProvider));
+        return rule.jmapServer()
+                .overrideWith(binder -> binder.bind(ZonedDateTimeProvider.class).toInstance(zonedDateTimeProvider));
     }
-    
+
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/2a307690/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraSetMailboxesMethodTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraSetMailboxesMethodTest.java b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraSetMailboxesMethodTest.java
index eb070cc..10c32e5 100644
--- a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraSetMailboxesMethodTest.java
+++ b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraSetMailboxesMethodTest.java
@@ -19,36 +19,23 @@
 
 package org.apache.james.jmap.cassandra;
 
-import org.apache.james.CassandraJamesServerMain;
+import org.apache.james.CassandraJmapTestRule;
 import org.apache.james.JmapJamesServer;
-import org.apache.james.backends.cassandra.EmbeddedCassandra;
 import org.apache.james.jmap.methods.integration.SetMailboxesMethodTest;
-import org.apache.james.mailbox.elasticsearch.EmbeddedElasticSearch;
-import org.apache.james.modules.CassandraJmapServerModule;
 import org.junit.Rule;
-import org.junit.rules.RuleChain;
-import org.junit.rules.TemporaryFolder;
 
 public class CassandraSetMailboxesMethodTest extends SetMailboxesMethodTest {
 
-    private TemporaryFolder temporaryFolder = new TemporaryFolder();
-    private EmbeddedElasticSearch embeddedElasticSearch = new EmbeddedElasticSearch(temporaryFolder);
-    private EmbeddedCassandra cassandra = EmbeddedCassandra.createStartServer();
-
-    @Rule
-    public RuleChain chain = RuleChain
-        .outerRule(temporaryFolder)
-        .around(embeddedElasticSearch);
-
+    @Rule 
+    public CassandraJmapTestRule rule = new CassandraJmapTestRule();
+    
     @Override
     protected JmapJamesServer createJmapServer() {
-        return new JmapJamesServer()
-                    .combineWith(CassandraJamesServerMain.cassandraServerModule)
-                    .overrideWith(new CassandraJmapServerModule(temporaryFolder, embeddedElasticSearch, cassandra));
+        return rule.jmapServer();
     }
-    
+
     @Override
     protected void await() {
-        embeddedElasticSearch.awaitForElasticSearch();
+        rule.await();
     }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/2a307690/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraSetMessagesMethodTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraSetMessagesMethodTest.java b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraSetMessagesMethodTest.java
index 2be70db..ba2e4fe 100644
--- a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraSetMessagesMethodTest.java
+++ b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraSetMessagesMethodTest.java
@@ -19,36 +19,24 @@
 
 package org.apache.james.jmap.cassandra;
 
-import org.apache.james.CassandraJamesServerMain;
+import org.apache.james.CassandraJmapTestRule;
 import org.apache.james.JmapJamesServer;
-import org.apache.james.backends.cassandra.EmbeddedCassandra;
 import org.apache.james.jmap.methods.integration.SetMessagesMethodTest;
-import org.apache.james.mailbox.elasticsearch.EmbeddedElasticSearch;
-import org.apache.james.modules.CassandraJmapServerModule;
 import org.junit.Rule;
-import org.junit.rules.RuleChain;
-import org.junit.rules.TemporaryFolder;
 
 public class CassandraSetMessagesMethodTest extends SetMessagesMethodTest {
 
-    private TemporaryFolder temporaryFolder = new TemporaryFolder();
-    private EmbeddedElasticSearch embeddedElasticSearch = new EmbeddedElasticSearch(temporaryFolder);
-    private EmbeddedCassandra cassandra = EmbeddedCassandra.createStartServer();
-
-    @Rule
-    public RuleChain chain = RuleChain
-        .outerRule(temporaryFolder)
-        .around(embeddedElasticSearch);
-
+    @Rule 
+    public CassandraJmapTestRule rule = new CassandraJmapTestRule();
+    
     @Override
     protected JmapJamesServer createJmapServer() {
-        return new JmapJamesServer()
-                    .combineWith(CassandraJamesServerMain.cassandraServerModule)
-                    .overrideWith(new CassandraJmapServerModule(temporaryFolder, embeddedElasticSearch, cassandra));
+        return rule.jmapServer();
     }
-    
+
     @Override
     protected void await() {
-        embeddedElasticSearch.awaitForElasticSearch();
+        rule.await();
     }
+    
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/2a307690/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraSetVacationResponseTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraSetVacationResponseTest.java b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraSetVacationResponseTest.java
index af3e629..463971f 100644
--- a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraSetVacationResponseTest.java
+++ b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraSetVacationResponseTest.java
@@ -19,36 +19,24 @@
 
 package org.apache.james.jmap.cassandra;
 
-import org.apache.james.CassandraJamesServerMain;
+import org.apache.james.CassandraJmapTestRule;
 import org.apache.james.JmapJamesServer;
-import org.apache.james.backends.cassandra.EmbeddedCassandra;
 import org.apache.james.jmap.methods.integration.SetVacationResponseTest;
-import org.apache.james.mailbox.elasticsearch.EmbeddedElasticSearch;
-import org.apache.james.modules.CassandraJmapServerModule;
 import org.junit.Rule;
-import org.junit.rules.RuleChain;
-import org.junit.rules.TemporaryFolder;
 
 public class CassandraSetVacationResponseTest extends SetVacationResponseTest {
 
-    private TemporaryFolder temporaryFolder = new TemporaryFolder();
-    private EmbeddedElasticSearch embeddedElasticSearch = new EmbeddedElasticSearch(temporaryFolder);
-    private EmbeddedCassandra cassandra = EmbeddedCassandra.createStartServer();
-
-    @Rule
-    public RuleChain chain = RuleChain
-        .outerRule(temporaryFolder)
-        .around(embeddedElasticSearch);
-
+    @Rule 
+    public CassandraJmapTestRule rule = new CassandraJmapTestRule();
+    
     @Override
     protected JmapJamesServer createJmapServer() {
-        return new JmapJamesServer()
-                    .combineWith(CassandraJamesServerMain.cassandraServerModule)
-                    .overrideWith(new CassandraJmapServerModule(temporaryFolder, embeddedElasticSearch, cassandra));
+        return rule.jmapServer();
     }
-    
+
     @Override
     protected void await() {
-        embeddedElasticSearch.awaitForElasticSearch();
+        rule.await();
     }
+    
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/2a307690/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraVacationIntegrationTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraVacationIntegrationTest.java b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraVacationIntegrationTest.java
index 91ea2c3..c16c96d 100644
--- a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraVacationIntegrationTest.java
+++ b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraVacationIntegrationTest.java
@@ -19,37 +19,25 @@
 
 package org.apache.james.jmap.cassandra;
 
-import org.apache.james.CassandraJamesServerMain;
+import org.apache.james.CassandraJmapTestRule;
 import org.apache.james.JmapJamesServer;
-import org.apache.james.backends.cassandra.EmbeddedCassandra;
 import org.apache.james.jmap.VacationIntegrationTest;
-import org.apache.james.mailbox.elasticsearch.EmbeddedElasticSearch;
-import org.apache.james.modules.CassandraJmapServerModule;
 import org.junit.Rule;
-import org.junit.rules.RuleChain;
-import org.junit.rules.TemporaryFolder;
 
 public class CassandraVacationIntegrationTest extends VacationIntegrationTest {
 
 
-    private TemporaryFolder temporaryFolder = new TemporaryFolder();
-    private EmbeddedElasticSearch embeddedElasticSearch = new EmbeddedElasticSearch(temporaryFolder);
-    private EmbeddedCassandra cassandra = EmbeddedCassandra.createStartServer();
-
-    @Rule
-    public RuleChain chain = RuleChain
-        .outerRule(temporaryFolder)
-        .around(embeddedElasticSearch);
-
+    @Rule 
+    public CassandraJmapTestRule rule = new CassandraJmapTestRule();
+    
     @Override
     protected JmapJamesServer createJmapServer() {
-        return new JmapJamesServer()
-            .combineWith(CassandraJamesServerMain.cassandraServerModule)
-            .overrideWith(new CassandraJmapServerModule(temporaryFolder, embeddedElasticSearch, cassandra));
+        return rule.jmapServer();
     }
 
     @Override
     protected void await() {
-        embeddedElasticSearch.awaitForElasticSearch();
+        rule.await();
     }
+    
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/2a307690/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/pom.xml
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/pom.xml b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/pom.xml
index 1019d01..0885af5 100644
--- a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/pom.xml
+++ b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/pom.xml
@@ -166,6 +166,12 @@
                     <scope>test</scope>
                 </dependency>
                 <dependency>
+                    <groupId>org.apache.james</groupId>
+                    <artifactId>james-server-memory-guice</artifactId>
+                    <type>test-jar</type>
+                    <scope>test</scope>
+                </dependency>
+                <dependency>
                     <groupId>com.jayway.restassured</groupId>
                     <artifactId>rest-assured</artifactId>
                     <scope>test</scope>

http://git-wip-us.apache.org/repos/asf/james-project/blob/2a307690/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryGetMailboxesMethodTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryGetMailboxesMethodTest.java b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryGetMailboxesMethodTest.java
index 02935bb..02d3185 100644
--- a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryGetMailboxesMethodTest.java
+++ b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryGetMailboxesMethodTest.java
@@ -20,22 +20,18 @@
 package org.apache.james.jmap.memory;
 
 import org.apache.james.JmapJamesServer;
-import org.apache.james.MemoryJamesServerMain;
+import org.apache.james.MemoryJmapTestRule;
 import org.apache.james.jmap.methods.integration.GetMailboxesMethodTest;
-import org.apache.james.jmap.servers.MemoryJmapServerModule;
 import org.junit.Rule;
-import org.junit.rules.TemporaryFolder;
 
 public class MemoryGetMailboxesMethodTest extends GetMailboxesMethodTest {
 
     @Rule
-    public TemporaryFolder temporaryFolder = new TemporaryFolder();
+    public MemoryJmapTestRule memoryJmap = new MemoryJmapTestRule();
 
     @Override
     protected JmapJamesServer createJmapServer() {
-        return new JmapJamesServer()
-                .combineWith(MemoryJamesServerMain.inMemoryServerModule)
-                .overrideWith(new MemoryJmapServerModule(temporaryFolder));
+        return memoryJmap.jmapServer();
     }
     
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/2a307690/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryGetMessageListMethodTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryGetMessageListMethodTest.java b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryGetMessageListMethodTest.java
index b07f0c2..c40fe5c 100644
--- a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryGetMessageListMethodTest.java
+++ b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryGetMessageListMethodTest.java
@@ -20,22 +20,18 @@
 package org.apache.james.jmap.memory;
 
 import org.apache.james.JmapJamesServer;
-import org.apache.james.MemoryJamesServerMain;
+import org.apache.james.MemoryJmapTestRule;
 import org.apache.james.jmap.methods.integration.GetMessageListMethodTest;
-import org.apache.james.jmap.servers.MemoryJmapServerModule;
 import org.junit.Rule;
-import org.junit.rules.TemporaryFolder;
 
 public class MemoryGetMessageListMethodTest extends GetMessageListMethodTest {
 
     @Rule
-    public TemporaryFolder temporaryFolder = new TemporaryFolder();
+    public MemoryJmapTestRule memoryJmap = new MemoryJmapTestRule();
 
     @Override
     protected JmapJamesServer createJmapServer() {
-        return new JmapJamesServer()
-                    .combineWith(MemoryJamesServerMain.inMemoryServerModule)
-                    .overrideWith(new MemoryJmapServerModule(temporaryFolder));
+        return memoryJmap.jmapServer();
     }
     
     @Override

http://git-wip-us.apache.org/repos/asf/james-project/blob/2a307690/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryGetVacationResponseMethodTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryGetVacationResponseMethodTest.java b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryGetVacationResponseMethodTest.java
index 464ad36..70348f4 100644
--- a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryGetVacationResponseMethodTest.java
+++ b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryGetVacationResponseMethodTest.java
@@ -20,24 +20,20 @@
 package org.apache.james.jmap.memory;
 
 import org.apache.james.JmapJamesServer;
-import org.apache.james.MemoryJamesServerMain;
+import org.apache.james.MemoryJmapTestRule;
 import org.apache.james.jmap.methods.integration.GetVacationResponseTest;
-import org.apache.james.jmap.servers.MemoryJmapServerModule;
 import org.apache.james.util.date.ZonedDateTimeProvider;
 import org.junit.Rule;
-import org.junit.rules.TemporaryFolder;
 
 public class MemoryGetVacationResponseMethodTest extends GetVacationResponseTest {
-
+    
     @Rule
-    public TemporaryFolder temporaryFolder = new TemporaryFolder();
+    public MemoryJmapTestRule memoryJmap = new MemoryJmapTestRule();
 
     @Override
     protected JmapJamesServer createJmapServer(ZonedDateTimeProvider zonedDateTimeProvider) {
-        return new JmapJamesServer()
-                    .combineWith(MemoryJamesServerMain.inMemoryServerModule)
-                    .overrideWith(new MemoryJmapServerModule(temporaryFolder),
-                        binder -> binder.bind(ZonedDateTimeProvider.class).toInstance(zonedDateTimeProvider));
+        return memoryJmap.jmapServer()
+                    .overrideWith(binder -> binder.bind(ZonedDateTimeProvider.class).toInstance(zonedDateTimeProvider));
     }
     
     @Override

http://git-wip-us.apache.org/repos/asf/james-project/blob/2a307690/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryJmapAuthenticationTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryJmapAuthenticationTest.java b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryJmapAuthenticationTest.java
index d687c69..e561a09 100644
--- a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryJmapAuthenticationTest.java
+++ b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryJmapAuthenticationTest.java
@@ -20,24 +20,20 @@
 package org.apache.james.jmap.memory;
 
 import org.apache.james.JmapJamesServer;
-import org.apache.james.MemoryJamesServerMain;
+import org.apache.james.MemoryJmapTestRule;
 import org.apache.james.jmap.FixedDateZonedDateTimeProvider;
 import org.apache.james.jmap.JMAPAuthenticationTest;
-import org.apache.james.jmap.servers.MemoryJmapServerModule;
 import org.apache.james.util.date.ZonedDateTimeProvider;
 import org.junit.Rule;
-import org.junit.rules.TemporaryFolder;
 
 public class MemoryJmapAuthenticationTest extends JMAPAuthenticationTest {
-
+    
     @Rule
-    public TemporaryFolder temporaryFolder = new TemporaryFolder();
+    public MemoryJmapTestRule memoryJmap = new MemoryJmapTestRule();
 
     @Override
     protected JmapJamesServer createJmapServer(FixedDateZonedDateTimeProvider zonedDateTimeProvider) {
-        return new JmapJamesServer()
-                .combineWith(MemoryJamesServerMain.inMemoryServerModule)
-                .overrideWith(new MemoryJmapServerModule(temporaryFolder),
-                             (binder) -> binder.bind(ZonedDateTimeProvider.class).toInstance(zonedDateTimeProvider));
+        return memoryJmap.jmapServer()
+                .overrideWith((binder) -> binder.bind(ZonedDateTimeProvider.class).toInstance(zonedDateTimeProvider));
     }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/2a307690/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemorySetMailboxesMethodTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemorySetMailboxesMethodTest.java b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemorySetMailboxesMethodTest.java
index 272db3b..ce5ff4f 100644
--- a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemorySetMailboxesMethodTest.java
+++ b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemorySetMailboxesMethodTest.java
@@ -20,22 +20,18 @@
 package org.apache.james.jmap.memory;
 
 import org.apache.james.JmapJamesServer;
-import org.apache.james.MemoryJamesServerMain;
+import org.apache.james.MemoryJmapTestRule;
 import org.apache.james.jmap.methods.integration.SetMailboxesMethodTest;
-import org.apache.james.jmap.servers.MemoryJmapServerModule;
 import org.junit.Rule;
-import org.junit.rules.TemporaryFolder;
 
 public class MemorySetMailboxesMethodTest extends SetMailboxesMethodTest {
 
     @Rule
-    public TemporaryFolder temporaryFolder = new TemporaryFolder();
+    public MemoryJmapTestRule memoryJmap = new MemoryJmapTestRule();
 
     @Override
     protected JmapJamesServer createJmapServer() {
-        return new JmapJamesServer()
-                    .combineWith(MemoryJamesServerMain.inMemoryServerModule)
-                    .overrideWith(new MemoryJmapServerModule(temporaryFolder));
+        return memoryJmap.jmapServer();
     }
     
     @Override

http://git-wip-us.apache.org/repos/asf/james-project/blob/2a307690/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemorySetMessagesMethodTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemorySetMessagesMethodTest.java b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemorySetMessagesMethodTest.java
index 38814d3..f859b40 100644
--- a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemorySetMessagesMethodTest.java
+++ b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemorySetMessagesMethodTest.java
@@ -20,22 +20,18 @@
 package org.apache.james.jmap.memory;
 
 import org.apache.james.JmapJamesServer;
-import org.apache.james.MemoryJamesServerMain;
+import org.apache.james.MemoryJmapTestRule;
 import org.apache.james.jmap.methods.integration.SetMessagesMethodTest;
-import org.apache.james.jmap.servers.MemoryJmapServerModule;
 import org.junit.Rule;
-import org.junit.rules.TemporaryFolder;
 
 public class MemorySetMessagesMethodTest extends SetMessagesMethodTest {
 
     @Rule
-    public TemporaryFolder temporaryFolder = new TemporaryFolder();
+    public MemoryJmapTestRule memoryJmap = new MemoryJmapTestRule();
 
     @Override
     protected JmapJamesServer createJmapServer() {
-        return new JmapJamesServer()
-                    .combineWith(MemoryJamesServerMain.inMemoryServerModule)
-                    .overrideWith(new MemoryJmapServerModule(temporaryFolder));
+        return memoryJmap.jmapServer();
     }
     
     @Override

http://git-wip-us.apache.org/repos/asf/james-project/blob/2a307690/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemorySetVacationResponseMethodTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemorySetVacationResponseMethodTest.java b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemorySetVacationResponseMethodTest.java
index 0c4f45f..bca1a90 100644
--- a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemorySetVacationResponseMethodTest.java
+++ b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemorySetVacationResponseMethodTest.java
@@ -20,22 +20,18 @@
 package org.apache.james.jmap.memory;
 
 import org.apache.james.JmapJamesServer;
-import org.apache.james.MemoryJamesServerMain;
+import org.apache.james.MemoryJmapTestRule;
 import org.apache.james.jmap.methods.integration.SetVacationResponseTest;
-import org.apache.james.jmap.servers.MemoryJmapServerModule;
 import org.junit.Rule;
-import org.junit.rules.TemporaryFolder;
 
 public class MemorySetVacationResponseMethodTest extends SetVacationResponseTest {
-
+    
     @Rule
-    public TemporaryFolder temporaryFolder = new TemporaryFolder();
+    public MemoryJmapTestRule memoryJmap = new MemoryJmapTestRule();
 
     @Override
     protected JmapJamesServer createJmapServer() {
-        return new JmapJamesServer()
-                    .combineWith(MemoryJamesServerMain.inMemoryServerModule)
-                    .overrideWith(new MemoryJmapServerModule(temporaryFolder));
+        return memoryJmap.jmapServer();
     }
     
     @Override

http://git-wip-us.apache.org/repos/asf/james-project/blob/2a307690/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryVacationIntegrationTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryVacationIntegrationTest.java b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryVacationIntegrationTest.java
index 42750e3..df5b1f7 100644
--- a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryVacationIntegrationTest.java
+++ b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryVacationIntegrationTest.java
@@ -20,22 +20,18 @@
 package org.apache.james.jmap.memory;
 
 import org.apache.james.JmapJamesServer;
-import org.apache.james.MemoryJamesServerMain;
+import org.apache.james.MemoryJmapTestRule;
 import org.apache.james.jmap.VacationIntegrationTest;
-import org.apache.james.jmap.servers.MemoryJmapServerModule;
 import org.junit.Rule;
-import org.junit.rules.TemporaryFolder;
 
 public class MemoryVacationIntegrationTest extends VacationIntegrationTest {
 
     @Rule
-    public TemporaryFolder temporaryFolder = new TemporaryFolder();
+    public MemoryJmapTestRule memoryJmap = new MemoryJmapTestRule();
 
     @Override
     protected JmapJamesServer createJmapServer() {
-        return new JmapJamesServer()
-            .combineWith(MemoryJamesServerMain.inMemoryServerModule)
-            .overrideWith(new MemoryJmapServerModule(temporaryFolder));
+        return memoryJmap.jmapServer();
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/james-project/blob/2a307690/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/WebAdminServerIntegrationTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/WebAdminServerIntegrationTest.java b/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/WebAdminServerIntegrationTest.java
index cc6264a..baebd9c 100644
--- a/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/WebAdminServerIntegrationTest.java
+++ b/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/WebAdminServerIntegrationTest.java
@@ -28,11 +28,8 @@ import static org.hamcrest.Matchers.is;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
-import org.apache.james.CassandraJamesServerMain;
+import org.apache.james.CassandraJmapTestRule;
 import org.apache.james.JmapJamesServer;
-import org.apache.james.backends.cassandra.EmbeddedCassandra;
-import org.apache.james.mailbox.elasticsearch.EmbeddedElasticSearch;
-import org.apache.james.modules.CassandraJmapServerModule;
 import org.apache.james.webadmin.routes.DomainRoutes;
 import org.apache.james.webadmin.routes.UserMailboxesRoutes;
 import org.apache.james.webadmin.routes.UserRoutes;
@@ -40,8 +37,6 @@ 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;
@@ -57,23 +52,15 @@ public class WebAdminServerIntegrationTest {
     public static final String MAILBOX = "mailbox";
     public static final String SPECIFIC_MAILBOX = SPECIFIC_USER + SEPARATOR + UserMailboxesRoutes.MAILBOXES + SEPARATOR + MAILBOX;
 
-    private TemporaryFolder temporaryFolder = new TemporaryFolder();
-    private EmbeddedElasticSearch embeddedElasticSearch = new EmbeddedElasticSearch(temporaryFolder);
-    private EmbeddedCassandra cassandra = EmbeddedCassandra.createStartServer();
-
     @Rule
-    public RuleChain chain = RuleChain
-        .outerRule(temporaryFolder)
-        .around(embeddedElasticSearch);
+    public CassandraJmapTestRule cassandraJmapTestRule = new CassandraJmapTestRule();
 
     private JmapJamesServer guiceJamesServer;
 
     @Before
     public void setUp() throws Exception {
-        guiceJamesServer = new JmapJamesServer()
-            .combineWith(CassandraJamesServerMain.cassandraServerModule)
-            .overrideWith(new CassandraJmapServerModule(temporaryFolder, embeddedElasticSearch, cassandra),
-                new WebAdminConfigurationModule());
+        guiceJamesServer = cassandraJmapTestRule.jmapServer()
+                .overrideWith(new WebAdminConfigurationModule());
         guiceJamesServer.start();
 
         RestAssured.requestSpecification = new RequestSpecBuilder()


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