JAMES-2555 Creating a module aggregate: ease JAMES server instantiation

Note that Lucene was out of server base definition causing divergence
between testing and production.


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

Branch: refs/heads/master
Commit: bdfe34f2ca5bcd909dac890c454e510251e37005
Parents: d9ea07b
Author: Benoit Tellier <btell...@linagora.com>
Authored: Mon Oct 15 08:56:08 2018 +0700
Committer: Benoit Tellier <btell...@linagora.com>
Committed: Tue Oct 23 08:43:21 2018 +0700

----------------------------------------------------------------------
 .../src/main/java/org/apache/james/JPAJamesServerMain.java   | 8 +++++---
 .../src/test/java/org/apache/james/JPAJamesServerTest.java   | 3 +--
 .../apache/james/JPAJamesServerWithSqlValidationTest.java    | 3 +--
 .../java/org/apache/james/JamesCapabilitiesServerTest.java   | 2 +-
 4 files changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/bdfe34f2/server/container/guice/jpa-guice/src/main/java/org/apache/james/JPAJamesServerMain.java
----------------------------------------------------------------------
diff --git 
a/server/container/guice/jpa-guice/src/main/java/org/apache/james/JPAJamesServerMain.java
 
b/server/container/guice/jpa-guice/src/main/java/org/apache/james/JPAJamesServerMain.java
index a36a709..f12f7ec 100644
--- 
a/server/container/guice/jpa-guice/src/main/java/org/apache/james/JPAJamesServerMain.java
+++ 
b/server/container/guice/jpa-guice/src/main/java/org/apache/james/JPAJamesServerMain.java
@@ -79,21 +79,23 @@ public class JPAJamesServerMain {
         new JPADataModule(),
         new JPAMailboxModule(),
         new MailboxModule(),
+        new LuceneSearchMailboxModule(),
         new NoJwtModule(),
         new RawPostDequeueDecoratorModule(),
         new SieveJPARepositoryModules(),
         new DefaultEventModule(),
         new SpamAssassinListenerModule());
 
+    public static final Module JPA_MODULE_AGGREGATE = 
Modules.combine(JPA_SERVER_MODULE, PROTOCOLS);
+
     public static void main(String[] args) throws Exception {
         Configuration configuration = Configuration.builder()
             .useWorkingDirectoryEnvProperty()
             .build();
 
         GuiceJamesServer server = 
GuiceJamesServer.forConfiguration(configuration)
-                    .combineWith(JPA_SERVER_MODULE, PROTOCOLS,
-                            new JMXServerModule(),
-                            new LuceneSearchMailboxModule());
+                    .combineWith(JPA_MODULE_AGGREGATE,
+                            new JMXServerModule());
         server.start();
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/bdfe34f2/server/container/guice/jpa-guice/src/test/java/org/apache/james/JPAJamesServerTest.java
----------------------------------------------------------------------
diff --git 
a/server/container/guice/jpa-guice/src/test/java/org/apache/james/JPAJamesServerTest.java
 
b/server/container/guice/jpa-guice/src/test/java/org/apache/james/JPAJamesServerTest.java
index b6647c6..21dc93f 100644
--- 
a/server/container/guice/jpa-guice/src/test/java/org/apache/james/JPAJamesServerTest.java
+++ 
b/server/container/guice/jpa-guice/src/test/java/org/apache/james/JPAJamesServerTest.java
@@ -24,7 +24,6 @@ import static org.assertj.core.api.Assertions.assertThat;
 import org.apache.james.core.quota.QuotaSize;
 import org.apache.james.mailbox.model.SerializableQuotaValue;
 import org.apache.james.modules.QuotaProbesImpl;
-import org.apache.james.modules.mailbox.LuceneSearchMailboxModule;
 import org.apache.james.modules.protocols.ImapGuiceProbe;
 import org.apache.james.modules.protocols.SmtpGuiceProbe;
 import org.apache.james.utils.DataProbeImpl;
@@ -44,7 +43,7 @@ class JPAJamesServerTest implements JamesServerContract {
     @RegisterExtension
     static JamesServerExtension jamesServerExtension = new 
JamesServerExtensionBuilder()
         .server(configuration -> 
GuiceJamesServer.forConfiguration(configuration)
-            .combineWith(JPAJamesServerMain.JPA_SERVER_MODULE, 
JPAJamesServerMain.PROTOCOLS, new LuceneSearchMailboxModule())
+            .combineWith(JPAJamesServerMain.JPA_MODULE_AGGREGATE)
             .overrideWith(new TestJPAConfigurationModule(), 
DOMAIN_LIST_CONFIGURATION_MODULE))
         .build();
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/bdfe34f2/server/container/guice/jpa-guice/src/test/java/org/apache/james/JPAJamesServerWithSqlValidationTest.java
----------------------------------------------------------------------
diff --git 
a/server/container/guice/jpa-guice/src/test/java/org/apache/james/JPAJamesServerWithSqlValidationTest.java
 
b/server/container/guice/jpa-guice/src/test/java/org/apache/james/JPAJamesServerWithSqlValidationTest.java
index 56ee6fa..85132d5 100644
--- 
a/server/container/guice/jpa-guice/src/test/java/org/apache/james/JPAJamesServerWithSqlValidationTest.java
+++ 
b/server/container/guice/jpa-guice/src/test/java/org/apache/james/JPAJamesServerWithSqlValidationTest.java
@@ -19,7 +19,6 @@
 
 package org.apache.james;
 
-import org.apache.james.modules.mailbox.LuceneSearchMailboxModule;
 import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.extension.RegisterExtension;
 
@@ -28,7 +27,7 @@ class JPAJamesServerWithSqlValidationTest extends 
JPAJamesServerTest {
     @RegisterExtension
     static JamesServerExtension jamesServerExtension = new 
JamesServerExtensionBuilder()
         .server(configuration -> 
GuiceJamesServer.forConfiguration(configuration)
-            .combineWith(JPAJamesServerMain.JPA_SERVER_MODULE, 
JPAJamesServerMain.PROTOCOLS, new LuceneSearchMailboxModule())
+            .combineWith(JPAJamesServerMain.JPA_MODULE_AGGREGATE)
             .overrideWith(new TestJPAConfigurationModuleWithSqlValidation(), 
DOMAIN_LIST_CONFIGURATION_MODULE))
         .build();
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/bdfe34f2/server/container/guice/jpa-guice/src/test/java/org/apache/james/JamesCapabilitiesServerTest.java
----------------------------------------------------------------------
diff --git 
a/server/container/guice/jpa-guice/src/test/java/org/apache/james/JamesCapabilitiesServerTest.java
 
b/server/container/guice/jpa-guice/src/test/java/org/apache/james/JamesCapabilitiesServerTest.java
index 49612f7..5876c11 100644
--- 
a/server/container/guice/jpa-guice/src/test/java/org/apache/james/JamesCapabilitiesServerTest.java
+++ 
b/server/container/guice/jpa-guice/src/test/java/org/apache/james/JamesCapabilitiesServerTest.java
@@ -42,7 +42,7 @@ class JamesCapabilitiesServerTest {
     @RegisterExtension
     static JamesServerExtension jamesServerExtension = new 
JamesServerExtensionBuilder()
         .server(configuration -> 
GuiceJamesServer.forConfiguration(configuration)
-            .combineWith(JPAJamesServerMain.JPA_SERVER_MODULE, 
JPAJamesServerMain.PROTOCOLS)
+            .combineWith(JPAJamesServerMain.JPA_MODULE_AGGREGATE)
             .overrideWith(new TestJPAConfigurationModule())
             .overrideWith(binder -> 
binder.bind(MailboxManager.class).toInstance(mailboxManager())))
         .build();


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org
For additional commands, e-mail: server-dev-h...@james.apache.org

Reply via email to