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 2020/04/02 04:32:08 UTC

[james-project] 01/15: [Build] Fasten JMAP Draft memory integration testing

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

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

commit cdc93045df905c261d59be213c05489142970b12
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Wed Apr 1 09:36:14 2020 +0700

    [Build] Fasten JMAP Draft memory integration testing
---
 .../modules/mailbox/FastRetryBackoffModule.java    | 38 ++++++++++++++++++++++
 .../container/guice/protocols/jmap-draft/pom.xml   |  4 +++
 .../apache/james/modules/TestJMAPServerModule.java |  5 +++
 3 files changed, 47 insertions(+)

diff --git a/server/container/guice/mailbox/src/main/java/org/apache/james/modules/mailbox/FastRetryBackoffModule.java b/server/container/guice/mailbox/src/main/java/org/apache/james/modules/mailbox/FastRetryBackoffModule.java
new file mode 100644
index 0000000..a0cd52d
--- /dev/null
+++ b/server/container/guice/mailbox/src/main/java/org/apache/james/modules/mailbox/FastRetryBackoffModule.java
@@ -0,0 +1,38 @@
+/****************************************************************
+ * 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.modules.mailbox;
+
+import java.time.Duration;
+
+import org.apache.james.mailbox.events.RetryBackoffConfiguration;
+
+import com.google.inject.AbstractModule;
+
+public class FastRetryBackoffModule extends AbstractModule {
+    @Override
+    protected void configure() {
+        bind(RetryBackoffConfiguration.class)
+            .toInstance(RetryBackoffConfiguration.builder()
+                .maxRetries(3)
+                .firstBackoff(Duration.ofMillis(10))
+                .jitterFactor(0.2)
+                .build());
+    }
+}
diff --git a/server/container/guice/protocols/jmap-draft/pom.xml b/server/container/guice/protocols/jmap-draft/pom.xml
index dc5156f..5979be9 100644
--- a/server/container/guice/protocols/jmap-draft/pom.xml
+++ b/server/container/guice/protocols/jmap-draft/pom.xml
@@ -55,6 +55,10 @@
         </dependency>
         <dependency>
             <groupId>${james.groupId}</groupId>
+            <artifactId>james-server-guice-mailbox</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
             <artifactId>james-server-jmap-draft</artifactId>
         </dependency>
         <dependency>
diff --git a/server/container/guice/protocols/jmap-draft/src/test/java/org/apache/james/modules/TestJMAPServerModule.java b/server/container/guice/protocols/jmap-draft/src/test/java/org/apache/james/modules/TestJMAPServerModule.java
index c455d1e..374d36a 100644
--- a/server/container/guice/protocols/jmap-draft/src/test/java/org/apache/james/modules/TestJMAPServerModule.java
+++ b/server/container/guice/protocols/jmap-draft/src/test/java/org/apache/james/modules/TestJMAPServerModule.java
@@ -20,6 +20,7 @@
 package org.apache.james.modules;
 
 import java.io.FileNotFoundException;
+import java.time.Duration;
 import java.util.Optional;
 
 import javax.inject.Singleton;
@@ -28,6 +29,8 @@ import org.apache.commons.configuration2.ex.ConfigurationException;
 import org.apache.james.jmap.JMAPConfiguration;
 import org.apache.james.jmap.draft.JMAPDraftConfiguration;
 import org.apache.james.jmap.draft.methods.GetMessageListMethod;
+import org.apache.james.mailbox.events.RetryBackoffConfiguration;
+import org.apache.james.modules.mailbox.FastRetryBackoffModule;
 
 import com.google.inject.AbstractModule;
 import com.google.inject.Provides;
@@ -106,6 +109,8 @@ public class TestJMAPServerModule extends AbstractModule {
 
     @Override
     protected void configure() {
+        install(new FastRetryBackoffModule());
+
         bindConstant().annotatedWith(Names.named(GetMessageListMethod.MAXIMUM_LIMIT)).to(maximumLimit);
     }
 


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