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 bt...@apache.org on 2019/06/26 03:29:05 UTC

[james-project] 25/28: JAMES-2659 don't expect too much from eventBus stop

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 6e53870f093046bfa6f9c12af7df1177c8c13b99
Author: Matthieu Baechler <ma...@apache.org>
AuthorDate: Fri Jun 21 14:31:23 2019 +0200

    JAMES-2659 don't expect too much from eventBus stop
---
 .../org/apache/james/mailbox/events/RabbitMQEventBusTest.java | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/mailbox/event/event-rabbitmq/src/test/java/org/apache/james/mailbox/events/RabbitMQEventBusTest.java b/mailbox/event/event-rabbitmq/src/test/java/org/apache/james/mailbox/events/RabbitMQEventBusTest.java
index 50df7d4..dac6986 100644
--- a/mailbox/event/event-rabbitmq/src/test/java/org/apache/james/mailbox/events/RabbitMQEventBusTest.java
+++ b/mailbox/event/event-rabbitmq/src/test/java/org/apache/james/mailbox/events/RabbitMQEventBusTest.java
@@ -65,6 +65,7 @@ import org.apache.james.mailbox.model.TestMessageId;
 import org.apache.james.mailbox.util.EventCollector;
 import org.apache.james.metrics.api.NoopMetricFactory;
 import org.apache.james.util.concurrency.ConcurrentTestRunner;
+import org.assertj.core.data.Percentage;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Disabled;
@@ -559,7 +560,7 @@ class RabbitMQEventBusTest implements GroupContract.SingleEventBusGroupContract,
             }
 
             @Test
-            void registrationsShouldNotHandleEventsAfterStop() throws Exception {
+            void dispatchShouldStopDeliveringEventsShortlyAfterStopIsCalled() throws Exception {
                 eventBus.start();
 
                 MailboxListenerCountingSuccessfulExecution listener = new MailboxListenerCountingSuccessfulExecution();
@@ -579,8 +580,7 @@ class RabbitMQEventBusTest implements GroupContract.SingleEventBusGroupContract,
 
                     TimeUnit.SECONDS.sleep(1);
                     assertThat(listener.numberOfEventCalls())
-                        .isEqualTo(callsAfterStop)
-                        .isLessThanOrEqualTo(MAX_EVENT_DISPATCHED_COUNT);
+                        .isCloseTo(callsAfterStop, Percentage.withPercentage(2));
                 }
             }
         }
@@ -650,7 +650,7 @@ class RabbitMQEventBusTest implements GroupContract.SingleEventBusGroupContract,
             }
 
             @Test
-            void registrationsShouldNotHandleEventsAfterStop() throws Exception {
+            void dispatchShouldStopDeliveringEventsShortlyAfterStopIsCalled() throws Exception {
                 eventBus.start();
                 eventBus2.start();
 
@@ -672,8 +672,7 @@ class RabbitMQEventBusTest implements GroupContract.SingleEventBusGroupContract,
 
                     TimeUnit.SECONDS.sleep(1);
                     assertThat(listener.numberOfEventCalls())
-                        .isEqualTo(callsAfterStop)
-                        .isLessThanOrEqualTo(MAX_EVENT_DISPATCHED_COUNT);
+                        .isCloseTo(callsAfterStop, Percentage.withPercentage(2));
                 }
             }
         }


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