james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [07/13] james-project git commit: JAMES-2447 Reduce calmly await poll delay
Date Thu, 05 Jul 2018 02:01:29 GMT
JAMES-2447 Reduce calmly await poll delay

The poll delay is the time to wait before first trial...

The problem is that many things get retried but could have worked directly (eg JMAP authentication)
thus minimizing delay highly speed things up.


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

Branch: refs/heads/master
Commit: 8baa7526d3fb82c7ad17bd3b7db1a9eabe294b88
Parents: b374cf9
Author: benwa <btellier@linagora.com>
Authored: Mon Jul 2 01:06:47 2018 +0700
Committer: benwa <btellier@linagora.com>
Committed: Thu Jul 5 08:58:13 2018 +0700

----------------------------------------------------------------------
 .../james/CassandraMailRepositoryIntegrationTest.java |  6 +++++-
 ...DirectResolutionRemoteDeliveryIntegrationTest.java |  9 +++++++--
 .../mailets/GatewayRemoteDeliveryIntegrationTest.java | 14 +++++++++++---
 .../apache/james/mailets/configuration/Constants.java | 10 +++++++---
 .../james/smtp/SmtpAuthorizedAddressesTest.java       | 12 ++++++++----
 .../java/org/apache/james/jmap/TestingConstants.java  |  6 ++++--
 6 files changed, 42 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/8baa7526/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraMailRepositoryIntegrationTest.java
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraMailRepositoryIntegrationTest.java
b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraMailRepositoryIntegrationTest.java
index cf2cbdb..f935d38 100644
--- a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraMailRepositoryIntegrationTest.java
+++ b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraMailRepositoryIntegrationTest.java
@@ -21,6 +21,8 @@ package org.apache.james;
 
 import static com.jayway.awaitility.Duration.FIVE_HUNDRED_MILLISECONDS;
 
+import java.util.concurrent.TimeUnit;
+
 import org.apache.james.mailrepository.api.MailRepositoryUrl;
 import org.apache.james.utils.DataProbeImpl;
 import org.apache.james.utils.MailRepositoryProbeImpl;
@@ -32,11 +34,13 @@ 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 class CassandraMailRepositoryIntegrationTest {
 
     private static final MailRepositoryUrl SENDER_DENIED_URL = MailRepositoryUrl.from("cassandra://var/mail/sender-denied/");
+    private static final Duration ONE_MILLISECOND = new Duration(1, TimeUnit.MILLISECONDS);
 
     @ClassRule
     public static DockerCassandraRule cassandra = new DockerCassandraRule();
@@ -57,7 +61,7 @@ public class CassandraMailRepositoryIntegrationTest {
             .pollInterval(FIVE_HUNDRED_MILLISECONDS)
             .and()
             .with()
-            .pollDelay(FIVE_HUNDRED_MILLISECONDS)
+            .pollDelay(ONE_MILLISECOND)
             .await();
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/8baa7526/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/DirectResolutionRemoteDeliveryIntegrationTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/DirectResolutionRemoteDeliveryIntegrationTest.java
b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/DirectResolutionRemoteDeliveryIntegrationTest.java
index fc8c7c4..984e3b8 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/DirectResolutionRemoteDeliveryIntegrationTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/DirectResolutionRemoteDeliveryIntegrationTest.java
@@ -48,6 +48,7 @@ import org.junit.Test;
 import org.junit.rules.TemporaryFolder;
 
 import com.google.common.collect.ImmutableList;
+import com.jayway.awaitility.Duration;
 
 public class DirectResolutionRemoteDeliveryIntegrationTest {
     private static final String JAMES_ANOTHER_DOMAIN = "james.com";
@@ -110,7 +111,9 @@ public class DirectResolutionRemoteDeliveryIntegrationTest {
         messageSender.connect(LOCALHOST_IP, SMTP_PORT)
             .sendMessage(FROM, RECIPIENT);
 
-        awaitAtMostOneMinute.until(this::messageIsReceivedByTheSmtpServer);
+        awaitAtMostOneMinute
+            .pollDelay(Duration.FIVE_HUNDRED_MILLISECONDS)
+            .until(this::messageIsReceivedByTheSmtpServer);
     }
 
     @Test
@@ -137,7 +140,9 @@ public class DirectResolutionRemoteDeliveryIntegrationTest {
         messageSender.connect(LOCALHOST_IP, SMTP_PORT)
             .sendMessage(FROM, RECIPIENT);
 
-        awaitAtMostOneMinute.until(this::messageIsReceivedByTheSmtpServer);
+        awaitAtMostOneMinute
+            .pollDelay(Duration.FIVE_HUNDRED_MILLISECONDS)
+            .until(this::messageIsReceivedByTheSmtpServer);
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/james-project/blob/8baa7526/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/GatewayRemoteDeliveryIntegrationTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/GatewayRemoteDeliveryIntegrationTest.java
b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/GatewayRemoteDeliveryIntegrationTest.java
index 0158104..d9e6bab 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/GatewayRemoteDeliveryIntegrationTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/GatewayRemoteDeliveryIntegrationTest.java
@@ -49,6 +49,8 @@ import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.TemporaryFolder;
 
+import com.jayway.awaitility.Duration;
+
 public class GatewayRemoteDeliveryIntegrationTest {
     private static final String JAMES_ANOTHER_DOMAIN = "james.com";
 
@@ -99,7 +101,9 @@ public class GatewayRemoteDeliveryIntegrationTest {
         messageSender.connect(LOCALHOST_IP, SMTP_PORT)
             .sendMessage(FROM, RECIPIENT);
 
-        awaitAtMostOneMinute.until(this::messageIsReceivedByTheSmtpServer);
+        awaitAtMostOneMinute
+            .pollDelay(Duration.FIVE_HUNDRED_MILLISECONDS)
+            .until(this::messageIsReceivedByTheSmtpServer);
     }
 
     @Test
@@ -137,7 +141,9 @@ public class GatewayRemoteDeliveryIntegrationTest {
         messageSender.connect(LOCALHOST_IP, SMTP_PORT)
             .sendMessage(FROM, RECIPIENT);
 
-        awaitAtMostOneMinute.until(this::messageIsReceivedByTheSmtpServer);
+        awaitAtMostOneMinute
+            .pollDelay(Duration.FIVE_HUNDRED_MILLISECONDS)
+            .until(this::messageIsReceivedByTheSmtpServer);
     }
 
     @Test
@@ -156,7 +162,9 @@ public class GatewayRemoteDeliveryIntegrationTest {
         messageSender.connect(LOCALHOST_IP, SMTP_PORT)
             .sendMessage(FROM, RECIPIENT);
 
-        awaitAtMostOneMinute.until(this::messageIsReceivedByTheSmtpServer);
+        awaitAtMostOneMinute
+            .pollDelay(Duration.FIVE_HUNDRED_MILLISECONDS)
+            .until(this::messageIsReceivedByTheSmtpServer);
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/james-project/blob/8baa7526/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/configuration/Constants.java
----------------------------------------------------------------------
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/configuration/Constants.java
b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/configuration/Constants.java
index 5eae0e7..813b3ca 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/configuration/Constants.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/configuration/Constants.java
@@ -19,20 +19,24 @@
 
 package org.apache.james.mailets.configuration;
 
-import static com.jayway.awaitility.Duration.FIVE_HUNDRED_MILLISECONDS;
+import static com.jayway.awaitility.Duration.ONE_HUNDRED_MILLISECONDS;
 import static com.jayway.awaitility.Duration.ONE_MINUTE;
 
+import java.util.concurrent.TimeUnit;
+
 import com.jayway.awaitility.Awaitility;
 import com.jayway.awaitility.Duration;
 import com.jayway.awaitility.core.ConditionFactory;
 
 public class Constants {
-    public static Duration slowPacedPollInterval = FIVE_HUNDRED_MILLISECONDS;
+    public static Duration slowPacedPollInterval = ONE_HUNDRED_MILLISECONDS;
+    public static Duration ONE_MILLISECOND = new Duration(1, TimeUnit.MILLISECONDS);
+
     public static ConditionFactory calmlyAwait = Awaitility.with()
         .pollInterval(slowPacedPollInterval)
         .and()
         .with()
-        .pollDelay(slowPacedPollInterval)
+        .pollDelay(ONE_MILLISECOND)
         .await();
     public static ConditionFactory awaitAtMostOneMinute = calmlyAwait.atMost(ONE_MINUTE);
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/8baa7526/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpAuthorizedAddressesTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpAuthorizedAddressesTest.java
b/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpAuthorizedAddressesTest.java
index 859325d..8d7d661 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpAuthorizedAddressesTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpAuthorizedAddressesTest.java
@@ -50,6 +50,8 @@ import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.TemporaryFolder;
 
+import com.jayway.awaitility.Duration;
+
 public class SmtpAuthorizedAddressesTest {
     private static final String FROM = "fromuser@" + DEFAULT_DOMAIN;
     private static final String TO = "to@any.com";
@@ -134,10 +136,12 @@ public class SmtpAuthorizedAddressesTest {
             .authenticate(FROM, PASSWORD)
             .sendMessage(FROM, TO);
 
-        awaitAtMostOneMinute.until(() -> fakeSmtp.isReceived(response -> response
-            .body("", hasSize(1))
-            .body("[0].from", equalTo(FROM))
-            .body("[0].subject", equalTo("test"))));
+        awaitAtMostOneMinute
+            .pollDelay(Duration.FIVE_HUNDRED_MILLISECONDS)
+            .until(() -> fakeSmtp.isReceived(response -> response
+                .body("", hasSize(1))
+                .body("[0].from", equalTo(FROM))
+                .body("[0].subject", equalTo("test"))));
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/james-project/blob/8baa7526/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
index 7dba329..9949c61 100644
--- 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
@@ -23,6 +23,7 @@ import static com.jayway.restassured.config.EncoderConfig.encoderConfig;
 import static com.jayway.restassured.config.RestAssuredConfig.newConfig;
 
 import java.nio.charset.StandardCharsets;
+import java.util.concurrent.TimeUnit;
 
 import com.jayway.awaitility.Awaitility;
 import com.jayway.awaitility.Duration;
@@ -31,12 +32,13 @@ import com.jayway.restassured.builder.RequestSpecBuilder;
 import com.jayway.restassured.http.ContentType;
 
 public interface TestingConstants {
-    Duration slowPacedPollInterval = Duration.FIVE_HUNDRED_MILLISECONDS;
+    Duration slowPacedPollInterval = Duration.ONE_HUNDRED_MILLISECONDS;
+    Duration ONE_MILLISECOND = new Duration(1, TimeUnit.MILLISECONDS);
 
     ConditionFactory calmlyAwait = Awaitility.with()
         .pollInterval(slowPacedPollInterval)
         .and().with()
-        .pollDelay(slowPacedPollInterval)
+        .pollDelay(ONE_MILLISECOND)
         .await();
 
     RequestSpecBuilder jmapRequestSpecBuilder = new RequestSpecBuilder()


---------------------------------------------------------------------
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