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/01/16 06:59:14 UTC
[06/17] james-project git commit: MAILBOX-371 Fix-up for
LifeCycleTest more stable
MAILBOX-371 Fix-up for LifeCycleTest more stable
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/5b9b1065
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/5b9b1065
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/5b9b1065
Branch: refs/heads/master
Commit: 5b9b106572488b8ce4f2173c9b6fe0b08b451fb6
Parents: af95d7b
Author: datph <dp...@linagora.com>
Authored: Mon Jan 14 15:24:35 2019 +0700
Committer: Benoit Tellier <bt...@linagora.com>
Committed: Wed Jan 16 13:47:08 2019 +0700
----------------------------------------------------------------------
.../mailbox/events/RabbitMQEventBusTest.java | 25 ++++++++++----------
1 file changed, 12 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/james-project/blob/5b9b1065/mailbox/event/event-rabbitmq/src/test/java/org/apache/james/mailbox/events/RabbitMQEventBusTest.java
----------------------------------------------------------------------
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 52a6e50..dbb125a 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
@@ -237,6 +237,11 @@ class RabbitMQEventBusTest implements GroupContract.SingleEventBusGroupContract,
@Nested
class LifeCycleTest {
+ private final Duration TEN_SECONDS = Duration.ofSeconds(10);
+
+ private static final int THREAD_COUNT = 10;
+ private static final int OPERATION_COUNT = 100;
+ private static final int MAX_EVENT_DISPATCHED_COUNT = THREAD_COUNT * OPERATION_COUNT;
private RabbitMQManagementAPI rabbitManagementAPI;
@@ -298,13 +303,10 @@ class RabbitMQEventBusTest implements GroupContract.SingleEventBusGroupContract,
MailboxListenerCountingSuccessfulExecution listener = new MailboxListenerCountingSuccessfulExecution();
eventBus.register(listener, GROUP_A);
- int threadCount = 10;
- int operationCount = 1000;
- int maxEventsDispatched = threadCount * operationCount;
ConcurrentTestRunner.builder()
.operation((threadNumber, step) -> eventBus.dispatch(EVENT, KEY_1))
- .threadCount(10)
- .operationCount(1000)
+ .threadCount(THREAD_COUNT)
+ .operationCount(OPERATION_COUNT)
.runSuccessfullyWithin(Duration.ofMinutes(1));
eventBus.stop();
@@ -313,7 +315,7 @@ class RabbitMQEventBusTest implements GroupContract.SingleEventBusGroupContract,
TimeUnit.SECONDS.sleep(1);
assertThat(listener.numberOfEventCalls())
.isEqualTo(callsAfterStop)
- .isLessThan(maxEventsDispatched);
+ .isLessThan(MAX_EVENT_DISPATCHED_COUNT);
}
}
@@ -389,14 +391,11 @@ class RabbitMQEventBusTest implements GroupContract.SingleEventBusGroupContract,
eventBus.register(listener, GROUP_A);
eventBus2.register(listener, GROUP_A);
- int threadCount = 10;
- int operationCount = 1000;
- int maxEventsDispatched = threadCount * operationCount;
ConcurrentTestRunner.builder()
.operation((threadNumber, step) -> eventBus.dispatch(EVENT, KEY_1))
- .threadCount(10)
- .operationCount(1000)
- .runSuccessfullyWithin(Duration.ofSeconds(5));
+ .threadCount(THREAD_COUNT)
+ .operationCount(OPERATION_COUNT)
+ .runSuccessfullyWithin(TEN_SECONDS);
eventBus.stop();
eventBus2.stop();
@@ -405,7 +404,7 @@ class RabbitMQEventBusTest implements GroupContract.SingleEventBusGroupContract,
TimeUnit.SECONDS.sleep(1);
assertThat(listener.numberOfEventCalls())
.isEqualTo(callsAfterStop)
- .isLessThan(maxEventsDispatched);
+ .isLessThan(MAX_EVENT_DISPATCHED_COUNT);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org