james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [08/44] james-project git commit: JAMES-2267 Avoid launching a JMAP server where it can be avoided
Date Fri, 05 Jan 2018 02:56:27 GMT
JAMES-2267 Avoid launching a JMAP server where it can be avoided


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

Branch: refs/heads/improve-mailet-testing-experience-v1
Commit: a537bce165c7988a9d2331d09585d20daffa7d5c
Parents: 623620e
Author: benwa <btellier@linagora.com>
Authored: Tue Dec 19 11:31:26 2017 +0700
Committer: benwa <btellier@linagora.com>
Committed: Fri Jan 5 09:13:51 2018 +0700

----------------------------------------------------------------------
 .../james/mailets/BounceIntegrationTest.java    | 34 +++++++++++++-------
 .../crypto/SMIMEDecryptIntegrationTest.java     |  6 ++--
 .../crypto/SMIMESignIntegrationTest.java        |  6 ++--
 .../mailets/AmqpForwardAttachmentTest.java      |  9 +++---
 .../transport/mailets/ContactExtractorTest.java |  9 +++---
 .../mailets/ICSAttachmentWorkflowTest.java      |  9 +++---
 .../transport/mailets/StripAttachmentTest.java  |  9 +++---
 7 files changed, 42 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/a537bce1/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 c92dd50..5c65644 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
@@ -19,7 +19,7 @@
 
 package org.apache.james.mailets;
 
-import org.apache.james.jmap.mailet.VacationMailet;
+import org.apache.james.MemoryJamesServerMain;
 import org.apache.james.mailbox.model.MailboxConstants;
 import org.apache.james.mailets.configuration.CommonProcessors;
 import org.apache.james.mailets.configuration.MailetConfiguration;
@@ -37,7 +37,6 @@ import org.apache.james.transport.mailets.Resend;
 import org.apache.james.transport.mailets.ToProcessor;
 import org.apache.james.transport.matchers.All;
 import org.apache.james.transport.matchers.RecipientIs;
-import org.apache.james.transport.matchers.RecipientIsLocal;
 import org.apache.james.utils.DataProbeImpl;
 import org.apache.james.utils.IMAPMessageReader;
 import org.apache.james.utils.SMTPMessageSender;
@@ -88,7 +87,9 @@ public class BounceIntegrationTest {
 
     @Test
     public void dsnBounceMailetShouldDeliverBounce() throws Exception {
-        jamesServer = TemporaryJamesServer.builder().build(temporaryFolder,
+        jamesServer = TemporaryJamesServer.builder()
+            .withBase(MemoryJamesServerMain.SMTP_AND_IMAP_MODULE)
+            .build(temporaryFolder,
             generateMailetContainerConfiguration(MailetConfiguration.builder()
                 .matcher(All.class)
                 .mailet(DSNBounce.class)
@@ -110,7 +111,9 @@ public class BounceIntegrationTest {
 
     @Test
     public void bounceMailetShouldDeliverBounce() throws Exception {
-        jamesServer = TemporaryJamesServer.builder().build(temporaryFolder,
+        jamesServer = TemporaryJamesServer.builder()
+            .withBase(MemoryJamesServerMain.SMTP_AND_IMAP_MODULE)
+            .build(temporaryFolder,
             generateMailetContainerConfiguration(MailetConfiguration.builder()
                 .matcher(All.class)
                 .mailet(Bounce.class)
@@ -132,7 +135,9 @@ public class BounceIntegrationTest {
 
     @Test
     public void forwardMailetShouldDeliverBounce() throws Exception {
-        jamesServer = TemporaryJamesServer.builder().build(temporaryFolder,
+        jamesServer = TemporaryJamesServer.builder()
+            .withBase(MemoryJamesServerMain.SMTP_AND_IMAP_MODULE)
+            .build(temporaryFolder,
             generateMailetContainerConfiguration(MailetConfiguration.builder()
                 .matcher(All.class)
                 .mailet(Forward.class)
@@ -155,7 +160,9 @@ public class BounceIntegrationTest {
 
     @Test
     public void redirectMailetShouldDeliverBounce() throws Exception {
-        jamesServer = TemporaryJamesServer.builder().build(temporaryFolder,
+        jamesServer = TemporaryJamesServer.builder()
+            .withBase(MemoryJamesServerMain.SMTP_AND_IMAP_MODULE)
+            .build(temporaryFolder,
             generateMailetContainerConfiguration(MailetConfiguration.builder()
                 .matcher(All.class)
                 .mailet(Redirect.class)
@@ -178,7 +185,9 @@ public class BounceIntegrationTest {
 
     @Test
     public void resendMailetShouldDeliverBounce() throws Exception {
-        jamesServer = TemporaryJamesServer.builder().build(temporaryFolder,
+        jamesServer = TemporaryJamesServer.builder()
+            .withBase(MemoryJamesServerMain.SMTP_AND_IMAP_MODULE)
+            .build(temporaryFolder,
             generateMailetContainerConfiguration(MailetConfiguration.builder()
                 .matcher(All.class)
                 .mailet(Resend.class)
@@ -201,7 +210,9 @@ public class BounceIntegrationTest {
 
     @Test
     public void notifySenderMailetShouldDeliverBounce() throws Exception {
-        jamesServer = TemporaryJamesServer.builder().build(temporaryFolder,
+        jamesServer = TemporaryJamesServer.builder()
+            .withBase(MemoryJamesServerMain.SMTP_AND_IMAP_MODULE)
+            .build(temporaryFolder,
             generateMailetContainerConfiguration(MailetConfiguration.builder()
                 .matcher(All.class)
                 .mailet(NotifySender.class)
@@ -223,7 +234,9 @@ public class BounceIntegrationTest {
 
     @Test
     public void notifyPostmasterMailetShouldDeliverBounce() throws Exception {
-        jamesServer = TemporaryJamesServer.builder().build(temporaryFolder,
+        jamesServer = TemporaryJamesServer.builder()
+            .withBase(MemoryJamesServerMain.SMTP_AND_IMAP_MODULE)
+            .build(temporaryFolder,
             generateMailetContainerConfiguration(MailetConfiguration.builder()
                 .matcher(All.class)
                 .mailet(NotifyPostmaster.class)
@@ -259,9 +272,6 @@ public class BounceIntegrationTest {
         return ProcessorConfiguration.transport()
             .addMailet(MailetConfiguration.BCC_STRIPPER)
             .addMailet(MailetConfiguration.builder()
-                .matcher(RecipientIsLocal.class)
-                .mailet(VacationMailet.class))
-            .addMailet(MailetConfiguration.builder()
                 .matcher(RecipientIs.class)
                 .matcherCondition(BOUNCE_RECEIVER)
                 .mailet(LocalDelivery.class))

http://git-wip-us.apache.org/repos/asf/james-project/blob/a537bce1/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/crypto/SMIMEDecryptIntegrationTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/crypto/SMIMEDecryptIntegrationTest.java
b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/crypto/SMIMEDecryptIntegrationTest.java
index 7739eaf..7ed510e 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/crypto/SMIMEDecryptIntegrationTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/crypto/SMIMEDecryptIntegrationTest.java
@@ -25,7 +25,7 @@ import java.nio.charset.StandardCharsets;
 import java.time.ZonedDateTime;
 
 import org.apache.commons.io.IOUtils;
-import org.apache.james.jmap.mailet.VacationMailet;
+import org.apache.james.MemoryJamesServerMain;
 import org.apache.james.mailbox.model.MailboxConstants;
 import org.apache.james.mailets.TemporaryJamesServer;
 import org.apache.james.mailets.configuration.CommonProcessors;
@@ -86,13 +86,11 @@ public class SMIMEDecryptIntegrationTest {
                     .addProperty("debug", "true"))
                 .addMailet(MailetConfiguration.builder()
                     .matcher(RecipientIsLocal.class)
-                    .mailet(VacationMailet.class))
-                .addMailet(MailetConfiguration.builder()
-                    .matcher(RecipientIsLocal.class)
                     .mailet(LocalDelivery.class)))
             .build();
 
         jamesServer = TemporaryJamesServer.builder()
+            .withBase(MemoryJamesServerMain.SMTP_AND_IMAP_MODULE)
             .withOverrides(binder -> binder.bind(ZonedDateTimeProvider.class).toInstance(()
-> DATE_2015))
             .build(temporaryFolder, mailetContainer);
         Duration slowPacedPollInterval = Duration.FIVE_HUNDRED_MILLISECONDS;

http://git-wip-us.apache.org/repos/asf/james-project/blob/a537bce1/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/crypto/SMIMESignIntegrationTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/crypto/SMIMESignIntegrationTest.java
b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/crypto/SMIMESignIntegrationTest.java
index a6c3208..f9ef2dc 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/crypto/SMIMESignIntegrationTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/crypto/SMIMESignIntegrationTest.java
@@ -23,7 +23,7 @@ import static org.assertj.core.api.Assertions.assertThat;
 
 import java.time.ZonedDateTime;
 
-import org.apache.james.jmap.mailet.VacationMailet;
+import org.apache.james.MemoryJamesServerMain;
 import org.apache.james.mailbox.model.MailboxConstants;
 import org.apache.james.mailets.TemporaryJamesServer;
 import org.apache.james.mailets.configuration.CommonProcessors;
@@ -98,9 +98,6 @@ public class SMIMESignIntegrationTest {
                     .matcher(All.class)
                     .mailet(RecipientRewriteTable.class))
                 .addMailet(MailetConfiguration.builder()
-                    .matcher(RecipientIsLocal.class)
-                    .mailet(VacationMailet.class))
-                .addMailet(MailetConfiguration.builder()
                     .mailet(SMIMESign.class)
                     .matcher(SenderIsLocal.class)
                     .addProperty("keyStoreFileName", temporaryFolder.getRoot().getAbsoluteFile().getAbsolutePath()
+ "/conf/smime.p12")
@@ -132,6 +129,7 @@ public class SMIMESignIntegrationTest {
             .build();
 
         jamesServer = TemporaryJamesServer.builder()
+            .withBase(MemoryJamesServerMain.SMTP_AND_IMAP_MODULE)
             .withOverrides(binder -> binder.bind(ZonedDateTimeProvider.class).toInstance(()
-> DATE_2015))
             .build(temporaryFolder, mailetContainer);
         Duration slowPacedPollInterval = Duration.FIVE_HUNDRED_MILLISECONDS;

http://git-wip-us.apache.org/repos/asf/james-project/blob/a537bce1/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 0d4597b..538c037 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
@@ -23,8 +23,8 @@ import static org.assertj.core.api.Assertions.assertThat;
 
 import java.nio.charset.StandardCharsets;
 
+import org.apache.james.MemoryJamesServerMain;
 import org.apache.james.core.MailAddress;
-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;
@@ -111,13 +111,12 @@ public class AmqpForwardAttachmentTest {
                             .addProperty(AmqpForwardAttribute.ROUTING_KEY_PARAMETER_NAME,
ROUTING_KEY))
                     .addMailet(MailetConfiguration.builder()
                             .matcher(RecipientIsLocal.class)
-                            .mailet(VacationMailet.class))
-                    .addMailet(MailetConfiguration.builder()
-                            .matcher(RecipientIsLocal.class)
                             .mailet(LocalDelivery.class)))
             .build();
 
-        jamesServer = TemporaryJamesServer.builder().build(temporaryFolder, mailetContainer);
+        jamesServer = TemporaryJamesServer.builder()
+            .withBase(MemoryJamesServerMain.SMTP_AND_IMAP_MODULE)
+            .build(temporaryFolder, mailetContainer);
         Duration slowPacedPollInterval = Duration.FIVE_HUNDRED_MILLISECONDS;
         calmlyAwait = Awaitility.with()
             .pollInterval(slowPacedPollInterval)

http://git-wip-us.apache.org/repos/asf/james-project/blob/a537bce1/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 cdbc936..f7ba334 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
@@ -23,8 +23,8 @@ import static org.assertj.core.api.Assertions.assertThat;
 
 import java.util.Optional;
 
+import org.apache.james.MemoryJamesServerMain;
 import org.apache.james.core.MailAddress;
-import org.apache.james.jmap.mailet.VacationMailet;
 import org.apache.james.mailets.TemporaryJamesServer;
 import org.apache.james.mailets.configuration.CommonProcessors;
 import org.apache.james.mailets.configuration.MailetConfiguration;
@@ -96,12 +96,11 @@ public class ContactExtractorTest {
                     .addMailet(MailetConfiguration.BCC_STRIPPER)
                     .addMailet(MailetConfiguration.builder()
                         .matcher(RecipientIsLocal.class)
-                        .mailet(VacationMailet.class))
-                    .addMailet(MailetConfiguration.builder()
-                        .matcher(RecipientIsLocal.class)
                         .mailet(LocalDelivery.class)))
             .build();
-        jamesServer = TemporaryJamesServer.builder().build(folder, mailets);
+        jamesServer = TemporaryJamesServer.builder()
+            .withBase(MemoryJamesServerMain.SMTP_AND_IMAP_MODULE)
+            .build(folder, mailets);
         DataProbeImpl probe = jamesServer.getProbe(DataProbeImpl.class);
         probe.addDomain(JAMES_ORG);
         probe.addUser(SENDER, PASSWORD);

http://git-wip-us.apache.org/repos/asf/james-project/blob/a537bce1/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 c6be395..f6bd7ed 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
@@ -26,9 +26,9 @@ import java.util.Optional;
 
 import javax.mail.internet.MimeMessage;
 
+import org.apache.james.MemoryJamesServerMain;
 import org.apache.james.core.MailAddress;
 import org.apache.james.jmap.mailet.TextCalendarBodyToAttachment;
-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;
@@ -495,13 +495,12 @@ public class ICSAttachmentWorkflowTest {
                             .addProperty("routing_key", ROUTING_KEY))
                     .addMailet(MailetConfiguration.builder()
                             .matcher(RecipientIsLocal.class)
-                            .mailet(VacationMailet.class))
-                    .addMailet(MailetConfiguration.builder()
-                            .matcher(RecipientIsLocal.class)
                             .mailet(LocalDelivery.class)))
             .build();
 
-        jamesServer = TemporaryJamesServer.builder().build(temporaryFolder, mailetContainer);
+        jamesServer = TemporaryJamesServer.builder()
+            .withBase(MemoryJamesServerMain.SMTP_AND_IMAP_MODULE)
+            .build(temporaryFolder, mailetContainer);
         Duration slowPacedPollInterval = Duration.FIVE_HUNDRED_MILLISECONDS;
         calmlyAwait = Awaitility.with().pollInterval(slowPacedPollInterval).and().with().pollDelay(slowPacedPollInterval).await();
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/a537bce1/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 15b7bff..2419288 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
@@ -23,8 +23,8 @@ import static org.assertj.core.api.Assertions.assertThat;
 
 import javax.mail.internet.MimeMessage;
 
+import org.apache.james.MemoryJamesServerMain;
 import org.apache.james.core.MailAddress;
-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;
@@ -92,13 +92,12 @@ public class StripAttachmentTest {
                             .addProperty("attribute", "my.attribute"))
                     .addMailet(MailetConfiguration.builder()
                             .matcher(RecipientIsLocal.class)
-                            .mailet(VacationMailet.class))
-                    .addMailet(MailetConfiguration.builder()
-                            .matcher(RecipientIsLocal.class)
                             .mailet(LocalDelivery.class)))
             .build();
 
-        jamesServer = TemporaryJamesServer.builder().build(temporaryFolder, mailetContainer);
+        jamesServer = TemporaryJamesServer.builder()
+            .withBase(MemoryJamesServerMain.SMTP_AND_IMAP_MODULE)
+            .build(temporaryFolder, mailetContainer);
         Duration slowPacedPollInterval = Duration.FIVE_HUNDRED_MILLISECONDS;
         calmlyAwait = Awaitility.with().pollInterval(slowPacedPollInterval).and().with().pollDelay(slowPacedPollInterval).await();
 


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