james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [39/44] james-project git commit: JAMES-2262 Allow mailet container configuration to override processors
Date Fri, 05 Jan 2018 03:01:23 GMT
JAMES-2262 Allow mailet container configuration to override processors

This allow to derivate base configuration and specify only processors that changed


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

Branch: refs/heads/master
Commit: ea5cf6fed6ee8abdd9677e755303d19fcd8fba18
Parents: 51c64ca
Author: benwa <btellier@linagora.com>
Authored: Mon Dec 25 10:14:30 2017 +0700
Committer: benwa <btellier@linagora.com>
Committed: Fri Jan 5 09:34:38 2018 +0700

----------------------------------------------------------------------
 .../james/mailets/BounceIntegrationTest.java    |  5 +-
 .../GatewayRemoteDeliveryIntegrationTest.java   | 14 +---
 .../mailets/NetworkMatcherIntegrationTest.java  |  4 +-
 .../james/mailets/SmtpAuthIntegrationTest.java  |  6 +-
 .../james/mailets/TemporaryJamesServer.java     | 15 +++-
 .../mailets/configuration/MailetContainer.java  | 14 ++--
 .../james/smtp/SmtpAuthorizedAddressesTest.java | 12 +--
 .../mailets/AmqpForwardAttachmentTest.java      | 42 +++++------
 .../transport/mailets/ContactExtractorTest.java |  9 +--
 .../transport/mailets/GroupMappingTest.java     |  8 +-
 .../mailets/ICSAttachmentWorkflowTest.java      | 78 ++++++++++----------
 .../transport/mailets/StripAttachmentTest.java  | 36 ++++-----
 12 files changed, 107 insertions(+), 136 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/ea5cf6fe/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/BounceIntegrationTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/BounceIntegrationTest.java
b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/BounceIntegrationTest.java
index e5a3cc2..910af99 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/BounceIntegrationTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/BounceIntegrationTest.java
@@ -28,7 +28,6 @@ import static org.apache.james.mailets.configuration.Constants.SMTP_PORT;
 import static org.apache.james.mailets.configuration.Constants.awaitOneMinute;
 
 import org.apache.james.MemoryJamesServerMain;
-import org.apache.james.mailets.configuration.CommonProcessors;
 import org.apache.james.mailets.configuration.MailetConfiguration;
 import org.apache.james.mailets.configuration.MailetContainer;
 import org.apache.james.mailets.configuration.ProcessorConfiguration;
@@ -248,10 +247,8 @@ public class BounceIntegrationTest {
     }
 
     private MailetContainer.Builder generateMailetContainerConfiguration(MailetConfiguration.Builder
redirectionMailetConfiguration) {
-        return MailetContainer.builder()
+        return TemporaryJamesServer.DEFAUL_MAILET_CONTAINER_CONFIGURATION
             .postmaster(POSTMASTER)
-            .addProcessor(CommonProcessors.root())
-            .addProcessor(CommonProcessors.error())
             .addProcessor(transport())
             .addProcessor(bounces(redirectionMailetConfiguration));
     }

http://git-wip-us.apache.org/repos/asf/james-project/blob/ea5cf6fe/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/GatewayRemoteDeliveryIntegrationTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/GatewayRemoteDeliveryIntegrationTest.java
b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/GatewayRemoteDeliveryIntegrationTest.java
index b4586d1..0c30246 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/GatewayRemoteDeliveryIntegrationTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/GatewayRemoteDeliveryIntegrationTest.java
@@ -231,16 +231,13 @@ public class GatewayRemoteDeliveryIntegrationTest {
         jamesServer = TemporaryJamesServer.builder()
             .withBase(SMTP_AND_IMAP_MODULE)
             .withOverrides(binder -> binder.bind(DNSService.class).toInstance(inMemoryDNSService))
-            .withMailetContainer(MailetContainer.builder()
-                .addProcessor(CommonProcessors.simpleRoot())
-                .addProcessor(CommonProcessors.error())
+            .withMailetContainer(TemporaryJamesServer.SIMPLE_MAILET_CONTAINER_CONFIGURATION
                 .addProcessor(ProcessorConfiguration.transport()
                     .addMailet(MailetConfiguration.BCC_STRIPPER)
                     .addMailet(MailetConfiguration.LOCAL_DELIVERY)
                     .addMailet(MailetConfiguration.remoteDeliveryBuilderNoBounces()
                         .matcher(All.class)
-                        .addProperty("gateway", gatewayProperty)))
-                .addProcessor(CommonProcessors.bounces()))
+                        .addProperty("gateway", gatewayProperty))))
             .build(temporaryFolder);
 
         dataProbe = jamesServer.getProbe(DataProbeImpl.class);
@@ -286,11 +283,8 @@ public class GatewayRemoteDeliveryIntegrationTest {
     }
 
     private MailetContainer.Builder generateMailetContainerConfiguration(String gatewayProperty)
{
-        return MailetContainer.builder()
-            .addProcessor(CommonProcessors.simpleRoot())
-            .addProcessor(CommonProcessors.error())
-            .addProcessor(relayAndLocalDeliveryTransport(gatewayProperty))
-            .addProcessor(CommonProcessors.bounces());
+        return TemporaryJamesServer.SIMPLE_MAILET_CONTAINER_CONFIGURATION
+            .addProcessor(relayAndLocalDeliveryTransport(gatewayProperty));
     }
 
     private ProcessorConfiguration.Builder relayAndLocalDeliveryTransport(String gatewayProperty)
{

http://git-wip-us.apache.org/repos/asf/james-project/blob/ea5cf6fe/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/NetworkMatcherIntegrationTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/NetworkMatcherIntegrationTest.java
b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/NetworkMatcherIntegrationTest.java
index f8e41c6..2f87c73 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/NetworkMatcherIntegrationTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/NetworkMatcherIntegrationTest.java
@@ -30,7 +30,6 @@ import static org.assertj.core.api.Assertions.assertThat;
 import org.apache.james.MemoryJamesServerMain;
 import org.apache.james.mailets.configuration.CommonProcessors;
 import org.apache.james.mailets.configuration.MailetConfiguration;
-import org.apache.james.mailets.configuration.MailetContainer;
 import org.apache.james.mailets.configuration.ProcessorConfiguration;
 import org.apache.james.probe.DataProbe;
 import org.apache.james.transport.mailets.ToProcessor;
@@ -63,9 +62,8 @@ public class NetworkMatcherIntegrationTest {
     private TemporaryJamesServer createJamesServerWithRootProcessor(ProcessorConfiguration.Builder
rootProcessor) throws Exception {
         TemporaryJamesServer temporaryJamesServer = TemporaryJamesServer.builder()
             .withBase(MemoryJamesServerMain.SMTP_AND_IMAP_MODULE)
-            .withMailetContainer(MailetContainer.builder()
+            .withMailetContainer(TemporaryJamesServer.DEFAUL_MAILET_CONTAINER_CONFIGURATION
                 .addProcessor(rootProcessor)
-                .addProcessor(CommonProcessors.error())
                 .addProcessor(CommonProcessors.deliverOnlyTransport()))
             .build(temporaryFolder);
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/ea5cf6fe/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/SmtpAuthIntegrationTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/SmtpAuthIntegrationTest.java
b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/SmtpAuthIntegrationTest.java
index 2a57982..7e82e39 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/SmtpAuthIntegrationTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/SmtpAuthIntegrationTest.java
@@ -71,12 +71,10 @@ public class SmtpAuthIntegrationTest {
             .addMailet(MailetConfiguration.TO_BOUNCE)
             .build();
 
-        MailetContainer mailetContainer = MailetContainer.builder()
+        MailetContainer.Builder mailetContainer = TemporaryJamesServer.DEFAUL_MAILET_CONTAINER_CONFIGURATION
             .addProcessor(rootProcessor)
-            .addProcessor(CommonProcessors.error())
             .addProcessor(CommonProcessors.deliverOnlyTransport())
-            .addProcessor(bounces())
-            .build();
+            .addProcessor(bounces());
 
         jamesServer = TemporaryJamesServer.builder()
             .withBase(MemoryJamesServerMain.SMTP_AND_IMAP_MODULE)

http://git-wip-us.apache.org/repos/asf/james-project/blob/ea5cf6fe/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
index 2328eea..265580c 100644
--- 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
@@ -49,7 +49,7 @@ import com.google.inject.Module;
 
 public class TemporaryJamesServer {
 
-    public static final MailetContainer DEFAUL_MAILET_CONTAINER_CONFIGURATION = MailetContainer.builder()
+    public static final MailetContainer.Builder DEFAUL_MAILET_CONTAINER_CONFIGURATION = MailetContainer.builder()
         .addProcessor(CommonProcessors.root())
         .addProcessor(CommonProcessors.error())
         .addProcessor(CommonProcessors.transport())
@@ -57,8 +57,15 @@ public class TemporaryJamesServer {
         .addProcessor(CommonProcessors.localAddressError())
         .addProcessor(CommonProcessors.relayDenied())
         .addProcessor(CommonProcessors.bounces())
-        .addProcessor(CommonProcessors.sieveManagerCheck())
-        .build();
+        .addProcessor(CommonProcessors.sieveManagerCheck());
+
+    public static final MailetContainer.Builder SIMPLE_MAILET_CONTAINER_CONFIGURATION = MailetContainer.builder()
+        .addProcessor(CommonProcessors.simpleRoot())
+        .addProcessor(CommonProcessors.error())
+        .addProcessor(CommonProcessors.transport())
+        .addProcessor(CommonProcessors.localAddressError())
+        .addProcessor(CommonProcessors.relayDenied())
+        .addProcessor(CommonProcessors.bounces());
 
     public static class Builder {
         private ImmutableList.Builder<Module> overrideModules;
@@ -105,7 +112,7 @@ public class TemporaryJamesServer {
         public TemporaryJamesServer build(TemporaryFolder temporaryFolder) throws Exception
{
             return new TemporaryJamesServer(
                 temporaryFolder,
-                mailetConfiguration.orElse(DEFAUL_MAILET_CONTAINER_CONFIGURATION),
+                mailetConfiguration.orElse(DEFAUL_MAILET_CONTAINER_CONFIGURATION.build()),
                 smtpConfiguration.orElse(SmtpConfiguration.DEFAULT),
                 module.orElse(MemoryJamesServerMain.IN_MEMORY_SERVER_AGGREGATE_MODULE),
                 overrideModules.build());

http://git-wip-us.apache.org/repos/asf/james-project/blob/ea5cf6fe/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
index 2adbf9e..c9ed6bb 100644
--- 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
@@ -20,7 +20,9 @@
 
 package org.apache.james.mailets.configuration;
 
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.Optional;
 
 import com.google.common.base.Preconditions;
@@ -39,10 +41,10 @@ public class MailetContainer implements SerializableAsXml {
         public static final String DEFAULT_POSTMASTER = "postmaster@localhost";
         private Optional<String> postmaster;
         private Optional<Integer> threads;
-        private ImmutableList.Builder<ProcessorConfiguration> processors;
+        private Map<String, ProcessorConfiguration> processors;
 
         private Builder() {
-            processors = ImmutableList.builder();
+            processors = new HashMap<>();
             threads = Optional.empty();
             postmaster = Optional.empty();
         }
@@ -58,13 +60,12 @@ public class MailetContainer implements SerializableAsXml {
         }
 
         public Builder addProcessor(ProcessorConfiguration processorConfiguration) {
-            this.processors.add(processorConfiguration);
+            this.processors.put(processorConfiguration.getState(), processorConfiguration);
             return this;
         }
 
         public Builder addProcessor(ProcessorConfiguration.Builder processorConfiguration)
{
-            this.processors.add(processorConfiguration.build());
-            return this;
+            return this.addProcessor(processorConfiguration.build());
         }
 
         public MailetContainer build() {
@@ -72,7 +73,8 @@ public class MailetContainer implements SerializableAsXml {
             int threads = this.threads.orElse(DEFAULT_THREAD_COUNT);
             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());
+            return new MailetContainer(postmaster, threads,
+                ImmutableList.copyOf(processors.values()));
         }
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/ea5cf6fe/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpAuthorizedAddressesTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpAuthorizedAddressesTest.java
b/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpAuthorizedAddressesTest.java
index f4940dd..d7c86ff 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpAuthorizedAddressesTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpAuthorizedAddressesTest.java
@@ -30,7 +30,6 @@ import static org.hamcrest.Matchers.hasSize;
 
 import org.apache.james.MemoryJamesServerMain;
 import org.apache.james.mailets.TemporaryJamesServer;
-import org.apache.james.mailets.configuration.CommonProcessors;
 import org.apache.james.mailets.configuration.MailetConfiguration;
 import org.apache.james.mailets.configuration.MailetContainer;
 import org.apache.james.mailets.configuration.ProcessorConfiguration;
@@ -83,20 +82,15 @@ public class SmtpAuthorizedAddressesTest {
     }
 
     private void createJamesServer(SmtpConfiguration.Builder smtpConfiguration) throws Exception
{
-        MailetContainer mailetContainer = MailetContainer.builder()
-            .addProcessor(CommonProcessors.simpleRoot())
-            .addProcessor(CommonProcessors.error())
+        MailetContainer.Builder mailetContainer = TemporaryJamesServer.SIMPLE_MAILET_CONTAINER_CONFIGURATION
             .addProcessor(ProcessorConfiguration.transport()
                 .addMailet(MailetConfiguration.BCC_STRIPPER)
                 .addMailet(MailetConfiguration.LOCAL_DELIVERY)
                 .addMailet(MailetConfiguration.remoteDeliveryBuilder()
                     .matcher(SMTPIsAuthNetwork.class)
                     .addProperty("gateway", fakeSmtp.getContainerIp()))
-                .addMailet(MailetConfiguration.TO_BOUNCE))
-            .addProcessor(CommonProcessors.localAddressError())
-            .addProcessor(CommonProcessors.relayDenied())
-            .addProcessor(CommonProcessors.bounces())
-            .build();
+                .addMailet(MailetConfiguration.TO_BOUNCE));
+
         jamesServer = TemporaryJamesServer.builder()
             .withBase(MemoryJamesServerMain.SMTP_AND_IMAP_MODULE)
             .withSmtpConfiguration(smtpConfiguration)

http://git-wip-us.apache.org/repos/asf/james-project/blob/ea5cf6fe/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/AmqpForwardAttachmentTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/AmqpForwardAttachmentTest.java
b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/AmqpForwardAttachmentTest.java
index 2d4dd3f..9e84419 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/AmqpForwardAttachmentTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/AmqpForwardAttachmentTest.java
@@ -31,7 +31,6 @@ import java.nio.charset.StandardCharsets;
 
 import org.apache.james.MemoryJamesServerMain;
 import org.apache.james.mailets.TemporaryJamesServer;
-import org.apache.james.mailets.configuration.CommonProcessors;
 import org.apache.james.mailets.configuration.MailetConfiguration;
 import org.apache.james.mailets.configuration.MailetContainer;
 import org.apache.james.mailets.configuration.ProcessorConfiguration;
@@ -79,29 +78,26 @@ public class AmqpForwardAttachmentTest {
 
     @Before
     public void setup() throws Exception {
-        MailetContainer mailetContainer = MailetContainer.builder()
-            .addProcessor(CommonProcessors.root())
-            .addProcessor(CommonProcessors.error())
+        MailetContainer.Builder mailetContainer = TemporaryJamesServer.DEFAUL_MAILET_CONTAINER_CONFIGURATION
             .addProcessor(ProcessorConfiguration.transport()
-                    .addMailet(MailetConfiguration.BCC_STRIPPER)
-                    .addMailet(MailetConfiguration.builder()
-                            .matcher(All.class)
-                            .mailet(StripAttachment.class)
-                            .addProperty(StripAttachment.ATTRIBUTE_PARAMETER_NAME, MAIL_ATTRIBUTE)
-                            .addProperty(StripAttachment.PATTERN_PARAMETER_NAME, ".*\\.txt"))
-                    .addMailet(MailetConfiguration.builder()
-                            .matcher(All.class)
-                            .mailet(MimeDecodingMailet.class)
-                            .addProperty(MimeDecodingMailet.ATTRIBUTE_PARAMETER_NAME, MAIL_ATTRIBUTE))
-                    .addMailet(MailetConfiguration.builder()
-                            .matcher(All.class)
-                            .mailet(AmqpForwardAttribute.class)
-                            .addProperty(AmqpForwardAttribute.URI_PARAMETER_NAME, amqpRule.getAmqpUri())
-                            .addProperty(AmqpForwardAttribute.EXCHANGE_PARAMETER_NAME, EXCHANGE_NAME)
-                            .addProperty(AmqpForwardAttribute.ATTRIBUTE_PARAMETER_NAME, MAIL_ATTRIBUTE)
-                            .addProperty(AmqpForwardAttribute.ROUTING_KEY_PARAMETER_NAME,
ROUTING_KEY))
-                    .addMailet(MailetConfiguration.LOCAL_DELIVERY))
-            .build();
+                .addMailet(MailetConfiguration.BCC_STRIPPER)
+                .addMailet(MailetConfiguration.builder()
+                    .matcher(All.class)
+                    .mailet(StripAttachment.class)
+                    .addProperty(StripAttachment.ATTRIBUTE_PARAMETER_NAME, MAIL_ATTRIBUTE)
+                    .addProperty(StripAttachment.PATTERN_PARAMETER_NAME, ".*\\.txt"))
+                .addMailet(MailetConfiguration.builder()
+                    .matcher(All.class)
+                    .mailet(MimeDecodingMailet.class)
+                    .addProperty(MimeDecodingMailet.ATTRIBUTE_PARAMETER_NAME, MAIL_ATTRIBUTE))
+                .addMailet(MailetConfiguration.builder()
+                    .matcher(All.class)
+                    .mailet(AmqpForwardAttribute.class)
+                    .addProperty(AmqpForwardAttribute.URI_PARAMETER_NAME, amqpRule.getAmqpUri())
+                    .addProperty(AmqpForwardAttribute.EXCHANGE_PARAMETER_NAME, EXCHANGE_NAME)
+                    .addProperty(AmqpForwardAttribute.ATTRIBUTE_PARAMETER_NAME, MAIL_ATTRIBUTE)
+                    .addProperty(AmqpForwardAttribute.ROUTING_KEY_PARAMETER_NAME, ROUTING_KEY))
+                .addMailet(MailetConfiguration.LOCAL_DELIVERY));
 
         jamesServer = TemporaryJamesServer.builder()
             .withBase(MemoryJamesServerMain.SMTP_AND_IMAP_MODULE)

http://git-wip-us.apache.org/repos/asf/james-project/blob/ea5cf6fe/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/ContactExtractorTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/ContactExtractorTest.java
b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/ContactExtractorTest.java
index 335b3cd..44b85dc 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/ContactExtractorTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/ContactExtractorTest.java
@@ -31,7 +31,6 @@ import java.util.Optional;
 
 import org.apache.james.MemoryJamesServerMain;
 import org.apache.james.mailets.TemporaryJamesServer;
-import org.apache.james.mailets.configuration.CommonProcessors;
 import org.apache.james.mailets.configuration.MailetConfiguration;
 import org.apache.james.mailets.configuration.MailetContainer;
 import org.apache.james.mailets.configuration.ProcessorConfiguration;
@@ -79,10 +78,8 @@ public class ContactExtractorTest {
     @Before
     public void setup() throws Exception {
         String attribute = "ExtractedContacts";
-        MailetContainer mailets = MailetContainer.builder()
+        MailetContainer.Builder mailets = TemporaryJamesServer.DEFAUL_MAILET_CONTAINER_CONFIGURATION
             .postmaster(SENDER)
-            .addProcessor(CommonProcessors.root())
-            .addProcessor(CommonProcessors.error())
             .addProcessor(
                 ProcessorConfiguration.transport()
                     .addMailet(MailetConfiguration.builder()
@@ -96,8 +93,8 @@ public class ContactExtractorTest {
                         .addProperty(AmqpForwardAttribute.EXCHANGE_PARAMETER_NAME, EXCHANGE)
                         .addProperty(AmqpForwardAttribute.ATTRIBUTE_PARAMETER_NAME, attribute))
                     .addMailet(MailetConfiguration.BCC_STRIPPER)
-                    .addMailet(MailetConfiguration.LOCAL_DELIVERY))
-            .build();
+                    .addMailet(MailetConfiguration.LOCAL_DELIVERY));
+
         jamesServer = TemporaryJamesServer.builder()
             .withBase(MemoryJamesServerMain.SMTP_AND_IMAP_MODULE)
             .withMailetContainer(mailets)

http://git-wip-us.apache.org/repos/asf/james-project/blob/ea5cf6fe/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/GroupMappingTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/GroupMappingTest.java
b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/GroupMappingTest.java
index fb82b8d..6f629dc 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/GroupMappingTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/GroupMappingTest.java
@@ -37,7 +37,6 @@ import javax.mail.internet.MimeMessage;
 import org.apache.james.jmap.mailet.VacationMailet;
 import org.apache.james.mailbox.model.MailboxConstants;
 import org.apache.james.mailets.TemporaryJamesServer;
-import org.apache.james.mailets.configuration.CommonProcessors;
 import org.apache.james.mailets.configuration.MailetConfiguration;
 import org.apache.james.mailets.configuration.MailetContainer;
 import org.apache.james.mailets.configuration.ProcessorConfiguration;
@@ -96,9 +95,7 @@ public class GroupMappingTest {
 
     @Before
     public void setup() throws Exception {
-        MailetContainer mailetContainer = MailetContainer.builder()
-            .addProcessor(CommonProcessors.simpleRoot())
-            .addProcessor(CommonProcessors.error())
+        MailetContainer.Builder mailetContainer = TemporaryJamesServer.SIMPLE_MAILET_CONTAINER_CONFIGURATION
             .addProcessor(ProcessorConfiguration.transport()
                 .addMailet(MailetConfiguration.BCC_STRIPPER)
                 .addMailet(MailetConfiguration.builder()
@@ -110,8 +107,7 @@ public class GroupMappingTest {
                 .addMailet(MailetConfiguration.LOCAL_DELIVERY)
                 .addMailet(MailetConfiguration.remoteDeliveryBuilder()
                     .matcher(All.class)
-                    .addProperty("gateway", fakeSmtp.getContainerIp())))
-            .build();
+                    .addProperty("gateway", fakeSmtp.getContainerIp())));
 
         jamesServer = TemporaryJamesServer.builder()
             .withMailetContainer(mailetContainer)

http://git-wip-us.apache.org/repos/asf/james-project/blob/ea5cf6fe/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/ICSAttachmentWorkflowTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/ICSAttachmentWorkflowTest.java
b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/ICSAttachmentWorkflowTest.java
index c035991..337f34e 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/ICSAttachmentWorkflowTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/ICSAttachmentWorkflowTest.java
@@ -35,7 +35,6 @@ import javax.mail.internet.MimeMessage;
 import org.apache.james.MemoryJamesServerMain;
 import org.apache.james.jmap.mailet.TextCalendarBodyToAttachment;
 import org.apache.james.mailets.TemporaryJamesServer;
-import org.apache.james.mailets.configuration.CommonProcessors;
 import org.apache.james.mailets.configuration.MailetConfiguration;
 import org.apache.james.mailets.configuration.MailetContainer;
 import org.apache.james.mailets.configuration.ProcessorConfiguration;
@@ -446,47 +445,44 @@ public class ICSAttachmentWorkflowTest {
 
     @Before
     public void setup() throws Exception {
-        MailetContainer mailetContainer = MailetContainer.builder()
-            .addProcessor(CommonProcessors.root())
-            .addProcessor(CommonProcessors.error())
+        MailetContainer.Builder mailetContainer = TemporaryJamesServer.DEFAUL_MAILET_CONTAINER_CONFIGURATION
             .addProcessor(ProcessorConfiguration.transport()
-                    .addMailet(MailetConfiguration.BCC_STRIPPER)
-                    .addMailet(MailetConfiguration.builder()
-                            .matcher(All.class)
-                            .mailet(StripAttachment.class)
-                            .addProperty("attribute", MAIL_ATTRIBUTE)
-                            .addProperty("pattern", ".*"))
-                    .addMailet(MailetConfiguration.builder()
-                            .matcher(All.class)
-                            .mailet(MimeDecodingMailet.class)
-                            .addProperty("attribute", MAIL_ATTRIBUTE))
-                    .addMailet(MailetConfiguration.builder()
-                            .matcher(All.class)
-                            .mailet(ICalendarParser.class)
-                            .addProperty("sourceAttribute", MAIL_ATTRIBUTE)
-                            .addProperty("destinationAttribute", PARSED_ICAL_MAIL_ATTRIBUTE))
-                    .addMailet(MailetConfiguration.builder()
-                            .matcher(All.class)
-                            .mailet(ICALToHeader.class)
-                            .addProperty("attribute", PARSED_ICAL_MAIL_ATTRIBUTE))
-                    .addMailet(MailetConfiguration.builder()
-                            .matcher(All.class)
-                            .mailet(ICALToJsonAttribute.class)
-                            .addProperty("source", PARSED_ICAL_MAIL_ATTRIBUTE)
-                            .addProperty("rawSource", MAIL_ATTRIBUTE)
-                            .addProperty("destination", JSON_MAIL_ATTRIBUTE))
-                    .addMailet(MailetConfiguration.builder()
-                            .matcher(All.class)
-                            .mailet(TextCalendarBodyToAttachment.class))
-                    .addMailet(MailetConfiguration.builder()
-                            .matcher(All.class)
-                            .mailet(AmqpForwardAttribute.class)
-                            .addProperty("uri", amqpRule.getAmqpUri())
-                            .addProperty("exchange", EXCHANGE_NAME)
-                            .addProperty("attribute", JSON_MAIL_ATTRIBUTE)
-                            .addProperty("routing_key", ROUTING_KEY))
-                    .addMailet(MailetConfiguration.LOCAL_DELIVERY))
-            .build();
+                .addMailet(MailetConfiguration.BCC_STRIPPER)
+                .addMailet(MailetConfiguration.builder()
+                    .matcher(All.class)
+                    .mailet(StripAttachment.class)
+                    .addProperty("attribute", MAIL_ATTRIBUTE)
+                    .addProperty("pattern", ".*"))
+                .addMailet(MailetConfiguration.builder()
+                    .matcher(All.class)
+                    .mailet(MimeDecodingMailet.class)
+                    .addProperty("attribute", MAIL_ATTRIBUTE))
+                .addMailet(MailetConfiguration.builder()
+                    .matcher(All.class)
+                    .mailet(ICalendarParser.class)
+                    .addProperty("sourceAttribute", MAIL_ATTRIBUTE)
+                    .addProperty("destinationAttribute", PARSED_ICAL_MAIL_ATTRIBUTE))
+                .addMailet(MailetConfiguration.builder()
+                    .matcher(All.class)
+                    .mailet(ICALToHeader.class)
+                    .addProperty("attribute", PARSED_ICAL_MAIL_ATTRIBUTE))
+                .addMailet(MailetConfiguration.builder()
+                    .matcher(All.class)
+                    .mailet(ICALToJsonAttribute.class)
+                    .addProperty("source", PARSED_ICAL_MAIL_ATTRIBUTE)
+                    .addProperty("rawSource", MAIL_ATTRIBUTE)
+                    .addProperty("destination", JSON_MAIL_ATTRIBUTE))
+                .addMailet(MailetConfiguration.builder()
+                    .matcher(All.class)
+                    .mailet(TextCalendarBodyToAttachment.class))
+                .addMailet(MailetConfiguration.builder()
+                    .matcher(All.class)
+                    .mailet(AmqpForwardAttribute.class)
+                    .addProperty("uri", amqpRule.getAmqpUri())
+                    .addProperty("exchange", EXCHANGE_NAME)
+                    .addProperty("attribute", JSON_MAIL_ATTRIBUTE)
+                    .addProperty("routing_key", ROUTING_KEY))
+                .addMailet(MailetConfiguration.LOCAL_DELIVERY));
 
         jamesServer = TemporaryJamesServer.builder()
             .withBase(MemoryJamesServerMain.SMTP_AND_IMAP_MODULE)

http://git-wip-us.apache.org/repos/asf/james-project/blob/ea5cf6fe/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/StripAttachmentTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/StripAttachmentTest.java
b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/StripAttachmentTest.java
index 03d45b4..535526b 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/StripAttachmentTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/StripAttachmentTest.java
@@ -31,7 +31,6 @@ import javax.mail.internet.MimeMessage;
 
 import org.apache.james.MemoryJamesServerMain;
 import org.apache.james.mailets.TemporaryJamesServer;
-import org.apache.james.mailets.configuration.CommonProcessors;
 import org.apache.james.mailets.configuration.MailetConfiguration;
 import org.apache.james.mailets.configuration.MailetContainer;
 import org.apache.james.mailets.configuration.ProcessorConfiguration;
@@ -63,26 +62,23 @@ public class StripAttachmentTest {
 
     @Before
     public void setup() throws Exception {
-        MailetContainer mailetContainer = MailetContainer.builder()
-            .addProcessor(CommonProcessors.root())
-            .addProcessor(CommonProcessors.error())
+        MailetContainer.Builder mailetContainer = TemporaryJamesServer.DEFAUL_MAILET_CONTAINER_CONFIGURATION
             .addProcessor(ProcessorConfiguration.transport()
-                    .addMailet(MailetConfiguration.BCC_STRIPPER)
-                    .addMailet(MailetConfiguration.builder()
-                            .matcher(All.class)
-                            .mailet(StripAttachment.class)
-                            .addProperty("attribute", "my.attribute")
-                            .addProperty("remove", "all")
-                            .addProperty("notpattern", ".*.tmp.*"))
-                    .addMailet(MailetConfiguration.builder()
-                            .matcher(All.class)
-                            .mailet(OnlyText.class))
-                    .addMailet(MailetConfiguration.builder()
-                            .matcher(All.class)
-                            .mailet(RecoverAttachment.class)
-                            .addProperty("attribute", "my.attribute"))
-                    .addMailet(MailetConfiguration.LOCAL_DELIVERY))
-            .build();
+                .addMailet(MailetConfiguration.BCC_STRIPPER)
+                .addMailet(MailetConfiguration.builder()
+                    .matcher(All.class)
+                    .mailet(StripAttachment.class)
+                    .addProperty("attribute", "my.attribute")
+                    .addProperty("remove", "all")
+                    .addProperty("notpattern", ".*.tmp.*"))
+                .addMailet(MailetConfiguration.builder()
+                    .matcher(All.class)
+                    .mailet(OnlyText.class))
+                .addMailet(MailetConfiguration.builder()
+                    .matcher(All.class)
+                    .mailet(RecoverAttachment.class)
+                    .addProperty("attribute", "my.attribute"))
+                .addMailet(MailetConfiguration.LOCAL_DELIVERY));
 
         jamesServer = TemporaryJamesServer.builder()
             .withBase(MemoryJamesServerMain.SMTP_AND_IMAP_MODULE)


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


Mime
View raw message