You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by rc...@apache.org on 2020/07/10 08:20:17 UTC
[james-project] 04/05: JAMES-3295 add a test
remoteDeliveryErrorHandlingShouldIgnoreMailsNotTransitingByRemoteDelivery
in RemoteDeliveryErrorHandlingTest
This is an automated email from the ASF dual-hosted git repository.
rcordier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git
commit 5ef6acc9764d40b009796a48a829a687931ec8cf
Author: Rene Cordier <rc...@linagora.com>
AuthorDate: Thu Jul 9 11:53:32 2020 +0700
JAMES-3295 add a test remoteDeliveryErrorHandlingShouldIgnoreMailsNotTransitingByRemoteDelivery in RemoteDeliveryErrorHandlingTest
---
.../mailets/RemoteDeliveryErrorHandlingTest.java | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/RemoteDeliveryErrorHandlingTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/RemoteDeliveryErrorHandlingTest.java
index d7519e7..690e359 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/RemoteDeliveryErrorHandlingTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/RemoteDeliveryErrorHandlingTest.java
@@ -57,6 +57,7 @@ import org.apache.james.utils.WebAdminGuiceProbe;
import org.apache.james.webadmin.WebAdminUtils;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.junit.jupiter.api.io.TempDir;
@@ -69,9 +70,11 @@ public class RemoteDeliveryErrorHandlingTest {
private static final String FROM = "from@" + DEFAULT_DOMAIN;
private static final String RECIPIENT_DOMAIN = "test.com";
private static final String RECIPIENT = "touser@" + RECIPIENT_DOMAIN;
+ private static final String RECIPIENT2 = "accident@" + RECIPIENT_DOMAIN;
private static final String LOCALHOST = "localhost";
private static final MailRepositoryUrl REMOTE_DELIVERY_TEMPORARY_ERROR_REPOSITORY = MailRepositoryUrl.from("memory://var/mail/error/remote-delivery/temporary");
private static final MailRepositoryUrl REMOTE_DELIVERY_PERMANENT_ERROR_REPOSITORY = MailRepositoryUrl.from("memory://var/mail/error/remote-delivery/permanent");
+ private static final MailRepositoryUrl ERROR_REPOSITORY = MailRepositoryUrl.from("memory://var/mail/error/");
private static final Integer MAX_EXECUTIONS = 2;
@RegisterExtension
@@ -257,4 +260,20 @@ public class RemoteDeliveryErrorHandlingTest {
.getRepositoryMailCount(REMOTE_DELIVERY_PERMANENT_ERROR_REPOSITORY))
.isEqualTo(1));
}
+
+ @Test
+ @Disabled("JAMES-3295 we need to add some more mailets to prove that if a mail has no temporary and permanent"
+ + "failure, it can be treated differently")
+ void remoteDeliveryErrorHandlingShouldIgnoreMailsNotTransitingByRemoteDelivery(SMTPMessageSender smtpMessageSender) throws Exception {
+ // When we relay a mail where some unexpected accident happens
+ smtpMessageSender.connect(LOCALHOST, jamesServer.getProbe(SmtpGuiceProbe.class).getSmtpPort())
+ .authenticate(FROM, PASSWORD)
+ .sendMessage(FROM, RECIPIENT2);
+
+ // Then mail should be stored in error repository
+ awaitAtMostOneMinute
+ .untilAsserted(() -> assertThat(jamesServer.getProbe(MailRepositoryProbeImpl.class)
+ .getRepositoryMailCount(ERROR_REPOSITORY))
+ .isEqualTo(1));
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org