JAMES-1688 Add MPT test for SMTP protocol
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/5bef0e5f Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/5bef0e5f Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/5bef0e5f Branch: refs/heads/master Commit: 5bef0e5f6cb2ddd0a48bc4e3535f8b7cf7368696 Parents: 69916b7 Author: Antoine Duprat <antdup...@gmail.com> Authored: Fri Feb 12 11:54:41 2016 +0100 Committer: Matthieu Baechler <matthieu.baech...@gmail.com> Committed: Fri Feb 19 11:55:19 2016 +0100 ---------------------------------------------------------------------- mailbox/elasticsearch/pom.xml | 2 - mailbox/pom.xml | 13 +- mpt/core/pom.xml | 2 +- .../apache/james/mpt/api/SmtpHostSystem.java | 24 ++ mpt/impl/imap-mailbox/cassandra/pom.xml | 1 - mpt/impl/imap-mailbox/cyrus/pom.xml | 1 - .../mpt/imapmailbox/cyrus/host/Docker.java | 3 +- mpt/impl/managesieve/core/pom.xml | 1 - mpt/impl/smtp/cassandra/pom.xml | 231 +++++++++++++++++++ .../org/apache/james/mpt/smtp/SmtpTest.java | 34 +++ .../apache/james/mpt/smtp/SmtpTestModule.java | 105 +++++++++ .../mpt/smtp/host/JamesSmtpHostSystem.java | 80 +++++++ .../cassandra/src/test/resources/dnsservice.xml | 29 +++ .../cassandra/src/test/resources/domainlist.xml | 28 +++ .../cassandra/src/test/resources/imapserver.xml | 54 +++++ .../smtp/cassandra/src/test/resources/keystore | Bin 0 -> 2245 bytes .../cassandra/src/test/resources/lmtpserver.xml | 41 ++++ .../src/test/resources/mailetcontainer.xml | 117 ++++++++++ .../src/test/resources/mailrepositorystore.xml | 31 +++ .../src/test/resources/managesieveserver.xml | 65 ++++++ .../cassandra/src/test/resources/pop3server.xml | 42 ++++ .../test/resources/recipientrewritetable.xml | 27 +++ .../cassandra/src/test/resources/smtpserver.xml | 106 +++++++++ mpt/impl/smtp/core/pom.xml | 207 +++++++++++++++++ .../apache/james/mpt/smtp/ForwardSmtpTest.java | 100 ++++++++ .../james/mpt/smtp/dns/InMemoryDNSService.java | 124 ++++++++++ .../apache/james/mpt/smtp/utils/DockerRule.java | 112 +++++++++ .../org/apache/james/smtp/scripts/helo.test | 16 ++ mpt/impl/smtp/pom.xml | 61 +++++ mpt/pom.xml | 48 ++++ 30 files changed, 1697 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/james-project/blob/5bef0e5f/mailbox/elasticsearch/pom.xml ---------------------------------------------------------------------- diff --git a/mailbox/elasticsearch/pom.xml b/mailbox/elasticsearch/pom.xml index 8276bbc..99adadc 100644 --- a/mailbox/elasticsearch/pom.xml +++ b/mailbox/elasticsearch/pom.xml @@ -184,12 +184,10 @@ <dependency> <groupId>com.fasterxml.jackson.datatype</groupId> <artifactId>jackson-datatype-guava</artifactId> - <version>2.3.3</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.datatype</groupId> <artifactId>jackson-datatype-jdk8</artifactId> - <version>2.4.3</version> </dependency> <dependency> <groupId>com.google.guava</groupId> http://git-wip-us.apache.org/repos/asf/james-project/blob/5bef0e5f/mailbox/pom.xml ---------------------------------------------------------------------- diff --git a/mailbox/pom.xml b/mailbox/pom.xml index bbe217a..6596bc1 100644 --- a/mailbox/pom.xml +++ b/mailbox/pom.xml @@ -118,7 +118,7 @@ <jasypt.version>1.9.0</jasypt.version> <guava.version>16.0</guava.version> <assertj.version>1.7.1</assertj.version> - <jackson-databinding.version>2.3.3</jackson-databinding.version> + <jackson-databinding.version>2.6.3</jackson-databinding.version> <cassandra-driver-core.version>2.1.8</cassandra-driver-core.version> <cassandra-unit.version>2.1.9.2</cassandra-unit.version> <apache-backends-cassandra.version>1.8.3-SNAPSHOT</apache-backends-cassandra.version> @@ -386,6 +386,17 @@ <artifactId>jackson-databind</artifactId> <version>${jackson-databinding.version}</version> </dependency> + <dependency> + <groupId>com.fasterxml.jackson.datatype</groupId> + <artifactId>jackson-datatype-guava</artifactId> + <version>${jackson-databinding.version}</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.datatype</groupId> + <artifactId>jackson-datatype-jdk8</artifactId> + <version>${jackson-databinding.version}</version> + </dependency> + <!-- END Commons --> http://git-wip-us.apache.org/repos/asf/james-project/blob/5bef0e5f/mpt/core/pom.xml ---------------------------------------------------------------------- diff --git a/mpt/core/pom.xml b/mpt/core/pom.xml index 5d50c10..2b02d9f 100644 --- a/mpt/core/pom.xml +++ b/mpt/core/pom.xml @@ -90,7 +90,7 @@ <dependency> <groupId>org.assertj</groupId> <artifactId>assertj-core</artifactId> - <version>${assertj-1.version}</version> + <version>${assertj-1.version}</version><!--$NO-MVN-MAN-VER$--> <scope>test</scope> </dependency> <dependency> http://git-wip-us.apache.org/repos/asf/james-project/blob/5bef0e5f/mpt/core/src/main/java/org/apache/james/mpt/api/SmtpHostSystem.java ---------------------------------------------------------------------- diff --git a/mpt/core/src/main/java/org/apache/james/mpt/api/SmtpHostSystem.java b/mpt/core/src/main/java/org/apache/james/mpt/api/SmtpHostSystem.java new file mode 100644 index 0000000..575115d --- /dev/null +++ b/mpt/core/src/main/java/org/apache/james/mpt/api/SmtpHostSystem.java @@ -0,0 +1,24 @@ +/**************************************************************** + * 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.mpt.api; + +public interface SmtpHostSystem extends HostSystem { + +} http://git-wip-us.apache.org/repos/asf/james-project/blob/5bef0e5f/mpt/impl/imap-mailbox/cassandra/pom.xml ---------------------------------------------------------------------- diff --git a/mpt/impl/imap-mailbox/cassandra/pom.xml b/mpt/impl/imap-mailbox/cassandra/pom.xml index 2ae2a7f..d160324 100644 --- a/mpt/impl/imap-mailbox/cassandra/pom.xml +++ b/mpt/impl/imap-mailbox/cassandra/pom.xml @@ -169,7 +169,6 @@ <dependency> <groupId>org.cassandraunit</groupId> <artifactId>cassandra-unit</artifactId> - <version>2.0.2.2</version> <scope>test</scope> </dependency> </dependencies> http://git-wip-us.apache.org/repos/asf/james-project/blob/5bef0e5f/mpt/impl/imap-mailbox/cyrus/pom.xml ---------------------------------------------------------------------- diff --git a/mpt/impl/imap-mailbox/cyrus/pom.xml b/mpt/impl/imap-mailbox/cyrus/pom.xml index 87f4be8..a1ec235 100644 --- a/mpt/impl/imap-mailbox/cyrus/pom.xml +++ b/mpt/impl/imap-mailbox/cyrus/pom.xml @@ -137,7 +137,6 @@ <dependency> <groupId>com.spotify</groupId> <artifactId>docker-client</artifactId> - <version>2.7.25</version> </dependency> <dependency> <groupId>org.apache.james</groupId> http://git-wip-us.apache.org/repos/asf/james-project/blob/5bef0e5f/mpt/impl/imap-mailbox/cyrus/src/test/java/org/apache/james/mpt/imapmailbox/cyrus/host/Docker.java ---------------------------------------------------------------------- diff --git a/mpt/impl/imap-mailbox/cyrus/src/test/java/org/apache/james/mpt/imapmailbox/cyrus/host/Docker.java b/mpt/impl/imap-mailbox/cyrus/src/test/java/org/apache/james/mpt/imapmailbox/cyrus/host/Docker.java index 80f50c5..d00a285 100644 --- a/mpt/impl/imap-mailbox/cyrus/src/test/java/org/apache/james/mpt/imapmailbox/cyrus/host/Docker.java +++ b/mpt/impl/imap-mailbox/cyrus/src/test/java/org/apache/james/mpt/imapmailbox/cyrus/host/Docker.java @@ -50,6 +50,7 @@ public class Docker { .image(imageName) .networkDisabled(false) .exposedPorts(ImmutableSet.of(EXPOSED_IMAP_PORT)) + .hostConfig(ALL_PORTS_HOST_CONFIG) .build(); try { @@ -62,7 +63,7 @@ public class Docker { public ContainerCreation start() throws Exception { ContainerCreation container = dockerClient.createContainer(containerConfig); - dockerClient.startContainer(container.id(), ALL_PORTS_HOST_CONFIG); + dockerClient.startContainer(container.id()); waitingForSocketToBeReady(container); return container; } http://git-wip-us.apache.org/repos/asf/james-project/blob/5bef0e5f/mpt/impl/managesieve/core/pom.xml ---------------------------------------------------------------------- diff --git a/mpt/impl/managesieve/core/pom.xml b/mpt/impl/managesieve/core/pom.xml index e9b56fc..05caab6 100644 --- a/mpt/impl/managesieve/core/pom.xml +++ b/mpt/impl/managesieve/core/pom.xml @@ -39,7 +39,6 @@ <dependency> <groupId>org.apache.james</groupId> <artifactId>james-server-data-api</artifactId> - <version>${james.version}</version> </dependency> <dependency> <groupId>org.apache.james.protocols</groupId> http://git-wip-us.apache.org/repos/asf/james-project/blob/5bef0e5f/mpt/impl/smtp/cassandra/pom.xml ---------------------------------------------------------------------- diff --git a/mpt/impl/smtp/cassandra/pom.xml b/mpt/impl/smtp/cassandra/pom.xml new file mode 100644 index 0000000..3c4d5c1 --- /dev/null +++ b/mpt/impl/smtp/cassandra/pom.xml @@ -0,0 +1,231 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <artifactId>apache-james-mpt-smtp</artifactId> + <groupId>org.apache.james</groupId> + <version>0.2-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + + <name>Apache James MPT SMTP</name> + + <artifactId>apache-james-mpt-smtp-cassandra</artifactId> + <packaging>jar</packaging> + + <profiles> + <profile> + <id>noTest</id> + <activation> + <os> + <family>windows</family> + </os> + </activation> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <skipTests>true</skipTests> + </configuration> + </plugin> + </plugins> + </build> + </profile> + <profile> + <id>disable-build-for-older-jdk</id> + <activation> + <jdk>(,1.8)</jdk> + </activation> + <build> + <plugins> + <plugin> + <artifactId>maven-jar-plugin</artifactId> + <executions> + <execution> + <id>default-jar</id> + <phase>none</phase> + </execution> + <execution> + <id>jar</id> + <phase>none</phase> + </execution> + <execution> + <id>test-jar</id> + <phase>none</phase> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-compiler-plugin</artifactId> + <executions> + <execution> + <id>default-compile</id> + <phase>none</phase> + </execution> + <execution> + <id>default-testCompile</id> + <phase>none</phase> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <executions> + <execution> + <id>default-test</id> + <phase>none</phase> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-source-plugin</artifactId> + <executions> + <execution> + <id>attach-sources</id> + <phase>none</phase> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-install-plugin</artifactId> + <executions> + <execution> + <id>default-install</id> + <phase>none</phase> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-resources-plugin</artifactId> + <executions> + <execution> + <id>default-resources</id> + <phase>none</phase> + </execution> + <execution> + <id>default-testResources</id> + <phase>none</phase> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-site-plugin</artifactId> + <executions> + <execution> + <id>attach-descriptor</id> + <phase>none</phase> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + <profile> + <id>build-for-jdk-8</id> + <activation> + <jdk>[1.8,)</jdk> + </activation> + <dependencies> + <dependency> + <groupId>org.apache.james</groupId> + <artifactId>apache-james-backends-cassandra</artifactId> + <scope>test</scope> + <type>test-jar</type> + </dependency> + <dependency> + <groupId>org.apache.james</groupId> + <artifactId>apache-james-mailbox-elasticsearch</artifactId> + <scope>test</scope> + <type>test-jar</type> + </dependency> + <dependency> + <groupId>org.apache.james</groupId> + <artifactId>apache-james-mpt-core</artifactId> + </dependency> + <dependency> + <groupId>org.apache.james</groupId> + <artifactId>apache-james-mpt-smtp-core</artifactId> + </dependency> + <dependency> + <groupId>org.apache.james</groupId> + <artifactId>james-server-cassandra-guice</artifactId> + </dependency> + <dependency> + <groupId>org.apache.james</groupId> + <artifactId>james-server-cassandra-guice</artifactId> + <scope>test</scope> + <type>test-jar</type> + </dependency> + <dependency> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> + <version>18.0</version> + </dependency> + <dependency> + <groupId>org.apache.onami</groupId> + <artifactId>org.apache.onami.test</artifactId> + </dependency> + <dependency> + <groupId>org.cassandraunit</groupId> + <artifactId>cassandra-unit</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-simple</artifactId> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <configuration> + <archive> + <manifest> + <mainClass>fully.qualified.MainClass</mainClass> + </manifest> + </archive> + <descriptorRefs> + <descriptorRef>jar-with-dependencies</descriptorRef> + </descriptorRefs> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>1.8</source> + <target>1.8</target> + </configuration> + </plugin> + </plugins> + </build> + </profile> + <profile> + <id>disable-animal-sniffer</id> + <activation> + <jdk>[1.6,)</jdk> + </activation> + <build> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>animal-sniffer-maven-plugin</artifactId> + <executions> + <execution> + <id>check_java_6</id> + <phase>none</phase> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + </profiles> + <build> + + </build> + +</project> http://git-wip-us.apache.org/repos/asf/james-project/blob/5bef0e5f/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/SmtpTest.java ---------------------------------------------------------------------- diff --git a/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/SmtpTest.java b/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/SmtpTest.java new file mode 100644 index 0000000..65ad160 --- /dev/null +++ b/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/SmtpTest.java @@ -0,0 +1,34 @@ +/**************************************************************** + * 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.mpt.smtp; + +import org.apache.james.mpt.smtp.ForwardSmtpTest; +import org.apache.onami.test.OnamiSuite; +import org.apache.onami.test.annotation.GuiceModules; +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +@RunWith(OnamiSuite.class) +@Suite.SuiteClasses({ + ForwardSmtpTest.class +}) +@GuiceModules({ SmtpTestModule.class }) +public class SmtpTest { + +} http://git-wip-us.apache.org/repos/asf/james-project/blob/5bef0e5f/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/SmtpTestModule.java ---------------------------------------------------------------------- diff --git a/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/SmtpTestModule.java b/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/SmtpTestModule.java new file mode 100644 index 0000000..62a5c4e --- /dev/null +++ b/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/SmtpTestModule.java @@ -0,0 +1,105 @@ +/**************************************************************** + * 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.mpt.smtp; + +import java.io.IOException; +import java.util.Optional; + +import org.apache.james.CassandraJamesServerMain; +import org.apache.james.backends.cassandra.CassandraCluster; +import org.apache.james.backends.cassandra.init.CassandraModuleComposite; +import org.apache.james.dnsservice.api.DNSService; +import org.apache.james.domainlist.api.DomainList; +import org.apache.james.domainlist.cassandra.CassandraDomainListModule; +import org.apache.james.jmap.JMAPConfiguration; +import org.apache.james.jmap.PortConfiguration; +import org.apache.james.mailbox.cassandra.modules.CassandraMailboxModule; +import org.apache.james.mailbox.cassandra.modules.CassandraMessageModule; +import org.apache.james.mailbox.elasticsearch.ClientProvider; +import org.apache.james.mailbox.elasticsearch.EmbeddedElasticSearch; +import org.apache.james.modules.TestFilesystemModule; +import org.apache.james.mpt.api.SmtpHostSystem; +import org.apache.james.mpt.smtp.dns.InMemoryDNSService; +import org.apache.james.mpt.smtp.host.JamesSmtpHostSystem; +import org.apache.james.rrt.cassandra.CassandraRRTModule; +import org.apache.james.user.api.UsersRepository; +import org.apache.james.user.cassandra.CassandraUsersRepositoryModule; +import org.apache.james.utils.ConfigurationsPerformer; +import org.junit.rules.TemporaryFolder; + +import com.datastax.driver.core.Session; +import com.google.inject.AbstractModule; +import com.google.inject.Module; +import com.google.inject.Provides; +import com.google.inject.Scopes; +import com.google.inject.Singleton; +import com.google.inject.util.Modules; + +public class SmtpTestModule extends AbstractModule { + + private final TemporaryFolder folder = new TemporaryFolder(); + private final CassandraCluster cassandraClusterSingleton; + private final EmbeddedElasticSearch embeddedElasticSearch; + + public SmtpTestModule() throws IOException { + folder.create(); + CassandraModuleComposite cassandraModuleComposite = new CassandraModuleComposite( + new CassandraMailboxModule(), + new CassandraMessageModule(), + new CassandraDomainListModule(), + new CassandraUsersRepositoryModule(), + new CassandraRRTModule()); + cassandraClusterSingleton = CassandraCluster.create(cassandraModuleComposite); + + embeddedElasticSearch = new EmbeddedElasticSearch(folder); + } + + @Override + protected void configure() { + Module cassandra = (binder) -> binder.bind(Session.class).toInstance(cassandraClusterSingleton.getConf()); + Module dns = (binder) -> { + binder.bind(InMemoryDNSService.class).in(Scopes.SINGLETON); + binder.bind(DNSService.class).to(InMemoryDNSService.class); + }; + Module elasticSearch = (binder) -> binder.bind(ClientProvider.class).toInstance(() -> embeddedElasticSearch.getNode().client()); + Module jmap = (binder) -> { + binder.bind(PortConfiguration.class).toInstance(Optional::empty); + binder.bind(JMAPConfiguration.class).toInstance( + JMAPConfiguration.builder() + .keystore("keystore") + .secret("james72laBalle") + .build()); + }; + + install(Modules.override(CassandraJamesServerMain.defaultModule) + .with(Modules.combine( + new TestFilesystemModule(folder), + cassandra, + dns, + elasticSearch, + jmap))); + } + + + @Provides + @Singleton + public SmtpHostSystem provideHostSystem(ConfigurationsPerformer configurationsPerformer, DomainList domainList, UsersRepository usersRepository) throws Exception { + return new JamesSmtpHostSystem(configurationsPerformer, domainList, usersRepository); + } +} http://git-wip-us.apache.org/repos/asf/james-project/blob/5bef0e5f/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/host/JamesSmtpHostSystem.java ---------------------------------------------------------------------- diff --git a/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/host/JamesSmtpHostSystem.java b/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/host/JamesSmtpHostSystem.java new file mode 100644 index 0000000..caf46f7 --- /dev/null +++ b/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/host/JamesSmtpHostSystem.java @@ -0,0 +1,80 @@ +/**************************************************************** + * 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.mpt.smtp.host; + +import java.util.Iterator; + +import org.apache.james.domainlist.api.DomainList; +import org.apache.james.mpt.api.SmtpHostSystem; +import org.apache.james.mpt.monitor.SystemLoggingMonitor; +import org.apache.james.mpt.session.ExternalSessionFactory; +import org.apache.james.user.api.UsersRepository; +import org.apache.james.utils.ConfigurationsPerformer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.common.base.Preconditions; +import com.google.common.base.Splitter; + +public class JamesSmtpHostSystem extends ExternalSessionFactory implements SmtpHostSystem { + + private static final Logger LOGGER = LoggerFactory.getLogger(JamesSmtpHostSystem.class); + + private final DomainList domainList; + private final UsersRepository usersRepository; + private final ConfigurationsPerformer configurationsPerformer; + + public JamesSmtpHostSystem(ConfigurationsPerformer configurationsPerformer, DomainList domainList, UsersRepository usersRepository) { + super("localhost", 1025, new SystemLoggingMonitor(), "220 mydomain.tld smtp"); + this.configurationsPerformer = configurationsPerformer; + this.domainList = domainList; + this.usersRepository = usersRepository; + } + + @Override + public boolean addUser(String userAtDomain, String password) throws Exception { + Preconditions.checkArgument(userAtDomain.contains("@"), "The 'user' should contain the 'domain'"); + Iterator<String> split = Splitter.on("@").split(userAtDomain).iterator(); + split.next(); + String domain = split.next(); + + domainList.addDomain(domain); + usersRepository.addUser(userAtDomain, password); + return true; + } + + @Override + public void beforeTests() throws Exception { + } + + @Override + public void afterTests() throws Exception { + } + + @Override + public void beforeTest() throws Exception { + LOGGER.info("Initializing modules"); + configurationsPerformer.initModules(); + } + + @Override + public void afterTest() throws Exception { + } +} http://git-wip-us.apache.org/repos/asf/james-project/blob/5bef0e5f/mpt/impl/smtp/cassandra/src/test/resources/dnsservice.xml ---------------------------------------------------------------------- diff --git a/mpt/impl/smtp/cassandra/src/test/resources/dnsservice.xml b/mpt/impl/smtp/cassandra/src/test/resources/dnsservice.xml new file mode 100644 index 0000000..0978a00 --- /dev/null +++ b/mpt/impl/smtp/cassandra/src/test/resources/dnsservice.xml @@ -0,0 +1,29 @@ +<?xml version="1.0"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + --> + +<dnsservice> + <servers> + <server>8.8.8.8</server> + <server>62.210.16.6</server> + </servers> + <autodiscover>false</autodiscover> + <authoritative>false</authoritative> + <maxcachesize>50000</maxcachesize> +</dnsservice> http://git-wip-us.apache.org/repos/asf/james-project/blob/5bef0e5f/mpt/impl/smtp/cassandra/src/test/resources/domainlist.xml ---------------------------------------------------------------------- diff --git a/mpt/impl/smtp/cassandra/src/test/resources/domainlist.xml b/mpt/impl/smtp/cassandra/src/test/resources/domainlist.xml new file mode 100644 index 0000000..438494b --- /dev/null +++ b/mpt/impl/smtp/cassandra/src/test/resources/domainlist.xml @@ -0,0 +1,28 @@ +<?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. + --> + +<domainlist class="org.apache.james.domainlist.cassandra.CassandraDomainList"> + <domainnames> + <domainname>mydomain.tld</domainname> + </domainnames> + <autodetect>false</autodetect> + <autodetectIP>true</autodetectIP> + <defaultDomain>localhost</defaultDomain> +</domainlist> http://git-wip-us.apache.org/repos/asf/james-project/blob/5bef0e5f/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 new file mode 100644 index 0000000..ff478a9 --- /dev/null +++ b/mpt/impl/smtp/cassandra/src/test/resources/imapserver.xml @@ -0,0 +1,54 @@ +<?xml version="1.0"?> + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + + +<imapservers> + <imapserver enabled="true"> + <jmxName>imapserver</jmxName> + <bind>0.0.0.0:1143</bind> + <connectionBacklog>200</connectionBacklog> + <tls socketTLS="false" startTLS="false"> + <!-- To create a new keystore execute: + keytool -genkey -alias james -keyalg RSA -keystore /path/to/james/conf/keystore + --> + <keystore>file://conf/keystore</keystore> + <secret>james72laBalle</secret> + <provider>org.bouncycastle.jce.provider.BouncyCastleProvider</provider> + </tls> + <connectionLimit>0</connectionLimit> + <connectionLimitPerIP>0</connectionLimitPerIP> + </imapserver> + <imapserver enabled="true"> + <jmxName>imapserver-ssl</jmxName> + <bind>0.0.0.0:1993</bind> + <connectionBacklog>200</connectionBacklog> + <tls socketTLS="false" startTLS="false"> + <!-- To create a new keystore execute: + keytool -genkey -alias james -keyalg RSA -keystore /path/to/james/conf/keystore + --> + <keystore>file://conf/keystore</keystore> + <secret>james72laBalle</secret> + <provider>org.bouncycastle.jce.provider.BouncyCastleProvider</provider> + </tls> + <connectionLimit>0</connectionLimit> + <connectionLimitPerIP>0</connectionLimitPerIP> + </imapserver> +</imapservers> http://git-wip-us.apache.org/repos/asf/james-project/blob/5bef0e5f/mpt/impl/smtp/cassandra/src/test/resources/keystore ---------------------------------------------------------------------- diff --git a/mpt/impl/smtp/cassandra/src/test/resources/keystore b/mpt/impl/smtp/cassandra/src/test/resources/keystore new file mode 100644 index 0000000..536a6c7 Binary files /dev/null and b/mpt/impl/smtp/cassandra/src/test/resources/keystore differ http://git-wip-us.apache.org/repos/asf/james-project/blob/5bef0e5f/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 new file mode 100644 index 0000000..5c4a9c7 --- /dev/null +++ b/mpt/impl/smtp/cassandra/src/test/resources/lmtpserver.xml @@ -0,0 +1,41 @@ +<?xml version="1.0"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + --> + +<lmtpservers> + + <lmtpserver enabled="true"> + <jmxName>lmtpserver</jmxName> + <!-- LMTP should not be reachable from outside your network so bind it to loopback--> + <bind>127.0.0.1:1024</bind> + <connectionBacklog>200</connectionBacklog> + <connectiontimeout>1200</connectiontimeout> + <!-- Set the maximum simultaneous incoming connections for this service --> + <connectionLimit>0</connectionLimit> + <!-- Set the maximum simultaneous incoming connections per IP for this service --> + <connectionLimitPerIP>0</connectionLimitPerIP> + <!-- This sets the maximum allowed message size (in kilobytes) for this --> + <!-- LMTP service. If unspecified, the value defaults to 0, which means no limit. --> + <maxmessagesize>0</maxmessagesize> + <handlerchain> + <handler class="org.apache.james.lmtpserver.CoreCmdHandlerLoader"/> + </handlerchain> + </lmtpserver> + +</lmtpservers> http://git-wip-us.apache.org/repos/asf/james-project/blob/5bef0e5f/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 new file mode 100644 index 0000000..c9d84eb --- /dev/null +++ b/mpt/impl/smtp/cassandra/src/test/resources/mailetcontainer.xml @@ -0,0 +1,117 @@ +<?xml version="1.0"?> + +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + --> + +<mailetcontainer enableJmx="true"> + + <context> + <postmaster>postmaster@localhost</postmaster> + </context> + + <spooler> + <threads>20</threads> + </spooler> + + <processors> + <processor state="root" enableJmx="true"> + <mailet match="All" class="PostmasterAlias"/> + <mailet match="RelayLimit=30" class="Null"/> + + <mailet match="SMTPAuthSuccessful" class="ToProcessor"> + <processor>transport</processor> + </mailet> + + <mailet match="All" class="ToProcessor"> + <processor>transport</processor> + </mailet> + </processor> + + <processor state="error" enableJmx="true"> + <mailet match="All" class="Bounce"> + </mailet> + <mailet match="All" class="ToRepository"> + <repositoryPath>file://var/mail/error/</repositoryPath> + </mailet> + </processor> + + + <processor state="transport" enableJmx="true"> + <mailet match="SMTPAuthSuccessful" class="SetMimeHeader"> + <name>X-UserIsAuth</name> + <value>true</value> + </mailet> + <mailet match="HasMailAttribute=org.apache.james.SMIMECheckSignature" class="SetMimeHeader"> + <name>X-WasSigned</name> + <value>true</value> + </mailet> + <mailet match="All" class="RecipientRewriteTable" /> + <!-- <mailet match="HostIsLocal" class="ToProcessor"> + <processor>local-address-error</processor> + <notice>550 - Requested action not taken: no such user here</notice> + </mailet> --> + <mailet match="All" class="RemoteDelivery"> + <outgoingQueue>outgoing</outgoingQueue> + <delayTime>5 minutes</delayTime> + <delayTime>10 minutes</delayTime> + <delayTime>45 minutes</delayTime> + <delayTime>2 hours</delayTime> + <delayTime>3 hours</delayTime> + <delayTime>6 hours</delayTime> + <maxRetries>0</maxRetries> + <maxDnsProblemRetries>0</maxDnsProblemRetries> + <deliveryThreads>1</deliveryThreads> + <sendpartial>false</sendpartial> + <bounceProcessor>bounces</bounceProcessor> + </mailet> + <!-- mailet match="All" class="ToProcessor"> + <processor>relay-denied</processor> + </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> + </mailet> + <mailet match="All" class="ToRepository"> + <repositoryPath>file://var/mail/relay-denied/</repositoryPath> + <notice>Warning: You are sending an e-mail to a remote server. You must be authentified to perform such an operation</notice> + </mailet> + </processor> + + <processor state="bounces" enableJmx="true"> + <mailet match="All" class="DSNBounce"> + <passThrough>false</passThrough> + </mailet> + </processor> + </processors> + +</mailetcontainer> + http://git-wip-us.apache.org/repos/asf/james-project/blob/5bef0e5f/mpt/impl/smtp/cassandra/src/test/resources/mailrepositorystore.xml ---------------------------------------------------------------------- diff --git a/mpt/impl/smtp/cassandra/src/test/resources/mailrepositorystore.xml b/mpt/impl/smtp/cassandra/src/test/resources/mailrepositorystore.xml new file mode 100644 index 0000000..3ca4a1d --- /dev/null +++ b/mpt/impl/smtp/cassandra/src/test/resources/mailrepositorystore.xml @@ -0,0 +1,31 @@ +<?xml version="1.0"?> + +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + --> + +<mailrepositorystore> + <mailrepositories> + <mailrepository class="org.apache.james.mailrepository.file.FileMailRepository"> + <protocols> + <protocol>file</protocol> + </protocols> + <config FIFO="false" CACHEKEYS="true"/> + </mailrepository> + </mailrepositories> +</mailrepositorystore> http://git-wip-us.apache.org/repos/asf/james-project/blob/5bef0e5f/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 new file mode 100644 index 0000000..ec57e09 --- /dev/null +++ b/mpt/impl/smtp/cassandra/src/test/resources/managesieveserver.xml @@ -0,0 +1,65 @@ +<?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/5bef0e5f/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 new file mode 100644 index 0000000..e4187da --- /dev/null +++ b/mpt/impl/smtp/cassandra/src/test/resources/pop3server.xml @@ -0,0 +1,42 @@ +<?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/5bef0e5f/mpt/impl/smtp/cassandra/src/test/resources/recipientrewritetable.xml ---------------------------------------------------------------------- diff --git a/mpt/impl/smtp/cassandra/src/test/resources/recipientrewritetable.xml b/mpt/impl/smtp/cassandra/src/test/resources/recipientrewritetable.xml new file mode 100644 index 0000000..b8ab709 --- /dev/null +++ b/mpt/impl/smtp/cassandra/src/test/resources/recipientrewritetable.xml @@ -0,0 +1,27 @@ +<?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. + --> + +<!-- The default table for storing James' RecipientRewriteTable mappings. --> +<recipientrewritetable class="org.apache.james.rrt.cassandra.CassandraRecipientRewriteTable"> + <recursiveMapping>true</recursiveMapping> + <mappingLimit>10</mappingLimit> + <mapping>some@domain=some</mapping> +</recipientrewritetable> + http://git-wip-us.apache.org/repos/asf/james-project/blob/5bef0e5f/mpt/impl/smtp/cassandra/src/test/resources/smtpserver.xml ---------------------------------------------------------------------- diff --git a/mpt/impl/smtp/cassandra/src/test/resources/smtpserver.xml b/mpt/impl/smtp/cassandra/src/test/resources/smtpserver.xml new file mode 100644 index 0000000..0eaeb3d --- /dev/null +++ b/mpt/impl/smtp/cassandra/src/test/resources/smtpserver.xml @@ -0,0 +1,106 @@ +<?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. + --> + +<smtpservers> + <smtpserver enabled="true"> + <heloName autodetect="false">mydomain.tld</heloName> + <jmxName>smtpserver-global</jmxName> + <bind>0.0.0.0:1025</bind> + <connectionBacklog>200</connectionBacklog> + <tls socketTLS="false" startTLS="false"> + <keystore>file://conf/keystore</keystore> + <secret>james72laBalle</secret> + <provider>org.bouncycastle.jce.provider.BouncyCastleProvider</provider> + <algorithm>SunX509</algorithm> + </tls> + <connectiontimeout>360</connectiontimeout> + <connectionLimit>0</connectionLimit> + <connectionLimitPerIP>0</connectionLimitPerIP> + <authRequired>false</authRequired> + <authorizedAddresses>0.0.0.0/0</authorizedAddresses> + <verifyIdentity>true</verifyIdentity> + <maxmessagesize>0</maxmessagesize> + <addressBracketsEnforcement>true</addressBracketsEnforcement> + <smtpGreeting>mydomain.tld smtp</smtpGreeting> + <handlerchain> + <handler class="org.apache.james.smtpserver.fastfail.ValidRcptHandler"/> + <handler class="org.apache.james.smtpserver.CoreCmdHandlerLoader"/> + </handlerchain> + </smtpserver> + <smtpserver enabled="true"> + <jmxName>smtpserver-TLS</jmxName> + <bind>0.0.0.0:10465</bind> + <connectionBacklog>200</connectionBacklog> + <tls socketTLS="false" startTLS="false"> + <keystore>file://conf/keystore</keystore> + <secret>james72laBalle</secret> + <provider>org.bouncycastle.jce.provider.BouncyCastleProvider</provider> + <algorithm>SunX509</algorithm> + </tls> + <connectiontimeout>360</connectiontimeout> + <connectionLimit>0</connectionLimit> + <connectionLimitPerIP>0</connectionLimitPerIP> + <!-- + Authorize only local users + --> + <authRequired>true</authRequired> + <authorizedAddresses>0.0.0.0/0</authorizedAddresses> + <!-- Trust authenticated users --> + <verifyIdentity>false</verifyIdentity> + <maxmessagesize>0</maxmessagesize> + <addressBracketsEnforcement>true</addressBracketsEnforcement> + <smtpGreeting>JAMES Linagora's SMTP awesome Server</smtpGreeting> + <handlerchain> + <handler class="org.apache.james.smtpserver.fastfail.ValidRcptHandler"/> + <handler class="org.apache.james.smtpserver.CoreCmdHandlerLoader"/> + </handlerchain> + </smtpserver> + <smtpserver enabled="true"> + <jmxName>smtpserver-authenticated</jmxName> + <bind>0.0.0.0:1587</bind> + <connectionBacklog>200</connectionBacklog> + <tls socketTLS="false" startTLS="false"> + <keystore>file://conf/keystore</keystore> + <secret>james72laBalle</secret> + <provider>org.bouncycastle.jce.provider.BouncyCastleProvider</provider> + <algorithm>SunX509</algorithm> + </tls> + <connectiontimeout>360</connectiontimeout> + <connectionLimit>0</connectionLimit> + <connectionLimitPerIP>0</connectionLimitPerIP> + <!-- + Authorize only local users + --> + <authRequired>true</authRequired> + <authorizedAddresses>0.0.0.0/0</authorizedAddresses> + <!-- Trust authenticated users --> + <verifyIdentity>false</verifyIdentity> + <maxmessagesize>0</maxmessagesize> + <addressBracketsEnforcement>true</addressBracketsEnforcement> + <smtpGreeting>JAMES Linagora's SMTP awesome Server</smtpGreeting> + <handlerchain> + <handler class="org.apache.james.smtpserver.fastfail.ValidRcptHandler"/> + <handler class="org.apache.james.smtpserver.CoreCmdHandlerLoader"/> + </handlerchain> + </smtpserver> +</smtpservers> + + http://git-wip-us.apache.org/repos/asf/james-project/blob/5bef0e5f/mpt/impl/smtp/core/pom.xml ---------------------------------------------------------------------- diff --git a/mpt/impl/smtp/core/pom.xml b/mpt/impl/smtp/core/pom.xml new file mode 100644 index 0000000..b1bd035 --- /dev/null +++ b/mpt/impl/smtp/core/pom.xml @@ -0,0 +1,207 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <artifactId>apache-james-mpt-smtp</artifactId> + <groupId>org.apache.james</groupId> + <version>0.2-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + + <name>Apache James MPT SMTP</name> + + <artifactId>apache-james-mpt-smtp-core</artifactId> + <packaging>jar</packaging> + + <profiles> + <profile> + <id>noTest</id> + <activation> + <os> + <family>windows</family> + </os> + </activation> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <skipTests>true</skipTests> + </configuration> + </plugin> + </plugins> + </build> + </profile> + <profile> + <id>disable-build-for-older-jdk</id> + <activation> + <jdk>(,1.8)</jdk> + </activation> + <build> + <plugins> + <plugin> + <artifactId>maven-jar-plugin</artifactId> + <executions> + <execution> + <id>default-jar</id> + <phase>none</phase> + </execution> + <execution> + <id>jar</id> + <phase>none</phase> + </execution> + <execution> + <id>test-jar</id> + <phase>none</phase> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-compiler-plugin</artifactId> + <executions> + <execution> + <id>default-compile</id> + <phase>none</phase> + </execution> + <execution> + <id>default-testCompile</id> + <phase>none</phase> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <executions> + <execution> + <id>default-test</id> + <phase>none</phase> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-source-plugin</artifactId> + <executions> + <execution> + <id>attach-sources</id> + <phase>none</phase> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-install-plugin</artifactId> + <executions> + <execution> + <id>default-install</id> + <phase>none</phase> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-resources-plugin</artifactId> + <executions> + <execution> + <id>default-resources</id> + <phase>none</phase> + </execution> + <execution> + <id>default-testResources</id> + <phase>none</phase> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-site-plugin</artifactId> + <executions> + <execution> + <id>attach-descriptor</id> + <phase>none</phase> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + <profile> + <id>build-for-jdk-8</id> + <activation> + <jdk>[1.8,)</jdk> + </activation> + <dependencies> + <dependency> + <groupId>org.apache.james</groupId> + <artifactId>james-server-data-api</artifactId> + </dependency> + <dependency> + <groupId>org.apache.james</groupId> + <artifactId>james-server-dnsservice-api</artifactId> + </dependency> + <dependency> + <groupId>org.apache.james</groupId> + <artifactId>apache-james-mpt-core</artifactId> + </dependency> + <dependency> + <groupId>com.jayway.restassured</groupId> + <artifactId>rest-assured</artifactId> + </dependency> + <dependency> + <groupId>com.spotify</groupId> + <artifactId>docker-client</artifactId> + </dependency> + <dependency> + <groupId>org.assertj</groupId> + <artifactId>assertj-core</artifactId> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <configuration> + <archive> + <manifest> + <mainClass>fully.qualified.MainClass</mainClass> + </manifest> + </archive> + <descriptorRefs> + <descriptorRef>jar-with-dependencies</descriptorRef> + </descriptorRefs> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>1.8</source> + <target>1.8</target> + </configuration> + </plugin> + </plugins> + </build> + </profile> + <profile> + <id>disable-animal-sniffer</id> + <activation> + <jdk>[1.6,)</jdk> + </activation> + <build> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>animal-sniffer-maven-plugin</artifactId> + <executions> + <execution> + <id>check_java_6</id> + <phase>none</phase> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + </profiles> + <build> + + </build> + +</project> http://git-wip-us.apache.org/repos/asf/james-project/blob/5bef0e5f/mpt/impl/smtp/core/src/main/java/org/apache/james/mpt/smtp/ForwardSmtpTest.java ---------------------------------------------------------------------- diff --git a/mpt/impl/smtp/core/src/main/java/org/apache/james/mpt/smtp/ForwardSmtpTest.java b/mpt/impl/smtp/core/src/main/java/org/apache/james/mpt/smtp/ForwardSmtpTest.java new file mode 100644 index 0000000..faab9a0 --- /dev/null +++ b/mpt/impl/smtp/core/src/main/java/org/apache/james/mpt/smtp/ForwardSmtpTest.java @@ -0,0 +1,100 @@ +/**************************************************************** + * 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.mpt.smtp; + +import static com.jayway.restassured.RestAssured.given; +import static com.jayway.restassured.config.EncoderConfig.encoderConfig; +import static com.jayway.restassured.config.RestAssuredConfig.newConfig; +import static org.hamcrest.Matchers.equalTo; + +import java.net.InetAddress; +import java.util.Locale; + +import javax.inject.Inject; + +import org.apache.james.mpt.api.SmtpHostSystem; +import org.apache.james.mpt.script.AbstractSimpleScriptedTestProtocol; +import org.apache.james.mpt.smtp.dns.InMemoryDNSService; +import org.apache.james.mpt.smtp.utils.DockerRule; +import org.apache.james.rrt.api.RecipientRewriteTable; +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.google.common.collect.ImmutableList; +import com.google.common.net.InetAddresses; +import com.jayway.restassured.RestAssured; +import com.jayway.restassured.http.ContentType; + +public class ForwardSmtpTest extends AbstractSimpleScriptedTestProtocol { + + public static final String USER = "bob"; + public static final String DOMAIN = "mydomain.tld"; + public static final String USER_AT_DOMAIN = USER + "@" + DOMAIN; + public static final String PASSWORD = "secret"; + + private final TemporaryFolder folder = new TemporaryFolder(); + private final DockerRule fakeSmtp = new DockerRule("weave/rest-smtp-sink"); + + @Rule + public final RuleChain chain = RuleChain.outerRule(folder).around(fakeSmtp); + + @Inject + private static SmtpHostSystem hostSystem; + + @Inject + private static RecipientRewriteTable recipientRewriteTable; + + @Inject + private static InMemoryDNSService dnsService; + + public ForwardSmtpTest() throws Exception { + super(hostSystem, USER_AT_DOMAIN, PASSWORD, "/org/apache/james/smtp/scripts/"); + } + + @Before + public void setUp() throws Exception { + super.setUp(); + InetAddress containerIp = InetAddresses.forString(fakeSmtp.getContainerIp()); + dnsService.registerRecord("yopmail.com", new InetAddress[]{containerIp}, ImmutableList.of("yopmail.com"), ImmutableList.of()); + recipientRewriteTable.addAddressMapping(USER, DOMAIN, "r...@yopmail.com"); + + RestAssured.port = Integer.valueOf("80"); + RestAssured.baseURI = "http://" + containerIp.getHostAddress(); + RestAssured.config = newConfig().encoderConfig(encoderConfig().defaultContentCharset(Charsets.UTF_8)); + } + + @Test + public void forwardingAnEmailShouldWork() throws Exception { + scriptTest("helo", Locale.US); + + given() + .accept(ContentType.JSON) + .contentType(ContentType.JSON) + .when() + .get("/api/email") + .then() + .statusCode(200) + .body("[0].from", equalTo("matth...@yopmail.com")) + .body("[0].subject", equalTo("test")); + } +} http://git-wip-us.apache.org/repos/asf/james-project/blob/5bef0e5f/mpt/impl/smtp/core/src/main/java/org/apache/james/mpt/smtp/dns/InMemoryDNSService.java ---------------------------------------------------------------------- diff --git a/mpt/impl/smtp/core/src/main/java/org/apache/james/mpt/smtp/dns/InMemoryDNSService.java b/mpt/impl/smtp/core/src/main/java/org/apache/james/mpt/smtp/dns/InMemoryDNSService.java new file mode 100644 index 0000000..3b32fba --- /dev/null +++ b/mpt/impl/smtp/core/src/main/java/org/apache/james/mpt/smtp/dns/InMemoryDNSService.java @@ -0,0 +1,124 @@ +/**************************************************************** + * 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.mpt.smtp.dns; + +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.function.Predicate; + +import org.apache.james.dnsservice.api.DNSService; +import org.apache.james.dnsservice.api.TemporaryResolutionException; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Maps; +import com.google.common.net.InetAddresses; + +public class InMemoryDNSService implements DNSService { + + private Map<String,DNSRecord> records; + + public InMemoryDNSService() { + records = Maps.newHashMap(); + records.put("0.0.0.0", dnsRecordFor(InetAddresses.forString("0.0.0.0"))); + records.put("127.0.0.1", dnsRecordFor(InetAddresses.forString("127.0.0.1"))); + } + + private DNSRecord dnsRecordFor(InetAddress addresses) { + return dnsRecordFor(ImmutableList.of(), ImmutableList.of(), addresses); + } + + private DNSRecord dnsRecordFor(Collection<String> mxRecords, Collection<String> txtRecords, InetAddress... addresses) { + return new DNSRecord(addresses, mxRecords, txtRecords); + } + + public void registerRecord(String hostname, InetAddress[] addresses,Collection<String> mxRecords, Collection<String> txtRecords ){ + records.put(hostname, dnsRecordFor(mxRecords, txtRecords, addresses)); + } + + public void dropRecord(String hostname){ + records.remove(hostname); + } + + @Override + public Collection<String> findMXRecords(final String hostname) throws TemporaryResolutionException { + return hostRecord(hostname).mxRecords; + } + + @Override + public Collection<String> findTXTRecords(String hostname) { + return hostRecord(hostname).txtRecords; + } + + @Override + public InetAddress[] getAllByName(String host) throws UnknownHostException { + return hostRecord(host).addresses; + } + + @Override + public InetAddress getByName(String host) throws UnknownHostException { + return hostRecord(host).addresses[0]; + } + + private DNSRecord hostRecord(String host) { + Predicate<? super Entry<String, DNSRecord>> filterByKey = (entry) -> entry.getKey().equals(host); + return getDNSEntry(filterByKey).getValue(); + } + + @Override + public InetAddress getLocalHost() throws UnknownHostException { + return InetAddress.getLocalHost(); + } + + @Override + public String getHostName(InetAddress addr) { + Predicate<? super Entry<String, DNSRecord>> filterByValue = (entry) -> entry.getValue().contains(addr); + return getDNSEntry(filterByValue).getKey(); + } + + private Entry<String, DNSRecord> getDNSEntry(Predicate<? super Entry<String, DNSRecord>> filter) { + return records.entrySet().stream() + .filter(filter) + .findFirst() + .get(); + } + + private static class DNSRecord { + + final InetAddress[] addresses; + final Collection<String> mxRecords; + final Collection<String> txtRecords; + private final List<InetAddress> addressList; + + public DNSRecord(InetAddress[] adresses, Collection<String> mxRecords, Collection<String> txtRecords) { + this.addresses = adresses; + this.mxRecords = mxRecords; + this.txtRecords = txtRecords; + this.addressList = ImmutableList.copyOf(addresses); + } + + public boolean contains(InetAddress address){ + return addressList.contains(address); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/james-project/blob/5bef0e5f/mpt/impl/smtp/core/src/main/java/org/apache/james/mpt/smtp/utils/DockerRule.java ---------------------------------------------------------------------- diff --git a/mpt/impl/smtp/core/src/main/java/org/apache/james/mpt/smtp/utils/DockerRule.java b/mpt/impl/smtp/core/src/main/java/org/apache/james/mpt/smtp/utils/DockerRule.java new file mode 100644 index 0000000..42dde6b --- /dev/null +++ b/mpt/impl/smtp/core/src/main/java/org/apache/james/mpt/smtp/utils/DockerRule.java @@ -0,0 +1,112 @@ +/**************************************************************** + * 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.mpt.smtp.utils; + + +import java.util.Map; + +import org.junit.rules.ExternalResource; +import org.junit.runner.Description; +import org.junit.runners.model.Statement; + +import com.google.common.base.Throwables; +import com.google.common.collect.Iterables; +import com.google.common.collect.Maps; +import com.spotify.docker.client.DefaultDockerClient; +import com.spotify.docker.client.DockerClient; +import com.spotify.docker.client.DockerException; +import com.spotify.docker.client.messages.ContainerConfig; +import com.spotify.docker.client.messages.ContainerCreation; +import com.spotify.docker.client.messages.HostConfig; + +public class DockerRule extends ExternalResource { + + public static final String DOCKER_SERVICE_URL = "unix:///var/run/docker.sock"; + private final DockerClient dockerClient; + private final HostConfig hostConfig; + private ContainerCreation container; + private Map<String, String> portBindings; + + public DockerRule(String imageName, String... cmd) throws DockerException, InterruptedException { + this(imageName, DOCKER_SERVICE_URL, cmd); + } + + public DockerRule(String imageName, String dockerServiceUrl, String... cmd) throws DockerException, InterruptedException { + portBindings = Maps.newHashMap(); + + hostConfig = HostConfig.builder() + .publishAllPorts(true) + .build(); + + ContainerConfig containerConfig = ContainerConfig.builder() + .image(imageName) + .networkDisabled(false) + .cmd(cmd) + .hostConfig(hostConfig) + .build(); + + dockerClient = new DefaultDockerClient(dockerServiceUrl); + + dockerClient.pull(imageName); + container = dockerClient.createContainer(containerConfig); + } + + @Override + public Statement apply(Statement base, Description description) { + return super.apply(base, description); + } + + @Override + protected void before() throws Throwable { + super.before(); + dockerClient.startContainer(container.id()); + portBindings.putAll(extractPortBindings()); + } + + public String getContainerIp() throws DockerException, InterruptedException { + return dockerClient.inspectContainer(container.id()) + .networkSettings() + .ipAddress(); + } + + private Map<String, String> extractPortBindings() throws DockerException, + InterruptedException { + return Maps.transformValues( + dockerClient.inspectContainer(container.id()) + .networkSettings() + .ports(), + x -> Iterables.getOnlyElement(x).hostPort()); + } + + @Override + protected void after() { + super.after(); + try { + dockerClient.killContainer(container.id()); + dockerClient.removeContainer(container.id(), true); + } catch (DockerException | InterruptedException e) { + Throwables.propagate(e); + } + } + + public Map<String, String> getPortBindings() { + return portBindings; + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/james-project/blob/5bef0e5f/mpt/impl/smtp/core/src/main/resources/org/apache/james/smtp/scripts/helo.test ---------------------------------------------------------------------- diff --git a/mpt/impl/smtp/core/src/main/resources/org/apache/james/smtp/scripts/helo.test b/mpt/impl/smtp/core/src/main/resources/org/apache/james/smtp/scripts/helo.test new file mode 100644 index 0000000..637f77d --- /dev/null +++ b/mpt/impl/smtp/core/src/main/resources/org/apache/james/smtp/scripts/helo.test @@ -0,0 +1,16 @@ +S: 220 mydomain.tld smtp +C: ehlo yopmail.com +C: mail from:<matth...@yopmail.com> +C: rcpt to:<b...@mydomain.tld> +C: data +S: 250.* +S: 250-PIPELINING +S: 250-ENHANCEDSTATUSCODES +S: 250 8BITMIME +S: 250 2.1.0 Sender <matth...@yopmail.com> OK +S: 250 2.1.5 Recipient <b...@mydomain.tld> OK +S: 354 Ok Send data ending with <CRLF>.<CRLF> +C: subject: test +C: test +C: . +S: 250 2.6.0 Message received http://git-wip-us.apache.org/repos/asf/james-project/blob/5bef0e5f/mpt/impl/smtp/pom.xml ---------------------------------------------------------------------- diff --git a/mpt/impl/smtp/pom.xml b/mpt/impl/smtp/pom.xml new file mode 100644 index 0000000..d51627c --- /dev/null +++ b/mpt/impl/smtp/pom.xml @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <artifactId>apache-james-mpt</artifactId> + <groupId>org.apache.james</groupId> + <version>0.2-SNAPSHOT</version> + <relativePath>../..</relativePath> + </parent> + <modelVersion>4.0.0</modelVersion> + + <artifactId>apache-james-mpt-smtp</artifactId> + <name>Apache James MPT SMTP</name> + <packaging>pom</packaging> + + <modules> + <module>core</module> + <module>cassandra</module> + </modules> + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>apache-james-mpt-smtp-cassandra</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>apache-james-mpt-smtp-core</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + </dependencies> + </dependencyManagement> + + <profiles> + <profile> + <id>cassandra</id> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <includes> + <include>**/cassandra/**/*.java</include> + </includes> + <excludes> + <exclude>**/suite/*.java</exclude> + <exclude>**/suite/**/*.java</exclude> + </excludes> + </configuration> + </plugin> + </plugins> + </build> + </profile> + </profiles> + +</project> --------------------------------------------------------------------- To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org