james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From matth...@apache.org
Subject [2/2] james-project git commit: JAMES-2334 Extract a lambda in RabbitMQCluster
Date Fri, 01 Jun 2018 07:31:14 GMT
JAMES-2334 Extract a lambda in RabbitMQCluster

This allow to give it a name and makes it more explicit


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/a880399a
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/a880399a
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/a880399a

Branch: refs/heads/master
Commit: a880399ab40a9522b354e0d27f998e3c791d251b
Parents: df80985
Author: benwa <btellier@linagora.com>
Authored: Thu May 31 17:20:14 2018 +0700
Committer: Matthieu Baechler <matthieu@apache.org>
Committed: Fri Jun 1 09:29:56 2018 +0200

----------------------------------------------------------------------
 .../james/queue/rabbitmq/RabbitMQClusterTest.java       | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/a880399a/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/RabbitMQClusterTest.java
----------------------------------------------------------------------
diff --git a/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/RabbitMQClusterTest.java
b/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/RabbitMQClusterTest.java
index b1f1f69..26cf6e1 100644
--- a/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/RabbitMQClusterTest.java
+++ b/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/RabbitMQClusterTest.java
@@ -256,11 +256,7 @@ class RabbitMQClusterTest {
 
             AtomicInteger counter = new AtomicInteger(0);
             InMemoryConsumer consumer = new InMemoryConsumer(resilientChannel,
-                () -> {
-                    if (counter.incrementAndGet() == nbMessages / 2) {
-                        cluster.getRabbitMQ1().stop();
-                    }
-                });
+                () -> stopWhenHalfProcessed(cluster, nbMessages, counter));
             resilientChannel.basicConsume(QUEUE, consumer);
 
             awaitAtMostOneMinute.until(() -> consumer.getConsumedMessages().size() ==
nbMessages);
@@ -269,6 +265,12 @@ class RabbitMQClusterTest {
             assertThat(consumer.getConsumedMessages()).containsOnlyElementsOf(expectedResult);
         }
 
+        private void stopWhenHalfProcessed(DockerRabbitMQCluster cluster, int nbMessages,
AtomicInteger counter) {
+            if (counter.incrementAndGet() == nbMessages / 2) {
+                cluster.getRabbitMQ1().stop();
+            }
+        }
+
     }
 
     private void closeQuietly(AutoCloseable... closeables) {


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


Mime
View raw message