You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by ma...@apache.org on 2018/06/06 07:01:09 UTC
[15/15] james-project git commit: JAMES-2406 Allow running a James
server that only does SMTP
JAMES-2406 Allow running a James server that only does SMTP
We should use this server as part of MPT SMTP 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/d7d6070e
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/d7d6070e
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/d7d6070e
Branch: refs/heads/master
Commit: d7d6070ea837ad3c562c8ae5fe50322ab40f4657
Parents: 825ca96
Author: benwa <bt...@linagora.com>
Authored: Thu May 31 12:01:30 2018 +0700
Committer: Matthieu Baechler <ma...@apache.org>
Committed: Wed Jun 6 09:00:10 2018 +0200
----------------------------------------------------------------------
mpt/impl/smtp/cassandra/pom.xml | 12 ----
.../smtp/host/CassandraJamesSmtpHostSystem.java | 28 ++++++---
.../cassandra/src/test/resources/imapserver.xml | 54 ----------------
.../cassandra/src/test/resources/lmtpserver.xml | 41 ------------
.../src/test/resources/mailetcontainer.xml | 12 ----
.../src/test/resources/managesieveserver.xml | 65 --------------------
.../cassandra/src/test/resources/pop3server.xml | 42 -------------
.../apache/james/CassandraJamesServerMain.java | 15 +++--
.../modules/mailbox/CassandraMailboxModule.java | 2 -
.../mailbox/CassandraObjectStoreModule.java | 5 ++
.../modules/CassandraJmapServerModule.java | 17 +----
.../james/modules/CassandraTestModule.java | 55 +++++++++++++++++
12 files changed, 92 insertions(+), 256 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/james-project/blob/d7d6070e/mpt/impl/smtp/cassandra/pom.xml
----------------------------------------------------------------------
diff --git a/mpt/impl/smtp/cassandra/pom.xml b/mpt/impl/smtp/cassandra/pom.xml
index e9d82fd..be11a48 100644
--- a/mpt/impl/smtp/cassandra/pom.xml
+++ b/mpt/impl/smtp/cassandra/pom.xml
@@ -39,18 +39,6 @@
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
- <artifactId>apache-james-backends-es</artifactId>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>apache-james-mailbox-tika</artifactId>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
<artifactId>apache-james-mpt-core</artifactId>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/james-project/blob/d7d6070e/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/host/CassandraJamesSmtpHostSystem.java
----------------------------------------------------------------------
diff --git a/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/host/CassandraJamesSmtpHostSystem.java b/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/host/CassandraJamesSmtpHostSystem.java
index 26a68fc..e4cd9fa 100644
--- a/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/host/CassandraJamesSmtpHostSystem.java
+++ b/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/host/CassandraJamesSmtpHostSystem.java
@@ -21,28 +21,36 @@ package org.apache.james.mpt.smtp.host;
import java.util.Iterator;
+import org.apache.commons.configuration.DefaultConfigurationBuilder;
import org.apache.james.CassandraJamesServerMain;
import org.apache.james.GuiceJamesServer;
-import org.apache.james.backends.es.EmbeddedElasticSearch;
import org.apache.james.dnsservice.api.DNSService;
import org.apache.james.dnsservice.api.InMemoryDNSService;
-import org.apache.james.mailbox.elasticsearch.MailboxElasticSearchConstants;
-import org.apache.james.modules.CassandraJmapServerModule;
+import org.apache.james.modules.CassandraTestModule;
import org.apache.james.modules.protocols.ProtocolHandlerModule;
+import org.apache.james.modules.protocols.SMTPServerModule;
+import org.apache.james.modules.server.CamelMailetContainerModule;
import org.apache.james.mpt.monitor.SystemLoggingMonitor;
import org.apache.james.mpt.session.ExternalSessionFactory;
import org.apache.james.mpt.smtp.SmtpHostSystem;
+import org.apache.james.queue.api.MailQueueItemDecoratorFactory;
+import org.apache.james.queue.api.RawMailQueueItemDecoratorFactory;
import org.apache.james.server.core.configuration.Configuration;
import org.apache.james.utils.DataProbeImpl;
import org.junit.rules.TemporaryFolder;
import com.google.common.base.Preconditions;
import com.google.common.base.Splitter;
+import com.google.inject.Module;
+import com.google.inject.util.Modules;
public class CassandraJamesSmtpHostSystem extends ExternalSessionFactory implements SmtpHostSystem {
+ private static final Module SMTP_PROTOCOL_MODULE = Modules.combine(
+ new ProtocolHandlerModule(),
+ new SMTPServerModule());
+
private TemporaryFolder folder;
- private EmbeddedElasticSearch embeddedElasticSearch;
private GuiceJamesServer jamesServer;
private InMemoryDNSService inMemoryDNSService;
@@ -84,8 +92,6 @@ public class CassandraJamesSmtpHostSystem extends ExternalSessionFactory impleme
inMemoryDNSService = new InMemoryDNSService();
folder = new TemporaryFolder();
folder.create();
- embeddedElasticSearch = new EmbeddedElasticSearch(folder.getRoot().toPath(), MailboxElasticSearchConstants.DEFAULT_MAILBOX_INDEX);
- embeddedElasticSearch.before();
jamesServer = createJamesServer();
jamesServer.start();
}
@@ -93,7 +99,6 @@ public class CassandraJamesSmtpHostSystem extends ExternalSessionFactory impleme
@Override
public void afterTest() {
jamesServer.stop();
- embeddedElasticSearch.after();
folder.delete();
}
@@ -109,8 +114,13 @@ public class CassandraJamesSmtpHostSystem extends ExternalSessionFactory impleme
.build();
return new GuiceJamesServer(configuration)
- .combineWith(CassandraJamesServerMain.CASSANDRA_SERVER_MODULE, CassandraJamesServerMain.PROTOCOLS, new ProtocolHandlerModule())
- .overrideWith(new CassandraJmapServerModule(embeddedElasticSearch, cassandraHost, cassandraPort),
+ .combineWith(
+ CassandraJamesServerMain.CASSANDRA_SERVER_CORE_MODULE,
+ SMTP_PROTOCOL_MODULE,
+ binder -> binder.bind(MailQueueItemDecoratorFactory.class).to(RawMailQueueItemDecoratorFactory.class),
+ binder -> binder.bind(CamelMailetContainerModule.DefaultProcessorsConfigurationSupplier.class)
+ .toInstance(DefaultConfigurationBuilder::new))
+ .overrideWith(new CassandraTestModule(cassandraHost, cassandraPort),
(binder) -> binder.bind(DNSService.class).toInstance(inMemoryDNSService));
}
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/d7d6070e/mpt/impl/smtp/cassandra/src/test/resources/imapserver.xml
----------------------------------------------------------------------
diff --git a/mpt/impl/smtp/cassandra/src/test/resources/imapserver.xml b/mpt/impl/smtp/cassandra/src/test/resources/imapserver.xml
deleted file mode 100644
index 28ce44c..0000000
--- a/mpt/impl/smtp/cassandra/src/test/resources/imapserver.xml
+++ /dev/null
@@ -1,54 +0,0 @@
-<?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>
http://git-wip-us.apache.org/repos/asf/james-project/blob/d7d6070e/mpt/impl/smtp/cassandra/src/test/resources/lmtpserver.xml
----------------------------------------------------------------------
diff --git a/mpt/impl/smtp/cassandra/src/test/resources/lmtpserver.xml b/mpt/impl/smtp/cassandra/src/test/resources/lmtpserver.xml
deleted file mode 100644
index 5c4a9c7..0000000
--- a/mpt/impl/smtp/cassandra/src/test/resources/lmtpserver.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?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>
http://git-wip-us.apache.org/repos/asf/james-project/blob/d7d6070e/mpt/impl/smtp/cassandra/src/test/resources/mailetcontainer.xml
----------------------------------------------------------------------
diff --git a/mpt/impl/smtp/cassandra/src/test/resources/mailetcontainer.xml b/mpt/impl/smtp/cassandra/src/test/resources/mailetcontainer.xml
index 5aa2982..1a86820 100644
--- a/mpt/impl/smtp/cassandra/src/test/resources/mailetcontainer.xml
+++ b/mpt/impl/smtp/cassandra/src/test/resources/mailetcontainer.xml
@@ -63,7 +63,6 @@
<mailet match="All" class="RemoveMimeHeader">
<name>bcc</name>
</mailet>
- <mailet match="RecipientIsLocal" class="org.apache.james.jmap.mailet.VacationMailet"/>
<mailet match="All" class="RecipientRewriteTable">
<errorProcessor>rrt-error</errorProcessor>
</mailet>
@@ -83,17 +82,6 @@
</mailet>
</processor>
- <processor state="local-address-error" enableJmx="true">
- <mailet match="All" class="Bounce">
- <attachment>none</attachment>
- <passThrough>true</passThrough>
- <debug>true</debug>
- </mailet>
- <mailet match="All" class="ToRepository">
- <repositoryPath>file://var/mail/address-error/</repositoryPath>
- </mailet>
- </processor>
-
<processor state="relay-denied" enableJmx="true">
<mailet match="All" class="Bounce">
<attachment>none</attachment>
http://git-wip-us.apache.org/repos/asf/james-project/blob/d7d6070e/mpt/impl/smtp/cassandra/src/test/resources/managesieveserver.xml
----------------------------------------------------------------------
diff --git a/mpt/impl/smtp/cassandra/src/test/resources/managesieveserver.xml b/mpt/impl/smtp/cassandra/src/test/resources/managesieveserver.xml
deleted file mode 100644
index ec57e09..0000000
--- a/mpt/impl/smtp/cassandra/src/test/resources/managesieveserver.xml
+++ /dev/null
@@ -1,65 +0,0 @@
-<?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.
- -->
-
-<!--
- This template file can be used as example for James Server configuration
- DO NOT USE IT AS SUCH AND ADAPT IT TO YOUR NEEDS
--->
-
-<!-- See http://james.apache.org/server/3/config.html for usage -->
-
-<managesieveservers>
-
- <managesieveserver enabled="true">
-
- <jmxName>managesieveserver</jmxName>
-
- <bind>0.0.0.0:4190</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>
- <!-- The algorithm is optional and only needs to be specified when using something other
- than the Sun JCE provider - You could use IbmX509 with IBM Java runtime. -->
- <algorithm>SunX509</algorithm>
- </tls>
-
- <!-- connection timeout in secconds -->
- <connectiontimeout>360</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>
- <maxmessagesize>0</maxmessagesize>
- <addressBracketsEnforcement>true</addressBracketsEnforcement>
-
- </managesieveserver>
-
-</managesieveservers>
-
-
http://git-wip-us.apache.org/repos/asf/james-project/blob/d7d6070e/mpt/impl/smtp/cassandra/src/test/resources/pop3server.xml
----------------------------------------------------------------------
diff --git a/mpt/impl/smtp/cassandra/src/test/resources/pop3server.xml b/mpt/impl/smtp/cassandra/src/test/resources/pop3server.xml
deleted file mode 100644
index e4187da..0000000
--- a/mpt/impl/smtp/cassandra/src/test/resources/pop3server.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?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.
- -->
-
-
-<pop3servers>
- <pop3server enabled="true">
- <jmxName>pop3server</jmxName>
- <bind>0.0.0.0:1110</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>
- <connectiontimeout>1200</connectiontimeout>
- <connectionLimit>0</connectionLimit>
- <connectionLimitPerIP>0</connectionLimitPerIP>
- <handlerchain>
- <handler class="org.apache.james.pop3server.core.CoreCmdHandlerLoader"/>
- </handlerchain>
- </pop3server>
-</pop3servers>
http://git-wip-us.apache.org/repos/asf/james-project/blob/d7d6070e/server/container/guice/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java
index eac26ac..762ad8a 100644
--- a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java
+++ b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java
@@ -28,6 +28,7 @@ import org.apache.james.modules.data.CassandraSieveRepositoryModule;
import org.apache.james.modules.data.CassandraUsersRepositoryModule;
import org.apache.james.modules.eventstore.CassandraEventStoreModule;
import org.apache.james.modules.mailbox.CassandraMailboxModule;
+import org.apache.james.modules.mailbox.CassandraObjectStoreModule;
import org.apache.james.modules.mailbox.CassandraQuotaMailingModule;
import org.apache.james.modules.mailbox.CassandraSessionModule;
import org.apache.james.modules.mailbox.ElasticSearchMailboxModule;
@@ -68,6 +69,7 @@ public class CassandraJamesServerMain {
new WebAdminServerModule());
public static final Module PROTOCOLS = Modules.combine(
+ new CassandraJmapModule(),
new IMAPServerModule(),
new LMTPServerModule(),
new ManageSieveServerModule(),
@@ -80,18 +82,20 @@ public class CassandraJamesServerMain {
public static final Module PLUGINS = Modules.combine(
new CassandraQuotaMailingModule());
- public static final Module CASSANDRA_SERVER_MODULE = Modules.combine(
+ public static final Module CASSANDRA_SERVER_CORE_MODULE = Modules.combine(
new ActiveMQQueueModule(),
new CassandraDomainListModule(),
new CassandraEventStoreModule(),
- new CassandraJmapModule(),
- new CassandraMailboxModule(),
new CassandraMailRepositoryModule(),
new CassandraMetricsModule(),
+ new CassandraObjectStoreModule(),
new CassandraRecipientRewriteTableModule(),
new CassandraSessionModule(),
new CassandraSieveRepositoryModule(),
- new CassandraUsersRepositoryModule(),
+ new CassandraUsersRepositoryModule());
+
+ public static final Module CASSANDRA_MAILBOX_MODULE = Modules.combine(
+ new CassandraMailboxModule(),
new ElasticSearchMailboxModule(),
new ElasticSearchMetricReporterModule(),
new MailboxModule(),
@@ -99,7 +103,8 @@ public class CassandraJamesServerMain {
new SpamAssassinListenerModule());
public static Module ALL_BUT_JMX_CASSANDRA_MODULE = Modules.combine(
- CASSANDRA_SERVER_MODULE,
+ CASSANDRA_SERVER_CORE_MODULE,
+ CASSANDRA_MAILBOX_MODULE,
PROTOCOLS,
PLUGINS);
http://git-wip-us.apache.org/repos/asf/james-project/blob/d7d6070e/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/CassandraMailboxModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/CassandraMailboxModule.java b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/CassandraMailboxModule.java
index 80db393..c742c38 100644
--- a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/CassandraMailboxModule.java
+++ b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/CassandraMailboxModule.java
@@ -93,7 +93,6 @@ public class CassandraMailboxModule extends AbstractModule {
protected void configure() {
install(new DefaultEventModule());
install(new CassandraQuotaModule());
- install(new CassandraObjectStoreModule());
bind(CassandraApplicableFlagDAO.class).in(Scopes.SINGLETON);
bind(CassandraAttachmentDAO.class).in(Scopes.SINGLETON);
@@ -157,7 +156,6 @@ public class CassandraMailboxModule extends AbstractModule {
cassandraDataDefinitions.addBinding().to(org.apache.james.mailbox.cassandra.modules.CassandraAnnotationModule.class);
cassandraDataDefinitions.addBinding().to(org.apache.james.mailbox.cassandra.modules.CassandraApplicableFlagsModule.class);
cassandraDataDefinitions.addBinding().to(org.apache.james.mailbox.cassandra.modules.CassandraAttachmentModule.class);
- cassandraDataDefinitions.addBinding().to(org.apache.james.blob.cassandra.CassandraBlobModule.class);
cassandraDataDefinitions.addBinding().to(org.apache.james.mailbox.cassandra.modules.CassandraDeletedMessageModule.class);
cassandraDataDefinitions.addBinding().to(org.apache.james.mailbox.cassandra.modules.CassandraFirstUnseenModule.class);
cassandraDataDefinitions.addBinding().to(org.apache.james.mailbox.cassandra.modules.CassandraMailboxCounterModule.class);
http://git-wip-us.apache.org/repos/asf/james-project/blob/d7d6070e/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/CassandraObjectStoreModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/CassandraObjectStoreModule.java b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/CassandraObjectStoreModule.java
index 4fad8e3..0e6d6fd 100644
--- a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/CassandraObjectStoreModule.java
+++ b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/CassandraObjectStoreModule.java
@@ -19,6 +19,7 @@
package org.apache.james.modules.mailbox;
+import org.apache.james.backends.cassandra.components.CassandraModule;
import org.apache.james.blob.api.BlobId;
import org.apache.james.blob.api.ObjectStore;
import org.apache.james.blob.cassandra.CassandraBlobId;
@@ -26,6 +27,7 @@ import org.apache.james.blob.cassandra.CassandraBlobsDAO;
import com.google.inject.AbstractModule;
import com.google.inject.Scopes;
+import com.google.inject.multibindings.Multibinder;
public class CassandraObjectStoreModule extends AbstractModule {
@Override
@@ -35,5 +37,8 @@ public class CassandraObjectStoreModule extends AbstractModule {
bind(ObjectStore.class).to(CassandraBlobsDAO.class);
bind(BlobId.Factory.class).to(CassandraBlobId.Factory.class);
+
+ Multibinder<CassandraModule> cassandraDataDefinitions = Multibinder.newSetBinder(binder(), CassandraModule.class);
+ cassandraDataDefinitions.addBinding().to(org.apache.james.blob.cassandra.CassandraBlobModule.class);
}
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/d7d6070e/server/container/guice/cassandra-guice/src/test/java/org/apache/james/modules/CassandraJmapServerModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/modules/CassandraJmapServerModule.java b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/modules/CassandraJmapServerModule.java
index ee72ccd..1a21ca0 100644
--- a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/modules/CassandraJmapServerModule.java
+++ b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/modules/CassandraJmapServerModule.java
@@ -19,17 +19,11 @@
package org.apache.james.modules;
-import javax.inject.Singleton;
-
-import org.apache.james.backends.cassandra.CassandraCluster;
import org.apache.james.backends.es.EmbeddedElasticSearch;
import org.apache.james.mailbox.extractor.TextExtractor;
import org.apache.james.mailbox.store.extractor.DefaultTextExtractor;
-import com.datastax.driver.core.Session;
import com.google.inject.AbstractModule;
-import com.google.inject.Provides;
-import com.google.inject.name.Names;
public class CassandraJmapServerModule extends AbstractModule {
@@ -46,16 +40,11 @@ public class CassandraJmapServerModule extends AbstractModule {
@Override
protected void configure() {
+ install(new CassandraTestModule(cassandraHost, cassandraPort));
install(new TestElasticSearchModule(embeddedElasticSearch));
install(new TestJMAPServerModule(LIMIT_TO_3_MESSAGES));
+
install(binder -> binder.bind(TextExtractor.class).to(DefaultTextExtractor.class));
- install(binder -> binder.bindConstant().annotatedWith(Names.named("cassandraHost")).to(cassandraHost));
- install(binder -> binder.bindConstant().annotatedWith(Names.named("cassandraPort")).to(cassandraPort));
- }
-
- @Provides
- @Singleton
- Session provideSession(CassandraCluster initializedCassandra) {
- return initializedCassandra.getConf();
}
+
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/d7d6070e/server/container/guice/cassandra-guice/src/test/java/org/apache/james/modules/CassandraTestModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/modules/CassandraTestModule.java b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/modules/CassandraTestModule.java
new file mode 100644
index 0000000..6047b85
--- /dev/null
+++ b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/modules/CassandraTestModule.java
@@ -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.modules;
+
+import javax.inject.Singleton;
+
+import org.apache.james.backends.cassandra.CassandraCluster;
+
+import com.datastax.driver.core.Session;
+import com.google.inject.AbstractModule;
+import com.google.inject.Provides;
+import com.google.inject.name.Names;
+
+public class CassandraTestModule extends AbstractModule {
+ private final String cassandraHost;
+ private final int cassandraPort;
+
+ public CassandraTestModule(String cassandraHost, int cassandraPort) {
+ this.cassandraHost = cassandraHost;
+ this.cassandraPort = cassandraPort;
+ }
+
+ @Override
+ protected void configure() {
+ install(binder -> binder.bindConstant()
+ .annotatedWith(Names.named("cassandraHost"))
+ .to(cassandraHost));
+ install(binder -> binder.bindConstant()
+ .annotatedWith(Names.named("cassandraPort"))
+ .to(cassandraPort));
+ }
+
+ @Provides
+ @Singleton
+ Session provideSession(CassandraCluster initializedCassandra) {
+ return initializedCassandra.getConf();
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org