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 <[email protected]> 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: [email protected] For additional commands, e-mail: [email protected]
