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 b29d2e6b01f75be43713572f2d99dcf636190997
Author: Benoit Tellier <btell...@linagora.com>
AuthorDate: Tue Jun 18 11:48:55 2019 +0700

    JAMES-2794 MailQueue should deliver multiple time the same mail
    
    Multiple features are based on this assumption, not yet tested within the 
MailQueueContract:
    
     - Reprocessing
     - RRT rewrites to a distant server
     - Some remoteDelivery bouncing options
---
 .../queue/activemq/ActiveMQMailQueueBlobTest.java  |  7 ++++++
 .../queue/activemq/ActiveMQMailQueueTest.java      |  7 ++++++
 .../apache/james/queue/api/MailQueueContract.java  | 25 ++++++++++++++++++++++
 .../apache/james/queue/jms/JMSMailQueueTest.java   |  7 ++++++
 .../queue/rabbitmq/RabbitMQMailQueueTest.java      |  7 ++++++
 5 files changed, 53 insertions(+)

diff --git 
a/server/queue/queue-activemq/src/test/java/org/apache/james/queue/activemq/ActiveMQMailQueueBlobTest.java
 
b/server/queue/queue-activemq/src/test/java/org/apache/james/queue/activemq/ActiveMQMailQueueBlobTest.java
index f6baa55..1b021d0 100644
--- 
a/server/queue/queue-activemq/src/test/java/org/apache/james/queue/activemq/ActiveMQMailQueueBlobTest.java
+++ 
b/server/queue/queue-activemq/src/test/java/org/apache/james/queue/activemq/ActiveMQMailQueueBlobTest.java
@@ -131,6 +131,13 @@ public class ActiveMQMailQueueBlobTest implements 
DelayedManageableMailQueueCont
     }
 
     @Test
+    @Override
+    @Disabled("JAMES-2794 This test never finishes")
+    public void enQueueShouldAcceptMailWithDuplicatedNames() {
+
+    }
+
+    @Test
     void computeNextDeliveryTimestampShouldReturnLongMaxWhenOverflow() {
         long deliveryTimestamp = 
mailQueue.computeNextDeliveryTimestamp(ChronoUnit.FOREVER.getDuration());
 
diff --git 
a/server/queue/queue-activemq/src/test/java/org/apache/james/queue/activemq/ActiveMQMailQueueTest.java
 
b/server/queue/queue-activemq/src/test/java/org/apache/james/queue/activemq/ActiveMQMailQueueTest.java
index a4a7512..acfdbfb 100644
--- 
a/server/queue/queue-activemq/src/test/java/org/apache/james/queue/activemq/ActiveMQMailQueueTest.java
+++ 
b/server/queue/queue-activemq/src/test/java/org/apache/james/queue/activemq/ActiveMQMailQueueTest.java
@@ -127,6 +127,13 @@ public class ActiveMQMailQueueTest implements 
DelayedManageableMailQueueContract
 
     @Test
     @Override
+    @Disabled("JAMES-2794 This test never finishes")
+    public void enQueueShouldAcceptMailWithDuplicatedNames() {
+
+    }
+
+    @Test
+    @Override
     @Disabled("JAMES-2544 Mixing concurrent ack/nack might lead to a deadlock")
     public void concurrentEnqueueDequeueWithAckNackShouldNotFail() {
 
diff --git 
a/server/queue/queue-api/src/test/java/org/apache/james/queue/api/MailQueueContract.java
 
b/server/queue/queue-api/src/test/java/org/apache/james/queue/api/MailQueueContract.java
index c09d292..a6492cc 100644
--- 
a/server/queue/queue-api/src/test/java/org/apache/james/queue/api/MailQueueContract.java
+++ 
b/server/queue/queue-api/src/test/java/org/apache/james/queue/api/MailQueueContract.java
@@ -37,6 +37,7 @@ import java.util.concurrent.ConcurrentLinkedDeque;
 import java.util.concurrent.LinkedBlockingDeque;
 import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.TimeUnit;
+import java.util.stream.Stream;
 
 import javax.mail.internet.MimeMessage;
 
@@ -53,6 +54,7 @@ import org.junit.jupiter.api.Test;
 import com.github.fge.lambdas.Throwing;
 import com.google.common.base.MoreObjects;
 import com.google.common.base.Strings;
+
 import reactor.core.publisher.Flux;
 import reactor.core.publisher.Mono;
 import reactor.core.scheduler.Schedulers;
@@ -110,6 +112,29 @@ public interface MailQueueContract {
     }
 
     @Test
+    default void enQueueShouldAcceptMailWithDuplicatedNames() throws Exception 
{
+        String name = "name";
+        FakeMail mail = FakeMail.builder()
+            .name(name)
+            .mimeMessage(createMimeMessage())
+            .recipients(RECIPIENT1, RECIPIENT2)
+            .sender(MailAddress.nullSender())
+            .lastUpdated(new Date())
+            .build();
+
+        enQueue(mail);
+        enQueue(mail);
+
+        Stream<String> dequeuedItemNames = Flux.from(getMailQueue().deQueue())
+            .take(2)
+            .map(MailQueue.MailQueueItem::getMail)
+            .map(Mail::getName)
+            .toStream();
+
+        assertThat(dequeuedItemNames).hasSize(2).containsOnly(name);
+    }
+
+    @Test
     default void queueShouldHandleNoSender() throws Exception {
         enQueue(FakeMail.builder()
             .name("name")
diff --git 
a/server/queue/queue-jms/src/test/java/org/apache/james/queue/jms/JMSMailQueueTest.java
 
b/server/queue/queue-jms/src/test/java/org/apache/james/queue/jms/JMSMailQueueTest.java
index a31ed09..8f92851 100644
--- 
a/server/queue/queue-jms/src/test/java/org/apache/james/queue/jms/JMSMailQueueTest.java
+++ 
b/server/queue/queue-jms/src/test/java/org/apache/james/queue/jms/JMSMailQueueTest.java
@@ -113,4 +113,11 @@ public class JMSMailQueueTest implements 
DelayedManageableMailQueueContract, Pri
     public void concurrentEnqueueDequeueWithAckNackShouldNotFail() {
 
     }
+
+    @Test
+    @Override
+    @Disabled("JAMES-2794 This test never finishes")
+    public void enQueueShouldAcceptMailWithDuplicatedNames() {
+
+    }
 }
diff --git 
a/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/RabbitMQMailQueueTest.java
 
b/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/RabbitMQMailQueueTest.java
index f6d57c6..03455ff 100644
--- 
a/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/RabbitMQMailQueueTest.java
+++ 
b/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/RabbitMQMailQueueTest.java
@@ -231,6 +231,13 @@ public class RabbitMQMailQueueTest implements 
ManageableMailQueueContract, MailQ
 
     }
 
+    @Test
+    @Override
+    @Disabled("JAMES-2794 This test never finishes")
+    public void enQueueShouldAcceptMailWithDuplicatedNames() {
+
+    }
+
     private void enqueueSomeMails(Function<Integer, String> namePattern, int 
emailCount) {
         IntStream.rangeClosed(1, emailCount)
             .forEach(Throwing.intConsumer(i -> enQueue(defaultMail()


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

Reply via email to