MAILET-135 Introduce mailet pipeline testing
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/4044435e Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/4044435e Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/4044435e Branch: refs/heads/master Commit: 4044435e69a2174058c33c280a6ffe1e838ff88e Parents: 2fda869 Author: Antoine Duprat <adup...@linagora.com> Authored: Thu Sep 15 16:49:51 2016 +0200 Committer: Antoine Duprat <adup...@apache.org> Committed: Tue Oct 4 12:45:06 2016 +0200 ---------------------------------------------------------------------- server/mailet/integration-testing/pom.xml | 258 +++++++++++++++++++ .../mailets/CommonMailetConfigurationTest.java | 65 +++++ .../mailets/TemporaryFilesystemModule.java | 95 +++++++ .../james/mailets/TemporaryJamesServer.java | 70 +++++ .../mailets/configuration/CommonProcessors.java | 248 ++++++++++++++++++ .../configuration/MailetConfiguration.java | 99 +++++++ .../mailets/configuration/MailetContainer.java | 104 ++++++++ .../configuration/ProcessorConfiguration.java | 96 +++++++ .../configuration/SerializableAsXml.java | 26 ++ .../src/test/resources/dnsservice.xml | 29 +++ .../src/test/resources/domainlist.xml | 27 ++ .../src/test/resources/imapserver.xml | 54 ++++ .../src/test/resources/keystore | Bin 0 -> 2245 bytes .../src/test/resources/lmtpserver.xml | 41 +++ .../src/test/resources/mailrepositorystore.xml | 31 +++ .../src/test/resources/managesieveserver.xml | 65 +++++ .../src/test/resources/pop3server.xml | 42 +++ .../src/test/resources/smtpserver.xml | 105 ++++++++ server/pom.xml | 1 + 19 files changed, 1456 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/james-project/blob/4044435e/server/mailet/integration-testing/pom.xml ---------------------------------------------------------------------- diff --git a/server/mailet/integration-testing/pom.xml b/server/mailet/integration-testing/pom.xml new file mode 100644 index 0000000..8bd8838 --- /dev/null +++ b/server/mailet/integration-testing/pom.xml @@ -0,0 +1,258 @@ +<?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/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <artifactId>james-server</artifactId> + <groupId>org.apache.james</groupId> + <version>3.0.0-beta5-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent> + + <artifactId>james-server-mailets-integration-testing</artifactId> + <packaging>bundle</packaging> + + <name>Apache James :: Server :: Mailets Integration Testing</name> + + + <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-memory</artifactId> + </dependency> + <dependency> + <groupId>org.apache.james</groupId> + <artifactId>james-server-guice-common</artifactId> + <scope>test</scope> + <type>test-jar</type> + </dependency> + <dependency> + <groupId>org.apache.james</groupId> + <artifactId>james-server-mailetcontainer-camel</artifactId> + </dependency> + <dependency> + <groupId>org.apache.james</groupId> + <artifactId>james-server-mailets</artifactId> + </dependency> + <dependency> + <groupId>org.apache.james</groupId> + <artifactId>james-server-memory-guice</artifactId> + </dependency> + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-classic</artifactId> + <version>1.1.6</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.assertj</groupId> + <artifactId>assertj-core</artifactId> + <version>${assertj-1.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</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>animal-sniffer-java-8</id> + <activation> + <jdk>[1.8,)</jdk> + </activation> + <build> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>animal-sniffer-maven-plugin</artifactId> + <configuration> + <signature> + <groupId>org.codehaus.mojo.signature</groupId> + <artifactId>java18</artifactId> + <version>1.0</version> + </signature> + </configuration> + <executions> + <execution> + <id>check_java_8</id> + <phase>test</phase> + <goals> + <goal>check</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + </profiles> + +</project> http://git-wip-us.apache.org/repos/asf/james-project/blob/4044435e/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/CommonMailetConfigurationTest.java ---------------------------------------------------------------------- diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/CommonMailetConfigurationTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/CommonMailetConfigurationTest.java new file mode 100644 index 0000000..3d785aa --- /dev/null +++ b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/CommonMailetConfigurationTest.java @@ -0,0 +1,65 @@ +/**************************************************************** + * 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.mailets; + +import org.apache.james.mailets.configuration.CommonProcessors; +import org.apache.james.mailets.configuration.MailetContainer; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TemporaryFolder; + +public class CommonMailetConfigurationTest { + + private static final String DEFAULT_DOMAIN = "james.org"; + + @Rule + public TemporaryFolder temporaryFolder = new TemporaryFolder(); + + private TemporaryJamesServer jamesServer; + + @Before + public void setup() throws Exception { + MailetContainer mailetContainer = MailetContainer.builder() + .postmaster("postmaster@" + DEFAULT_DOMAIN) + .threads(5) + .addProcessor(CommonProcessors.root()) + .addProcessor(CommonProcessors.error()) + .addProcessor(CommonProcessors.transport()) + .addProcessor(CommonProcessors.spam()) + .addProcessor(CommonProcessors.localAddressError()) + .addProcessor(CommonProcessors.relayDenied()) + .addProcessor(CommonProcessors.bounces()) + .addProcessor(CommonProcessors.sieveManagerCheck()) + .build(); + + jamesServer = new TemporaryJamesServer(temporaryFolder, mailetContainer); + } + + @After + public void tearDown() { + jamesServer.shutdown(); + } + + @Test + public void startingJamesWithCommonMailetConfigurationShouldWork() { + } +} http://git-wip-us.apache.org/repos/asf/james-project/blob/4044435e/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/TemporaryFilesystemModule.java ---------------------------------------------------------------------- diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/TemporaryFilesystemModule.java b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/TemporaryFilesystemModule.java new file mode 100644 index 0000000..aeebc0a --- /dev/null +++ b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/TemporaryFilesystemModule.java @@ -0,0 +1,95 @@ +/**************************************************************** + * 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.mailets; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.List; +import java.util.function.Supplier; + +import org.apache.commons.io.IOUtils; +import org.apache.james.core.JamesServerResourceLoader; +import org.apache.james.filesystem.api.FileSystem; +import org.apache.james.filesystem.api.JamesDirectoriesProvider; +import org.apache.james.modules.CommonServicesModule; +import org.junit.rules.TemporaryFolder; + +import com.google.common.base.Throwables; +import com.google.common.collect.ImmutableList; +import com.google.inject.AbstractModule; +import com.google.inject.name.Names; + +public class TemporaryFilesystemModule extends AbstractModule { + + private static final List<String> CONFIGURATION_FILE_NAMES = ImmutableList.of("dnsservice.xml", + "domainlist.xml", + "imapserver.xml", + "keystore", + "lmtpserver.xml", + "mailrepositorystore.xml", + "managesieveserver.xml", + "pop3server.xml", + "recipientrewritetable.xml", + "smtpserver.xml", + "usersrepository.xml"); + + private final Supplier<File> workingDirectory; + + private static File rootDir(TemporaryFolder temporaryFolder) { + return temporaryFolder.getRoot(); + } + + public TemporaryFilesystemModule(TemporaryFolder temporaryFolder) { + this(() -> TemporaryFilesystemModule.rootDir(temporaryFolder)); + } + + public TemporaryFilesystemModule(Supplier<File> workingDirectory) { + this.workingDirectory = workingDirectory; + } + + @Override + protected void configure() { + try { + bind(JamesDirectoriesProvider.class).toInstance(new JamesServerResourceLoader(workingDirectory.get().getAbsolutePath())); + copyResources(Paths.get(workingDirectory.get().getAbsolutePath(), "conf")); + bindConstant().annotatedWith(Names.named(CommonServicesModule.CONFIGURATION_PATH)).to(FileSystem.FILE_PROTOCOL_AND_CONF); + } catch (IOException e) { + Throwables.propagate(e); + } + } + + private void copyResources(Path resourcesFolder) throws FileNotFoundException, IOException { + CONFIGURATION_FILE_NAMES.stream() + .forEach(resourceName -> copyResource(resourcesFolder, resourceName)); + } + + private void copyResource(Path resourcesFolder, String resourceName) { + try (OutputStream outputStream = new FileOutputStream(resourcesFolder.resolve(resourceName).toFile())){ + IOUtils.copy(ClassLoader.getSystemClassLoader().getResource(resourceName).openStream(), outputStream); + } catch (IOException e) { + Throwables.propagate(e); + } + } +} http://git-wip-us.apache.org/repos/asf/james-project/blob/4044435e/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/TemporaryJamesServer.java ---------------------------------------------------------------------- diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/TemporaryJamesServer.java b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/TemporaryJamesServer.java new file mode 100644 index 0000000..265df8b --- /dev/null +++ b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/TemporaryJamesServer.java @@ -0,0 +1,70 @@ +/**************************************************************** + * 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.mailets; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.nio.file.Paths; + +import org.apache.commons.configuration.ConfigurationException; +import org.apache.commons.io.IOUtils; +import org.apache.james.GuiceJamesServer; +import org.apache.james.MemoryJamesServerMain; +import org.apache.james.mailets.configuration.MailetContainer; +import org.apache.james.modules.TestJMAPServerModule; +import org.junit.rules.TemporaryFolder; + +public class TemporaryJamesServer { + + private static final String MAILETCONTAINER_CONFIGURATION_FILENAME = "mailetcontainer.xml"; + + private static final int LIMIT_TO_3_MESSAGES = 3; + + private final GuiceJamesServer jamesServer; + + + public TemporaryJamesServer(TemporaryFolder temporaryFolder, MailetContainer mailetContainer) throws Exception { + appendMailetConfigurations(temporaryFolder, mailetContainer); + + jamesServer = new GuiceJamesServer() + .combineWith(MemoryJamesServerMain.inMemoryServerModule) + .overrideWith(new TestJMAPServerModule(LIMIT_TO_3_MESSAGES), + new TemporaryFilesystemModule(temporaryFolder)); + + jamesServer.start(); + } + + private void appendMailetConfigurations(TemporaryFolder temporaryFolder, MailetContainer mailetContainer) throws ConfigurationException, IOException { + try (OutputStream outputStream = createMailetConfigurationFile(temporaryFolder)) { + IOUtils.write(mailetContainer.serializeAsXml(), outputStream); + } + } + + private FileOutputStream createMailetConfigurationFile(TemporaryFolder temporaryFolder) throws IOException { + File configurationFolder = temporaryFolder.newFolder("conf"); + return new FileOutputStream(Paths.get(configurationFolder.getAbsolutePath(), MAILETCONTAINER_CONFIGURATION_FILENAME).toFile()); + } + + public void shutdown() { + jamesServer.stop(); + } +} http://git-wip-us.apache.org/repos/asf/james-project/blob/4044435e/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/configuration/CommonProcessors.java ---------------------------------------------------------------------- diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/configuration/CommonProcessors.java b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/configuration/CommonProcessors.java new file mode 100644 index 0000000..294f01c --- /dev/null +++ b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/configuration/CommonProcessors.java @@ -0,0 +1,248 @@ +/**************************************************************** + * 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.mailets.configuration; + +public class CommonProcessors { + + public static ProcessorConfiguration root() { + return ProcessorConfiguration.builder() + .state("root") + .enableJmx(true) + .addMailet(MailetConfiguration.builder() + .match("All") + .clazz("PostmasterAlias") + .build()) + .addMailet(MailetConfiguration.builder() + .match("RelayLimit=30") + .clazz("Null") + .build()) + .addMailet(MailetConfiguration.builder() + .match("RecipientIs=sievemana...@james.linagora.com") + .clazz("ToProcessor") + .addProperty("processor", "sieve-manager-check") + .build()) + .addMailet(MailetConfiguration.builder() + .match("HasMailAttribute=spamChecked") + .clazz("ToProcessor") + .addProperty("processor", "transport") + .build()) + .addMailet(MailetConfiguration.builder() + .match("All") + .clazz("SetMailAttribute") + .addProperty("spamChecked", "true") + .build()) + .addMailet(MailetConfiguration.builder() + .match("SMTPAuthSuccessful") + .clazz("ToProcessor") + .addProperty("processor", "transport") + .build()) + .addMailet(MailetConfiguration.builder() + .match("InSpammerBlacklist=query.bondedsender.org.") + .clazz("ToProcessor") + .addProperty("processor", "transport") + .build()) + .addMailet(MailetConfiguration.builder() + .match("InSpammerBlacklist=dnsbl.njabl.org.") + .clazz("ToProcessor") + .addProperty("processor", "spam") + .addProperty("notice", "550 Requested action not taken: rejected - see http://njabl.org/") + .build()) + .addMailet(MailetConfiguration.builder() + .match("All") + .clazz("ToProcessor") + .addProperty("processor", "transport") + .build()) + .build(); + } + + public static ProcessorConfiguration error() { + return ProcessorConfiguration.builder() + .state("error") + .enableJmx(true) + .addMailet(MailetConfiguration.builder() + .match("All") + .clazz("Bounce") + .build()) + .addMailet(MailetConfiguration.builder() + .match("All") + .clazz("ToRepository") + .addProperty("repositoryPath", "file://var/mail/error/") + .build()) + .build(); + } + + public static ProcessorConfiguration transport() { + return ProcessorConfiguration.builder() + .state("transport") + .enableJmx(true) + .addMailet(MailetConfiguration.builder() + .match("SMTPAuthSuccessful") + .clazz("SetMimeHeader") + .addProperty("name", "X-UserIsAuth") + .addProperty("value", "true") + .build()) + .addMailet(MailetConfiguration.builder() + .match("HasMailAttribute=org.apache.james.SMIMECheckSignature") + .clazz("SetMimeHeader") + .addProperty("name", "X-WasSigned") + .addProperty("value", "true") + .build()) + .addMailet(MailetConfiguration.builder() + .match("All") + .clazz("RemoveMimeHeader") + .addProperty("name", "bcc") + .build()) + .addMailet(MailetConfiguration.builder() + .match("All") + .clazz("RecipientRewriteTable") + .build()) + .addMailet(MailetConfiguration.builder() + .match("RecipientIsLocal") + .clazz("org.apache.james.jmap.mailet.VacationMailet") + .build()) + .addMailet(MailetConfiguration.builder() + .match("RecipientIsLocal") + .clazz("LocalDelivery") + .build()) + .addMailet(MailetConfiguration.builder() + .match("SMTPAuthSuccessful") + .clazz("RemoteDelivery") + .addProperty("outgoingQueue", "outgoing") + .addProperty("delayTime", "5000, 100000, 500000") + .addProperty("maxRetries", "25") + .addProperty("maxDnsProblemRetries", "0") + .addProperty("deliveryThreads", "10") + .addProperty("sendpartial", "true") + .addProperty("bounceProcessor", "bounces") + .build()) + .addMailet(MailetConfiguration.builder() + .match("All") + .clazz("ToProcessor") + .addProperty("processor", "relay-denied") + .build()) + .build(); + } + + public static ProcessorConfiguration spam() { + return ProcessorConfiguration.builder() + .state("spam") + .enableJmx(true) + .addMailet(MailetConfiguration.builder() + .match("All") + .clazz("ToRepository") + .addProperty("repositoryPath", "file://var/mail/spam/") + .build()) + .build(); + } + + public static ProcessorConfiguration localAddressError() { + return ProcessorConfiguration.builder() + .state("local-address-error") + .enableJmx(true) + .addMailet(MailetConfiguration.builder() + .match("All") + .clazz("Bounce") + .addProperty("attachment", "none") + .build()) + .addMailet(MailetConfiguration.builder() + .match("All") + .clazz("ToRepository") + .addProperty("repositoryPath", "file://var/mail/address-error/") + .build()) + .build(); + } + + public static ProcessorConfiguration relayDenied() { + return ProcessorConfiguration.builder() + .state("replay-denied") + .enableJmx(true) + .addMailet(MailetConfiguration.builder() + .match("All") + .clazz("Bounce") + .addProperty("attachment", "none") + .build()) + .addMailet(MailetConfiguration.builder() + .match("All") + .clazz("ToRepository") + .addProperty("repositoryPath", "file://var/mail/relay-denied/") + .addProperty("notice", "Warning: You are sending an e-mail to a remote server. You must be authentified to perform such an operation") + .build()) + .build(); + } + + public static ProcessorConfiguration bounces() { + return ProcessorConfiguration.builder() + .state("bounces") + .enableJmx(true) + .addMailet(MailetConfiguration.builder() + .match("All") + .clazz("DSNBounce") + .addProperty("passThrough", "false") + .build()) + .build(); + } + + public static ProcessorConfiguration sieveManagerCheck() { + return ProcessorConfiguration.builder() + .state("sieve-manager-check") + .enableJmx(true) + .addMailet(MailetConfiguration.builder() + .match("RecipientIsLocal") + .clazz("ToProcessor") + .addProperty("processor", "sieve-manager") + .build()) + .addMailet(MailetConfiguration.builder() + .match("All") + .clazz("Bounce") + .addProperty("inline", "heads") + .addProperty("attachment", "none") + .addProperty("passThrough", "false") + .addProperty("prefix", "[REJECTED]") + .addProperty("notice", "You can't send messages to configure SIEVE on this serveur unless you are the official SIEVE manager.") + .build()) + .addMailet(MailetConfiguration.builder() + .match("All") + .clazz("Null") + .build()) + .build(); + } + + public static ProcessorConfiguration sieveManager() { + return ProcessorConfiguration.builder() + .state("sieve-manager") + .enableJmx(true) + .addMailet(MailetConfiguration.builder() + .match("All") + .clazz("SetMailAttribute") + .addProperty("org.apache.james.SMTPAuthUser", "true") + .build()) + .addMailet(MailetConfiguration.builder() + .match("All") + .clazz("org.apache.james.transport.mailets.managesieve.ManageSieveMailet") + .addProperty("helpURL", "file:/root/james-server-app-3.0.0-beta5-SNAPSHOT/conf/managesieve.help.txt") + .build()) + .addMailet(MailetConfiguration.builder() + .match("All") + .clazz("Null") + .build()) + .build(); + } +} http://git-wip-us.apache.org/repos/asf/james-project/blob/4044435e/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/configuration/MailetConfiguration.java ---------------------------------------------------------------------- diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/configuration/MailetConfiguration.java b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/configuration/MailetConfiguration.java new file mode 100644 index 0000000..f841bfb --- /dev/null +++ b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/configuration/MailetConfiguration.java @@ -0,0 +1,99 @@ +/**************************************************************** + * 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.mailets.configuration; + +import java.util.Map; + +import com.google.common.base.Preconditions; +import com.google.common.base.Strings; +import com.google.common.collect.ImmutableMap; + +public class MailetConfiguration implements SerializableAsXml { + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + + private String match; + private String clazz; + private ImmutableMap.Builder<String, String> properties; + + private Builder() { + properties = ImmutableMap.builder(); + } + + public Builder match(String match) { + this.match = match; + return this; + } + + public Builder clazz(String clazz) { + this.clazz = clazz; + return this; + } + + public Builder addProperty(String key, String value) { + this.properties.put(key, value); + return this; + } + + public MailetConfiguration build() { + Preconditions.checkState(!Strings.isNullOrEmpty(match), "'match' is mandatory"); + Preconditions.checkState(!Strings.isNullOrEmpty(clazz), "'class' is mandatory"); + return new MailetConfiguration(match, clazz, properties.build()); + } + } + + private final String match; + private final String clazz; + private final Map<String, String> properties; + + private MailetConfiguration(String match, String clazz, ImmutableMap<String, String> properties) { + this.match = match; + this.clazz = clazz; + this.properties = properties; + } + + public String getMatch() { + return match; + } + + public String getClazz() { + return clazz; + } + + public Map<String, String> getProperties() { + return properties; + } + + @Override + public String serializeAsXml() { + StringBuilder builder = new StringBuilder(); + builder.append("<mailet match=\"").append(getMatch()).append("\" class=\"").append(getClazz()).append("\">\n"); + for (Map.Entry<String, String> entry : getProperties().entrySet()) { + builder.append("<").append(entry.getKey()).append(">").append(entry.getValue()).append("</").append(entry.getKey()).append(">\n"); + } + builder.append("</mailet>\n"); + return builder.toString(); + } +} http://git-wip-us.apache.org/repos/asf/james-project/blob/4044435e/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/configuration/MailetContainer.java ---------------------------------------------------------------------- diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/configuration/MailetContainer.java b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/configuration/MailetContainer.java new file mode 100644 index 0000000..ae71091 --- /dev/null +++ b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/configuration/MailetContainer.java @@ -0,0 +1,104 @@ +/**************************************************************** + * 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.mailets.configuration; + +import java.util.List; + +import com.google.common.base.Preconditions; +import com.google.common.base.Strings; +import com.google.common.collect.ImmutableList; + +public class MailetContainer implements SerializableAsXml { + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + + private String postmaster; + private int threads; + private ImmutableList.Builder<ProcessorConfiguration> processors; + + private Builder() { + processors = ImmutableList.builder(); + } + + public Builder postmaster(String postmaster) { + this.postmaster = postmaster; + return this; + } + + public Builder threads(int threads) { + this.threads = threads; + return this; + } + + public Builder addProcessor(ProcessorConfiguration processorConfiguration) { + this.processors.add(processorConfiguration); + return this; + } + + public MailetContainer build() { + Preconditions.checkState(!Strings.isNullOrEmpty(postmaster), "'postmaster' is mandatory"); + Preconditions.checkState(threads > 0, "'threads' should be greater than 0"); + return new MailetContainer(postmaster, threads, processors.build()); + } + } + + private final String postmaster; + private final int threads; + private final List<ProcessorConfiguration> processors; + + private MailetContainer(String postmaster, int threads, List<ProcessorConfiguration> processors) { + this.postmaster = postmaster; + this.threads = threads; + this.processors = processors; + } + + public String getPostmaster() { + return postmaster; + } + + public int getThreads() { + return threads; + } + + public List<ProcessorConfiguration> getProcessors() { + return processors; + } + + @Override + public String serializeAsXml() { + StringBuilder builder = new StringBuilder(); + builder.append("<?xml version=\"1.0\"?>\n") + .append("<mailetcontainer enableJmx=\"true\">\n") + .append("<context><postmaster>").append(getPostmaster()).append("</postmaster>").append("</context>\n") + .append("<spooler><threads>").append(getThreads()).append("</threads>").append("</spooler>\n") + .append("<processors>\n"); + for (ProcessorConfiguration processorConfiguration : getProcessors()) { + builder.append(processorConfiguration.serializeAsXml()); + } + builder.append("</processors>\n") + .append("</mailetcontainer>"); + return builder.toString(); + } +} http://git-wip-us.apache.org/repos/asf/james-project/blob/4044435e/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/configuration/ProcessorConfiguration.java ---------------------------------------------------------------------- diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/configuration/ProcessorConfiguration.java b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/configuration/ProcessorConfiguration.java new file mode 100644 index 0000000..00128f1 --- /dev/null +++ b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/configuration/ProcessorConfiguration.java @@ -0,0 +1,96 @@ +/**************************************************************** + * 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.mailets.configuration; + +import com.google.common.base.Preconditions; +import com.google.common.base.Strings; +import com.google.common.collect.ImmutableList; + +public class ProcessorConfiguration implements SerializableAsXml { + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + + private String state; + private boolean enableJmx; + private ImmutableList.Builder<MailetConfiguration> mailets; + + private Builder() { + mailets = ImmutableList.builder(); + } + + public Builder state(String state) { + this.state = state; + return this; + } + + public Builder enableJmx(boolean enableJmx) { + this.enableJmx = enableJmx; + return this; + } + + public Builder addMailet(MailetConfiguration mailetConfiguration) { + this.mailets.add(mailetConfiguration); + return this; + } + + public ProcessorConfiguration build() { + Preconditions.checkState(!Strings.isNullOrEmpty(state), "'state' is mandatory"); + return new ProcessorConfiguration(state, enableJmx, mailets.build()); + } + } + + private final String state; + private final boolean enableJmx; + private final ImmutableList<MailetConfiguration> mailets; + + private ProcessorConfiguration(String state, boolean enableJmx, ImmutableList<MailetConfiguration> mailets) { + this.state = state; + this.enableJmx = enableJmx; + this.mailets = mailets; + } + + public String getState() { + return state; + } + + public boolean isEnableJmx() { + return enableJmx; + } + + public ImmutableList<MailetConfiguration> getMailets() { + return mailets; + } + + @Override + public String serializeAsXml() { + StringBuilder builder = new StringBuilder(); + builder.append("<processor state=\"").append(getState()).append("\" enableJmx=\"").append(isEnableJmx() ? "true" : "false").append("\">\n"); + for (MailetConfiguration mailet : getMailets()) { + builder.append(mailet.serializeAsXml()); + } + builder.append("</processor>\n"); + return builder.toString(); + } +} http://git-wip-us.apache.org/repos/asf/james-project/blob/4044435e/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/configuration/SerializableAsXml.java ---------------------------------------------------------------------- diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/configuration/SerializableAsXml.java b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/configuration/SerializableAsXml.java new file mode 100644 index 0000000..fcc9248 --- /dev/null +++ b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/configuration/SerializableAsXml.java @@ -0,0 +1,26 @@ +/**************************************************************** + * 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.mailets.configuration; + +public interface SerializableAsXml { + + String serializeAsXml(); +} http://git-wip-us.apache.org/repos/asf/james-project/blob/4044435e/server/mailet/integration-testing/src/test/resources/dnsservice.xml ---------------------------------------------------------------------- diff --git a/server/mailet/integration-testing/src/test/resources/dnsservice.xml b/server/mailet/integration-testing/src/test/resources/dnsservice.xml new file mode 100644 index 0000000..0978a00 --- /dev/null +++ b/server/mailet/integration-testing/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/4044435e/server/mailet/integration-testing/src/test/resources/domainlist.xml ---------------------------------------------------------------------- diff --git a/server/mailet/integration-testing/src/test/resources/domainlist.xml b/server/mailet/integration-testing/src/test/resources/domainlist.xml new file mode 100644 index 0000000..e2797bb --- /dev/null +++ b/server/mailet/integration-testing/src/test/resources/domainlist.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. + --> + +<!-- See http://james.apache.org/server/3/config.html for usage --> + +<domainlist class="org.apache.james.domainlist.jpa.JPADomainList"> + <autodetect>true</autodetect> + <autodetectIP>true</autodetectIP> + <defaultDomain>localhost</defaultDomain> +</domainlist> http://git-wip-us.apache.org/repos/asf/james-project/blob/4044435e/server/mailet/integration-testing/src/test/resources/imapserver.xml ---------------------------------------------------------------------- diff --git a/server/mailet/integration-testing/src/test/resources/imapserver.xml b/server/mailet/integration-testing/src/test/resources/imapserver.xml new file mode 100644 index 0000000..ff478a9 --- /dev/null +++ b/server/mailet/integration-testing/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/4044435e/server/mailet/integration-testing/src/test/resources/keystore ---------------------------------------------------------------------- diff --git a/server/mailet/integration-testing/src/test/resources/keystore b/server/mailet/integration-testing/src/test/resources/keystore new file mode 100644 index 0000000..536a6c7 Binary files /dev/null and b/server/mailet/integration-testing/src/test/resources/keystore differ http://git-wip-us.apache.org/repos/asf/james-project/blob/4044435e/server/mailet/integration-testing/src/test/resources/lmtpserver.xml ---------------------------------------------------------------------- diff --git a/server/mailet/integration-testing/src/test/resources/lmtpserver.xml b/server/mailet/integration-testing/src/test/resources/lmtpserver.xml new file mode 100644 index 0000000..5c4a9c7 --- /dev/null +++ b/server/mailet/integration-testing/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/4044435e/server/mailet/integration-testing/src/test/resources/mailrepositorystore.xml ---------------------------------------------------------------------- diff --git a/server/mailet/integration-testing/src/test/resources/mailrepositorystore.xml b/server/mailet/integration-testing/src/test/resources/mailrepositorystore.xml new file mode 100644 index 0000000..3ca4a1d --- /dev/null +++ b/server/mailet/integration-testing/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/4044435e/server/mailet/integration-testing/src/test/resources/managesieveserver.xml ---------------------------------------------------------------------- diff --git a/server/mailet/integration-testing/src/test/resources/managesieveserver.xml b/server/mailet/integration-testing/src/test/resources/managesieveserver.xml new file mode 100644 index 0000000..ec57e09 --- /dev/null +++ b/server/mailet/integration-testing/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/4044435e/server/mailet/integration-testing/src/test/resources/pop3server.xml ---------------------------------------------------------------------- diff --git a/server/mailet/integration-testing/src/test/resources/pop3server.xml b/server/mailet/integration-testing/src/test/resources/pop3server.xml new file mode 100644 index 0000000..e4187da --- /dev/null +++ b/server/mailet/integration-testing/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/4044435e/server/mailet/integration-testing/src/test/resources/smtpserver.xml ---------------------------------------------------------------------- diff --git a/server/mailet/integration-testing/src/test/resources/smtpserver.xml b/server/mailet/integration-testing/src/test/resources/smtpserver.xml new file mode 100644 index 0000000..a3d4b8f --- /dev/null +++ b/server/mailet/integration-testing/src/test/resources/smtpserver.xml @@ -0,0 +1,105 @@ +<?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"> + <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>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-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/4044435e/server/pom.xml ---------------------------------------------------------------------- diff --git a/server/pom.xml b/server/pom.xml index d8d6773..73c42cc 100644 --- a/server/pom.xml +++ b/server/pom.xml @@ -72,6 +72,7 @@ <module>mailet/mailetcontainer-api</module> <module>mailet/mailetcontainer-camel</module> <module>mailet/mailets</module> + <module>mailet/integration-testing</module> <module>dns-service/dnsservice-api</module> <module>dns-service/dnsservice-dnsjava</module> --------------------------------------------------------------------- To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org