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/02/21 02:27:22 UTC

[james-project] 09/13: JAMES-3063 RabbitMQ Channel Pool can provide closed channels

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 9c8f1353d33fdddb909169cc8c92c167b3d5d4a8
Author: Tran Tien Duc <dt...@linagora.com>
AuthorDate: Fri Feb 7 17:59:51 2020 +0700

    JAMES-3063 RabbitMQ Channel Pool can provide closed channels
---
 .../rabbitmq/ReactorRabbitMQChannelPoolTest.java    | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/backends-common/rabbitmq/src/test/java/org/apache/james/backends/rabbitmq/ReactorRabbitMQChannelPoolTest.java b/backends-common/rabbitmq/src/test/java/org/apache/james/backends/rabbitmq/ReactorRabbitMQChannelPoolTest.java
index 9eaf53f..8927930 100644
--- a/backends-common/rabbitmq/src/test/java/org/apache/james/backends/rabbitmq/ReactorRabbitMQChannelPoolTest.java
+++ b/backends-common/rabbitmq/src/test/java/org/apache/james/backends/rabbitmq/ReactorRabbitMQChannelPoolTest.java
@@ -20,6 +20,7 @@
 package org.apache.james.backends.rabbitmq;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatCode;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 import java.time.Duration;
@@ -31,6 +32,7 @@ import java.util.concurrent.ExecutionException;
 import org.apache.james.util.concurrency.ConcurrentTestRunner;
 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;
 
@@ -107,4 +109,23 @@ class ReactorRabbitMQChannelPoolTest implements ChannelPoolContract {
         channelPool.close();
         assertThat(channel.isOpen()).isFalse();
     }
+
+    @Disabled("IllegalArgumentException on channel state checks")
+    @Test
+    void channelBorrowShouldNotThrowWhenClosedChannel() throws Exception {
+        ChannelPool channelPool = generateChannelPool(1);
+        Channel channel = channelPool.getChannelMono().block();
+        returnChannel(channel, channelPool);
+
+        // unexpected closing, connection timeout, rabbitmq temporally down...
+        channel.close();
+
+        assertThatCode(() -> channelPool.getChannelMono().block())
+            .doesNotThrowAnyException();
+    }
+
+    private void returnChannel(Channel channel, ChannelPool channelPool) {
+        channelPool.getChannelCloseHandler()
+            .accept(SignalType.ON_COMPLETE, channel);
+    }
 }


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