james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [43/44] james-project git commit: JAMES-2262 Improve composability: allow adding all mailets from a processor
Date Fri, 05 Jan 2018 02:57:02 GMT
JAMES-2262 Improve composability: allow adding all mailets from a processor


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

Branch: refs/heads/improve-mailet-testing-experience-v1
Commit: b5efd2f011c2618a13981a24be8736716fc31aa9
Parents: ea5cf6f
Author: benwa <btellier@linagora.com>
Authored: Mon Dec 25 10:25:02 2017 +0700
Committer: benwa <btellier@linagora.com>
Committed: Fri Jan 5 09:34:39 2018 +0700

----------------------------------------------------------------------
 .../james/mailets/GatewayRemoteDeliveryIntegrationTest.java | 3 +--
 .../org/apache/james/mailets/SmtpAuthIntegrationTest.java   | 5 ++---
 .../james/mailets/configuration/ProcessorConfiguration.java | 9 +++++++++
 .../org/apache/james/smtp/SmtpAuthorizedAddressesTest.java  | 4 ++--
 .../james/transport/mailets/AmqpForwardAttachmentTest.java  | 4 ++--
 .../james/transport/mailets/ContactExtractorTest.java       | 4 ++--
 .../apache/james/transport/mailets/GroupMappingTest.java    | 4 ++--
 .../james/transport/mailets/ICSAttachmentWorkflowTest.java  | 4 ++--
 .../apache/james/transport/mailets/StripAttachmentTest.java | 4 ++--
 server/protocols/jmap-integration-testing/pom.xml           | 1 -
 10 files changed, 24 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/b5efd2f0/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 0c30246..ff55d89 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
@@ -289,8 +289,7 @@ public class GatewayRemoteDeliveryIntegrationTest {
 
     private ProcessorConfiguration.Builder relayAndLocalDeliveryTransport(String gatewayProperty)
{
         return ProcessorConfiguration.transport()
-            .addMailet(MailetConfiguration.BCC_STRIPPER)
-            .addMailet(MailetConfiguration.LOCAL_DELIVERY)
+            .addMailetsFrom(CommonProcessors.deliverOnlyTransport())
             .addMailet(MailetConfiguration.remoteDeliveryBuilder()
                 .addProperty("gateway", gatewayProperty)
                 .matcher(All.class));

http://git-wip-us.apache.org/repos/asf/james-project/blob/b5efd2f0/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 7e82e39..a47e393 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
@@ -63,13 +63,12 @@ public class SmtpAuthIntegrationTest {
 
     @Before
     public void setup() throws Exception {
-        ProcessorConfiguration rootProcessor = ProcessorConfiguration.root()
+        ProcessorConfiguration.Builder rootProcessor = ProcessorConfiguration.root()
             .addMailet(MailetConfiguration.builder()
                 .matcher(SMTPAuthSuccessful.class)
                 .mailet(ToProcessor.class)
                 .addProperty("processor", ProcessorConfiguration.STATE_TRANSPORT))
-            .addMailet(MailetConfiguration.TO_BOUNCE)
-            .build();
+            .addMailet(MailetConfiguration.TO_BOUNCE);
 
         MailetContainer.Builder mailetContainer = TemporaryJamesServer.DEFAUL_MAILET_CONTAINER_CONFIGURATION
             .addProcessor(rootProcessor)

http://git-wip-us.apache.org/repos/asf/james-project/blob/b5efd2f0/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
index 8f207fa..d214f66 100644
--- 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
@@ -83,6 +83,15 @@ public class ProcessorConfiguration implements SerializableAsXml {
             return this;
         }
 
+        public Builder addMailetsFrom(ProcessorConfiguration processorConfiguration) {
+            this.mailets.addAll(processorConfiguration.mailets);
+            return this;
+        }
+
+        public Builder addMailetsFrom(ProcessorConfiguration.Builder processorConfiguration)
{
+            return this.addMailetsFrom(processorConfiguration.build());
+        }
+
         public Builder addMailet(MailetConfiguration.Builder mailetConfiguration) {
             this.mailets.add(mailetConfiguration.build());
             return this;

http://git-wip-us.apache.org/repos/asf/james-project/blob/b5efd2f0/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 d7c86ff..81b3b1c 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,6 +30,7 @@ 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;
@@ -84,8 +85,7 @@ public class SmtpAuthorizedAddressesTest {
     private void createJamesServer(SmtpConfiguration.Builder smtpConfiguration) throws Exception
{
         MailetContainer.Builder mailetContainer = TemporaryJamesServer.SIMPLE_MAILET_CONTAINER_CONFIGURATION
             .addProcessor(ProcessorConfiguration.transport()
-                .addMailet(MailetConfiguration.BCC_STRIPPER)
-                .addMailet(MailetConfiguration.LOCAL_DELIVERY)
+                .addMailetsFrom(CommonProcessors.deliverOnlyTransport())
                 .addMailet(MailetConfiguration.remoteDeliveryBuilder()
                     .matcher(SMTPIsAuthNetwork.class)
                     .addProperty("gateway", fakeSmtp.getContainerIp()))

http://git-wip-us.apache.org/repos/asf/james-project/blob/b5efd2f0/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 9e84419..6bf3f33 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,6 +31,7 @@ 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;
@@ -80,7 +81,6 @@ public class AmqpForwardAttachmentTest {
     public void setup() throws Exception {
         MailetContainer.Builder mailetContainer = TemporaryJamesServer.DEFAUL_MAILET_CONTAINER_CONFIGURATION
             .addProcessor(ProcessorConfiguration.transport()
-                .addMailet(MailetConfiguration.BCC_STRIPPER)
                 .addMailet(MailetConfiguration.builder()
                     .matcher(All.class)
                     .mailet(StripAttachment.class)
@@ -97,7 +97,7 @@ public class AmqpForwardAttachmentTest {
                     .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));
+                .addMailetsFrom(CommonProcessors.deliverOnlyTransport()));
 
         jamesServer = TemporaryJamesServer.builder()
             .withBase(MemoryJamesServerMain.SMTP_AND_IMAP_MODULE)

http://git-wip-us.apache.org/repos/asf/james-project/blob/b5efd2f0/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 44b85dc..aba1652 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,6 +31,7 @@ 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;
@@ -92,8 +93,7 @@ public class ContactExtractorTest {
                         .addProperty(AmqpForwardAttribute.URI_PARAMETER_NAME, amqpRule.getAmqpUri())
                         .addProperty(AmqpForwardAttribute.EXCHANGE_PARAMETER_NAME, EXCHANGE)
                         .addProperty(AmqpForwardAttribute.ATTRIBUTE_PARAMETER_NAME, attribute))
-                    .addMailet(MailetConfiguration.BCC_STRIPPER)
-                    .addMailet(MailetConfiguration.LOCAL_DELIVERY));
+                    .addMailetsFrom(CommonProcessors.deliverOnlyTransport()));
 
         jamesServer = TemporaryJamesServer.builder()
             .withBase(MemoryJamesServerMain.SMTP_AND_IMAP_MODULE)

http://git-wip-us.apache.org/repos/asf/james-project/blob/b5efd2f0/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 6f629dc..123560f 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,6 +37,7 @@ 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;
@@ -97,14 +98,13 @@ public class GroupMappingTest {
     public void setup() throws Exception {
         MailetContainer.Builder mailetContainer = TemporaryJamesServer.SIMPLE_MAILET_CONTAINER_CONFIGURATION
             .addProcessor(ProcessorConfiguration.transport()
-                .addMailet(MailetConfiguration.BCC_STRIPPER)
                 .addMailet(MailetConfiguration.builder()
                     .matcher(All.class)
                     .mailet(RecipientRewriteTable.class))
                 .addMailet(MailetConfiguration.builder()
                     .matcher(RecipientIsLocal.class)
                     .mailet(VacationMailet.class))
-                .addMailet(MailetConfiguration.LOCAL_DELIVERY)
+                .addMailetsFrom(CommonProcessors.deliverOnlyTransport())
                 .addMailet(MailetConfiguration.remoteDeliveryBuilder()
                     .matcher(All.class)
                     .addProperty("gateway", fakeSmtp.getContainerIp())));

http://git-wip-us.apache.org/repos/asf/james-project/blob/b5efd2f0/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 337f34e..1745adc 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,6 +35,7 @@ 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;
@@ -447,7 +448,6 @@ public class ICSAttachmentWorkflowTest {
     public void setup() throws Exception {
         MailetContainer.Builder mailetContainer = TemporaryJamesServer.DEFAUL_MAILET_CONTAINER_CONFIGURATION
             .addProcessor(ProcessorConfiguration.transport()
-                .addMailet(MailetConfiguration.BCC_STRIPPER)
                 .addMailet(MailetConfiguration.builder()
                     .matcher(All.class)
                     .mailet(StripAttachment.class)
@@ -482,7 +482,7 @@ public class ICSAttachmentWorkflowTest {
                     .addProperty("exchange", EXCHANGE_NAME)
                     .addProperty("attribute", JSON_MAIL_ATTRIBUTE)
                     .addProperty("routing_key", ROUTING_KEY))
-                .addMailet(MailetConfiguration.LOCAL_DELIVERY));
+                .addMailetsFrom(CommonProcessors.deliverOnlyTransport()));
 
         jamesServer = TemporaryJamesServer.builder()
             .withBase(MemoryJamesServerMain.SMTP_AND_IMAP_MODULE)

http://git-wip-us.apache.org/repos/asf/james-project/blob/b5efd2f0/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 535526b..bd17057 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,6 +31,7 @@ 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;
@@ -64,7 +65,6 @@ public class StripAttachmentTest {
     public void setup() throws Exception {
         MailetContainer.Builder mailetContainer = TemporaryJamesServer.DEFAUL_MAILET_CONTAINER_CONFIGURATION
             .addProcessor(ProcessorConfiguration.transport()
-                .addMailet(MailetConfiguration.BCC_STRIPPER)
                 .addMailet(MailetConfiguration.builder()
                     .matcher(All.class)
                     .mailet(StripAttachment.class)
@@ -78,7 +78,7 @@ public class StripAttachmentTest {
                     .matcher(All.class)
                     .mailet(RecoverAttachment.class)
                     .addProperty("attribute", "my.attribute"))
-                .addMailet(MailetConfiguration.LOCAL_DELIVERY));
+                .addMailetsFrom(CommonProcessors.deliverOnlyTransport()));
 
         jamesServer = TemporaryJamesServer.builder()
             .withBase(MemoryJamesServerMain.SMTP_AND_IMAP_MODULE)

http://git-wip-us.apache.org/repos/asf/james-project/blob/b5efd2f0/server/protocols/jmap-integration-testing/pom.xml
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/pom.xml b/server/protocols/jmap-integration-testing/pom.xml
index ed38f3f..3cfe300 100644
--- a/server/protocols/jmap-integration-testing/pom.xml
+++ b/server/protocols/jmap-integration-testing/pom.xml
@@ -35,7 +35,6 @@
     <modules>
         <module>cassandra-jmap-integration-testing</module>
         <module>jmap-integration-testing-common</module>
-        <module>memory-jmap-integration-testing</module>
     </modules>
 
 </project>


---------------------------------------------------------------------
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