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 rc...@apache.org on 2019/12/11 10:28:48 UTC

[james-project] branch master updated (8d2f38a -> 067e123)

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

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


    from 8d2f38a  JAMES-2999 reuse spamassassin images between runs
     new 24d0103  [Refactoring] Move MaildirMailboxIdDeserializerTest to JUnit 5
     new f02e1d5  [Refactoring] Small access modifiers cleanup in test classes in mailbox-maildir module
     new 45fc76c  [Refactoring] Remove unused createMailboxManager method in MaildirMailboxManagerProvider
     new fea2af3  [Refactoring] Move MailderMailboxMessageNameTest to JUnit 5
     new 2a7fd57  [Refactoring] Fixing typo MailderMailboxMessageNameTest -> MaildirMailboxMessageNameTest
     new 5e2a49f  [Refactoring] Move test classes in mailbox-lucene to JUnit 5
     new 6050a4f  [Refactoring] Move JPAMailboxMessageTest to JUnit 5
     new b87d108  [Refactoring] Move MessageUtilsTest to JUnit 5
     new 57d5610  [Refactoring] Move JPAMailboxIdDeserializerTest to JUnit 5
     new 9223f56  [Refactoring] Small access modifiers cleanup in test classes in mailbox-jpa module using JUnit 5
     new 5f8d524  [Refactoring] Move AbstractMessageManagerTest to JUnit 5
     new e5b3ce6  JAMES-2666 Fix EventDeadLetters unstable test
     new 067e123  JAMES-2717 Avoid restarting ElasticSearch container for each test class

The 13 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../backends/es/DockerElasticSearchExtension.java  |  16 +-
 .../mailbox/jpa/JPAMailboxIdDeserializerTest.java  |  28 +--
 .../james/mailbox/jpa/JPAMailboxManagerTest.java   |   6 +-
 .../mailbox/jpa/JPASubscriptionManagerTest.java    |   4 +-
 .../mailbox/jpa/JpaMailboxManagerStressTest.java   |   4 +-
 .../james/mailbox/jpa/mail/JPAMapperProvider.java  |   2 +-
 .../mailbox/jpa/mail/JpaAnnotationMapperTest.java  |   4 +-
 .../mailbox/jpa/mail/JpaMailboxMapperTest.java     |   4 +-
 .../mailbox/jpa/mail/JpaMessageMapperTest.java     |   2 +-
 .../james/mailbox/jpa/mail/JpaMessageMoveTest.java |   2 +-
 .../james/mailbox/jpa/mail/MessageUtilsTest.java   |  55 +++---
 .../mail/model/openjpa/JPAMailboxMessageTest.java  |   6 +-
 .../jpa/quota/JPACurrentQuotaManagerTest.java      |   2 +-
 .../mailbox/jpa/quota/JPAPerUserMaxQuotaTest.java  |   2 +-
 .../LuceneMailboxMessageSearchIndexTest.java       | 170 +++++++++--------
 .../search/StrictLuceneMessageSearchIndexText.java |  56 +++---
 mailbox/maildir/pom.xml                            |   5 +
 .../DomainUserMaildirMailboxManagerStressTest.java |   2 +-
 .../DomainUserMaildirMailboxManagerTest.java       |   2 +-
 .../FullUserMaildirMailboxManagerStressTest.java   |   2 +-
 .../maildir/FullUserMaildirMailboxManagerTest.java |   2 +-
 .../maildir/MailderMailboxMessageNameTest.java     | 210 ---------------------
 .../maildir/MaildirMailboxIdDeserializerTest.java  |  28 +--
 .../maildir/MaildirMailboxManagerProvider.java     |   8 +-
 .../maildir/MaildirMailboxMessageNameTest.java     | 181 ++++++++++++++++++
 .../maildir/MaildirSubscriptionManagerTest.java    |   2 +-
 .../UserMaildirMailboxManagerStressTest.java       |   2 +-
 .../inmemory/InMemoryMessageManagerTest.java       |  17 +-
 .../mailbox/store/AbstractMessageManagerTest.java  |  20 +-
 .../EventDeadLettersIntegrationTest.java           |  16 +-
 30 files changed, 408 insertions(+), 452 deletions(-)
 delete mode 100644 mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/MailderMailboxMessageNameTest.java
 create mode 100644 mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/MaildirMailboxMessageNameTest.java


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


[james-project] 04/13: [Refactoring] Move MailderMailboxMessageNameTest to JUnit 5

Posted by rc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit fea2af330d2ea8f6affa6c986de404111cd55b17
Author: Rene Cordier <rc...@linagora.com>
AuthorDate: Tue Dec 10 17:15:34 2019 +0700

    [Refactoring] Move MailderMailboxMessageNameTest to JUnit 5
---
 mailbox/maildir/pom.xml                            |   5 +
 .../maildir/MailderMailboxMessageNameTest.java     | 167 +++++++++------------
 2 files changed, 74 insertions(+), 98 deletions(-)

diff --git a/mailbox/maildir/pom.xml b/mailbox/maildir/pom.xml
index 282845c..3ea306b 100644
--- a/mailbox/maildir/pom.xml
+++ b/mailbox/maildir/pom.xml
@@ -82,6 +82,11 @@
             <artifactId>commons-lang3</artifactId>
         </dependency>
         <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter-params</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>org.mockito</groupId>
             <artifactId>mockito-core</artifactId>
             <scope>test</scope>
diff --git a/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/MailderMailboxMessageNameTest.java b/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/MailderMailboxMessageNameTest.java
index 69e7cd5..7d467e3 100644
--- a/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/MailderMailboxMessageNameTest.java
+++ b/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/MailderMailboxMessageNameTest.java
@@ -20,96 +20,82 @@ package org.apache.james.mailbox.maildir;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
-import java.util.ArrayList;
-import java.util.List;
+import java.util.stream.Stream;
 
 import javax.mail.Flags;
 
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-
-@RunWith(value = Parameterized.class)
-public class MailderMailboxMessageNameTest {
-
-    private String validName;
-    private Parts parts;
-
-    public MailderMailboxMessageNameTest(Parts parts) {
-        this.validName = parts.fullName;
-        this.parts = parts;
-    }
-
-    @Parameterized.Parameters
-    public static List<Object[]> testData() {
-        List<Object[]> args = new ArrayList<>();
-        // no size, two flags
-        Parts parts = Parts.fullName("1328026049.19146_0.km1111:2,RS").timeSeconds(1328026049)
-                .baseName("1328026049.19146_0.km1111").flagAnswered().flagSeen();
-        args.add(toObjectArray(parts));
-
-        // size and flag
-        parts = Parts.fullName("1328613172.M569643P1862V0000000000000902I00EE42CE_0.km1111,S=13103:2,S")
-                .timeSeconds(1328613172).size(13103L)
-                .baseName("1328613172.M569643P1862V0000000000000902I00EE42CE_0.km1111").flagSeen();
-        args.add(toObjectArray(parts));
-
-        // size, no flags
-        parts = Parts.fullName("1340124194.M723289P3184V0000000000000902I006780E9_6.km1111,S=1344:2,")
-                .baseName("1340124194.M723289P3184V0000000000000902I006780E9_6.km1111").timeSeconds(1340124194)
-                .size(1344L);
-        args.add(toObjectArray(parts));
-
-        // three flags, no size
-        parts = Parts.fullName("1106685752.12132_0.km1111:2,FRS").baseName("1106685752.12132_0.km1111")
-                .timeSeconds(1106685752).flagFlagged().flagAnswered().flagSeen();
-        args.add(toObjectArray(parts));
-
-        // with dovecot attributes
-        parts = Parts.fullName("1035478339.27041_118.foo.org,S=1000,W=1030:2,S")
-                .baseName("1035478339.27041_118.foo.org").timeSeconds(1035478339).size(1000L).flagSeen();
-        args.add(toObjectArray(parts));
-
-        parts = parts.copy();
-        parts.fullName = "1035478339.27041_118.foo.org,W=1030,S=1000:2,S";
-        args.add(toObjectArray(parts));
-
-        // new mail, no info part at all. found in courier maildirs
-        parts = Parts.fullName("1355543030.15049_0.foo.org").baseName("1355543030.15049_0.foo.org")
-                .timeSeconds(1355543030).noFlags();
-        args.add(toObjectArray(parts));
-
-        // new mail, generated by james
-        parts = Parts.fullName("1356001301.e563087e30181513.foohost,S=629:2,")
-                .baseName("1356001301.e563087e30181513.foohost").timeSeconds(1356001301).size(629L);
-        args.add(toObjectArray(parts));
-
-        parts = Parts.fullName("1355675588.5c7e107958851103.foohost,S=654:2,S").timeSeconds(1355675588)
-                .baseName("1355675588.5c7e107958851103.foohost").size(654L).flagSeen();
-        args.add(toObjectArray(parts));
-
-        parts = Parts.fullName("1355675651.f3dd564265174501.foohost,S=661:2,")
-                .baseName("1355675651.f3dd564265174501.foohost").timeSeconds(1355675651).size(661L);
-        args.add(toObjectArray(parts));
-
-        return args;
-    }
-    
-    private static Object[] toObjectArray(Parts validName) {
-        return new Object[] { validName };
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
+
+class MailderMailboxMessageNameTest {
+
+    private static Stream<Arguments> testParsing() {
+        return Stream.of(
+                // no size, two flags
+                Parts.fullName("1328026049.19146_0.km1111:2,RS").timeSeconds(1328026049)
+                    .baseName("1328026049.19146_0.km1111")
+                    .flagAnswered()
+                    .flagSeen(),
+                // size and flag
+                Parts.fullName("1328613172.M569643P1862V0000000000000902I00EE42CE_0.km1111,S=13103:2,S")
+                    .timeSeconds(1328613172)
+                    .size(13103L)
+                    .baseName("1328613172.M569643P1862V0000000000000902I00EE42CE_0.km1111")
+                    .flagSeen(),
+                // size, no flags
+                Parts.fullName("1340124194.M723289P3184V0000000000000902I006780E9_6.km1111,S=1344:2,")
+                    .baseName("1340124194.M723289P3184V0000000000000902I006780E9_6.km1111")
+                    .timeSeconds(1340124194)
+                    .size(1344L),
+                // three flags, no size
+                Parts.fullName("1106685752.12132_0.km1111:2,FRS")
+                    .baseName("1106685752.12132_0.km1111")
+                    .timeSeconds(1106685752)
+                    .flagFlagged()
+                    .flagAnswered()
+                    .flagSeen(),
+                // with dovecot attributes
+                Parts.fullName("1035478339.27041_118.foo.org,S=1000,W=1030:2,S")
+                    .baseName("1035478339.27041_118.foo.org")
+                    .timeSeconds(1035478339)
+                    .size(1000L)
+                    .flagSeen(),
+                Parts.fullName("1035478339.27041_118.foo.org,W=1030,S=1000:2,S")
+                    .baseName("1035478339.27041_118.foo.org")
+                    .timeSeconds(1035478339)
+                    .size(1000L)
+                    .flagSeen(),
+                // new mail, no info part at all. found in courier maildirs
+                Parts.fullName("1355543030.15049_0.foo.org")
+                    .baseName("1355543030.15049_0.foo.org")
+                    .timeSeconds(1355543030)
+                    .noFlags(),
+                // new mail, generated by james
+                Parts.fullName("1356001301.e563087e30181513.foohost,S=629:2,")
+                    .baseName("1356001301.e563087e30181513.foohost")
+                    .timeSeconds(1356001301)
+                    .size(629L),
+                Parts.fullName("1355675588.5c7e107958851103.foohost,S=654:2,S")
+                    .timeSeconds(1355675588)
+                    .baseName("1355675588.5c7e107958851103.foohost")
+                    .size(654L)
+                    .flagSeen(),
+                Parts.fullName("1355675651.f3dd564265174501.foohost,S=661:2,")
+                    .baseName("1355675651.f3dd564265174501.foohost")
+                    .timeSeconds(1355675651)
+                    .size(661L))
+            .map(Arguments::of);
     }
 
-    @Test
-    public void testParsing() throws Exception {
-        try {
-            parseValidName(validName, parts);
-        } catch (Throwable e) {
-            throw new Exception("Valid name '" + validName + "' failed.", e);
-        }
+    @ParameterizedTest
+    @MethodSource
+    void testParsing(Parts parts) {
+        parseValidName(parts);
     }
 
-    private void parseValidName(String name, Parts parts) throws Exception {
-        MaildirMessageName mn = new MaildirMessageName(null, name);
+    private void parseValidName(Parts parts) {
+        MaildirMessageName mn = new MaildirMessageName(null, parts.fullName);
         mn.setMessageNameStrictParse(false);
         if (parts.time == null) {
             assertThat(mn.getInternalDate()).describedAs("date").isNull();
@@ -147,11 +133,6 @@ public class MailderMailboxMessageNameTest {
             return this;
         }
 
-        public Parts flagRecent() {
-            this.flags.add(Flags.Flag.RECENT);
-            return this;
-        }
-
         public Parts flagAnswered() {
             this.flags.add(Flags.Flag.ANSWERED);
             return this;
@@ -162,16 +143,6 @@ public class MailderMailboxMessageNameTest {
             return this;
         }
 
-        public Parts flagDeleted() {
-            this.flags.add(Flags.Flag.DELETED);
-            return this;
-        }
-
-        public Parts flagDraft() {
-            this.flags.add(Flags.Flag.DRAFT);
-            return this;
-        }
-
         public Parts baseName(String baseName) {
             this.baseName = baseName;
             return this;


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


[james-project] 10/13: [Refactoring] Small access modifiers cleanup in test classes in mailbox-jpa module using JUnit 5

Posted by rc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 9223f56e8f44fdaf187ffd955e308664406478bd
Author: Rene Cordier <rc...@linagora.com>
AuthorDate: Tue Dec 10 16:11:12 2019 +0700

    [Refactoring] Small access modifiers cleanup in test classes in mailbox-jpa module using JUnit 5
---
 .../java/org/apache/james/mailbox/jpa/JPAMailboxManagerTest.java    | 6 +++---
 .../org/apache/james/mailbox/jpa/JPASubscriptionManagerTest.java    | 4 ++--
 .../org/apache/james/mailbox/jpa/JpaMailboxManagerStressTest.java   | 4 ++--
 .../java/org/apache/james/mailbox/jpa/mail/JPAMapperProvider.java   | 2 +-
 .../org/apache/james/mailbox/jpa/mail/JpaAnnotationMapperTest.java  | 4 ++--
 .../org/apache/james/mailbox/jpa/mail/JpaMailboxMapperTest.java     | 4 ++--
 .../org/apache/james/mailbox/jpa/mail/JpaMessageMapperTest.java     | 2 +-
 .../java/org/apache/james/mailbox/jpa/mail/JpaMessageMoveTest.java  | 2 +-
 .../apache/james/mailbox/jpa/quota/JPACurrentQuotaManagerTest.java  | 2 +-
 .../org/apache/james/mailbox/jpa/quota/JPAPerUserMaxQuotaTest.java  | 2 +-
 10 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/JPAMailboxManagerTest.java b/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/JPAMailboxManagerTest.java
index ea377f2..4b917d9 100644
--- a/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/JPAMailboxManagerTest.java
+++ b/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/JPAMailboxManagerTest.java
@@ -29,7 +29,7 @@ import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Nested;
 import org.junit.jupiter.api.Test;
 
-public class JPAMailboxManagerTest extends MailboxManagerTest<OpenJPAMailboxManager> {
+class JPAMailboxManagerTest extends MailboxManagerTest<OpenJPAMailboxManager> {
 
     @Disabled("JPAMailboxManager is using DefaultMessageId which doesn't support full feature of a messageId, which is an essential" +
         " element of the Vault")
@@ -37,8 +37,8 @@ public class JPAMailboxManagerTest extends MailboxManagerTest<OpenJPAMailboxMana
     class HookTests {
     }
 
-    private static final JpaTestCluster JPA_TEST_CLUSTER = JpaTestCluster.create(JPAMailboxFixture.MAILBOX_PERSISTANCE_CLASSES);
-    private Optional<OpenJPAMailboxManager> openJPAMailboxManager = Optional.empty();
+    static final JpaTestCluster JPA_TEST_CLUSTER = JpaTestCluster.create(JPAMailboxFixture.MAILBOX_PERSISTANCE_CLASSES);
+    Optional<OpenJPAMailboxManager> openJPAMailboxManager = Optional.empty();
     
     @Override
     protected OpenJPAMailboxManager provideMailboxManager() {
diff --git a/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/JPASubscriptionManagerTest.java b/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/JPASubscriptionManagerTest.java
index cda60c3..41bfd71 100644
--- a/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/JPASubscriptionManagerTest.java
+++ b/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/JPASubscriptionManagerTest.java
@@ -31,9 +31,9 @@ import org.junit.jupiter.api.BeforeEach;
 
 class JPASubscriptionManagerTest implements SubscriptionManagerContract {
 
-    private static final JpaTestCluster JPA_TEST_CLUSTER = JpaTestCluster.create(JPAMailboxFixture.MAILBOX_PERSISTANCE_CLASSES);
+    static final JpaTestCluster JPA_TEST_CLUSTER = JpaTestCluster.create(JPAMailboxFixture.MAILBOX_PERSISTANCE_CLASSES);
 
-    private SubscriptionManager subscriptionManager;
+    SubscriptionManager subscriptionManager;
 
     @Override
     public SubscriptionManager getSubscriptionManager() {
diff --git a/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/JpaMailboxManagerStressTest.java b/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/JpaMailboxManagerStressTest.java
index da90cfb..520c195 100644
--- a/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/JpaMailboxManagerStressTest.java
+++ b/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/JpaMailboxManagerStressTest.java
@@ -30,8 +30,8 @@ import org.junit.jupiter.api.BeforeEach;
 
 class JpaMailboxManagerStressTest implements MailboxManagerStressContract<OpenJPAMailboxManager> {
 
-    private static final JpaTestCluster JPA_TEST_CLUSTER = JpaTestCluster.create(JPAMailboxFixture.MAILBOX_PERSISTANCE_CLASSES);
-    private Optional<OpenJPAMailboxManager> openJPAMailboxManager = Optional.empty();
+    static final JpaTestCluster JPA_TEST_CLUSTER = JpaTestCluster.create(JPAMailboxFixture.MAILBOX_PERSISTANCE_CLASSES);
+    Optional<OpenJPAMailboxManager> openJPAMailboxManager = Optional.empty();
 
     @Override
     public OpenJPAMailboxManager getManager() {
diff --git a/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/mail/JPAMapperProvider.java b/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/mail/JPAMapperProvider.java
index 7fe350a..c8eb976 100644
--- a/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/mail/JPAMapperProvider.java
+++ b/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/mail/JPAMapperProvider.java
@@ -51,7 +51,7 @@ public class JPAMapperProvider implements MapperProvider {
     }
 
     @Override
-    public MailboxMapper createMailboxMapper() throws MailboxException {
+    public MailboxMapper createMailboxMapper() {
         return new TransactionalMailboxMapper(new JPAMailboxMapper(jpaTestCluster.getEntityManagerFactory()));
     }
 
diff --git a/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/mail/JpaAnnotationMapperTest.java b/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/mail/JpaAnnotationMapperTest.java
index 641e298..d2826ff 100644
--- a/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/mail/JpaAnnotationMapperTest.java
+++ b/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/mail/JpaAnnotationMapperTest.java
@@ -31,9 +31,9 @@ import org.junit.jupiter.api.AfterEach;
 
 class JpaAnnotationMapperTest extends AnnotationMapperTest {
 
-    public static final JpaTestCluster JPA_TEST_CLUSTER = JpaTestCluster.create(JPAMailboxFixture.MAILBOX_PERSISTANCE_CLASSES);
+    static final JpaTestCluster JPA_TEST_CLUSTER = JpaTestCluster.create(JPAMailboxFixture.MAILBOX_PERSISTANCE_CLASSES);
 
-    private final AtomicInteger counter = new AtomicInteger();
+    final AtomicInteger counter = new AtomicInteger();
 
     @AfterEach
     void tearDown() {
diff --git a/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/mail/JpaMailboxMapperTest.java b/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/mail/JpaMailboxMapperTest.java
index c9fe5be..a697b87 100644
--- a/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/mail/JpaMailboxMapperTest.java
+++ b/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/mail/JpaMailboxMapperTest.java
@@ -31,9 +31,9 @@ import org.junit.jupiter.api.AfterEach;
 
 class JpaMailboxMapperTest extends MailboxMapperTest {
 
-    public static final JpaTestCluster JPA_TEST_CLUSTER = JpaTestCluster.create(JPAMailboxFixture.MAILBOX_PERSISTANCE_CLASSES);
+    static final JpaTestCluster JPA_TEST_CLUSTER = JpaTestCluster.create(JPAMailboxFixture.MAILBOX_PERSISTANCE_CLASSES);
 
-    private final AtomicInteger counter = new AtomicInteger();
+    final AtomicInteger counter = new AtomicInteger();
 
     @Override
     protected MailboxMapper createMailboxMapper() {
diff --git a/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/mail/JpaMessageMapperTest.java b/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/mail/JpaMessageMapperTest.java
index 5ebe877..87cb269 100644
--- a/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/mail/JpaMessageMapperTest.java
+++ b/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/mail/JpaMessageMapperTest.java
@@ -27,7 +27,7 @@ import org.junit.jupiter.api.AfterEach;
 
 class JpaMessageMapperTest extends MessageMapperTest {
 
-    public static final JpaTestCluster JPA_TEST_CLUSTER = JpaTestCluster.create(JPAMailboxFixture.MAILBOX_PERSISTANCE_CLASSES);
+    static final JpaTestCluster JPA_TEST_CLUSTER = JpaTestCluster.create(JPAMailboxFixture.MAILBOX_PERSISTANCE_CLASSES);
     
     @Override
     protected MapperProvider createMapperProvider() {
diff --git a/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/mail/JpaMessageMoveTest.java b/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/mail/JpaMessageMoveTest.java
index 1940cb3..de8a1d3 100644
--- a/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/mail/JpaMessageMoveTest.java
+++ b/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/mail/JpaMessageMoveTest.java
@@ -27,7 +27,7 @@ import org.junit.jupiter.api.AfterEach;
 
 class JpaMessageMoveTest extends MessageMoveTest {
     
-    public static final JpaTestCluster JPA_TEST_CLUSTER = JpaTestCluster.create(JPAMailboxFixture.MAILBOX_PERSISTANCE_CLASSES);
+    static final JpaTestCluster JPA_TEST_CLUSTER = JpaTestCluster.create(JPAMailboxFixture.MAILBOX_PERSISTANCE_CLASSES);
 
     @Override
     protected MapperProvider createMapperProvider() {
diff --git a/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/quota/JPACurrentQuotaManagerTest.java b/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/quota/JPACurrentQuotaManagerTest.java
index 885a63f..dbcebc1 100644
--- a/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/quota/JPACurrentQuotaManagerTest.java
+++ b/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/quota/JPACurrentQuotaManagerTest.java
@@ -27,7 +27,7 @@ import org.junit.jupiter.api.AfterEach;
 
 class JPACurrentQuotaManagerTest extends StoreCurrentQuotaManagerTest {
 
-    private static final JpaTestCluster JPA_TEST_CLUSTER = JpaTestCluster.create(JPAMailboxFixture.QUOTA_PERSISTANCE_CLASSES);
+    static final JpaTestCluster JPA_TEST_CLUSTER = JpaTestCluster.create(JPAMailboxFixture.QUOTA_PERSISTANCE_CLASSES);
 
     @Override
     protected StoreCurrentQuotaManager provideTestee() {
diff --git a/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/quota/JPAPerUserMaxQuotaTest.java b/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/quota/JPAPerUserMaxQuotaTest.java
index b557d95..6c5df68 100644
--- a/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/quota/JPAPerUserMaxQuotaTest.java
+++ b/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/quota/JPAPerUserMaxQuotaTest.java
@@ -27,7 +27,7 @@ import org.junit.jupiter.api.AfterEach;
 
 class JPAPerUserMaxQuotaTest extends GenericMaxQuotaManagerTest {
 
-    private static final JpaTestCluster JPA_TEST_CLUSTER = JpaTestCluster.create(JPAMailboxFixture.QUOTA_PERSISTANCE_CLASSES);
+    static final JpaTestCluster JPA_TEST_CLUSTER = JpaTestCluster.create(JPAMailboxFixture.QUOTA_PERSISTANCE_CLASSES);
 
     @Override
     protected MaxQuotaManager provideMaxQuotaManager() {


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


[james-project] 07/13: [Refactoring] Move JPAMailboxMessageTest to JUnit 5

Posted by rc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 6050a4f4743845521ebda0a86eee0b2ad3acd9f5
Author: Rene Cordier <rc...@linagora.com>
AuthorDate: Tue Dec 10 16:00:17 2019 +0700

    [Refactoring] Move JPAMailboxMessageTest to JUnit 5
---
 .../james/mailbox/jpa/mail/model/openjpa/JPAMailboxMessageTest.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/mail/model/openjpa/JPAMailboxMessageTest.java b/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/mail/model/openjpa/JPAMailboxMessageTest.java
index 3c598c7..be0f6c5 100644
--- a/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/mail/model/openjpa/JPAMailboxMessageTest.java
+++ b/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/mail/model/openjpa/JPAMailboxMessageTest.java
@@ -23,15 +23,15 @@ import static org.assertj.core.api.Assertions.assertThat;
 import java.nio.charset.StandardCharsets;
 
 import org.apache.commons.io.IOUtils;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-public class JPAMailboxMessageTest {
+class JPAMailboxMessageTest {
 
     /**
      * Even though there should never be a null body, it does happen. See JAMES-2384
      */
     @Test
-    public void getFullContentShouldReturnOriginalContentWhenBodyFieldIsNull() throws Exception {
+    void getFullContentShouldReturnOriginalContentWhenBodyFieldIsNull() throws Exception {
 
         // Prepare the message
         byte[] content = "Subject: the null message".getBytes(StandardCharsets.UTF_8);


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


[james-project] 06/13: [Refactoring] Move test classes in mailbox-lucene to JUnit 5

Posted by rc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 5e2a49f12da5b4f722bac0ea69560a4f7b530496
Author: Rene Cordier <rc...@linagora.com>
AuthorDate: Tue Dec 10 16:34:00 2019 +0700

    [Refactoring] Move test classes in mailbox-lucene to JUnit 5
---
 .../LuceneMailboxMessageSearchIndexTest.java       | 170 ++++++++++-----------
 .../search/StrictLuceneMessageSearchIndexText.java |  56 +++----
 2 files changed, 112 insertions(+), 114 deletions(-)

diff --git a/mailbox/lucene/src/test/java/org/apache/james/mailbox/lucene/search/LuceneMailboxMessageSearchIndexTest.java b/mailbox/lucene/src/test/java/org/apache/james/mailbox/lucene/search/LuceneMailboxMessageSearchIndexTest.java
index 3156f23..24fcd4c 100644
--- a/mailbox/lucene/src/test/java/org/apache/james/mailbox/lucene/search/LuceneMailboxMessageSearchIndexTest.java
+++ b/mailbox/lucene/src/test/java/org/apache/james/mailbox/lucene/search/LuceneMailboxMessageSearchIndexTest.java
@@ -49,53 +49,53 @@ import org.apache.james.mailbox.model.TestId;
 import org.apache.james.mailbox.model.TestMessageId;
 import org.apache.james.mailbox.store.MessageBuilder;
 import org.apache.lucene.store.RAMDirectory;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 import com.google.common.collect.ImmutableList;
 
-public class LuceneMailboxMessageSearchIndexTest {
-    private static final long LIMIT = 100L;
-    private static final TestId TEST_ID_1 = TestId.of(0);
-    private static final TestId TEST_ID_2 = TestId.of(1);
-    private static final TestId TEST_ID_3 = TestId.of(2);
+class LuceneMailboxMessageSearchIndexTest {
+    static final long LIMIT = 100L;
+    static final TestId TEST_ID_1 = TestId.of(0);
+    static final TestId TEST_ID_2 = TestId.of(1);
+    static final TestId TEST_ID_3 = TestId.of(2);
 
-    private static final Username BOB = Username.of("bob");
-    private Mailbox mailbox = new Mailbox(MailboxPath.forUser(BOB, "box"), 18, TEST_ID_1);
-    private Mailbox mailbox2 = new Mailbox(MailboxPath.forUser(BOB, "box"), 19, TEST_ID_2);
-    private Mailbox mailbox3 = new Mailbox(MailboxPath.forUser(BOB, "box"), 12, TEST_ID_3);
-    private LuceneMessageSearchIndex index;
-    private MailboxSession session;
+    static final Username BOB = Username.of("bob");
+    Mailbox mailbox = new Mailbox(MailboxPath.forUser(BOB, "box"), 18, TEST_ID_1);
+    Mailbox mailbox2 = new Mailbox(MailboxPath.forUser(BOB, "box"), 19, TEST_ID_2);
+    Mailbox mailbox3 = new Mailbox(MailboxPath.forUser(BOB, "box"), 12, TEST_ID_3);
+    LuceneMessageSearchIndex index;
+    MailboxSession session;
 
-    private static final String FROM_ADDRESS = "Harry <ha...@example.org>";
+    static final String FROM_ADDRESS = "Harry <ha...@example.org>";
 
-    private static final String SUBJECT_PART = "Mixed";
+    static final String SUBJECT_PART = "Mixed";
 
-    private static final String CUSTARD = "CUSTARD";
+    static final String CUSTARD = "CUSTARD";
 
-    private static final String RHUBARD = "Rhubard";
+    static final String RHUBARD = "Rhubard";
 
-    private static final String BODY = "This is a simple email\r\n "
+    static final String BODY = "This is a simple email\r\n "
             + "It has " + RHUBARD + ".\r\n" + "It has " + CUSTARD + ".\r\n"
             + "It needs naught else.\r\n";
 
-    private MessageUid uid1;
-    private MessageUid uid2;
-    private MessageUid uid3;
-    private MessageUid uid4;
-    private MessageUid uid5;
-    private MessageId id1;
-    private MessageId id2;
-    private MessageId id3;
-    private MessageId id4;
-    private MessageId id5;
+    MessageUid uid1;
+    MessageUid uid2;
+    MessageUid uid3;
+    MessageUid uid4;
+    MessageUid uid5;
+    MessageId id1;
+    MessageId id2;
+    MessageId id3;
+    MessageId id4;
+    MessageId id5;
 
     protected boolean useLenient() {
         return true;
     }
     
-    @Before
-    public void setUp() throws Exception {
+    @BeforeEach
+    void setUp() throws Exception {
         session = MailboxSessionUtil.create(Username.of("username"));
         TestMessageId.Factory factory = new TestMessageId.Factory();
         id1 = factory.generate();
@@ -183,11 +183,9 @@ public class LuceneMailboxMessageSearchIndexTest {
         index.add(session, mailbox3, builder.build(id5));
 
     }
-    
-
 
     @Test
-    public void bodySearchShouldMatchPhraseInBody() throws Exception {
+    void bodySearchShouldMatchPhraseInBody() throws Exception {
         SearchQuery query = new SearchQuery();
         query.andCriteria(SearchQuery.bodyContains(CUSTARD));
         Stream<MessageUid> result = index.search(session, mailbox3, query);
@@ -195,7 +193,7 @@ public class LuceneMailboxMessageSearchIndexTest {
     }
 
     @Test
-    public void bodySearchShouldNotMatchAbsentPhraseInBody() throws Exception {
+    void bodySearchShouldNotMatchAbsentPhraseInBody() throws Exception {
         SearchQuery query = new SearchQuery();
         query.andCriteria(SearchQuery.bodyContains(CUSTARD + CUSTARD));
         Stream<MessageUid> result = index.search(session, mailbox3, query);
@@ -203,7 +201,7 @@ public class LuceneMailboxMessageSearchIndexTest {
     }
     
     @Test
-    public void bodySearchShouldBeCaseInsensitive() throws Exception {
+    void bodySearchShouldBeCaseInsensitive() throws Exception {
         SearchQuery query = new SearchQuery();
         query.andCriteria(SearchQuery.bodyContains(RHUBARD));
         Stream<MessageUid> result = index.search(session, mailbox3, query);
@@ -211,7 +209,7 @@ public class LuceneMailboxMessageSearchIndexTest {
     }
 
     @Test
-    public void bodySearchNotMatchPhraseOnlyInFrom() throws Exception {
+    void bodySearchNotMatchPhraseOnlyInFrom() throws Exception {
         SearchQuery query = new SearchQuery();
         query.andCriteria(SearchQuery.bodyContains(FROM_ADDRESS));
         Stream<MessageUid> result = index.search(session, mailbox3, query);
@@ -219,7 +217,7 @@ public class LuceneMailboxMessageSearchIndexTest {
     }
 
     @Test
-    public void bodySearchShouldNotMatchPhraseOnlyInSubject() throws Exception {
+    void bodySearchShouldNotMatchPhraseOnlyInSubject() throws Exception {
         SearchQuery query = new SearchQuery();
         query.andCriteria(SearchQuery.bodyContains(SUBJECT_PART));
         Stream<MessageUid> result = index.search(session, mailbox3, query);
@@ -227,7 +225,7 @@ public class LuceneMailboxMessageSearchIndexTest {
     }
 
     @Test
-    public void textSearchShouldMatchPhraseInBody() throws Exception {
+    void textSearchShouldMatchPhraseInBody() throws Exception {
         SearchQuery query = new SearchQuery();
         query.andCriteria(SearchQuery.mailContains(CUSTARD));
         Stream<MessageUid> result = index.search(session, mailbox3, query);
@@ -235,7 +233,7 @@ public class LuceneMailboxMessageSearchIndexTest {
     }
 
     @Test
-    public void textSearchShouldNotAbsentMatchPhraseInBody() throws Exception {
+    void textSearchShouldNotAbsentMatchPhraseInBody() throws Exception {
         SearchQuery query = new SearchQuery();
         query.andCriteria(SearchQuery.mailContains(CUSTARD + CUSTARD));
         Stream<MessageUid> result = index.search(session, mailbox3, query);
@@ -243,7 +241,7 @@ public class LuceneMailboxMessageSearchIndexTest {
     }
 
     @Test
-    public void textSearchMatchShouldBeCaseInsensitive() throws Exception {
+    void textSearchMatchShouldBeCaseInsensitive() throws Exception {
         SearchQuery query = new SearchQuery();
         query.andCriteria(SearchQuery.mailContains(RHUBARD.toLowerCase(Locale.US)));
         Stream<MessageUid> result = index.search(session, mailbox3, query);
@@ -251,7 +249,7 @@ public class LuceneMailboxMessageSearchIndexTest {
     }
 
     @Test
-    public void addressSearchShouldMatchToFullAddress() throws Exception {
+    void addressSearchShouldMatchToFullAddress() throws Exception {
         SearchQuery query = new SearchQuery();
         query.andCriteria(SearchQuery.address(AddressType.To,FROM_ADDRESS));
         Stream<MessageUid> result = index.search(session, mailbox3, query);
@@ -259,7 +257,7 @@ public class LuceneMailboxMessageSearchIndexTest {
     }
 
     @Test
-    public void addressSearchShouldMatchToDisplayName() throws Exception {
+    void addressSearchShouldMatchToDisplayName() throws Exception {
         SearchQuery query = new SearchQuery();
         query.andCriteria(SearchQuery.address(AddressType.To,"Harry"));
         Stream<MessageUid> result = index.search(session, mailbox3, query);
@@ -267,7 +265,7 @@ public class LuceneMailboxMessageSearchIndexTest {
     }
     
     @Test
-    public void addressSearchShouldMatchToEmail() throws Exception {
+    void addressSearchShouldMatchToEmail() throws Exception {
         SearchQuery query = new SearchQuery();
         query.andCriteria(SearchQuery.address(AddressType.To,"Harry@example.org"));
         Stream<MessageUid> result = index.search(session, mailbox3, query);
@@ -275,7 +273,7 @@ public class LuceneMailboxMessageSearchIndexTest {
     }
     
     @Test
-    public void addressSearchShouldMatchFrom() throws Exception {
+    void addressSearchShouldMatchFrom() throws Exception {
         SearchQuery query = new SearchQuery();
         query.andCriteria(SearchQuery.address(AddressType.From,"ser-from@domain.or"));
         Stream<MessageUid> result = index.search(session, mailbox3, query);
@@ -283,7 +281,7 @@ public class LuceneMailboxMessageSearchIndexTest {
     }
 
     @Test
-    public void textSearchShouldMatchPhraseOnlyInToHeader() throws Exception {
+    void textSearchShouldMatchPhraseOnlyInToHeader() throws Exception {
         SearchQuery query = new SearchQuery();
         query.andCriteria(SearchQuery.mailContains(FROM_ADDRESS));
         Stream<MessageUid> result = index.search(session, mailbox3, query);
@@ -291,7 +289,7 @@ public class LuceneMailboxMessageSearchIndexTest {
     }
     
     @Test
-    public void textSearchShouldMatchPhraseOnlyInSubjectHeader() throws Exception {
+    void textSearchShouldMatchPhraseOnlyInSubjectHeader() throws Exception {
         SearchQuery query = new SearchQuery();
         query.andCriteria(SearchQuery.mailContains(SUBJECT_PART));
         Stream<MessageUid> result = index.search(session, mailbox3, query);
@@ -299,7 +297,7 @@ public class LuceneMailboxMessageSearchIndexTest {
     }
     
     @Test
-    public void searchAllShouldMatchAllMailboxEmails() throws Exception {
+    void searchAllShouldMatchAllMailboxEmails() throws Exception {
         SearchQuery query = new SearchQuery();
         query.andCriteria(SearchQuery.all());
         Stream<MessageUid> result = index.search(session, mailbox2, query);
@@ -307,7 +305,7 @@ public class LuceneMailboxMessageSearchIndexTest {
     }
 
     @Test
-    public void searchBodyInAllMailboxesShouldMatch() throws Exception {
+    void searchBodyInAllMailboxesShouldMatch() throws Exception {
         SearchQuery query = new SearchQuery();
         query.andCriteria(SearchQuery.bodyContains("My Body"));
 
@@ -317,7 +315,7 @@ public class LuceneMailboxMessageSearchIndexTest {
     }
 
     @Test
-    public void searchBodyInSpecificMailboxesShouldMatch() throws Exception {
+    void searchBodyInSpecificMailboxesShouldMatch() throws Exception {
         SearchQuery query = new SearchQuery();
         query.andCriteria(SearchQuery.bodyContains("My Body"));
 
@@ -330,7 +328,7 @@ public class LuceneMailboxMessageSearchIndexTest {
     }
 
     @Test
-    public void searchAllShouldMatchAllUserEmails() throws Exception {
+    void searchAllShouldMatchAllUserEmails() throws Exception {
         SearchQuery query = new SearchQuery();
         query.andCriteria(SearchQuery.all());
 
@@ -341,7 +339,7 @@ public class LuceneMailboxMessageSearchIndexTest {
     }
 
     @Test
-    public void searchAllShouldLimitTheSize() throws Exception {
+    void searchAllShouldLimitTheSize() throws Exception {
         SearchQuery query = new SearchQuery();
         query.andCriteria(SearchQuery.all());
 
@@ -352,7 +350,7 @@ public class LuceneMailboxMessageSearchIndexTest {
     }
     
     @Test
-    public void flagSearchShouldMatch() throws Exception {
+    void flagSearchShouldMatch() throws Exception {
         SearchQuery query = new SearchQuery();
         query.andCriteria(SearchQuery.flagIsSet(Flag.DELETED));
         Stream<MessageUid> result = index.search(session, mailbox, query);
@@ -360,7 +358,7 @@ public class LuceneMailboxMessageSearchIndexTest {
     }
     
     @Test
-    public void bodySearchShouldMatchSeveralEmails() throws Exception {    
+    void bodySearchShouldMatchSeveralEmails() throws Exception {    
         SearchQuery query = new SearchQuery();
         query.andCriteria(SearchQuery.bodyContains("body"));
         Stream<MessageUid> result = index.search(session, mailbox, query);
@@ -368,7 +366,7 @@ public class LuceneMailboxMessageSearchIndexTest {
     }
     
     @Test
-    public void textSearchShouldMatchSeveralEmails() throws Exception {    
+    void textSearchShouldMatchSeveralEmails() throws Exception {    
         SearchQuery query = new SearchQuery();
         query.andCriteria(SearchQuery.mailContains("body"));
         Stream<MessageUid> result = index.search(session, mailbox, query);
@@ -376,7 +374,7 @@ public class LuceneMailboxMessageSearchIndexTest {
     }
     
     @Test
-    public void headerSearchShouldMatch() throws Exception {
+    void headerSearchShouldMatch() throws Exception {
         SearchQuery query = new SearchQuery();
         query.andCriteria(SearchQuery.headerContains("Subject", "test"));
         Stream<MessageUid> result = index.search(session, mailbox, query);
@@ -384,7 +382,7 @@ public class LuceneMailboxMessageSearchIndexTest {
     }
     
     @Test
-    public void headerExistsShouldMatch() throws Exception {
+    void headerExistsShouldMatch() throws Exception {
         SearchQuery query = new SearchQuery();
         query.andCriteria(SearchQuery.headerExists("Subject"));
         Stream<MessageUid> result = index.search(session, mailbox, query);
@@ -392,7 +390,7 @@ public class LuceneMailboxMessageSearchIndexTest {
     }
     
     @Test
-    public void flagUnsetShouldMatch() throws Exception {
+    void flagUnsetShouldMatch() throws Exception {
         SearchQuery query = new SearchQuery();
         query.andCriteria(SearchQuery.flagIsUnSet(Flag.DRAFT));
         Stream<MessageUid> result = index.search(session, mailbox, query);
@@ -400,7 +398,7 @@ public class LuceneMailboxMessageSearchIndexTest {
     }
     
     @Test
-    public void internalDateBeforeShouldMatch() throws Exception {
+    void internalDateBeforeShouldMatch() throws Exception {
         SearchQuery query = new SearchQuery();
         Calendar cal = Calendar.getInstance();
         cal.setTime(new Date());
@@ -412,7 +410,7 @@ public class LuceneMailboxMessageSearchIndexTest {
     
     
     @Test
-    public void internalDateAfterShouldMatch() throws Exception {
+    void internalDateAfterShouldMatch() throws Exception {
         SearchQuery query = new SearchQuery();
         Calendar cal = Calendar.getInstance();
         cal.setTime(new Date());
@@ -424,7 +422,7 @@ public class LuceneMailboxMessageSearchIndexTest {
     
     
     @Test
-    public void internalDateOnShouldMatch() throws Exception {
+    void internalDateOnShouldMatch() throws Exception {
         SearchQuery query = new SearchQuery();
         Calendar cal = Calendar.getInstance();
         cal.setTime(new Date());
@@ -434,7 +432,7 @@ public class LuceneMailboxMessageSearchIndexTest {
     }
     
     @Test
-    public void uidSearchShouldMatch() throws Exception {
+    void uidSearchShouldMatch() throws Exception {
         SearchQuery query = new SearchQuery();
         Calendar cal = Calendar.getInstance();
         cal.setTime(new Date());
@@ -444,7 +442,7 @@ public class LuceneMailboxMessageSearchIndexTest {
     }
     
     @Test
-    public void uidRangeSearchShouldMatch() throws Exception {
+    void uidRangeSearchShouldMatch() throws Exception {
         SearchQuery query = new SearchQuery();
         Calendar cal = Calendar.getInstance();
         cal.setTime(new Date());
@@ -454,7 +452,7 @@ public class LuceneMailboxMessageSearchIndexTest {
     }
     
     @Test
-    public void sizeEqualsShouldMatch() throws Exception {
+    void sizeEqualsShouldMatch() throws Exception {
         SearchQuery query = new SearchQuery();
         query.andCriteria(SearchQuery.sizeEquals(200));
         Stream<MessageUid> result = index.search(session, mailbox, query);
@@ -462,7 +460,7 @@ public class LuceneMailboxMessageSearchIndexTest {
     }
     
     @Test
-    public void sizeLessThanShouldMatch() throws Exception {
+    void sizeLessThanShouldMatch() throws Exception {
         SearchQuery query = new SearchQuery();
         query.andCriteria(SearchQuery.sizeLessThan(200));
         Stream<MessageUid> result = index.search(session, mailbox, query);
@@ -470,7 +468,7 @@ public class LuceneMailboxMessageSearchIndexTest {
     }
     
     @Test
-    public void sizeGreaterThanShouldMatch() throws Exception {
+    void sizeGreaterThanShouldMatch() throws Exception {
         SearchQuery query = new SearchQuery();
         query.andCriteria(SearchQuery.sizeGreaterThan(6));
         Stream<MessageUid> result = index.search(session, mailbox, query);
@@ -478,7 +476,7 @@ public class LuceneMailboxMessageSearchIndexTest {
     }
     
     @Test
-    public void uidShouldBeSorted() throws Exception {
+    void uidShouldBeSorted() throws Exception {
         SearchQuery query = new SearchQuery();
         query.andCriteria(SearchQuery.all());
         Stream<MessageUid> result = index.search(session, mailbox, query);
@@ -486,7 +484,7 @@ public class LuceneMailboxMessageSearchIndexTest {
     }
     
     @Test
-    public void uidReverseSortShouldReturnWellOrderedResults() throws Exception {
+    void uidReverseSortShouldReturnWellOrderedResults() throws Exception {
         SearchQuery query = new SearchQuery(SearchQuery.all());
         query.setSorts(ImmutableList.of(new Sort(SortClause.Uid, Order.REVERSE)));
 
@@ -495,7 +493,7 @@ public class LuceneMailboxMessageSearchIndexTest {
     }
     
     @Test
-    public void sortOnSentDateShouldReturnWellOrderedResults() throws Exception {
+    void sortOnSentDateShouldReturnWellOrderedResults() throws Exception {
         SearchQuery query = new SearchQuery(SearchQuery.all());
         query.setSorts(ImmutableList.of(new Sort(SortClause.SentDate, Order.NATURAL)));
 
@@ -504,7 +502,7 @@ public class LuceneMailboxMessageSearchIndexTest {
     }
     
     @Test
-    public void reverseSortOnSentDateShouldReturnWellOrderedResults() throws Exception {
+    void reverseSortOnSentDateShouldReturnWellOrderedResults() throws Exception {
         SearchQuery query = new SearchQuery(SearchQuery.all());
         query.setSorts(ImmutableList.of(new Sort(SortClause.SentDate, Order.REVERSE)));
 
@@ -513,7 +511,7 @@ public class LuceneMailboxMessageSearchIndexTest {
     }
 
     @Test
-    public void sortOnSubjectShouldReturnWellOrderedResults() throws Exception {
+    void sortOnSubjectShouldReturnWellOrderedResults() throws Exception {
         SearchQuery query = new SearchQuery(SearchQuery.all());
         query.setSorts(ImmutableList.of(new Sort(SortClause.BaseSubject, Order.NATURAL)));
 
@@ -522,7 +520,7 @@ public class LuceneMailboxMessageSearchIndexTest {
     }
     
     @Test
-    public void reverseSortOnSubjectShouldReturnWellOrderedResults() throws Exception {
+    void reverseSortOnSubjectShouldReturnWellOrderedResults() throws Exception {
         SearchQuery query = new SearchQuery(SearchQuery.all());
         query.setSorts(ImmutableList.of(new Sort(SortClause.BaseSubject, Order.REVERSE)));
 
@@ -531,7 +529,7 @@ public class LuceneMailboxMessageSearchIndexTest {
     }
     
     @Test
-    public void sortOnMailboxFromShouldReturnWellOrderedResults() throws Exception {
+    void sortOnMailboxFromShouldReturnWellOrderedResults() throws Exception {
         SearchQuery query = new SearchQuery(SearchQuery.all());
         query.setSorts(ImmutableList.of(new Sort(SortClause.MailboxFrom, Order.NATURAL)));
 
@@ -540,7 +538,7 @@ public class LuceneMailboxMessageSearchIndexTest {
     }
     
     @Test
-    public void reverseSortOnMailboxFromShouldReturnWellOrderedResults() throws Exception {
+    void reverseSortOnMailboxFromShouldReturnWellOrderedResults() throws Exception {
         SearchQuery query = new SearchQuery(SearchQuery.all());
         query.setSorts(ImmutableList.of(new Sort(SortClause.MailboxFrom, Order.REVERSE)));
 
@@ -549,7 +547,7 @@ public class LuceneMailboxMessageSearchIndexTest {
     }
     
     @Test
-    public void sortOnMailboxCCShouldReturnWellOrderedResults() throws Exception {
+    void sortOnMailboxCCShouldReturnWellOrderedResults() throws Exception {
         SearchQuery query = new SearchQuery(SearchQuery.all());
         query.setSorts(ImmutableList.of(new Sort(SortClause.MailboxCc, Order.NATURAL)));
 
@@ -558,7 +556,7 @@ public class LuceneMailboxMessageSearchIndexTest {
     }
     
     @Test
-    public void reverseSortOnMailboxCCShouldReturnWellOrderedResults() throws Exception {
+    void reverseSortOnMailboxCCShouldReturnWellOrderedResults() throws Exception {
         SearchQuery query = new SearchQuery(SearchQuery.all());
         query.setSorts(ImmutableList.of(new Sort(SortClause.MailboxCc, Order.REVERSE)));
 
@@ -567,7 +565,7 @@ public class LuceneMailboxMessageSearchIndexTest {
     }
     
     @Test
-    public void sortOnMailboxToShouldReturnWellOrderedResults() throws Exception {
+    void sortOnMailboxToShouldReturnWellOrderedResults() throws Exception {
         SearchQuery query = new SearchQuery(SearchQuery.all());
         query.setSorts(ImmutableList.of(new Sort(SortClause.MailboxTo, Order.NATURAL)));
 
@@ -576,7 +574,7 @@ public class LuceneMailboxMessageSearchIndexTest {
     }
     
     @Test
-    public void reverseSortOnMailboxToShouldReturnWellOrderedResults() throws Exception {
+    void reverseSortOnMailboxToShouldReturnWellOrderedResults() throws Exception {
         SearchQuery query = new SearchQuery(SearchQuery.all());
         query.setSorts(ImmutableList.of(new Sort(SortClause.MailboxTo, Order.REVERSE)));
 
@@ -585,7 +583,7 @@ public class LuceneMailboxMessageSearchIndexTest {
     }
     
     @Test
-    public void sortOnDisplayToShouldReturnWellOrderedResults() throws Exception {
+    void sortOnDisplayToShouldReturnWellOrderedResults() throws Exception {
         SearchQuery query = new SearchQuery(SearchQuery.all());
         query.setSorts(ImmutableList.of(new Sort(SortClause.DisplayTo, Order.NATURAL)));
 
@@ -594,7 +592,7 @@ public class LuceneMailboxMessageSearchIndexTest {
     }
     
     @Test
-    public void reverseSortOnDisplayToShouldReturnWellOrderedResults() throws Exception {
+    void reverseSortOnDisplayToShouldReturnWellOrderedResults() throws Exception {
         SearchQuery query = new SearchQuery(SearchQuery.all());
         query.setSorts(ImmutableList.of(new Sort(SortClause.DisplayTo, Order.REVERSE)));
 
@@ -603,7 +601,7 @@ public class LuceneMailboxMessageSearchIndexTest {
     }
     
     @Test
-    public void sortOnDisplayFromShouldReturnWellOrderedResults() throws Exception {
+    void sortOnDisplayFromShouldReturnWellOrderedResults() throws Exception {
         SearchQuery query = new SearchQuery(SearchQuery.all());
         query.setSorts(ImmutableList.of(new Sort(SortClause.DisplayFrom, Order.NATURAL)));
 
@@ -612,7 +610,7 @@ public class LuceneMailboxMessageSearchIndexTest {
     }
     
     @Test
-    public void reverseSortOnDisplayFromShouldReturnWellOrderedResults() throws Exception {
+    void reverseSortOnDisplayFromShouldReturnWellOrderedResults() throws Exception {
         SearchQuery query = new SearchQuery(SearchQuery.all());
         query.setSorts(ImmutableList.of(new Sort(SortClause.DisplayFrom, Order.REVERSE)));
 
@@ -621,7 +619,7 @@ public class LuceneMailboxMessageSearchIndexTest {
     }
     
     @Test
-    public void sortOnArrivalDateShouldReturnWellOrderedResults() throws Exception {
+    void sortOnArrivalDateShouldReturnWellOrderedResults() throws Exception {
         SearchQuery query = new SearchQuery(SearchQuery.all());
         query.setSorts(ImmutableList.of(new Sort(SortClause.Arrival, Order.NATURAL)));
 
@@ -630,7 +628,7 @@ public class LuceneMailboxMessageSearchIndexTest {
     }
     
     @Test
-    public void reverseSortOnArrivalDateShouldReturnWellOrderedResults() throws Exception {
+    void reverseSortOnArrivalDateShouldReturnWellOrderedResults() throws Exception {
         SearchQuery query = new SearchQuery(SearchQuery.all());
         query.setSorts(ImmutableList.of(new Sort(SortClause.Arrival, Order.REVERSE)));
 
@@ -639,7 +637,7 @@ public class LuceneMailboxMessageSearchIndexTest {
     }
     
     @Test
-    public void sortOnSizeShouldReturnWellOrderedResults() throws Exception {
+    void sortOnSizeShouldReturnWellOrderedResults() throws Exception {
         SearchQuery query = new SearchQuery(SearchQuery.all());
         query.setSorts(ImmutableList.of(new Sort(SortClause.Size, Order.NATURAL)));
 
@@ -648,7 +646,7 @@ public class LuceneMailboxMessageSearchIndexTest {
     }
     
     @Test
-    public void reverseSortOnSizeShouldReturnWellOrderedResults() throws Exception {
+    void reverseSortOnSizeShouldReturnWellOrderedResults() throws Exception {
         SearchQuery query = new SearchQuery(SearchQuery.all());
         query.setSorts(ImmutableList.of(new Sort(SortClause.Size, Order.REVERSE)));
 
@@ -657,7 +655,7 @@ public class LuceneMailboxMessageSearchIndexTest {
     }
     
     @Test
-    public void notOperatorShouldReverseMatching() throws Exception {
+    void notOperatorShouldReverseMatching() throws Exception {
         SearchQuery query = new SearchQuery();
         query.andCriteria(SearchQuery.not(SearchQuery.uid(new SearchQuery.UidRange[] { new SearchQuery.UidRange(uid1)})));
 
diff --git a/mailbox/lucene/src/test/java/org/apache/james/mailbox/lucene/search/StrictLuceneMessageSearchIndexText.java b/mailbox/lucene/src/test/java/org/apache/james/mailbox/lucene/search/StrictLuceneMessageSearchIndexText.java
index 141b328..0be6714 100644
--- a/mailbox/lucene/src/test/java/org/apache/james/mailbox/lucene/search/StrictLuceneMessageSearchIndexText.java
+++ b/mailbox/lucene/src/test/java/org/apache/james/mailbox/lucene/search/StrictLuceneMessageSearchIndexText.java
@@ -1,28 +1,28 @@
-/****************************************************************
- * 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.mailbox.lucene.search;
-
-public class StrictLuceneMessageSearchIndexText extends LuceneMailboxMessageSearchIndexTest {
-
-    @Override
-    protected boolean useLenient() {
-        return false;
-    }
-
-}
+/****************************************************************
+ * 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.mailbox.lucene.search;
+
+class StrictLuceneMessageSearchIndexText extends LuceneMailboxMessageSearchIndexTest {
+
+    @Override
+    protected boolean useLenient() {
+        return false;
+    }
+
+}


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


[james-project] 11/13: [Refactoring] Move AbstractMessageManagerTest to JUnit 5

Posted by rc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 5f8d524ce6632b15f1077e1a9351d8061d31140e
Author: Rene Cordier <rc...@linagora.com>
AuthorDate: Tue Dec 10 11:45:22 2019 +0700

    [Refactoring] Move AbstractMessageManagerTest to JUnit 5
---
 .../mailbox/inmemory/InMemoryMessageManagerTest.java | 17 ++++++-----------
 .../mailbox/store/AbstractMessageManagerTest.java    | 20 ++++++++------------
 2 files changed, 14 insertions(+), 23 deletions(-)

diff --git a/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/InMemoryMessageManagerTest.java b/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/InMemoryMessageManagerTest.java
index fddfc18..df575e3 100644
--- a/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/InMemoryMessageManagerTest.java
+++ b/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/InMemoryMessageManagerTest.java
@@ -21,19 +21,14 @@ package org.apache.james.mailbox.inmemory;
 import org.apache.james.mailbox.inmemory.manager.InMemoryIntegrationResources;
 import org.apache.james.mailbox.store.AbstractMessageManagerTest;
 import org.apache.james.mailbox.store.MessageManagerTestSystem;
-import org.junit.Before;
+import org.junit.jupiter.api.BeforeEach;
 
-public class InMemoryMessageManagerTest extends AbstractMessageManagerTest {
+class InMemoryMessageManagerTest extends AbstractMessageManagerTest {
 
-    @Override
-    @Before
-    public void setUp() throws Exception {
-        super.setUp();
-    }
-    
-    @Override
-    protected MessageManagerTestSystem createTestSystem() {
-        return new InMemoryMessageManagerTestSystem(InMemoryIntegrationResources.defaultResources().getMailboxManager());
+    @BeforeEach
+    void setUp() throws Exception {
+        MessageManagerTestSystem testSystem = new InMemoryMessageManagerTestSystem(InMemoryIntegrationResources.defaultResources().getMailboxManager());
+        super.setup(testSystem);
     }
 
 }
diff --git a/mailbox/store/src/test/java/org/apache/james/mailbox/store/AbstractMessageManagerTest.java b/mailbox/store/src/test/java/org/apache/james/mailbox/store/AbstractMessageManagerTest.java
index 0d517df..3c23ef3 100644
--- a/mailbox/store/src/test/java/org/apache/james/mailbox/store/AbstractMessageManagerTest.java
+++ b/mailbox/store/src/test/java/org/apache/james/mailbox/store/AbstractMessageManagerTest.java
@@ -31,23 +31,19 @@ import org.apache.james.mailbox.MailboxSessionUtil;
 import org.apache.james.mailbox.MessageManager;
 import org.apache.james.mailbox.fixture.MailboxFixture;
 import org.apache.james.mailbox.model.MailboxACL;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 public abstract class AbstractMessageManagerTest {
 
-    private static final boolean NO_RESET_RECENT = false;
+    static final boolean NO_RESET_RECENT = false;
 
-    private MessageManagerTestSystem testSystem;
-    private MailboxManager mailboxManager;
-    private MailboxSession aliceSession;
-    private MailboxSession bobSession;
+    MailboxManager mailboxManager;
+    MailboxSession aliceSession;
+    MailboxSession bobSession;
 
-    protected abstract MessageManagerTestSystem createTestSystem() throws Exception;
-
-    public void setUp() throws Exception {
+    protected void setup(MessageManagerTestSystem testSystem) throws Exception {
         aliceSession = MailboxSessionUtil.create(ALICE);
         bobSession = MailboxSessionUtil.create(BOB);
-        testSystem = createTestSystem();
         mailboxManager = testSystem.getMailboxManager();
 
         testSystem.createMailbox(INBOX_ALICE, aliceSession);
@@ -57,7 +53,7 @@ public abstract class AbstractMessageManagerTest {
     }
 
     @Test
-    public void getMetadataShouldListUsersAclWhenShared() throws Exception {
+    void getMetadataShouldListUsersAclWhenShared() throws Exception {
         mailboxManager.applyRightsCommand(INBOX_ALICE, MailboxACL.command().forUser(BOB).rights(MailboxACL.Right.Read).asAddition(), aliceSession);
         mailboxManager.applyRightsCommand(INBOX_ALICE, MailboxACL.command().forUser(CEDRIC).rights(MailboxACL.Right.Read).asAddition(), aliceSession);
         MessageManager messageManager = mailboxManager.getMailbox(INBOX_ALICE, aliceSession);
@@ -67,7 +63,7 @@ public abstract class AbstractMessageManagerTest {
     }
 
     @Test
-    public void getMetadataShouldNotExposeOtherUsersWhenSessionIsNotOwner() throws Exception {
+    void getMetadataShouldNotExposeOtherUsersWhenSessionIsNotOwner() throws Exception {
         mailboxManager.applyRightsCommand(INBOX_ALICE, MailboxACL.command().forUser(BOB).rights(MailboxACL.Right.Read).asAddition(), aliceSession);
         mailboxManager.applyRightsCommand(INBOX_ALICE, MailboxACL.command().forUser(CEDRIC).rights(MailboxACL.Right.Read).asAddition(), aliceSession);
         MessageManager messageManager = mailboxManager.getMailbox(INBOX_ALICE, aliceSession);


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


[james-project] 13/13: JAMES-2717 Avoid restarting ElasticSearch container for each test class

Posted by rc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 067e123b64a3be52a7526590356ebc849f06863d
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Tue Dec 10 11:57:46 2019 +0700

    JAMES-2717 Avoid restarting ElasticSearch container for each test class
---
 .../james/backends/es/DockerElasticSearchExtension.java  | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/backends-common/elasticsearch/src/test/java/org/apache/james/backends/es/DockerElasticSearchExtension.java b/backends-common/elasticsearch/src/test/java/org/apache/james/backends/es/DockerElasticSearchExtension.java
index b9051a0..6583954 100644
--- a/backends-common/elasticsearch/src/test/java/org/apache/james/backends/es/DockerElasticSearchExtension.java
+++ b/backends-common/elasticsearch/src/test/java/org/apache/james/backends/es/DockerElasticSearchExtension.java
@@ -19,34 +19,22 @@
 
 package org.apache.james.backends.es;
 
-import org.junit.jupiter.api.extension.AfterAllCallback;
 import org.junit.jupiter.api.extension.AfterEachCallback;
-import org.junit.jupiter.api.extension.BeforeAllCallback;
 import org.junit.jupiter.api.extension.ExtensionContext;
 import org.junit.jupiter.api.extension.ParameterContext;
 import org.junit.jupiter.api.extension.ParameterResolutionException;
 import org.junit.jupiter.api.extension.ParameterResolver;
 
-public class DockerElasticSearchExtension implements AfterAllCallback, BeforeAllCallback, AfterEachCallback, ParameterResolver {
+public class DockerElasticSearchExtension implements AfterEachCallback, ParameterResolver {
 
     private final DockerElasticSearch elasticSearch = DockerElasticSearchSingleton.INSTANCE;
 
     @Override
-    public void beforeAll(ExtensionContext context) throws Exception {
-        elasticSearch.start();
-    }
-
-    @Override
-    public void afterEach(ExtensionContext context) throws Exception {
+    public void afterEach(ExtensionContext context) {
         elasticSearch.cleanUpData();
     }
 
     @Override
-    public void afterAll(ExtensionContext context) throws Exception {
-        elasticSearch.stop();
-    }
-
-    @Override
     public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext) throws ParameterResolutionException {
         return (parameterContext.getParameter().getType() == DockerElasticSearch.class);
     }


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


[james-project] 02/13: [Refactoring] Small access modifiers cleanup in test classes in mailbox-maildir module

Posted by rc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit f02e1d5cc2c9bf7e53e77c0399b419923fa1de94
Author: Rene Cordier <rc...@linagora.com>
AuthorDate: Tue Dec 10 16:43:41 2019 +0700

    [Refactoring] Small access modifiers cleanup in test classes in mailbox-maildir module
---
 .../mailbox/maildir/DomainUserMaildirMailboxManagerStressTest.java      | 2 +-
 .../james/mailbox/maildir/DomainUserMaildirMailboxManagerTest.java      | 2 +-
 .../james/mailbox/maildir/FullUserMaildirMailboxManagerStressTest.java  | 2 +-
 .../apache/james/mailbox/maildir/FullUserMaildirMailboxManagerTest.java | 2 +-
 .../apache/james/mailbox/maildir/MaildirSubscriptionManagerTest.java    | 2 +-
 .../james/mailbox/maildir/UserMaildirMailboxManagerStressTest.java      | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/DomainUserMaildirMailboxManagerStressTest.java b/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/DomainUserMaildirMailboxManagerStressTest.java
index 3e898ec..ff61e53 100644
--- a/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/DomainUserMaildirMailboxManagerStressTest.java
+++ b/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/DomainUserMaildirMailboxManagerStressTest.java
@@ -32,7 +32,7 @@ class DomainUserMaildirMailboxManagerStressTest implements MailboxManagerStressC
     @TempDir
     File tmpFolder;
 
-    private StoreMailboxManager mailboxManager;
+    StoreMailboxManager mailboxManager;
 
     @Override
     public StoreMailboxManager getManager() {
diff --git a/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/DomainUserMaildirMailboxManagerTest.java b/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/DomainUserMaildirMailboxManagerTest.java
index bdae634..1bdea8f 100644
--- a/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/DomainUserMaildirMailboxManagerTest.java
+++ b/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/DomainUserMaildirMailboxManagerTest.java
@@ -27,7 +27,7 @@ import org.junit.jupiter.api.Nested;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.RegisterExtension;
 
-public class DomainUserMaildirMailboxManagerTest extends MailboxManagerTest<StoreMailboxManager> {
+class DomainUserMaildirMailboxManagerTest extends MailboxManagerTest<StoreMailboxManager> {
 
     @Disabled("Maildir is using DefaultMessageId which doesn't support full feature of a messageId, which is an essential" +
         " element of the Vault")
diff --git a/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/FullUserMaildirMailboxManagerStressTest.java b/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/FullUserMaildirMailboxManagerStressTest.java
index 093546f..6bb20fc 100644
--- a/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/FullUserMaildirMailboxManagerStressTest.java
+++ b/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/FullUserMaildirMailboxManagerStressTest.java
@@ -32,7 +32,7 @@ class FullUserMaildirMailboxManagerStressTest implements MailboxManagerStressCon
     @TempDir
     File tmpFolder;
 
-    private StoreMailboxManager mailboxManager;
+    StoreMailboxManager mailboxManager;
 
     @Override
     public StoreMailboxManager getManager() {
diff --git a/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/FullUserMaildirMailboxManagerTest.java b/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/FullUserMaildirMailboxManagerTest.java
index 2af38dc..ee8ddb4 100644
--- a/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/FullUserMaildirMailboxManagerTest.java
+++ b/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/FullUserMaildirMailboxManagerTest.java
@@ -27,7 +27,7 @@ import org.junit.jupiter.api.Nested;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.RegisterExtension;
 
-public class FullUserMaildirMailboxManagerTest extends MailboxManagerTest<StoreMailboxManager> {
+class FullUserMaildirMailboxManagerTest extends MailboxManagerTest<StoreMailboxManager> {
 
     @Disabled("Maildir is using DefaultMessageId which doesn't support full feature of a messageId, which is an essential" +
         " element of the Vault")
diff --git a/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/MaildirSubscriptionManagerTest.java b/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/MaildirSubscriptionManagerTest.java
index 474ad74..8bd76e3 100644
--- a/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/MaildirSubscriptionManagerTest.java
+++ b/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/MaildirSubscriptionManagerTest.java
@@ -34,7 +34,7 @@ class MaildirSubscriptionManagerTest implements SubscriptionManagerContract {
     @TempDir
     File tmpFolder;
 
-    private SubscriptionManager subscriptionManager;
+    SubscriptionManager subscriptionManager;
 
     @Override
     public SubscriptionManager getSubscriptionManager() {
diff --git a/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/UserMaildirMailboxManagerStressTest.java b/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/UserMaildirMailboxManagerStressTest.java
index 083d22d..03acce9 100644
--- a/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/UserMaildirMailboxManagerStressTest.java
+++ b/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/UserMaildirMailboxManagerStressTest.java
@@ -32,7 +32,7 @@ class UserMaildirMailboxManagerStressTest implements MailboxManagerStressContrac
     @TempDir
     File tmpFolder;
 
-    private StoreMailboxManager mailboxManager;
+    StoreMailboxManager mailboxManager;
 
     @Override
     public StoreMailboxManager getManager() {


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


[james-project] 09/13: [Refactoring] Move JPAMailboxIdDeserializerTest to JUnit 5

Posted by rc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 57d561075cc18fcaf66c8a4bdaa3f12dfe893b55
Author: Rene Cordier <rc...@linagora.com>
AuthorDate: Tue Dec 10 16:06:27 2019 +0700

    [Refactoring] Move JPAMailboxIdDeserializerTest to JUnit 5
---
 .../mailbox/jpa/JPAMailboxIdDeserializerTest.java  | 28 ++++++++++++----------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/JPAMailboxIdDeserializerTest.java b/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/JPAMailboxIdDeserializerTest.java
index 3a60788..1ad1d88 100644
--- a/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/JPAMailboxIdDeserializerTest.java
+++ b/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/JPAMailboxIdDeserializerTest.java
@@ -20,32 +20,34 @@
 package org.apache.james.mailbox.jpa;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 import org.apache.james.mailbox.store.mail.model.MailboxIdDeserialisationException;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
-public class JPAMailboxIdDeserializerTest {
+class JPAMailboxIdDeserializerTest {
 
-    private static final String SERIALIZED_ID = "123456789012";
-    private static final String MALFORMED_SERIALIZED_ID = "abcz";
-    private static final JPAId JPA_ID = JPAId.of(Long.parseLong(SERIALIZED_ID));
+    static final String SERIALIZED_ID = "123456789012";
+    static final String MALFORMED_SERIALIZED_ID = "abcz";
+    static final JPAId JPA_ID = JPAId.of(Long.parseLong(SERIALIZED_ID));
 
-    private JPAMailboxIdDeserializer mailboxIdDeserializer;
+    JPAMailboxIdDeserializer mailboxIdDeserializer;
 
-    @Before
-    public void setUp() {
+    @BeforeEach
+    void setUp() {
         mailboxIdDeserializer = new JPAMailboxIdDeserializer();
     }
 
     @Test
-    public void deserializeShouldWork() throws Exception {
+    void deserializeShouldWork() throws Exception {
         assertThat(mailboxIdDeserializer.deserialize(SERIALIZED_ID)).isEqualTo(JPA_ID);
     }
 
-    @Test(expected = MailboxIdDeserialisationException.class)
-    public void deserializeShouldThrowOnMalformedData() throws Exception {
-        mailboxIdDeserializer.deserialize(MALFORMED_SERIALIZED_ID);
+    @Test
+    void deserializeShouldThrowOnMalformedData() {
+        assertThatThrownBy(() -> mailboxIdDeserializer.deserialize(MALFORMED_SERIALIZED_ID))
+            .isInstanceOf(MailboxIdDeserialisationException.class);
     }
 
 }


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


[james-project] 05/13: [Refactoring] Fixing typo MailderMailboxMessageNameTest -> MaildirMailboxMessageNameTest

Posted by rc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 2a7fd570e04d3ea4abfca145a6c087ab01b71304
Author: Rene Cordier <rc...@linagora.com>
AuthorDate: Tue Dec 10 17:24:29 2019 +0700

    [Refactoring] Fixing typo MailderMailboxMessageNameTest -> MaildirMailboxMessageNameTest
---
 ...erMailboxMessageNameTest.java => MaildirMailboxMessageNameTest.java} | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/MailderMailboxMessageNameTest.java b/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/MaildirMailboxMessageNameTest.java
similarity index 99%
rename from mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/MailderMailboxMessageNameTest.java
rename to mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/MaildirMailboxMessageNameTest.java
index 7d467e3..ede021a 100644
--- a/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/MailderMailboxMessageNameTest.java
+++ b/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/MaildirMailboxMessageNameTest.java
@@ -28,7 +28,7 @@ import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.Arguments;
 import org.junit.jupiter.params.provider.MethodSource;
 
-class MailderMailboxMessageNameTest {
+class MaildirMailboxMessageNameTest {
 
     private static Stream<Arguments> testParsing() {
         return Stream.of(


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


[james-project] 08/13: [Refactoring] Move MessageUtilsTest to JUnit 5

Posted by rc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit b87d10811dfaa513225ab2904ebf04f8503e8cec
Author: Rene Cordier <rc...@linagora.com>
AuthorDate: Tue Dec 10 16:03:52 2019 +0700

    [Refactoring] Move MessageUtilsTest to JUnit 5
---
 .../james/mailbox/jpa/mail/MessageUtilsTest.java   | 55 ++++++++++------------
 1 file changed, 26 insertions(+), 29 deletions(-)

diff --git a/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/mail/MessageUtilsTest.java b/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/mail/MessageUtilsTest.java
index 368a2dc..c58c204 100644
--- a/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/mail/MessageUtilsTest.java
+++ b/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/mail/MessageUtilsTest.java
@@ -20,6 +20,7 @@
 package org.apache.james.mailbox.jpa.mail;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.mockito.ArgumentMatchers.eq;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
@@ -39,62 +40,58 @@ import org.apache.james.mailbox.store.mail.model.DefaultMessageId;
 import org.apache.james.mailbox.store.mail.model.MailboxMessage;
 import org.apache.james.mailbox.store.mail.model.impl.PropertyBuilder;
 import org.apache.james.mailbox.store.mail.model.impl.SimpleMailboxMessage;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
 
-public class MessageUtilsTest {
-    private static final MessageUid MESSAGE_UID = MessageUid.of(1);
-    private static final MessageId MESSAGE_ID = new DefaultMessageId();
-    private static final int BODY_START = 16;
-    private static final String CONTENT = "anycontent";
+class MessageUtilsTest {
+    static final MessageUid MESSAGE_UID = MessageUid.of(1);
+    static final MessageId MESSAGE_ID = new DefaultMessageId();
+    static final int BODY_START = 16;
+    static final String CONTENT = "anycontent";
     
-    @Mock private ModSeqProvider modSeqProvider;
-    @Mock private UidProvider uidProvider;
-    @Mock private Mailbox mailbox;
+    @Mock ModSeqProvider modSeqProvider;
+    @Mock UidProvider uidProvider;
+    @Mock Mailbox mailbox;
 
-    @Rule
-    public ExpectedException expectedException = ExpectedException.none();
+    MessageUtils messageUtils;
+    MailboxMessage message;
 
-    private MessageUtils messageUtils;
-    private MailboxMessage message;
-
-    @Before
-    public void setUp() throws Exception {
+    @BeforeEach
+    void setUp() {
         MockitoAnnotations.initMocks(this);
         messageUtils = new MessageUtils(uidProvider, modSeqProvider);
-        message = new SimpleMailboxMessage(MESSAGE_ID, new Date(), CONTENT.length(), BODY_START, new SharedByteArrayInputStream(CONTENT.getBytes()), new Flags(), new PropertyBuilder(), mailbox.getMailboxId());
+        message = new SimpleMailboxMessage(MESSAGE_ID, new Date(), CONTENT.length(), BODY_START,
+            new SharedByteArrayInputStream(CONTENT.getBytes()), new Flags(), new PropertyBuilder(), mailbox.getMailboxId());
     }
     
     @Test
-    public void newInstanceShouldFailWhenNullUidProvider() {
-        expectedException.expect(NullPointerException.class);
-        new MessageUtils(null, modSeqProvider);
+    void newInstanceShouldFailWhenNullUidProvider() {
+        assertThatThrownBy(() -> new MessageUtils(null, modSeqProvider))
+            .isInstanceOf(NullPointerException.class);
     }
     
     @Test
-    public void newInstanceShouldFailWhenNullModSeqProvider() {
-        expectedException.expect(NullPointerException.class);
-        new MessageUtils(uidProvider, null);
+    void newInstanceShouldFailWhenNullModSeqProvider() {
+        assertThatThrownBy(() -> new MessageUtils(uidProvider, null))
+            .isInstanceOf(NullPointerException.class);
     }
     
     @Test
-    public void nextModSeqShouldCallModSeqProvider() throws Exception {
+    void nextModSeqShouldCallModSeqProvider() throws Exception {
         messageUtils.nextModSeq(mailbox);
         verify(modSeqProvider).nextModSeq(eq(mailbox));
     }
     
     @Test
-    public void nextUidShouldCallUidProvider() throws Exception {
+    void nextUidShouldCallUidProvider() throws Exception {
         messageUtils.nextUid(mailbox);
         verify(uidProvider).nextUid(eq(mailbox));
     }
     
     @Test
-    public void enrichMesageShouldEnrichUidAndModSeq() throws Exception {
+    void enrichMesageShouldEnrichUidAndModSeq() throws Exception {
         when(uidProvider.nextUid(eq(mailbox))).thenReturn(MESSAGE_UID);
         when(modSeqProvider.nextModSeq(eq(mailbox))).thenReturn(ModSeq.of(11));
 


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


[james-project] 03/13: [Refactoring] Remove unused createMailboxManager method in MaildirMailboxManagerProvider

Posted by rc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 45fc76c1d1acec235d2895c2d1dafe1289dc43c4
Author: Rene Cordier <rc...@linagora.com>
AuthorDate: Tue Dec 10 16:45:40 2019 +0700

    [Refactoring] Remove unused createMailboxManager method in MaildirMailboxManagerProvider
---
 .../james/mailbox/maildir/MaildirMailboxManagerProvider.java      | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/MaildirMailboxManagerProvider.java b/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/MaildirMailboxManagerProvider.java
index 3b4e17c..b7abdd0 100644
--- a/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/MaildirMailboxManagerProvider.java
+++ b/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/MaildirMailboxManagerProvider.java
@@ -20,7 +20,6 @@
 package org.apache.james.mailbox.maildir;
 
 import java.io.File;
-import java.io.IOException;
 
 import org.apache.james.mailbox.acl.GroupMembershipResolver;
 import org.apache.james.mailbox.acl.MailboxACLResolver;
@@ -28,7 +27,6 @@ import org.apache.james.mailbox.acl.SimpleGroupMembershipResolver;
 import org.apache.james.mailbox.acl.UnionMailboxACLResolver;
 import org.apache.james.mailbox.events.InVMEventBus;
 import org.apache.james.mailbox.events.delivery.InVmEventDelivery;
-import org.apache.james.mailbox.exception.MailboxException;
 import org.apache.james.mailbox.store.Authenticator;
 import org.apache.james.mailbox.store.Authorizator;
 import org.apache.james.mailbox.store.JVMMailboxPathLocker;
@@ -45,14 +43,10 @@ import org.apache.james.mailbox.store.quota.QuotaComponents;
 import org.apache.james.mailbox.store.search.MessageSearchIndex;
 import org.apache.james.mailbox.store.search.SimpleMessageSearchIndex;
 import org.apache.james.metrics.api.NoopMetricFactory;
-import org.junit.rules.TemporaryFolder;
 
 public class MaildirMailboxManagerProvider {
-    public static StoreMailboxManager createMailboxManager(String configuration, TemporaryFolder temporaryFolder) throws MailboxException, IOException {
-        return createMailboxManager(configuration, temporaryFolder.newFolder());
-    }
 
-    public static StoreMailboxManager createMailboxManager(String configuration, File tempFile) throws MailboxException {
+    public static StoreMailboxManager createMailboxManager(String configuration, File tempFile) {
         MaildirStore store = new MaildirStore(tempFile.getPath() + configuration, new JVMMailboxPathLocker());
         MaildirMailboxSessionMapperFactory mf = new MaildirMailboxSessionMapperFactory(store);
 


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


[james-project] 01/13: [Refactoring] Move MaildirMailboxIdDeserializerTest to JUnit 5

Posted by rc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 24d0103876897c13159527759298755d59bb9edd
Author: Rene Cordier <rc...@linagora.com>
AuthorDate: Tue Dec 10 16:40:20 2019 +0700

    [Refactoring] Move MaildirMailboxIdDeserializerTest to JUnit 5
---
 .../maildir/MaildirMailboxIdDeserializerTest.java  | 28 ++++++++++++----------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/MaildirMailboxIdDeserializerTest.java b/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/MaildirMailboxIdDeserializerTest.java
index b1e1667..bed406b 100644
--- a/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/MaildirMailboxIdDeserializerTest.java
+++ b/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/MaildirMailboxIdDeserializerTest.java
@@ -20,35 +20,37 @@
 package org.apache.james.mailbox.maildir;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 import java.util.UUID;
 
 import org.apache.james.mailbox.store.mail.model.MailboxIdDeserialisationException;
 import org.apache.james.mailbox.store.mail.model.MailboxIdDeserializer;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
-public class MaildirMailboxIdDeserializerTest {
+class MaildirMailboxIdDeserializerTest {
 
-    private static final String SERIALIZED_ID = "2f3a4fcc-ca64-36e3-9bcf-33e92dd93135";
-    private static final String MALFORMED_SERIALIZED_ID = "az";
-    private static final MaildirId MAILDIR_ID = MaildirId.of(UUID.fromString(SERIALIZED_ID));
+    static final String SERIALIZED_ID = "2f3a4fcc-ca64-36e3-9bcf-33e92dd93135";
+    static final String MALFORMED_SERIALIZED_ID = "az";
+    static final MaildirId MAILDIR_ID = MaildirId.of(UUID.fromString(SERIALIZED_ID));
 
-    private MailboxIdDeserializer mailboxIdDeserializer;
+    MailboxIdDeserializer mailboxIdDeserializer;
 
-    @Before
-    public void setUp() {
+    @BeforeEach
+    void setUp() {
         mailboxIdDeserializer = new MaildirMailboxIdDeserializer();
     }
 
     @Test
-    public void deserializeShouldWork() throws Exception {
+    void deserializeShouldWork() throws Exception {
         assertThat(mailboxIdDeserializer.deserialize(SERIALIZED_ID)).isEqualTo(MAILDIR_ID);
     }
 
-    @Test(expected = MailboxIdDeserialisationException.class)
-    public void deserializeShouldThrowOnMalformedData() throws Exception {
-        mailboxIdDeserializer.deserialize(MALFORMED_SERIALIZED_ID);
+    @Test
+    void deserializeShouldThrowOnMalformedData() {
+        assertThatThrownBy(() -> mailboxIdDeserializer.deserialize(MALFORMED_SERIALIZED_ID))
+            .isInstanceOf(MailboxIdDeserialisationException.class);
     }
 
 }


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


[james-project] 12/13: JAMES-2666 Fix EventDeadLetters unstable test

Posted by rc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit e5b3ce651ab255e6798d51e0e6016dca8269af7e
Author: Tran Tien Duc <dt...@linagora.com>
AuthorDate: Tue Dec 10 10:28:25 2019 +0700

    JAMES-2666 Fix EventDeadLetters unstable test
    
    There is a time window after the listener has been failed to process an
    event and storing that event into deadletter. If webadmin is requested
    during that time window, there is no event returned from the deadletter
    and consequently, IndexOutboundException at `response.get(0)`
---
 .../integration/EventDeadLettersIntegrationTest.java     | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/EventDeadLettersIntegrationTest.java b/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/EventDeadLettersIntegrationTest.java
index 2927ac3..1550438 100644
--- a/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/EventDeadLettersIntegrationTest.java
+++ b/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/EventDeadLettersIntegrationTest.java
@@ -24,8 +24,10 @@ import static io.restassured.RestAssured.when;
 import static io.restassured.RestAssured.with;
 import static org.awaitility.Duration.ONE_HUNDRED_MILLISECONDS;
 import static org.awaitility.Duration.ONE_MINUTE;
+import static org.awaitility.Duration.TEN_SECONDS;
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.Matchers.containsInAnyOrder;
+import static org.hamcrest.Matchers.greaterThanOrEqualTo;
 import static org.hamcrest.Matchers.hasSize;
 
 import java.util.ArrayList;
@@ -189,12 +191,18 @@ public class EventDeadLettersIntegrationTest {
     }
 
     private String retrieveFirstFailedInsertionId() {
-        List<String> response = with()
+        calmlyAwait.atMost(TEN_SECONDS)
+            .untilAsserted(() ->
+                when()
+                    .get(EventDeadLettersRoutes.BASE_PATH + "/groups/" + GROUP_ID)
+                .then()
+                    .body(".", hasSize(1)));
+
+        return (String) with()
             .get(EventDeadLettersRoutes.BASE_PATH + "/groups/" + GROUP_ID)
             .jsonPath()
-            .getList(".");
-
-        return response.get(0);
+            .getList(".")
+            .get(0);
     }
 
     @Test


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