JAMES-2589 Write SMTP integretion tests for Cassandra RabbitMQ Swift
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/d0557b4c Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/d0557b4c Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/d0557b4c Branch: refs/heads/master Commit: d0557b4c34649409d5349a60703443ceb1315c51 Parents: 9c214e8 Author: Benoit Tellier <[email protected]> Authored: Thu Nov 15 13:18:05 2018 +0700 Committer: Benoit Tellier <[email protected]> Committed: Wed Nov 21 16:49:15 2018 +0700 ---------------------------------------------------------------------- mpt/impl/smtp/cassandra-rabbitmq-swift/pom.xml | 126 +++++++++++++ .../CassandraRabbitMQSwiftSmtpTestRule.java | 183 +++++++++++++++++++ .../james/mpt/smtp/RabbitMQForwardSmtpTest.java | 53 ++++++ .../smtp/RabbitMQSmtpStarttlsCommandTest.java | 55 ++++++ .../src/test/resources/dnsservice.xml | 29 +++ .../src/test/resources/domainlist.xml | 28 +++ .../src/test/resources/keystore | Bin 0 -> 2245 bytes .../src/test/resources/mailetcontainer.xml | 107 +++++++++++ .../src/test/resources/mailrepositorystore.xml | 31 ++++ .../test/resources/recipientrewritetable.xml | 27 +++ .../src/test/resources/smtpserver.xml | 103 +++++++++++ mpt/impl/smtp/pom.xml | 1 + 12 files changed, 743 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/james-project/blob/d0557b4c/mpt/impl/smtp/cassandra-rabbitmq-swift/pom.xml ---------------------------------------------------------------------- diff --git a/mpt/impl/smtp/cassandra-rabbitmq-swift/pom.xml b/mpt/impl/smtp/cassandra-rabbitmq-swift/pom.xml new file mode 100644 index 0000000..2c57048 --- /dev/null +++ b/mpt/impl/smtp/cassandra-rabbitmq-swift/pom.xml @@ -0,0 +1,126 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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. +--> +<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"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.james</groupId> + <artifactId>apache-james-mpt-smtp</artifactId> + <version>3.3.0-SNAPSHOT</version> + </parent> + + <artifactId>apache-james-mpt-smtp-cassandra-rabbitmq-swift</artifactId> + <packaging>jar</packaging> + + <name>Apache James MPT SMTP Cassandra RabbitMQ Swift</name> + + <dependencies> + <dependency> + <groupId>${james.groupId}</groupId> + <artifactId>apache-james-backends-cassandra</artifactId> + <type>test-jar</type> + <scope>test</scope> + </dependency> + <dependency> + <groupId>${james.groupId}</groupId> + <artifactId>apache-james-backends-rabbitmq</artifactId> + <type>test-jar</type> + <scope>test</scope> + </dependency> + <dependency> + <groupId>${james.groupId}</groupId> + <artifactId>apache-james-mpt-core</artifactId> + </dependency> + <dependency> + <groupId>${james.groupId}</groupId> + <artifactId>blob-objectstorage</artifactId> + <type>test-jar</type> + <scope>test</scope> + </dependency> + <dependency> + <groupId>${james.groupId}</groupId> + <artifactId>blob-objectstorage-guice</artifactId> + <type>test-jar</type> + <scope>test</scope> + </dependency> + <dependency> + <groupId>${james.groupId}</groupId> + <artifactId>apache-james-mpt-smtp-core</artifactId> + </dependency> + <dependency> + <groupId>${james.groupId}</groupId> + <artifactId>james-server-cassandra-rabbitmq-guice</artifactId> + </dependency> + <dependency> + <groupId>${james.groupId}</groupId> + <artifactId>james-server-cassandra-rabbitmq-guice</artifactId> + <type>test-jar</type> + <scope>test</scope> + </dependency> + <dependency> + <groupId>${james.groupId}</groupId> + <artifactId>james-server-guice-common</artifactId> + <type>test-jar</type> + <scope>test</scope> + </dependency> + <dependency> + <groupId>${james.groupId}</groupId> + <artifactId>james-server-guice-jmap</artifactId> + <type>test-jar</type> + <scope>test</scope> + </dependency> + <dependency> + <groupId>${james.groupId}</groupId> + <artifactId>james-server-util</artifactId> + <type>test-jar</type> + <scope>test</scope> + </dependency> + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-classic</artifactId> + </dependency> + <dependency> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> + </dependency> + <dependency> + <groupId>org.junit.platform</groupId> + <artifactId>junit-platform-launcher</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.junit.vintage</groupId> + <artifactId>junit-vintage-engine</artifactId> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <reuseForks>true</reuseForks> + </configuration> + </plugin> + </plugins> + </build> + +</project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/james-project/blob/d0557b4c/mpt/impl/smtp/cassandra-rabbitmq-swift/src/test/java/org/apache/james/mpt/smtp/CassandraRabbitMQSwiftSmtpTestRule.java ---------------------------------------------------------------------- diff --git a/mpt/impl/smtp/cassandra-rabbitmq-swift/src/test/java/org/apache/james/mpt/smtp/CassandraRabbitMQSwiftSmtpTestRule.java b/mpt/impl/smtp/cassandra-rabbitmq-swift/src/test/java/org/apache/james/mpt/smtp/CassandraRabbitMQSwiftSmtpTestRule.java new file mode 100644 index 0000000..e1b32a5 --- /dev/null +++ b/mpt/impl/smtp/cassandra-rabbitmq-swift/src/test/java/org/apache/james/mpt/smtp/CassandraRabbitMQSwiftSmtpTestRule.java @@ -0,0 +1,183 @@ +/**************************************************************** + * 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.util.Iterator; +import java.util.function.Function; + +import org.apache.commons.configuration.DefaultConfigurationBuilder; +import org.apache.james.CassandraJamesServerMain; +import org.apache.james.GuiceJamesServer; +import org.apache.james.backend.rabbitmq.DockerRabbitMQSingleton; +import org.apache.james.backends.cassandra.init.configuration.ClusterConfiguration; +import org.apache.james.dnsservice.api.DNSService; +import org.apache.james.dnsservice.api.InMemoryDNSService; +import org.apache.james.modules.TestRabbitMQModule; +import org.apache.james.modules.TestSwiftBlobStoreModule; +import org.apache.james.modules.blobstore.BlobStoreChoosingConfiguration; +import org.apache.james.modules.blobstore.BlobStoreChoosingModule; +import org.apache.james.modules.protocols.ProtocolHandlerModule; +import org.apache.james.modules.protocols.SMTPServerModule; +import org.apache.james.modules.protocols.SmtpGuiceProbe; +import org.apache.james.modules.rabbitmq.RabbitMQModule; +import org.apache.james.modules.server.CamelMailetContainerModule; +import org.apache.james.mpt.api.Continuation; +import org.apache.james.mpt.api.Session; +import org.apache.james.mpt.monitor.SystemLoggingMonitor; +import org.apache.james.mpt.session.ExternalSessionFactory; +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.util.Host; +import org.apache.james.util.Port; +import org.apache.james.utils.DataProbeImpl; +import org.junit.rules.TemporaryFolder; +import org.junit.rules.TestRule; +import org.junit.runner.Description; +import org.junit.runners.model.Statement; + +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 CassandraRabbitMQSwiftSmtpTestRule implements TestRule, SmtpHostSystem { + + enum SmtpServerConnectedType { + SMTP_GLOBAL_SERVER(probe -> Port.of(probe.getSmtpPort())), + SMTP_START_TLS_SERVER(probe -> Port.of(probe.getSmtpsPort())); + + private final Function<SmtpGuiceProbe, Port> portExtractor; + + SmtpServerConnectedType(Function<SmtpGuiceProbe, Port> portExtractor) { + this.portExtractor = portExtractor; + } + + public Function<SmtpGuiceProbe, Port> getPortExtractor() { + return portExtractor; + } + } + + private static final Module SMTP_PROTOCOL_MODULE = Modules.combine( + new ProtocolHandlerModule(), + new SMTPServerModule()); + + private final Host cassandraHost; + private final SmtpServerConnectedType smtpServerConnectedType; + + private TemporaryFolder folder; + private GuiceJamesServer jamesServer; + private InMemoryDNSService inMemoryDNSService; + private ExternalSessionFactory sessionFactory; + + public CassandraRabbitMQSwiftSmtpTestRule(SmtpServerConnectedType smtpServerConnectedType, Host cassandraHost) { + this.smtpServerConnectedType = smtpServerConnectedType; + this.cassandraHost = cassandraHost; + } + + @Override + public Statement apply(Statement base, Description description) { + return base; + } + + @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(); + + createDomainIfNeeded(domain); + jamesServer.getProbe(DataProbeImpl.class).addUser(userAtDomain, password); + return true; + } + + @Override + public Session newSession(Continuation continuation) throws Exception { + return sessionFactory.newSession(continuation); + } + + private void createDomainIfNeeded(String domain) throws Exception { + if (!jamesServer.getProbe(DataProbeImpl.class).containsDomain(domain)) { + jamesServer.getProbe(DataProbeImpl.class).addDomain(domain); + } + } + + @Override + public void addAddressMapping(String user, String domain, String address) throws Exception { + jamesServer.getProbe(DataProbeImpl.class).addAddressMapping(user, domain, address); + } + + @Override + public void beforeTest() throws Exception { + inMemoryDNSService = new InMemoryDNSService(); + folder = new TemporaryFolder(); + folder.create(); + jamesServer = createJamesServer(); + jamesServer.start(); + + createSessionFactory(); + } + + @Override + public void afterTest() { + jamesServer.stop(); + folder.delete(); + } + + @Override + public InMemoryDNSService getInMemoryDnsService() { + return inMemoryDNSService; + } + + private GuiceJamesServer createJamesServer() throws Exception { + Configuration configuration = Configuration.builder() + .workingDirectory(folder.newFolder()) + .configurationFromClasspath() + .build(); + + return GuiceJamesServer.forConfiguration(configuration) + .combineWith( + Modules + .override(Modules.combine(CassandraJamesServerMain.CASSANDRA_SERVER_CORE_MODULE)) + .with(new RabbitMQModule(), new BlobStoreChoosingModule()), + SMTP_PROTOCOL_MODULE, + binder -> binder.bind(MailQueueItemDecoratorFactory.class).to(RawMailQueueItemDecoratorFactory.class), + binder -> binder.bind(CamelMailetContainerModule.DefaultProcessorsConfigurationSupplier.class) + .toInstance(DefaultConfigurationBuilder::new)) + .overrideWith(new TestRabbitMQModule(DockerRabbitMQSingleton.SINGLETON)) + .overrideWith(new TestSwiftBlobStoreModule()) + .overrideWith(binder -> binder.bind(BlobStoreChoosingConfiguration.class).toInstance(BlobStoreChoosingConfiguration.objectStorage())) + .overrideWith( + binder -> binder.bind(ClusterConfiguration.class).toInstance( + ClusterConfiguration.builder() + .host(cassandraHost) + .keyspace("testing") + .replicationFactor(1) + .build()), + binder -> binder.bind(DNSService.class).toInstance(inMemoryDNSService)); + } + + private void createSessionFactory() { + SmtpGuiceProbe smtpProbe = jamesServer.getProbe(SmtpGuiceProbe.class); + Port smtpPort = smtpServerConnectedType.getPortExtractor().apply(smtpProbe); + + sessionFactory = new ExternalSessionFactory("localhost", smtpPort, new SystemLoggingMonitor(), "220 mydomain.tld smtp"); + } +} http://git-wip-us.apache.org/repos/asf/james-project/blob/d0557b4c/mpt/impl/smtp/cassandra-rabbitmq-swift/src/test/java/org/apache/james/mpt/smtp/RabbitMQForwardSmtpTest.java ---------------------------------------------------------------------- diff --git a/mpt/impl/smtp/cassandra-rabbitmq-swift/src/test/java/org/apache/james/mpt/smtp/RabbitMQForwardSmtpTest.java b/mpt/impl/smtp/cassandra-rabbitmq-swift/src/test/java/org/apache/james/mpt/smtp/RabbitMQForwardSmtpTest.java new file mode 100644 index 0000000..6461a7c --- /dev/null +++ b/mpt/impl/smtp/cassandra-rabbitmq-swift/src/test/java/org/apache/james/mpt/smtp/RabbitMQForwardSmtpTest.java @@ -0,0 +1,53 @@ +/**************************************************************** + * 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 org.apache.james.mpt.smtp.CassandraRabbitMQSwiftSmtpTestRule.SmtpServerConnectedType.SMTP_GLOBAL_SERVER; + +import org.apache.james.backends.cassandra.DockerCassandraRule; +import org.junit.After; +import org.junit.Before; +import org.junit.ClassRule; +import org.junit.Rule; + +public class RabbitMQForwardSmtpTest extends ForwardSmtpTest { + + @ClassRule public static DockerCassandraRule cassandraServer = new DockerCassandraRule(); + + @Rule + public CassandraRabbitMQSwiftSmtpTestRule cassandraRabbitMQSwiftSmtpTestRule = new CassandraRabbitMQSwiftSmtpTestRule(SMTP_GLOBAL_SERVER, cassandraServer.getHost()); + + @Before + @Override + public void setUp() throws Exception { + cassandraRabbitMQSwiftSmtpTestRule.beforeTest(); + super.setUp(); + } + + @Override + protected SmtpHostSystem createSmtpHostSystem() { + return cassandraRabbitMQSwiftSmtpTestRule; + } + + @After + public void tearDown() { + cassandraRabbitMQSwiftSmtpTestRule.afterTest(); + } +} http://git-wip-us.apache.org/repos/asf/james-project/blob/d0557b4c/mpt/impl/smtp/cassandra-rabbitmq-swift/src/test/java/org/apache/james/mpt/smtp/RabbitMQSmtpStarttlsCommandTest.java ---------------------------------------------------------------------- diff --git a/mpt/impl/smtp/cassandra-rabbitmq-swift/src/test/java/org/apache/james/mpt/smtp/RabbitMQSmtpStarttlsCommandTest.java b/mpt/impl/smtp/cassandra-rabbitmq-swift/src/test/java/org/apache/james/mpt/smtp/RabbitMQSmtpStarttlsCommandTest.java new file mode 100644 index 0000000..52433da --- /dev/null +++ b/mpt/impl/smtp/cassandra-rabbitmq-swift/src/test/java/org/apache/james/mpt/smtp/RabbitMQSmtpStarttlsCommandTest.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.mpt.smtp; + +import static org.apache.james.mpt.smtp.CassandraRabbitMQSwiftSmtpTestRule.SmtpServerConnectedType.SMTP_START_TLS_SERVER; + +import org.apache.james.backends.cassandra.DockerCassandraRule; +import org.junit.After; +import org.junit.Before; +import org.junit.ClassRule; +import org.junit.Rule; + +public class RabbitMQSmtpStarttlsCommandTest extends SmtpStarttlsCommandTest { + + @ClassRule public static DockerCassandraRule cassandraServer = new DockerCassandraRule(); + + @Rule + public CassandraRabbitMQSwiftSmtpTestRule cassandraRabbitMQSwiftSmtpTestRule = new CassandraRabbitMQSwiftSmtpTestRule(SMTP_START_TLS_SERVER, cassandraServer.getHost()); + + @Before + @Override + public void setUp() throws Exception { + cassandraRabbitMQSwiftSmtpTestRule.beforeTest(); + super.setUp(); + } + + @Override + protected SmtpHostSystem createSmtpHostSystem() { + return cassandraRabbitMQSwiftSmtpTestRule; + } + + + @After + public void tearDown() { + cassandraRabbitMQSwiftSmtpTestRule.afterTest(); + } + +} http://git-wip-us.apache.org/repos/asf/james-project/blob/d0557b4c/mpt/impl/smtp/cassandra-rabbitmq-swift/src/test/resources/dnsservice.xml ---------------------------------------------------------------------- diff --git a/mpt/impl/smtp/cassandra-rabbitmq-swift/src/test/resources/dnsservice.xml b/mpt/impl/smtp/cassandra-rabbitmq-swift/src/test/resources/dnsservice.xml new file mode 100644 index 0000000..0978a00 --- /dev/null +++ b/mpt/impl/smtp/cassandra-rabbitmq-swift/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/d0557b4c/mpt/impl/smtp/cassandra-rabbitmq-swift/src/test/resources/domainlist.xml ---------------------------------------------------------------------- diff --git a/mpt/impl/smtp/cassandra-rabbitmq-swift/src/test/resources/domainlist.xml b/mpt/impl/smtp/cassandra-rabbitmq-swift/src/test/resources/domainlist.xml new file mode 100644 index 0000000..cb6a2e8 --- /dev/null +++ b/mpt/impl/smtp/cassandra-rabbitmq-swift/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> + <domainnames> + <domainname>mydomain.tld</domainname> + </domainnames> + <autodetect>false</autodetect> + <autodetectIP>false</autodetectIP> + <defaultDomain>localhost</defaultDomain> +</domainlist> http://git-wip-us.apache.org/repos/asf/james-project/blob/d0557b4c/mpt/impl/smtp/cassandra-rabbitmq-swift/src/test/resources/keystore ---------------------------------------------------------------------- diff --git a/mpt/impl/smtp/cassandra-rabbitmq-swift/src/test/resources/keystore b/mpt/impl/smtp/cassandra-rabbitmq-swift/src/test/resources/keystore new file mode 100644 index 0000000..536a6c7 Binary files /dev/null and b/mpt/impl/smtp/cassandra-rabbitmq-swift/src/test/resources/keystore differ http://git-wip-us.apache.org/repos/asf/james-project/blob/d0557b4c/mpt/impl/smtp/cassandra-rabbitmq-swift/src/test/resources/mailetcontainer.xml ---------------------------------------------------------------------- diff --git a/mpt/impl/smtp/cassandra-rabbitmq-swift/src/test/resources/mailetcontainer.xml b/mpt/impl/smtp/cassandra-rabbitmq-swift/src/test/resources/mailetcontainer.xml new file mode 100644 index 0000000..d854443 --- /dev/null +++ b/mpt/impl/smtp/cassandra-rabbitmq-swift/src/test/resources/mailetcontainer.xml @@ -0,0 +1,107 @@ +<?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="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="All" class="RemoveMimeHeader"> + <name>bcc</name> + </mailet> + <mailet match="HasMailAttribute=org.apache.james.SMIMECheckSignature" class="SetMimeHeader"> + <name>X-WasSigned</name> + <value>true</value> + </mailet> + <mailet match="All" class="RemoveMimeHeader"> + <name>bcc</name> + </mailet> + <mailet match="All" class="RecipientRewriteTable"> + <errorProcessor>rrt-error</errorProcessor> + </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> + </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> + + <processor state="rrt-error" enableJmx="false"> + <mailet match="All" class="ToRepository"> + <repositoryPath>file://var/mail/rrt-error/</repositoryPath> + <passThrough>true</passThrough> + </mailet> + <mailet match="IsSenderInRRTLoop" class="Null"/> + <mailet match="All" class="Bounce"/> + </processor> + </processors> + +</mailetcontainer> + http://git-wip-us.apache.org/repos/asf/james-project/blob/d0557b4c/mpt/impl/smtp/cassandra-rabbitmq-swift/src/test/resources/mailrepositorystore.xml ---------------------------------------------------------------------- diff --git a/mpt/impl/smtp/cassandra-rabbitmq-swift/src/test/resources/mailrepositorystore.xml b/mpt/impl/smtp/cassandra-rabbitmq-swift/src/test/resources/mailrepositorystore.xml new file mode 100644 index 0000000..3ca4a1d --- /dev/null +++ b/mpt/impl/smtp/cassandra-rabbitmq-swift/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/d0557b4c/mpt/impl/smtp/cassandra-rabbitmq-swift/src/test/resources/recipientrewritetable.xml ---------------------------------------------------------------------- diff --git a/mpt/impl/smtp/cassandra-rabbitmq-swift/src/test/resources/recipientrewritetable.xml b/mpt/impl/smtp/cassandra-rabbitmq-swift/src/test/resources/recipientrewritetable.xml new file mode 100644 index 0000000..5553a40 --- /dev/null +++ b/mpt/impl/smtp/cassandra-rabbitmq-swift/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> + <recursiveMapping>true</recursiveMapping> + <mappingLimit>10</mappingLimit> + <mapping>some@domain=some</mapping> +</recipientrewritetable> + http://git-wip-us.apache.org/repos/asf/james-project/blob/d0557b4c/mpt/impl/smtp/cassandra-rabbitmq-swift/src/test/resources/smtpserver.xml ---------------------------------------------------------------------- diff --git a/mpt/impl/smtp/cassandra-rabbitmq-swift/src/test/resources/smtpserver.xml b/mpt/impl/smtp/cassandra-rabbitmq-swift/src/test/resources/smtpserver.xml new file mode 100644 index 0000000..a862fad --- /dev/null +++ b/mpt/impl/smtp/cassandra-rabbitmq-swift/src/test/resources/smtpserver.xml @@ -0,0 +1,103 @@ +<?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:0</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> + <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:0</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> + <!-- 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:0</bind> + <connectionBacklog>200</connectionBacklog> + <tls socketTLS="false" startTLS="true"> + <keystore>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> + <!-- 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/d0557b4c/mpt/impl/smtp/pom.xml ---------------------------------------------------------------------- diff --git a/mpt/impl/smtp/pom.xml b/mpt/impl/smtp/pom.xml index 196c71a..c110f74 100644 --- a/mpt/impl/smtp/pom.xml +++ b/mpt/impl/smtp/pom.xml @@ -32,6 +32,7 @@ <modules> <module>cassandra</module> + <module>cassandra-rabbitmq-swift</module> <module>core</module> </modules> --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
