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 ro...@apache.org on 2019/03/07 16:32:54 UTC

[james-project] 02/03: JAMES-2675 Workaround RabbitMQ slowness to send indexation requests

This is an automated email from the ASF dual-hosted git repository.

rouazana pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 5b6ba76b4faaf54de7cd895f8a1b623c01b05511
Author: Raphael Ouazana <ra...@linagora.com>
AuthorDate: Wed Mar 6 17:30:46 2019 +0100

    JAMES-2675 Workaround RabbitMQ slowness to send indexation requests
---
 .../cucumber/GetMessageListMethodStepdefs.java     | 24 +++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessageListMethodStepdefs.java b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessageListMethodStepdefs.java
index c3b99af..d2e4156 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessageListMethodStepdefs.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessageListMethodStepdefs.java
@@ -20,9 +20,10 @@
 package org.apache.james.jmap.methods.integration.cucumber;
 
 import static org.apache.james.jmap.TestingConstants.ARGUMENTS;
-import static org.assertj.core.api.Assertions.assertThat;
+import static org.apache.james.jmap.TestingConstants.calmlyAwait;
 
 import java.util.List;
+import java.util.concurrent.TimeUnit;
 
 import javax.inject.Inject;
 
@@ -103,20 +104,29 @@ public class GetMessageListMethodStepdefs {
 
     @Then("^the message list is empty$")
     public void assertEmpty() {
-        assertThat(httpClient.response.getStatusLine().getStatusCode()).isEqualTo(200);
-        assertThat(httpClient.jsonPath.<List<String>>read(ARGUMENTS + ".messageIds")).isEmpty();
+        calmlyAwait
+            .atMost(30, TimeUnit.SECONDS)
+            .until(
+                () -> httpClient.response.getStatusLine().getStatusCode() == 200
+                    && httpClient.jsonPath.<List<String>>read(ARGUMENTS + ".messageIds").isEmpty());
     }
 
     @Then("^the message list has size (\\d+)")
     public void assertSize(int size) {
-        assertThat(httpClient.response.getStatusLine().getStatusCode()).isEqualTo(200);
-        assertThat(httpClient.jsonPath.<List<String>>read(ARGUMENTS + ".messageIds")).hasSize(size);
+        calmlyAwait
+            .atMost(30, TimeUnit.SECONDS)
+            .until(
+                () -> httpClient.response.getStatusLine().getStatusCode() == 200
+                    && httpClient.jsonPath.<List<String>>read(ARGUMENTS + ".messageIds").size() == size);
     }
 
     @Then("^the message list contains \"([^\"]*)\"")
     public void assertContains(String message) {
         MessageId messageId = messageIdStepdefs.getMessageId(message);
-        assertThat(httpClient.response.getStatusLine().getStatusCode()).isEqualTo(200);
-        assertThat(httpClient.jsonPath.<List<String>>read(ARGUMENTS + ".messageIds")).contains(messageId.serialize());
+        calmlyAwait
+            .atMost(30, TimeUnit.SECONDS)
+            .until(
+                () -> httpClient.response.getStatusLine().getStatusCode() == 200
+                    && httpClient.jsonPath.<List<String>>read(ARGUMENTS + ".messageIds").contains(messageId.serialize()));
     }
 }


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