JAMES-2346 Factorize Awaitability constants in JMAP integration tests

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

Branch: refs/heads/master
Commit: 85ae28e07cc2095fd5d3ec43dfea3969cc308cdb
Parents: 9481435
Author: benwa <btell...@linagora.com>
Authored: Fri Mar 9 14:58:45 2018 +0700
Committer: benwa <btell...@linagora.com>
Committed: Tue Mar 13 15:11:54 2018 +0700

----------------------------------------------------------------------
 .../james/jmap/HttpJmapAuthentication.java      | 16 ++-------
 .../org/apache/james/jmap/TestingConstants.java | 36 ++++++++++++++++++++
 .../james/jmap/VacationIntegrationTest.java     | 12 +------
 .../jmap/VacationRelayIntegrationTest.java      | 14 +-------
 .../methods/integration/SendMDNMethodTest.java  |  1 +
 .../integration/SetMessagesMethodTest.java      |  7 +---
 .../integration/SpamAssassinContract.java       | 28 +--------------
 .../cucumber/SetMailboxesMethodStepdefs.java    |  6 ++--
 8 files changed, 46 insertions(+), 74 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/85ae28e0/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/HttpJmapAuthentication.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/HttpJmapAuthentication.java
 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/HttpJmapAuthentication.java
index e24034b..8cebfb9 100644
--- 
a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/HttpJmapAuthentication.java
+++ 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/HttpJmapAuthentication.java
@@ -19,9 +19,10 @@
 
 package org.apache.james.jmap;
 
+import static org.apache.james.jmap.TestingConstants.calmlyAwait;
+
 import java.io.IOException;
 import java.net.URISyntaxException;
-import java.util.concurrent.TimeUnit;
 
 import org.apache.http.client.ClientProtocolException;
 import org.apache.http.client.fluent.Request;
@@ -31,23 +32,12 @@ import org.apache.http.entity.ContentType;
 import org.apache.james.jmap.api.access.AccessToken;
 import org.hamcrest.core.IsAnything;
 
-import com.jayway.awaitility.Awaitility;
-import com.jayway.awaitility.Duration;
-import com.jayway.awaitility.core.ConditionFactory;
 import com.jayway.jsonpath.JsonPath;
 
 public class HttpJmapAuthentication {
 
-    private static final ConditionFactory CALMLY_AWAIT = Awaitility.with()
-            .pollInterval(Duration.FIVE_HUNDRED_MILLISECONDS)
-            .and().with()
-            .pollDelay(Duration.ONE_HUNDRED_MILLISECONDS)
-            .await()
-            .atMost(30, TimeUnit.SECONDS)
-            .ignoreExceptions();
-
     public static AccessToken authenticateJamesUser(URIBuilder uriBuilder, 
String username, String password) {
-        return CALMLY_AWAIT.until(
+        return calmlyAwait.until(
             () -> doAuthenticate(uriBuilder, username, password), 
IsAnything.anything());
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/85ae28e0/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/TestingConstants.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/TestingConstants.java
 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/TestingConstants.java
new file mode 100644
index 0000000..9e9e37d
--- /dev/null
+++ 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/TestingConstants.java
@@ -0,0 +1,36 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+package org.apache.james.jmap;
+
+import com.jayway.awaitility.Awaitility;
+import com.jayway.awaitility.Duration;
+import com.jayway.awaitility.core.ConditionFactory;
+
+public interface TestingConstants {
+    Duration slowPacedPollInterval = Duration.FIVE_HUNDRED_MILLISECONDS;
+
+    ConditionFactory calmlyAwait = Awaitility.with()
+        .pollInterval(slowPacedPollInterval)
+        .and().with()
+        .pollDelay(slowPacedPollInterval)
+        .await();
+
+
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/85ae28e0/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/VacationIntegrationTest.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/VacationIntegrationTest.java
 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/VacationIntegrationTest.java
index 2462081..f6de795 100644
--- 
a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/VacationIntegrationTest.java
+++ 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/VacationIntegrationTest.java
@@ -23,6 +23,7 @@ import static com.jayway.restassured.RestAssured.given;
 import static com.jayway.restassured.RestAssured.with;
 import static com.jayway.restassured.config.EncoderConfig.encoderConfig;
 import static com.jayway.restassured.config.RestAssuredConfig.newConfig;
+import static org.apache.james.jmap.TestingConstants.calmlyAwait;
 import static org.hamcrest.Matchers.empty;
 import static org.hamcrest.Matchers.equalTo;
 import static org.hamcrest.Matchers.hasSize;
@@ -48,9 +49,6 @@ import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
-import com.jayway.awaitility.Awaitility;
-import com.jayway.awaitility.Duration;
-import com.jayway.awaitility.core.ConditionFactory;
 import com.jayway.restassured.RestAssured;
 import com.jayway.restassured.builder.RequestSpecBuilder;
 import com.jayway.restassured.http.ContentType;
@@ -68,7 +66,6 @@ public abstract class VacationIntegrationTest {
     private static final String HTML_REASON = "<b>" + REASON + "</b>";
     public static final String ORIGINAL_MESSAGE_TEXT_BODY = "Hello someone, 
and thank you for joining example.com!";
 
-    private ConditionFactory calmlyAwait;
     private GuiceJamesServer guiceJamesServer;
     private JmapGuiceProbe jmapGuiceProbe;
 
@@ -103,13 +100,6 @@ public abstract class VacationIntegrationTest {
             .setPort(jmapGuiceProbe
                 .getJmapPort())
             .build();
-
-        Duration slowPacedPollInterval = Duration.FIVE_HUNDRED_MILLISECONDS;
-        calmlyAwait = Awaitility
-            .with()
-            .pollInterval(slowPacedPollInterval)
-            .and()
-            .pollDelay(slowPacedPollInterval).await();
     }
 
     private URIBuilder baseUri() {

http://git-wip-us.apache.org/repos/asf/james-project/blob/85ae28e0/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/VacationRelayIntegrationTest.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/VacationRelayIntegrationTest.java
 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/VacationRelayIntegrationTest.java
index f430748..8620089 100644
--- 
a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/VacationRelayIntegrationTest.java
+++ 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/VacationRelayIntegrationTest.java
@@ -20,6 +20,7 @@
 package org.apache.james.jmap;
 
 import static com.jayway.awaitility.Duration.ONE_MINUTE;
+import static org.apache.james.jmap.TestingConstants.calmlyAwait;
 import static org.hamcrest.Matchers.equalTo;
 
 import java.util.concurrent.TimeUnit;
@@ -42,10 +43,6 @@ import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 
-import com.jayway.awaitility.Awaitility;
-import com.jayway.awaitility.Duration;
-import com.jayway.awaitility.core.ConditionFactory;
-
 public abstract class VacationRelayIntegrationTest {
 
     private static final String DOMAIN = "mydomain.tld";
@@ -60,8 +57,6 @@ public abstract class VacationRelayIntegrationTest {
     @Rule
     public FakeSmtp fakeSmtp = new FakeSmtp();
 
-
-    private ConditionFactory calmlyAwait;
     private GuiceJamesServer guiceJamesServer;
     private JmapGuiceProbe jmapGuiceProbe;
 
@@ -89,13 +84,6 @@ public abstract class VacationRelayIntegrationTest {
 
         jmapGuiceProbe = guiceJamesServer.getProbe(JmapGuiceProbe.class);
 
-        Duration slowPacedPollInterval = Duration.FIVE_HUNDRED_MILLISECONDS;
-        calmlyAwait = Awaitility
-            .with()
-            .pollInterval(slowPacedPollInterval)
-            .and()
-            .pollDelay(slowPacedPollInterval).await();
-
         fakeSmtp.awaitStarted(calmlyAwait.atMost(ONE_MINUTE));
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/85ae28e0/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SendMDNMethodTest.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SendMDNMethodTest.java
 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SendMDNMethodTest.java
index d7690c7..694d42b 100644
--- 
a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SendMDNMethodTest.java
+++ 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SendMDNMethodTest.java
@@ -236,6 +236,7 @@ public abstract class SendMDNMethodTest {
                 "}}, \"#0\"]]")
             .post("/jmap");
 
+
         await();
 
         // BOB should have received it

http://git-wip-us.apache.org/repos/asf/james-project/blob/85ae28e0/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMessagesMethodTest.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMessagesMethodTest.java
 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMessagesMethodTest.java
index 5b78467..dbabc4b 100644
--- 
a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMessagesMethodTest.java
+++ 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMessagesMethodTest.java
@@ -23,6 +23,7 @@ import static com.jayway.restassured.RestAssured.given;
 import static com.jayway.restassured.RestAssured.with;
 import static com.jayway.restassured.config.EncoderConfig.encoderConfig;
 import static com.jayway.restassured.config.RestAssuredConfig.newConfig;
+import static org.apache.james.jmap.TestingConstants.calmlyAwait;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.hamcrest.Matchers.contains;
 import static org.hamcrest.Matchers.containsInAnyOrder;
@@ -98,9 +99,7 @@ import org.junit.Test;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.Lists;
 import com.google.common.io.ByteStreams;
-import com.jayway.awaitility.Awaitility;
 import com.jayway.awaitility.Duration;
-import com.jayway.awaitility.core.ConditionFactory;
 import com.jayway.restassured.RestAssured;
 import com.jayway.restassured.builder.RequestSpecBuilder;
 import com.jayway.restassured.builder.ResponseSpecBuilder;
@@ -126,7 +125,6 @@ public abstract class SetMessagesMethodTest {
     private static final MailboxPath USER_MAILBOX = 
MailboxPath.forUser(USERNAME, "mailbox");
     private static final String NOT_UPDATED = ARGUMENTS + ".notUpdated";
 
-    private ConditionFactory calmlyAwait;
     private AccessToken bobAccessToken;
 
     protected abstract GuiceJamesServer createJmapServer();
@@ -172,9 +170,6 @@ public abstract class SetMessagesMethodTest {
         mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, 
DefaultMailboxes.DRAFTS);
         mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, 
DefaultMailboxes.SENT);
         await();
-
-        Duration slowPacedPollInterval = Duration.FIVE_HUNDRED_MILLISECONDS;
-        calmlyAwait = 
Awaitility.with().pollInterval(slowPacedPollInterval).and().with().pollDelay(slowPacedPollInterval).await();
     }
 
     private URIBuilder baseUri() {

http://git-wip-us.apache.org/repos/asf/james-project/blob/85ae28e0/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SpamAssassinContract.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SpamAssassinContract.java
 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SpamAssassinContract.java
index 6a57aca..a2b385a 100644
--- 
a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SpamAssassinContract.java
+++ 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SpamAssassinContract.java
@@ -23,6 +23,7 @@ import static com.jayway.restassured.RestAssured.given;
 import static com.jayway.restassured.RestAssured.with;
 import static com.jayway.restassured.config.EncoderConfig.encoderConfig;
 import static com.jayway.restassured.config.RestAssuredConfig.newConfig;
+import static org.apache.james.jmap.TestingConstants.calmlyAwait;
 import static org.hamcrest.Matchers.equalTo;
 import static org.hamcrest.Matchers.hasSize;
 
@@ -43,9 +44,6 @@ import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 
-import com.jayway.awaitility.Awaitility;
-import com.jayway.awaitility.Duration;
-import com.jayway.awaitility.core.ConditionFactory;
 import com.jayway.restassured.RestAssured;
 import com.jayway.restassured.builder.RequestSpecBuilder;
 import com.jayway.restassured.http.ContentType;
@@ -102,9 +100,6 @@ public interface SpamAssassinContract {
 
     @Test
     default void 
spamShouldBeDeliveredInSpamMailboxWhenSameMessageHasAlreadyBeenMovedToSpam(JamesWithSpamAssassin
 james) throws Exception {
-        Duration slowPacedPollInterval = Duration.FIVE_HUNDRED_MILLISECONDS;
-        ConditionFactory calmlyAwait = 
Awaitility.with().pollInterval(slowPacedPollInterval).and().with().pollDelay(slowPacedPollInterval).await();
-
         james.getSpamAssassinExtension().getSpamAssassin().train(ALICE);
         AccessToken aliceAccessToken = accessTokenFor(james.getJmapServer(), 
ALICE, ALICE_PASSWORD);
         AccessToken bobAccessToken = accessTokenFor(james.getJmapServer(), 
BOB, BOB_PASSWORD);
@@ -155,9 +150,6 @@ public interface SpamAssassinContract {
 
     @Test
     default void 
imapCopiesToSpamMailboxShouldBeConsideredAsSpam(JamesWithSpamAssassin james) 
throws Exception {
-        Duration slowPacedPollInterval = Duration.FIVE_HUNDRED_MILLISECONDS;
-        ConditionFactory calmlyAwait = 
Awaitility.with().pollInterval(slowPacedPollInterval).and().with().pollDelay(slowPacedPollInterval).await();
-
         james.getSpamAssassinExtension().getSpamAssassin().train(ALICE);
         AccessToken aliceAccessToken = accessTokenFor(james.getJmapServer(), 
ALICE, ALICE_PASSWORD);
         AccessToken bobAccessToken = accessTokenFor(james.getJmapServer(), 
BOB, BOB_PASSWORD);
@@ -205,9 +197,6 @@ public interface SpamAssassinContract {
 
     @Test
     default void 
imapMovesToSpamMailboxShouldBeConsideredAsSpam(JamesWithSpamAssassin james) 
throws Exception {
-        Duration slowPacedPollInterval = Duration.FIVE_HUNDRED_MILLISECONDS;
-        ConditionFactory calmlyAwait = 
Awaitility.with().pollInterval(slowPacedPollInterval).and().with().pollDelay(slowPacedPollInterval).await();
-
         james.getSpamAssassinExtension().getSpamAssassin().train(ALICE);
         AccessToken aliceAccessToken = accessTokenFor(james.getJmapServer(), 
ALICE, ALICE_PASSWORD);
         AccessToken bobAccessToken = accessTokenFor(james.getJmapServer(), 
BOB, BOB_PASSWORD);
@@ -255,9 +244,6 @@ public interface SpamAssassinContract {
 
     @Test
     default void 
spamAssassinShouldForgetMessagesMovedOutOfSpamFolderUsingJMAP(JamesWithSpamAssassin
 james) throws Exception {
-        Duration slowPacedPollInterval = Duration.FIVE_HUNDRED_MILLISECONDS;
-        ConditionFactory calmlyAwait = 
Awaitility.with().pollInterval(slowPacedPollInterval).and().with().pollDelay(slowPacedPollInterval).await();
-
         james.getSpamAssassinExtension().getSpamAssassin().train(ALICE);
         AccessToken aliceAccessToken = accessTokenFor(james.getJmapServer(), 
ALICE, ALICE_PASSWORD);
         AccessToken bobAccessToken = accessTokenFor(james.getJmapServer(), 
BOB, BOB_PASSWORD);
@@ -321,9 +307,6 @@ public interface SpamAssassinContract {
 
     @Test
     default void 
movingAMailToTrashShouldNotImpactSpamassassinLearning(JamesWithSpamAssassin 
james) throws Exception {
-        Duration slowPacedPollInterval = Duration.FIVE_HUNDRED_MILLISECONDS;
-        ConditionFactory calmlyAwait = 
Awaitility.with().pollInterval(slowPacedPollInterval).and().with().pollDelay(slowPacedPollInterval).await();
-
         james.getSpamAssassinExtension().getSpamAssassin().train(ALICE);
         AccessToken aliceAccessToken = accessTokenFor(james.getJmapServer(), 
ALICE, ALICE_PASSWORD);
         AccessToken bobAccessToken = accessTokenFor(james.getJmapServer(), 
BOB, BOB_PASSWORD);
@@ -387,9 +370,6 @@ public interface SpamAssassinContract {
 
     @Test
     default void 
spamAssassinShouldForgetMessagesMovedOutOfSpamFolderUsingIMAP(JamesWithSpamAssassin
 james) throws Exception {
-        Duration slowPacedPollInterval = Duration.FIVE_HUNDRED_MILLISECONDS;
-        ConditionFactory calmlyAwait = 
Awaitility.with().pollInterval(slowPacedPollInterval).and().with().pollDelay(slowPacedPollInterval).await();
-
         james.getSpamAssassinExtension().getSpamAssassin().train(ALICE);
         AccessToken aliceAccessToken = accessTokenFor(james.getJmapServer(), 
ALICE, ALICE_PASSWORD);
         AccessToken bobAccessToken = accessTokenFor(james.getJmapServer(), 
BOB, BOB_PASSWORD);
@@ -450,9 +430,6 @@ public interface SpamAssassinContract {
 
     @Test
     default void 
expungingSpamMessageShouldNotImpactSpamAssassinState(JamesWithSpamAssassin 
james) throws Exception {
-        Duration slowPacedPollInterval = Duration.FIVE_HUNDRED_MILLISECONDS;
-        ConditionFactory calmlyAwait = 
Awaitility.with().pollInterval(slowPacedPollInterval).and().with().pollDelay(slowPacedPollInterval).await();
-
         james.getSpamAssassinExtension().getSpamAssassin().train(ALICE);
         AccessToken aliceAccessToken = accessTokenFor(james.getJmapServer(), 
ALICE, ALICE_PASSWORD);
         AccessToken bobAccessToken = accessTokenFor(james.getJmapServer(), 
BOB, BOB_PASSWORD);
@@ -514,9 +491,6 @@ public interface SpamAssassinContract {
 
     @Test
     default void 
deletingSpamMessageShouldNotImpactSpamAssassinState(JamesWithSpamAssassin 
james) throws Exception {
-        Duration slowPacedPollInterval = Duration.FIVE_HUNDRED_MILLISECONDS;
-        ConditionFactory calmlyAwait = 
Awaitility.with().pollInterval(slowPacedPollInterval).and().with().pollDelay(slowPacedPollInterval).await();
-
         james.getSpamAssassinExtension().getSpamAssassin().train(ALICE);
         AccessToken aliceAccessToken = accessTokenFor(james.getJmapServer(), 
ALICE, ALICE_PASSWORD);
         AccessToken bobAccessToken = accessTokenFor(james.getJmapServer(), 
BOB, BOB_PASSWORD);

http://git-wip-us.apache.org/repos/asf/james-project/blob/85ae28e0/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/SetMailboxesMethodStepdefs.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/SetMailboxesMethodStepdefs.java
 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/SetMailboxesMethodStepdefs.java
index a11da56..657e812 100644
--- 
a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/SetMailboxesMethodStepdefs.java
+++ 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/SetMailboxesMethodStepdefs.java
@@ -19,6 +19,7 @@
 
 package org.apache.james.jmap.methods.integration.cucumber;
 
+import static org.apache.james.jmap.TestingConstants.calmlyAwait;
 import static org.assertj.core.api.Assertions.assertThat;
 
 import java.io.ByteArrayInputStream;
@@ -40,8 +41,6 @@ import org.apache.james.mailbox.model.MailboxPath;
 
 import com.github.fge.lambdas.Throwing;
 import com.google.common.collect.Maps;
-import com.jayway.awaitility.Awaitility;
-import com.jayway.awaitility.Duration;
 import com.jayway.jsonpath.DocumentContext;
 import com.jayway.jsonpath.JsonPath;
 
@@ -269,11 +268,10 @@ public class SetMailboxesMethodStepdefs {
 
     @Then("^mailbox \"([^\"]*)\" contains (\\d+) messages$")
     public void mailboxContainsMessages(String mailboxName, int messageCount) {
-        Duration slowPacedPollInterval = Duration.FIVE_HUNDRED_MILLISECONDS;
         String username = userStepdefs.getConnectedUser();
         String mailboxId = mainStepdefs.getMailboxId(username, 
mailboxName).serialize();
 
-        
Awaitility.await().atMost(Duration.FIVE_SECONDS).pollDelay(slowPacedPollInterval).pollInterval(slowPacedPollInterval).until(()
 -> {
+        calmlyAwait.until(() -> {
             String requestBody = "[[\"getMessageList\", 
{\"filter\":{\"inMailboxes\":[\"" + mailboxId + "\"]}}, \"#0\"]]";
 
             httpClient.post(requestBody);


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

Reply via email to