This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 156a6f269165f0c8061115c0c6a055bee0ab99ad
Author: Benoit Tellier <[email protected]>
AuthorDate: Fri Jun 21 10:58:17 2019 +0700

    JAMES-2994 Reprocessing to an unknown processor triggers an infinite loop 
as the mail is nack
---
 .../mailets/MailReprocessingIntegrationTest.java   | 31 ++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git 
a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/MailReprocessingIntegrationTest.java
 
b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/MailReprocessingIntegrationTest.java
index 19c63a8..f8de0d5 100644
--- 
a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/MailReprocessingIntegrationTest.java
+++ 
b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/MailReprocessingIntegrationTest.java
@@ -20,6 +20,7 @@
 package org.apache.james.transport.mailets;
 
 import static io.restassured.RestAssured.given;
+import static 
org.apache.james.mailets.configuration.CommonProcessors.ERROR_REPOSITORY;
 import static org.apache.james.mailets.configuration.Constants.DEFAULT_DOMAIN;
 import static org.apache.james.mailets.configuration.Constants.FROM;
 import static org.apache.james.mailets.configuration.Constants.LOCALHOST_IP;
@@ -53,6 +54,7 @@ import 
org.apache.james.webadmin.authentication.NoAuthenticationFilter;
 import org.apache.mailet.base.test.FakeMail;
 import org.junit.After;
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.TemporaryFolder;
@@ -188,6 +190,35 @@ public class MailReprocessingIntegrationTest {
         assertThat(containsExactlyOneMail(REPOSITORY_A)).isTrue();
     }
 
+    @Ignore("JAMES-2994 Reprocessing to an unknown processor triggers an 
infinite loop as the mail is nack")
+    @Test
+    public void reprocessingShouldProcessAsErrorWhenUnknownMailProcessor() 
throws Exception {
+        // Given an incoming email
+        messageSender.connect(LOCALHOST_IP, 
jamesServer.getProbe(SmtpGuiceProbe.class).getSmtpPort())
+            .sendMessage(FakeMail.builder()
+                .name("name")
+                .mimeMessage(MimeMessageBuilder.mimeMessageBuilder()
+                    .addToRecipient(RECIPIENT)
+                    .setSender(FROM)
+                    .setText("match me"))
+                .sender(FROM)
+                .recipient(RECIPIENT));
+        // Being stored in MailRepository B
+        awaitAtMostOneMinute.until(() -> containsExactlyOneMail(REPOSITORY_B));
+
+        // When I reprocess it
+        given()
+            .spec(specification)
+            .param("action", "reprocess")
+            .param("queue", MailQueueFactory.SPOOL)
+            .param("processor", "unknown")
+            .patch("/mailRepositories/" + REPOSITORY_B.getPath().urlEncoded() 
+ "/mails").prettyPeek();
+
+        // Then I can move it to repository A
+        awaitAtMostOneMinute.until(() -> 
containsExactlyOneMail(ERROR_REPOSITORY));
+        assertThat(containsExactlyOneMail(ERROR_REPOSITORY)).isTrue();
+    }
+
     private boolean containsExactlyOneMail(MailRepositoryUrl repositoryUrl) {
         try {
             return given()


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to